texts: Supercover line algorithm from corners instead of the square's center?

texts:
I need to check whether a cell in a 2D grid is visible to the starting cell. I'm currently using amit's supercover line algorithm, this one https://www.redblobgames.com/grids/line-drawing.html#supercover
The algorithm works but I need  the cells that are intersected by the top-left corner-to-corner line instead of the center-to-center.
This shows what I mean:

The green square is the start point and red is the end point
The white dots represents the cells that are visited by the line drawing algorithm I'm using
I want to get the cells that are intersected by the blue line. It's drew from the top-left corner of the start cell to the top-left corner of the end cell.

This is my implementation of the amit's algorithm in gdscript
func _line_of_sight(p0, p1):
    var dx = p1.x - p0.x
    var dy = p1.y - p0.y

    var sx = 1 if dx > 0 else -1
    var sy = 1 if dy > 0 else -1

    var p = Vector2(p0.x, p0.y)
    _points.append(p)

    var x = 0
    var y = 0
    var nx = abs(dx)
    var ny = abs(dy)

    var result = true
    var blocked_cells = _tilemap.get_used_cells()

    while x < nx or y < ny:
        var px = (1+2*x) * ny
        var py = (1+2*y) * nx

        if px == py:
            p.x += sx
            p.y += sy
            x += 1
            y += 1

        elif px < py:
            p.x += sx
            x += 1
        else:
            p.y += sy
            y += 1

        if blocked_cells.has(p):
            result = false

        _points.append(p)

    return result

I've also tried Bresenham's line algorithm and the Bresenham supercover modification, this and this, as well as this, but none did the trick
Any insight would be appreciated - thanks in advance!


texts:
I used TexturePacker to create an atlas for me and I've read it into my game.  I can use unrotated and untrimmed sprites and it works fine.  Now I would like to support trimmed sprites and I'm running into a conceptual issue.

I'm not sure how to do the untrimming.  What do you do with the trim information?

My sprite is rendered as a quad with 4 vertices and 4 uv's.

Let's say the original sprite was:

size.width = 100;
size.height = 100;

Let's say that it exists in the atlas at:

location.x = 0;
location.y = 0;
location.width = 100;
location.height = 100;

To draw this untrimmed image, I do the following.

Compute 4 vertices for the sprite.  I use the height/width ratio
to adjust the top right and bottom right vertices.  That way the
sprite's aspect ratio is what you would expect
Compute 4 UV for the sprite.  In the above case, if the atlas is 1024 pixels square, then the UVs would form a box between the points (0.0, 0.0) to (0.1, 0.1)

And this works fine.  I can see an untrimmed image exactly as you would expect.

Enter trimming....

Let's say the original sprite was:

size.width = 100;
size.height = 100;

Let's say that it was trimmed in the atlas too:

trim.x = 5; // it was trimmed "in" from the left by 5 pixels
trim.y = 5; // it was trimmed "down" from the top by 5 pixels
trim.width = 15; // it was trimmed "in" from the right by 15 pixels
trim.height = 15; // it was trimmed "up" from the bottom by 15 pixels

So now the final location in the atlas is:

location.x = 0;
location.y = 0;
location.width = 80;
location.height = 80;

What I'm confused about is how to "untrim" the image when it is drawn.  I tried:

Moving the UV's by the amount that was trimmed. This resulted in a stretched image and in other tests, I saw parts of the adjacent sprites.  You can't really move a UV.
Moving the vertices by the amount that was trimmed.  Some of my sprites are actually animations.  This causes some frames to have different heights and widths -- sprite appears to "bounce".  It's bounding box shifts around too with the trimming.  (Currently, I have AABB's formed tightly around the vertices of the sprite -- which is what you would expect when the sprite is not trimmed.)

I clearly am missing the concept here.  How does one "untrim" the sprite during a render?  (I'm using OpenGL)  Am I supposed to move around the vertices, but not the bounding box?


texts: How bad would be to focus on iOS/Android development for an indie developer?

texts:
After some time developing games for others I'm thinking of moving towards my own productions. My background is 10+ years of software development, with last 2 years spent on the iOS development (Objective-C and CoronaSDK).

With my current experience in Corona I can quickly develop for iOS and Android systems. And this is something that I'm probably gonna do with several of the game ideas I have, at least for the prototype part.

But - I'm wondering if it's not a bad idea to focus on those 2 systems only. After all there are other mobile platforms, there are PCs, Macs and Linux boxes... All of them having gamers using them.

I was wondering if it wasn't a good idea to try some other SDK, giving me more flexibility when it comes to platform-independance. There's Unity3D (I think I can develop a 2D game in it though), there's MoAI from what I checked.

I see a few options, not sure which one is best as I have little experience in this field (publishing own games):

Stick with CoronaSDK for the whole time, release for iOS and Android platforms, screw other mobile devices and PCs,
Use Corona for prototyping, then when the idea goes more into the "production" phase rewrite it in MoAI or Unity3D for more platforms support,
Start with one of those 2 SDKs right now (which means the prototype phase will be delayed a bit, but after that I can jump right into real coding).

Any clues here, what to do?


texts:
I'm using a custom Behaviour Tree library (not UDK or any other engine) so I'm wondering on the best way to cause an interrupt to a currently running node. I don't have decorators or parallel nodes in this library so looking for a different way to do it. I don't care about the specific reasons as to why the interrupt is needed. In general it just needs to tell the currently running node to stop running so the tree can be transversed again and that would find out the reason as the main "threats" would be checked.

I'm trying to think of a clean way to cause such interrupts in the tree. Generally the conditions that are already in the tree would be the reason for the interrupt (IsEnemyInRange,  IsThirsty, IsHungry, etc) but if a node is running over multiple frames these don't get checked.

Any ideas given the above limitations I listed?


texts:
I am trying to move QWAD wheel robot, I have grouped the wheels separately and added wheels colliders for each wheel.
The problem is that the wheels are moving but the robot is stationary. I have been stuck with this problem from many days.
I am very new to unity3D and C# scripting. At first I tried the concept of moving rigid body using car model and it is working perfectly fine. When I applied the same logic to QWAD wheel ROBOT is not woking as expeted, kindly help me out.

Please find the code below

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

public class RoboMovemnt : MonoBehaviour
{
void Start()
{
    rb = GetComponent<Rigidbody>();
}
public void GetInput()
{
    m_horizontalInput = Input.GetAxis("Horizontal");
    m_verticalInput = Input.GetAxis("Vertical");

}
private void Steer()
{
    m_steeringAngle = maxSteerAngle * m_horizontalInput;
    FR_Wheelwc.steerAngle = m_steeringAngle;
    FL_Wheelwc.steerAngle = m_steeringAngle;
}
private void Accelerate()
{
    RR_Wheelwc.motorTorque = m_verticalInput*motorForce;
    RL_Wheelwc.motorTorque = m_verticalInput * motorForce;

    if (m_verticalInput == 0)
    {
        RL_Wheelwc.brakeTorque = brakeTorque;
        RR_Wheelwc.brakeTorque = brakeTorque;
    }

}

private void UpdateWheelPoses()
{
    UpdateWheelPose(FR_Wheelwc, FR_WheelT);
    UpdateWheelPose(FL_Wheelwc, FL_WheelT);
    UpdateWheelPose(RR_Wheelwc, RR_WheelT);
    UpdateWheelPose(RL_Wheelwc, RL_WheelT);

}
private void UpdateWheelPose(WheelCollider _collider ,Transform _transform)
{
    Vector3 _pos = _transform.position;
    Quaternion _quat = _transform.rotation;

    _collider.GetWorldPose(out _pos, out _quat);

    _transform.position = _pos;
    _transform.rotation = _quat;

}
void HandBrake()
{
    if (Input.GetKey(KeyCode.Space))
    {
        IsBrake = true;
    }
    else
    {
        IsBrake = false;
    }
    if(IsBrake == true)
    {
        RL_Wheelwc.brakeTorque = brakeTorque;
        RR_Wheelwc.brakeTorque = brakeTorque;

        RL_Wheelwc.motorTorque = 0;
        RR_Wheelwc.motorTorque = 0;

    }
    else
    {
        RL_Wheelwc.brakeTorque = 0;
        RR_Wheelwc.brakeTorque = 0;

    }
}

private void FixedUpdate()
{
    GetInput();
    Steer();
    Accelerate();
    UpdateWheelPoses();
    HandBrake();

}

private float m_horizontalInput;
private float m_verticalInput;
private float m_steeringAngle;
private Rigidbody rb;
private int Velocity;

public WheelCollider FR_Wheelwc, FL_Wheelwc, RR_Wheelwc, RL_Wheelwc;
public Transform  FR_WheelT, FL_WheelT, RR_WheelT, RL_WheelT;
public float maxSteerAngle = 30;
public float motorForce  = 500;
public bool IsBrake = false;
public float brakeTorque = 50000f;

}


texts: What's wrong with my animation trigger script?

texts:
So I am making an RPG and I am setting up the player. I am trying to trigger an attack animation by pressing a button. I wrote this down and I get an error that says "Expressions in statements must only be executed for their side-effects". I don't know what that means, but it is an error that won't let me play the game without fixing it. I'm not sure where to go from here. How would I fix the error? EDIT: I'm not using Mecanim, nor am I planning on using it.

This is the script. It is in JavaScript (Unity3D).

#pragma strict

var anim: AnimationClip;

function Start()
{
    animation["Sword Slash"].layer = 4;
    animation["Sword Slash"].wrapMode.Once;
}

function Update ()
{

    if (Input.GetKeyDown ("c"))
    {
        animation.Play("Sword Slash");
    }
}


texts: How to loop background music through splash screen, main menu, options menu?

texts:
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!


texts: Why do some game titles differ between localisation versions?

texts:
I had previously asked this on Arqade but it seems it was off-topic, hopefully this network is a better place to ask.

I've noticed that for a number of games, different localisation versions sometimes differ in the titles. A notable example are the Professor Layton series, in which the Diabolical Box, Unwound Future, and Last Specter are named as Pandora's Box, Lost Future, and Spectre's Call in the European versions (respectively). I can see how the Japanese names would differ (e.g. "Mask of Miracle" instead of "Miracle Mask") due to it being a different language, but I can't understand why the English titles for the European versions should have different names from the US versions.

What makes the situation even more confusing is that the Curious Village, Miracle Mask, and Azran Legacy aren't subject to this and have the same names in both the European and US versions.

Can anybody enlighten me as to why developers/publishers do this? To my knowledge the games are more or less identical in every other way, apart from British/US English spelling differences (and the exclusion of the London Life minigame in the Spectre's Call). Another example would be Luigi's Mansion: Dark Moon, known as Luigi's Mansion 2 in Europe, which again makes no sense to me.


texts: Blender to UE4: Custom rig has bones ending up in the wrong place

texts:
I'm trying to create a custom mesh and rig in stock Blender 2.8 and export it via .fbx to stock UE 4.23. Unfortunately, the bones of the skeleton end up in entirely the wrong place.

In short, the bones behave strangely. From what I can tell, the child of the root bone seems to fold into the root, dragging along all its own children. The weirdest part about this is that everything works perfectly fine in UE4. The animations work and so does everything else (aside from the usual scaling woes), only that added sockets end up in the wrong place. If I try to transform any of the bones in any way, the mesh goes completely haywire.

I already watched Epic's latest stream on this topic and tried to replicate the thing from that stream, but it has the same problem. I tried renaming the Armature to "Root", having a separate root bone, having no dedicated root bone at all, moving the rig and mesh around, applying those movements, having different spots for the pivot point set, different combinations of all those, in addition to trying different Blender->UE pipeline "tricks" from earlier Blender versions like playing around with the scaling, but nothing has any effect.
From what I have gathered, renaming the Armature or messing with Blender's scaling isn't a wise choice anyway, since apparently this can cause severe problems down the road.

I'm starting to run out of ideas, hopefully somebody can help me out.


texts: How important is Programming for a Level Designer?

texts:
I'm currently attending school in a Level Design program, and I was wondering how important programming really is in being a Level Designer?

I'm apparently incapable of learning programming (despite my best efforts), and tend to do very well in all other courses 3D modelling, story/character design, narrative and dialogue writing, environmental and conceptual design etc.

I'm wondering if my strengths in the other areas are enough (with practice) to let me become a Level Designer, or I'm wasting my time if I can't program?

I really want to be a Designer, but I just can't seem to wrap my head around the "language" of programming in general (Java kicks my teeth in even with tutoring and additional work on my own).


texts:
I'm making a simple 2D game for iPhone.  Think of the game as a ball on the screen that goes up while the user is touching the screen and falls down when the user stops touching the screen.

The ball starts moving up in touchesBegan:withEvent and starts moving down in touchesEnded:withEvent.  This works fine almost all the time. However on occasion the ball will keep moving up after the user stops touching... or the ball will keep moving down while the user is touching.  Why is this happening?

Just fyi the ball is drawn on a UIWindow.  The taps are handled by a UIImageview subclass that's clearColor and takes up the entire screen.  This "touchLayer" is also moved to the front of the window in the game loop.

Any idea why this control scheme occasionally fails?  Perhaps the touch events just aren't firing?  Or they're fired out of order?

Cheers!


texts: Dynamic thruster balancing of space ship

texts:
The space ships in my game a meant to be player-built with an arbitrary amount of thrusters attached anywhere with any rotation. I currently have some dirty code to rotate the ship to a given angle (accelerating and decelerating).

Here's an example of a symmetrical ship facing where the red line points, being told to rotate left.

However, as you would imagine, depending on where the player has put the thrusters, sometimes undesired linear forces are affecting the ship. In this case, the ship starts moving forward.

I'm elaborating on whether it's possible to find the maximum thrust a thruster can apply to cause no linear velocity. (In the above case that would be none since there's nothing to counteract the forces from the rear thrusters, and the front ones kill eachother).

What I've come up with so far is a formula to determinate the "turn efficiency" e.g. how much rotation is caused in relation to linear movement.

a - position vector to thruster a
b - position vector to thruster b
v1 - force from thruster a
v2 - force from thruster b

efficiencyDelta = a.cross(v1) / |v1|  -  ( a.cross(v1) + b.cross(v2) ) / |v1 + v2|

, basically "a.cross(v1 * t) / |v1|" is supposed to be the turn efficiency. And then we subtract it by the turn efficiency of the thrusters combined, to see if firing the new thruster is worth it.

Problem arises when I realize that thrusters aren't surposed to be on/off, but can vary their thrust from 0 to 1. And how to go about when the player wants the ship to go forward. Ofcourse, there would need to be a balance of how much to rotate/move.

I'm no rocket scientist so I'm hoping there's someone who can tell me if it's even possible to calculate the throttle of each thruster this way and give me a push in the right direction.

Thank you for taking the time! / Kim


texts: Process for Creating Imposters (For Unity)

texts:
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.


texts: Calculating stopping distance while turning

texts:
I need to calculate the movement of an object that is slowing down to approach its destination while turning. Calculating the linear stopping distance and deceleration is straightforward. However if the object is not pointing at the destination, and has a limited rotation speed, makes this more complicated. For example imagine it starts pointing 90 degrees off the target: its rotation will increase the distance to the target.

The turning circle increases the distance to the target, but decelerating makes the subsequent turning circle tighter, and I'm not sure how to take in to account both factors.

Basically I have the following information:

starting position, angle, and speed
target position
deceleration
rotation speed

and I need to calculate the distance (or time) to the target. What is the calculation for that?

I can also see that if the starting speed is too high, it may not be solvable - in which case it would be useful to also calculate the maximum possible speed.


texts: Is the city of the GTA, L.A. Noire, Assasins Creed or Saint Row games considered a level?

texts:
I'm trying to figure out whether or not the worlds in which these games take place are levels or not, for the sake of level design. I consider the world to be one big level and all the missions and such being levels as well.
While most levels in other games have specific goals, there are pretty much no objectives tied to the "mega-levels" of these games.

I just wanted to get some opinions.


texts:
After tinkering a bit with cocos2d, I discovered that there is no classic game loop and everything is more-or-less event driven. I guess I can wrap my head around that, no problem.

But I cannot find anything about thread safety. Say, I schedule something to occur every two seconds, which Thread will run the code? Given that I cannot find anything about that, I guess there is just one Cocos2d Thread and everything will be fine.

Nevertheless, this implicit assumption does not give me a good feeling. Knowing is better than guessing. ;-)

Can anyone shed some light onto that topic?


texts: Can J2EE be used to implement games ? Is there any connection between J2EE and games?

texts:
Making an game using applets, but have to implement project using J2EE. Is there any sense in making a game with using J2EE for implementation ?

Our teacher said that we can make games for the java project, now she has put in the requirement that we have to use J2EE, and expects us to make the game. Where does J2EE comes in the picture ?


texts: Sprite detached from the screen but contact is still made

texts:
Well, i'm facing a strange problem with my code. I'm trying to remove a sprite named ice when either of player, enemy or the ground comes in contact with the ice. The contact is made successfully and the ice is hidden after the contact but due to some reasons the player,enemy and the ground still comes in contact with the ice. I want the ice object to be completely removed from the scene when contact is made. I'm using the below code:

public void beginContact(Contact contact) {
    // TODO Auto-generated method stub
    Fixture x1 = contact.getFixtureA();
    Fixture x2 = contact.getFixtureB();

if (x1.getBody().getUserData().equals("player")
        && x2.getBody().getUserData().equals("ice") && gb.isVisible()==true) {
    Log.i("Contact Made", "CN");
    detachChild(gb);
    gb.setVisible(false);
    score = score + 1;
    scoreText.setText("Score: " + score);
}
if (x1.getBody().getUserData().equals("ground")
        && x2.getBody().getUserData().equals("ice") && gb.isVisible()==true) {
    detachChild(gb);
    gb.setVisible(false);

}
if (x1.getBody().getUserData().equals("enemy")
        && x2.getBody().getUserData().equals("ice") && gb.isVisible()==true) {
    detachChild(gb);
    gb.setVisible(false);

}

}


texts: Huge procedurally generated subway transit map

texts:
How could I generate a single transit map image
, which is not based on any real map, on a massive scale? Are there algorithms or tools which could do something like this already?

  Unlike conventional maps, transit maps are usually not geographically accurate—instead they use straight lines and fixed angles, and often illustrate a fixed distance between stations, compressing those in the outer area of the system and expanding those close to the center.

The scale I'm looking for is earth-like. If a line ran horizontally across it could have 40,075 stations kind of map. Ideally, It should also wrap around, like on a sphere.

I want it to look just like any local transit map (I'm basing myself on the Montreal metro map) which means I don't care about what a metro system of this scale should look like or how useless this would be.

So far, the research

Nathan Hellinga's Processing.py subway map generator resembles what I'm looking for and looks great but the algorithm wouldn't scale well to a very large grid.
Jannis Redmann's generating transit map theory is really interesting but bases itself on real world data. Maybe it could be used with generated data but how do you generate that data then?
Fractal generators! But how do I make it look like a transit map?
With Graphviz, I would still need an algorithm to generate data.
Slime is a really interesting idea! But how do you procedurally generate that?
Wave function collapse algorithm!!
Generating a random heightmap, making a graph out of it, and then making it pretty
My idea, a random walker.
You all know what this is, I just don't think that's the best option there is.


texts: add random force and direction to rigidbodies every x seconds

texts:
i need to add a windForce to multiple rigidbodies, with random direction and random force every x lapse of time. I'm using InvokeRepeating to update the windDirection so that the rigidbodies can be pushed in a different direction every x seconds.
Here's the code:
void windRotate()
{
    windDirection.y = Random.Range(0, 360);
    transform.Rotate(windDirection * smooth);

    if (objectsInWind.Count > 0)
    {
        foreach (Rigidbody rigid in objectsInWind)
        {
            rigid.AddForce(windDirection * 10);
        }

    }
}

This way the rigidbodies don't receive any force. I guess the system does not recognize the Vector3 Update of windDirection, so I need to recalculate it, bit I was not able.
On the other hand if I use this:
rigid.AddForce(Vector3.Up* 10);

the rigidbodies moves but in one direction only, and it's not updated on the next windDirection change.
I tried playing with the various Vector3 values (up, right etc..) and different force methods (AddRelativeForce) but nothing changed.
By using Debug.Log(windDirection); i know that windDirection is updating correctly ever 3 seconds, so it should also be updated in my methods when i apply the force, but id does not work.
Any suggestion?
Thanks


texts: How do i keep the image size proportionate after camera size change

texts: Basically, I want to keep an image the same size on the screen maximized as it would be minimized. Is there any way to do this without a script?


texts:
I'm making a platformer that wants the screen to closely follow the player, and I know I need the Scroll TO behavior.

However, when I tried to make the screen move to the player, I get this:

As seen in the picture, the player's sprite is (I think) too small. Is there any way to increase the 'zoom-ness' of the Scroll-to behavior?

Below is the code's snippet:

Do you know what I have to do, or is there something wrong with my code?

Thanks in advance,

JamieK


texts: Most common way to obtain textures for 3D models?

texts:
I'm getting into basic 3D modelling and am attempting to texture my model. I'm aware of UV mapping and some similar texturing tools, but I'm not sure how the majority of CG artists obtain their 3D models. When creating realistic models, do they take photos of what they're making a model of and then use those, create multiple textures in Photoshop and then apply those to the model (as in a skin texture and a clothes textures and so on). Also, when creating cartoon-style models, is the method the same? Or do they use different tools, such as Illustrator.

Thanks in advance.


texts:
I implemented a skybox into my program using a tutorial, and using the provided 6 textures from that tutorial to make a cube map texture, my skybox looked fine. However, ever since then every other skybox texture set I have tried to add has had issues with the edges not blending together. Here is generally how they always end up looking:

here is my code for for loading the textures and the parameters:

glActiveTexture(GL_TEXTURE0);
textureID = SOIL_load_OGL_cubemap(textures[0], textures[1], textures[2], textures[3], textures[4], textures[5], 0, 0, SOIL_LOAD_RGB);
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
if (textureID == 0)
{
    glGenTextures(1, &textureID);

    int width, height;
    unsigned char* image;

    glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
    for (GLuint i = 0; i < 6; i++)
    {
        GLuint sID = SOIL_load_OGL_texture(textures[i], 0, 0, 0);
        image = SOIL_load_image(textures[i], &width, &height, 0, SOIL_LOAD_RGB);
        glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image);
        SOIL_free_image_data(image);
    }
}

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);

And code for rendering the skybox:

glDepthMask(GL_FALSE);
shader->bind();
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
viewMatrix.r4.x = 0;
viewMatrix.r4.y = 0;
viewMatrix.r4.z = 0;
shader->loadMatrix("viewMatrix", &viewMatrix.m11);
glBindVertexArray(vao);
glEnableVertexAttribArray(0);
glDrawArrays(GL_TRIANGLES, 0, 36);
glBindVertexArray(0);
glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
shader->unbind();
glDepthMask(GL_TRUE);

And the shader code

const char vertexShader[] =
    "#version 330\r\n"
    "in vec3 position;\r\n;"
    "out vec3 texCoord;\r\n"
    "uniform mat4 projectionMatrix;\r\n"
    "uniform mat4 viewMatrix;\r\n"
    "void main()\r\n"
    "{\r\n"
    "gl_Position = projectionMatrix * viewMatrix * vec4(position, 1);\r\n"
    "texCoord = position;\r\n"
    "}";

const char fragmentShader[] =
    "#version 330\r\n"
    "in vec3 texCoord;\r\n"
    "out vec4 color;\r\n"
    "uniform samplerCube sampler;\r\n"
    "void main()\r\n"
    "{\r\n"
    "color = texture(sampler, texCoord);\r\n"
    "}";

Does anyone see something that I might be missing that's causing my skybox to not render properly for most cube maps?


texts: Best practice for 4x game management in Unity?

texts:
I'm trying my hand at creating a turn-based 4x game in Unity, with a galaxy map and 2D hexagon grid maps for each individual planet. The planet grid hexes would be gameobjects, with the overall grid being around 30x40 in size. The number of planets would be under 50.

What would be the best way to set this up? I'm looking for a solid approach regarding performance here, but one that also caters to easier design/programming would be a plus.

Some approaches I've come up with:

Load all of the grids for the individual planets at the start into a single scene, with each being under a "planet gameobject", and then set those gameobjects to inactive. The galaxy map would be its own scene that is loaded additively when needed; clicking on a planet to view it would set its associated gameobject to active and then unload the galaxy map scene.
Instantiate the gameobjects for planets as they're called up; the grid data for the planet is dynamically loaded as part of this. The planet gameobject is destroyed when no longer needed. Galaxy map would function the same as approach 1.
Individual scenes for each planet, loaded/unloaded additively when needed. A separate, single scene would be used for loading procedurally generated planets.

Seems to have serious challenges for managing units/resources across planets/scenes.

Approach 1 seems to be the most straightforward, as the core of the game would be managed in a single scene, but I am concerned about performance. I'm setting up some test projects to stress test the approaches, but it'd be great to get feedback from someone with more experience.

Any help is appreciated!


texts: I'm looking for a C++/OpenGL/SDL game engine tutorial

texts:
I have a decent knowledge of SDL, OpenGL and FMOD. I am looking for a recent tutorial or book on the basics of making a game engine. Most of the book and tutorial I found are using old dead library like glut and glaux or simply outdated like NeHe tutorial.

The one thing I would really like to understand is the structure and how everything is linked together.

I do not want to use a tutorial to copy it or anything else like that but simply to understand the structure behind it. No server stuff.

I would really appreciate if the tutorial/book use OpenGL and SDL because I really love to use them.


texts: I have  a camera in a fixed position in the middle of a field, and I would like to rotate the camera to follow the character as it moves around. There is no point lower than the camera, but I would like it to follow vertically as well. Given the point/euler angle of the camera, and the point of the character, what math could I use to implement this?


texts: Porting WP8 to IOS GraphicsDevice Error (Monogame/Xamarin)

texts:
I seem to be having a problem porting to IOS. I have my game working on WP8 and Android with any major issues but when trying to run on iPhone I seem to get an error when initialising the GraphicsDevice

below is a screenshot to the problem. has anyone else had this issue and is there a workaround/fix?
Thanks in advance! :)

http://i.imgur.com/6Kwk6D6.png


texts:
I remember back in the 90s when X-Com came out, being really impressed by the way its world map was an actual world: a map of Earth drawn on a spherical surface.  That was pretty cool, because I had never seen it before.  And now, thinking back... I can't recall just off the top of my head ever seeing it again, with the obvious exception of X-Com: Terror From The Deep, which used the same engine.

Most games that have an entire-planet world map either use a rectangle that wraps around at the sides but not the top and bottom (a cylinder), or a rectangle that wraps around at all four edges (an impossible geometry that some people call a "torus", even though it can't actually represent a real torus.)  And that makes me wonder why.

What difficulties does attempting to build a spherical world map for a video game raise, that it's so incredibly rare to actually see it done?


texts: Job title for a roleplaying event gamemaster in an online RPG?

texts:
I'm considering creating a position in an online RPG where the responsibilities would mainly involve conceiving roleplaying-oriented events and plotlines and executing on them using developer tools such as the ability to create instances of NPCs/items and the ability to control NPCs.  Examples of events/plotlines might be "ancient god of evil breaks loose from his prison and attacks the realm" or "upcoming marriage between offspring of powerful dynasties has political opponents trying to disrupt it".

What is the best job title for this sort of position?

The first thing that popped into my head was "customer experience associate", but this appears to have an established meaning in retail where it's a way of dressing up "salesperson".  "Game master" positions in MMOs are generally helpdesk positions with no creative duties or authority.  I want to select something that neither exaggerates nor undersells this person's level of responsibility.


texts: Problem with LAN multiplayer game in Unity

texts:
I'm trying to learn how to make an offline LAN multiplayer game in Unity.

So for example, I make something that can send a text message and make a cube XD

Now this is my problem:

(When I send a message, try connecting to the server, or when I try to create a cube I should first click on the other window!)

StartServer:

    using UnityEngine;
using System.Collections;

public class StartServer : MonoBehaviour {
    public Transform Taghsimobj;
    public Transform Makan;
    public Transform CubeOBJ;

    public string MSG;
    public string ResMsg;

    void Ress (string inres) {
        ResMsg = inres;

    }

    void OnGUI () {

        if (Network.peerType == NetworkPeerType.Disconnected)
        {
            if (GUILayout.Button ("StartServer"))
            {
                Network.InitializeServer(10, 25000);
            }
            if (GUILayout.Button ("Connect"))
            {
                Network.Connect ("192.168.1.101", 25000);
            }

        }
        else
        {
            if (GUILayout.Button ("CreatCube"))
            {
                Network.Instantiate (CubeOBJ, Makan.transform.position, Makan.transform.rotation, 0);
            }
            if (GUILayout.Button ("CreatChat"))
            {
                Network.Instantiate (Taghsimobj, this.transform.position, this.transform.rotation, 0);
            }
            if (GUILayout.Button ("SendMessage"))
            {
                GameObject.Find ("GameObject(Clone)").GetComponent<NetworkView>().RPC ("ResText", RPCMode.All, MSG);
            }
            MSG=GUILayout.TextField(MSG);
            GUILayout.Box (ResMsg);
        }

    }
}

taghsim:

    using UnityEngine;
using System.Collections;

public class Taghsim : MonoBehaviour {

    void Start () {
    }

    [RPC]
    void ResText (string ResIn) {
        GameObject.Find ("Main Camera").SendMessage ("Ress", ResIn);

    }
}


texts:
I'm using a variant of the D3D12 UWP template that comes with VS2017 Community Edition and I have two related questions:

When I add this italicized and bolded code to the vertex shader signature, I get an X4016 error:

PixelShaderInput main(VertexShaderInput input, uint instanceID : SV_InstanceID)

The full text of the error is:
error X4016: SV_InstanceID semantic cannot be used with 10Level9 targets

I don't understand what this means because when the template calls D3D12CreateDevice, it sets D3D_FEATURE_LEVEL_11_0.

Per this post, I'm thinking SV_InstanceID is supported in DX11 and above:
https://stackoverflow.com/questions/21241207/dx11-c-shader-cant-receive-instance-buffer-content

If I'm using a D3D12 template that is setting D3D_FEATURE_LEVEL_11_0 in the D3D12CreateDeveice call, why does the template think I have 10Level9 target?

Where can I go to change the template so that it uses a target that is compatible with the SV_InstanceID semantic in the vertex shader?

NOTE: I'm trying to loosely follow the example on Page 561 of Frank Luna's "3D Game Programming with DirectX 12" Text where he passes instanceID into the vertex shader.


texts:
I would like to draw a texture in a rectangle that is smaller than the texture, normally the texture will be scaled to fill the rectangle, which results in a squished image. I want to draw it to fit.
For example, if the green stuff is the Texture, I would like to draw only the stuff in the red rectangle.

I already tried to get the color data from the base texture and create a new one, filled with the part from the base.
Color[] colorData = new Color[progressRectangle.Width * progressRectangle.Height];
Color[] sourceColorData = new Color[t2dBack.Width * t2dBack.Height];
t2dBack.GetData(sourceColorData);
for (int x = 0; x < progressRectangle.Width; x++)
{
    for (int y = 0; y < progressRectangle.Height; y++)
    {
        colorData[x + progressRectangle.Width * y] = sourceColorData[x + t2dBack.Width * y];
    }
}

t2dBackDraw.SetData(colorData);

but that just results in gibberish.
Is there an easy way to accomplish this?

kind regards


texts: How does delta compression reduce the amount of data sent over the network?

texts:
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.


texts: How do I disable the graphical output of Quake 3?

texts:
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.


texts: LibGDX setToRotation canceling out position

texts:
I'm working on a 3d project in Libgdx. I've got a camera flying around in 3d space, being controlled with touch. Works great, moves forward and backward, strafes, full 360 look around with no gimbal lock.
But, I want my player to be able to see what they're holding. So I've added a "hands" model instance, which I'll change out depending on what is being held. I've positioned the model in front on the camera, which works fine.
But then whenever I try to call a transform.setToRotation, it sets the rotation, but moves the position back to 0,0,0. Does anyone know why this is happening? Here's my camera update code:
public void updateCamera()
{
    // left right look
    camDir.set(cam.direction);
    cam.rotate(cam.up , deltaX);

    // up down
    tempVec.set(camDir.crs(cam.up), deltaY);
    cam.rotate(tempVec);
    cam.update();

    // move forward
    cam.position.add(forwardTemp.set(cam.direction).scl(deltaForward));
    cam.update();

    // strafe
    strafeTemp.set(cam.direction);
    strafeTemp.rotate(cam.up, 90);
    cam.position.add(strafeTemp.scl(deltaStrafe));
    cam.update();

    // move tool hands to match
    handPos.set(cam.position);
    handPos.add(forwardTemp.set(cam.direction).scl(1.5f));
    handInst.transform.setToTranslation(handPos);

    handInst.transform.setToRotation(cam.direction, Vector3.X);
} // end updateCamera


texts: How do you make Direct3D work in a browser?

texts:
I've come across games that are 3D that are playable in a browser.  They require a plugin to be installed to work.  I guess the plugin creates a D3D window inside the browser.

How would I go about implementing something similar?


texts:
I've been developing a first person shooter/massive multiplayer online roleplaying game for my small business, and was wondering if it would be feasible to use peer-to-peer technology to communicate between players, without the use of an intermediary server (as our company does not have enough funds for a high-speed connection to run a game server on). How would such Peer-to-peer technology be best implemented in such a game? Here's a few of the options I've been considering:
a) Divide the game into segments, and have each segment be played on a separate P2P "mesh" (currently named XRevolution)
b) Have one mesh for all portions of the game, and place all of the players on a single grid
c) Some other P2P solution
I've already used option A (considering only one area of the game is done) on a small scale (4 computers), but am wondering how well that would scale when thousands of computers would potentially be bound to the same mesh.
Here's a list of possible concerns with P2P technology

During penetration testing, it was identified that a client could spoof packets to lie about the state of the game to other peers, allowing people to cheat. This is identified as "medium" risk, as it could be prevented to a certain extent through various security routines that would be integrated within the game (such as encryption, movement prediction, double-checking state with other peers, AI, etc.)
Lag was originally a problem on slower networks, but now movement prediction and other techniques are used to reduce the effect of lag, and disconnect peers whose lag is too high. However, a problem which remains is the amount of time it would take on a larger-scale network to find peers (other players), and establish connections. Due to the amount of time it would take to connect to so many peers, solution A would seem optimal to solve this particular problem
A problem with solution A, would be in-game chat between meshes (as no two peers in different meshes can communicate with each other, except for the purpose of relaying), however, this problem could be potentially solved by using something in-between solutions A and B (such as creating a separate mesh for inter-mesh communication, which would be specific to each player or something)
What's the best way to do something like this? Solution A, or B, something in-between the two, or an entirely different solution altogether. Due to our budget, using a server to facilitate communication between players is completely out of the question, so it would be nice to use a P2P solution, otherwise the project would have to be abandoned.


texts:
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


texts: How do I load Gleed 2D levels in WP7 XNA game?

texts:
I've been trying so long to use this modified version of GLEED2D that includes WP7 support,

I'm stuck into loading the level into my game, now my Game1.cs class has the following:

    protected override void Initialize()
    {

        Stream stream = TitleContainer.OpenStream("Content/leveltest.xml");
        XElement xml = XElement.Load(stream);
        level = LevelLoader.Load(xml);
        base.Initialize();
    }

I included the XML file of my level into Content Directory, when I try to build the solution, It gives this error:

XML is not in the XNA intermediate format. Missing XnaContent root element.

I didn't find any reference on how to fix it on the developer's blog or the github WiKi

Any Idea?


texts:
I have some understanding of c# and I am new to unity. I am currently making a 3D project which use the Rigidbody component on the ball object.
When I use following code:

public class Ball : MonoBehaviour
{
    public float launchSpeed;

    private Rigidbody rigidbody;

    // Use this for initialization
    void Start()
    {
        rigidbody = GetComponent<Rigidbody>();
        rigidbody.velocity = new Vector3(0, 1, launchSpeed);
    }

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

    }
}

I get the compiler warning:

  'Ball.rigidbody' hides inherited member 'Component.Rigidbody'. Use a
  new keyword if hiding was intended

I understand the idea behind using new and override in c#, but I just don't understand why is the rigidbody hidden?

I am using Unity 5.2.0f3, and MS Visual Studio Community 2015.


texts: I would like to draw a land for a motocross game. I've been thinking of Bezier Curves but I am not sure whether this is the best approach. Can you give me some advice? I want to do it in JavaScript, not very good choice but it's personal project so for time being it's OK.


texts: processing request in order on game server

texts:
I am creating a simple multiplayer puzzle game in which multiple players can join a lobby and compete with each other. the player that submits the answer first gets the highest point, the player that submits the answers second gets the second highest point and so on..

How do I maintain the order of request on the server side?

I assume i cannot use an event-based server as it would become impossible to process requests in order.

a simple multithreaded server would be an ideal choice in this case as the requests will be short-lived.

initially, I was thinking to create the server in python but since it has not so good support for "real threads" it would mean compromising on performance.

My two main questions are:

how is this scenario generally handled?
how is this scenario
    generally handle if the language of choice is python?


texts: What functional language is most suited to create games with?

texts:
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.


texts:
I have a typical foreach loop in a coroutine like:

    foreach (DLine LineItem in DLINEs)
    {
        GameObject NL = GameObject.Instantiate(DXFLine);
        NL.layer = LayerMask.NameToLayer("2D");
        LineRenderer NLLR = NL.GetComponent();
        NLLR.positionCount = (2);
        NLLR.startWidth = (0.01f); NLLR.endWidth = (0.01f);
        Color LineColor = new Color();
        DLAYER DL = TABLES.DLAYARs.FirstOrDefault(l => l.LayerName == LineItem.Layer);
        if ((LineItem.ColorNumber == -1395 || LineItem.ColorNumber == 256) && DL != null)
            LineColor = COLORs[DL.ColorNumber];
        else if ((LineItem.ColorNumber != -1395 && LineItem.ColorNumber != 256))
            LineColor = COLORs[LineItem.ColorNumber];
        if (LineColor == Color.clear) LineColor = new Color(1.0f, 1.0f, 1.0f);
            NLLR.startColor = LineColor;
        NLLR.endColor = LineColor;
>       NLLR.SetPosition(0, LineItem.StartPoint.ToVector3());
>       NLLR.SetPosition(1, LineItem.EndPoint.ToVector3());
        NL.name = "LINE-" + LineItem.Handle;
        NL.transform.SetParent(Lines.transform);
        DXF_Input.DXFLines.Add(NLLR);
        //Debug.Log(item.Log());
        Counter++;
        if (Counter == 50)
        {
             Counter = 0;
             yield return WFS;
        }
    }

and I want to debug it using Visual studio by putting breakepoint on the lines with '>'. I'm running unity and attaching the VS to unity and it stops at the breakpoint so there is no problem there. But when I want to see the values, it says the Identifier LineItem is not in the scope.
Why is this happening?
How can I fix it?


texts: What is the state of the art at shipping game graphics such as lots of small BMP files?

texts:
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.


texts:
I'm experiencing an odd problem where everything placed in front of my light appears black in my scene. This happens on multiple axes. I've searched the depths of the internet to find a solution, but I can't seem to find anything. It's also important to note that this is only happening to my models; the model's normals are fine and dandy. The rest of the scene renders as expected...

Here's how it looks:

Here's how my light is initialized:

GLfloat light_ambient[] =
{ 0.2, 0.2, 0.2, 1.0 };
GLfloat light_diffuse[] =
{ 0.8, 0.8, 0.8, 1.0 };
GLfloat light_specular[] =
{ 1.0, 1.0, 1.0, 1.0 };
GLfloat light_position[] =
{ 15.0, 11.0, 10.0, 1.0 };

glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);

glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.4);
glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.1);
glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.0);

glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);

Here's how my light's position is set:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60, (double)g_window1Width / g_window1Height, 1.0, 300.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslated(0.0, 0.0, -player.camera.Dist);
glRotated(player.camera.Angle-90, 1.0, 0.0, 0.0);
glRotated(player.camera.Rot, 0.0, 0.0, 1.0);
glTranslated(-player.camera.TgtX, player.camera.TgtY, -player.camera.TgtZ);
glScaled(1.0, -1.0, 1.0);
glEnable(GL_POLYGON_OFFSET_LINE);
glPolygonOffset(g_offset[0], g_offset[1]);

glClearColor(0.0, 0.0, 0.0, 0.0);
glClearStencil(0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

glm::vec4 light_position;
light_position.x = player.mouseMapPos.x - 1;
light_position.y = player.mouseMapPos.y - 1;
light_position.z = player.mouseMapPos.z + 0.5;
light_position.w = 1.0f;

glLightfv(GL_LIGHT0, GL_POSITION, glm::value_ptr(light_position));

I can supply more code and information as needed...


texts:
I hope you are all doing ok.  I have an issue with my Fresnel shader that doesn't allow the Fresnel to change as my camera moves around.  I'm not sure what i'm doing wrong.  I'm using glsl with the Schlick Fresnel algorithm along with a Diffuse BRDF.  A picture says a thousand words, so let me show you the issue I am having.  For debugging purposes, I am only rendering the Fresnel, nothing else.

The following image shows the Fresnel working perfectly from this particular angle (i'm looking along the direction the light is facing)

However, the following image shows the Fresnel not working when I pan the camera around the object to arrive at it's back (facing more or less against the light direction.)

As you can see, the Fresnel didn't change at all when i moved the camera,  It's as if it's "Baked" into the object.

The code for the Schlick algorithm used in this application is:

vec3 Specular_Fresnel_Schlick( in vec3 SpecularColor, in vec3 PixelNormal, in vec3 LightDir )
{
    float NdotL = max( 0, dot( PixelNormal, LightDir ) );
    return SpecularColor + ( 1 - SpecularColor ) * pow( ( 1 - NdotL ), 5 );
}

All calculations are done in world space.

Any help you can provide would be a huge deal.  Thank you for your time.


texts:
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 ?


texts:
I am new to OpenGL ES 1 in android. My 3D Model border getting Jagged. Please help me to look like a smooth border instead of jagged.

Screenshot : http://i.stack.imgur.com/1Gq83.png

private class Renderer implements GLSurfaceView.Renderer {
    public Renderer() {
        setEGLConfigChooser(8, 8, 8, 8, 16, 0);
        getHolder().setFormat(PixelFormat.TRANSLUCENT);
        setZOrderOnTop(true);
    }

    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
        gl.glClearColor(0.0f,0.0f,0.0f, 0.0f);
        gl.glDisable(GL10.GL_DITHER);
        gl.glEnable(GL10.GL_DEPTH_TEST);
        gl.glEnable(GL10.GL_BLEND);
        gl.glBlendFunc(GL10.GL_SRC_ALPHA_SATURATE, GL10.GL_ONE);
        gl.glDepthFunc(GL10.GL_LEQUAL);
        gl.glHint(GL10.GL_POLYGON_SMOOTH_HINT, GL10.GL_NICEST);
        gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
        gl.glEnable(GL10.GL_TEXTURE_2D);
        gl.glShadeModel(GL10.GL_SMOOTH);
    }

    public void onSurfaceChanged(GL10 gl, int w, int h) {
        mViewWidth = (float)w;
        mViewHeight = (float)h;
        gl.glViewport(0,0,w,h);

        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
        GLU.gluPerspective(gl, 45, mViewWidth/mViewHeight, 0.1f, 100f);

        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glLoadIdentity();
    }

    public void onDrawFrame(GL10 gl) {
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
        gl.glPushMatrix();

        gl.glDisable(GL10.GL_DITHER);

        GLU.gluLookAt(gl, 0, 0, 10, 0, 0, 0, 0, 1, 0);

        //draw_model
        gl.glPushMatrix();

        if(mOrigin != null && mRotate != null) {
            gl.glTranslatef(mOrigin.x, mOrigin.y, mOrigin.z);
            gl.glRotatef(mRotate.x, 1f, 0f, 0f);
            gl.glRotatef(mRotate.y, 0f, 1f, 0f);
            gl.glRotatef(mRotate.z, 0f, 0f, 1f);
        }

        if(mModel != null) {
            mModel.draw(gl);
            if(!RendererView.textureFileName.equals(""))
                mModel.bindTextures(mContext, gl);
        }

        gl.glPopMatrix();
        gl.glPopMatrix();

        if(isPictureTake) {

            w = getWidth();
            h = getHeight();
            b = new int[w*(y+h)];
            bt = new int[w*h];

            IntBuffer ib = IntBuffer.wrap(b);
            ib.position(0);
            gl.glReadPixels(0, 0, w, h, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, ib);
            createBitmapFromGLSurface(context);
            isPictureTake = false;
        }
    }
}

Thanks in advance.


texts: List of 2d action games with level editors

texts:
Action game level design is hard. If you want to hone your skills at designing action game levels, the problem is that first of all you have to make a good game, with good controls, interesting enemies, not to mention all the more basic code like collision, rendering, and of course the level editor (okay, so you could use an engine for a lot of that, but it's still a lot of work). Even once you have that, if your game isn't any good, that'll hinder any potential practice you might get from designing levels.

So I'm looking for 2d action games with level editors. In addition to reducing your work load and allowing you to focus on level design, having a complete game means that you can play the professionally-made levels first and have something to compare your work to.

Personally I'm thinking of sidescrolling action/platformers, but 2d action includes any 2d game that is primarily execution-based, ie reflexes and knowledge of the controls. So, Super Mario Bros. counts as 2d action in this instance.

My own examples are on the PC, but console games are fine too (although I think PC games usually have better level editors, maybe that's changing though).

PS: I hope this question is acceptable, even though there's obviously no single right answer. I noticed there's no "big-list" tag here, but I've seen questions like this on other SE sites, and it'll be plenty useful to future readers, which is part of the point of SE questions.


texts: Converting designs from photoshop/flash/after effects into code

texts:
I work as part of a two person team, I am the developer and my partner is the designer. We are currently having great difficulty working out the best way to convert his work into the actual app. We prototype all our animation in either Flash or After Effects and then I implement it into the actual application.

The implementation is not a problem, but converting the information is what we are struggling to do efficiently. We have tried making large story boards that show the change in position/scale/rotation and the time for each of these tweens but they are time consuming to make. Currently I am running an After Effects trial and just dissecting the info straight from his design but my trial will run out soon.

Just wondering if anyone can shed some light on how they do it or what is the standard practice in the industry?

Thanks


texts: Impact of object's statistics on the rendering

texts:
Consider two 3D objects with n points and n triangles. One of the objects has a smooth surface such as a ball or a box, and the other object is like a fuzzy onion-layered object with large intersecting faces. Is there any difference between the rendering (complexity and time) of these two objects?

I know that regardless of the input, the rendering process has a fixed complexity, but I am wondering whether it is possible to evaluate the impact of objects' (vertex and connectivity) statistics on the rendering (complexity and time).


texts: CSS Sprite position updates slow due to addition of 'px'?

texts:
I'm moving fewer than 10 position: absolute elements around the screen. An enormous amount of CPU time (profiled in Chrome as (program) i.e. native code) is used where I do the following:

style.left = monster.x + 'px';
style.top  = monster.y + 'px';

... where style belongs to the DOM element representing the monster in question.

This is a string concatenation cost since as soon as I remove that + 'px', the problem disappears. Of course, then absolute positioning doesn't work onscreen since the px is required by the browser.

I'm running this logic via requestAnimationFrame which runs about 60FPS... am currently amending such that position updates only occur every 2-3 frames as this will certainly help. Am also modifying so that only when the numeric value changes, is the style property set anew, rather than setting the style property on every active frame.

Even so, is this how CSS sprite updates are done? Is it always this slow? The only alternatives I can see are to use canvas (usually also slow, for different reasons) or WebGL. I'd prefer CSS for simplicity.


texts: Why Unity Navmesh codes should be executed first?

texts:
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.


texts: How to take a screenshot with java from directX

texts:
I'm looking for a way to take a screenshot with a Java application of any running directX game. I use the following code

Robot robot = new Robot();
GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
BufferedImage screenshot = robot.createScreenCapture(config.getBounds());
ImageIO.write(screenshot,"png", file);

This one works perfectly anywhere but in directX games. I'm not that familiar with Java and even less with DirectX, I'm just trying to adjust this code. I googled very much, but everything just leads to the same code I already have.

Do you know of another way to take a screenshot of DirectX games?

Thanks.


texts:
I am making a android game, and it is supposed to have attacks.(Note, this game is 2D). I have implemented things like movement to the base, but I am not too sure about the actual attack algorithm. There are supposed to be to bases, one attacker and one defender. I have tried multiple ways, but I cannot get it realistic enough. Here is what has to be a part of it:

    public void attackCalculations(){
        Random r = new Random();

        int[] aa = att.ARMIES;
        int[] ab = def.ARMIES;

    }

I thought about making random casualties based on who have more troops(attacker or defender), but it will not work(tested it, and the casualties were often 0, and it was a loss for the attacker...)
There are ten troops(the ARMIES-variable is a array-int with a max of 10)

    int ARMIES = new int[10];

So, how can I calculate who wins based on all the troops(cannot make a single integer due to different troops)?


texts: Forward rendering and separation of shaders logic

texts:
I'm currently playing with writing a rendering engine and implementing a forward rendering pipeline.

I have few doubts on how things should be implemented regarding the render passes as-well as the rendering of multiple lights.

So I'm wondering what is the better approach here:

Uber shader that is generated dynamically to adjust for the number of lights that currently affect the active scene.
This have the nice benefits of only one render pass for the lighting shader so much less binding occurs which is a plus.
have separate lighting shader for each type of light and have a render pass for each mesh with each type of light, combining in the end the result of (possibly 2 render target that we ping-pong between) with additive blending. This have the nice benefits of separation and more modular and maintainable shader code, but in the other hand the're more render passes and more binding going on and not to mention the ping-pong of additive blending between the render targets.
Other Ideas that I didn't heard/thought about and would love to hear

Ofcourse there's always room for optimization of both techniques such as ocllusion test, test which point/spot light affect which mesh (relevant to the second technique).

So I'm wondering what is the take on it of modern rendering/game engine and maybe I didn't list what their approach is and would love to hear about it.

Also if you side for one technique or another would like to have your thoughts on the pros and cons.

Thanks in advance!


texts: How to layer two textures in a cylinder without Z-fighting?

texts:
In the documentation of ShaderLab culling and depth testing you have the following:

Offset

Offset Factor, Units

Allows you specify a depth offset with two parameters. factor and units. Factor scales the maximum Z slope, with respect to X or Y of the polygon, and units scale the minimum resolvable depth buffer value. This allows you to force one polygon to be drawn on top of another although they are actually in the same position. For example Offset 0, -1 pulls the polygon closer to the camera
ignoring the polygon’s slope, whereas Offset -1, -1 will pull the polygon even closer when looking at a grazing angle.

I have the following scenery, it's two cylinders of the same size, one being the sky, one being the horizon on the floor, it is shown exactly how it is expected to render:

This is how it actually looks without playing with the offset factor and units, lots of Z-fighting:

I had to put a fairly high value to Factor so Z-fighting stops, around 15.
And setting the value of Units has absolutely no effect.
So I'm a bit at a loss as on how to correctly use both of these parameters.
Question:
Can you explain how shall one understand the meaning and correctly use Factor and Units?


texts:
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:


texts:
playerpreferance.setint problem

I am develop one game.In this game 15 levels. I am face this type of issues when send one level score into second levels. I am used player preferences in start() method. Get after Increase the score 20% levels. Player will be given score when the levels finished success.

how to score get used preferences in next level??

Math:
Level 1 would be 20 + 0 Level 2 is 20 + (20), Level 3 is 20 + (40), Level 4 is
20 + (60), Etc.
ex:

Scene1-> Level1(finishlevel) -> Getclaim button press currentreward=20;

Scene2->Level2(finishlevel)-> Getclaim button press currentreward=40;

Code:

GameManager.cs

    int pointAdd;
    public int levelID;   //ex: Leve1 levelId=0 ,Level2 Leveld=1
    public Text creditsText;

    void FixUpdate()
    {
       creditsText.text="" + PlayerPrefs.GetInt("", 0).ToString();
    }

    public void GetClaim()
    {
        pointAdd = PlayerPrefs.GetInt("",0);
        pointAdd = 20 + (levelID * 20); //FIRST SCENE LEVEID=0 //SecondScene LevelId =1 ////problem here when i m quit a game not increment 20,game store only 20
        PlayerPrefs.SetInt("", pointAdd);
        creditsText.text = ("" + pointAdd);
        btnreward.SetActive(false);   //one time claim then deactive button
    }

what i m doing: playing a game  when i m play level1=20,level2=40 preferance store.that run successful but when i m quit a game and again play a game(means level1)current credittextis=40 but not add a 20 means my credittext is=60,but game can store here Credittext=20??


texts:
Well, i have been online for hours looking for solutions, but i have found none. Im looking for a way to create textures without the function D3DXCreateShaderResourceViewFromFile.
Since D3DX is deprecated i figured that DirectXTK was the way to go since it is supported officially. I found that i could use the function CreateWICTextureFromFile, but whenever i use it i get the following linker errors:
LNK2038 mismatch detected for '_MSC_VER' value 1800 doesnt match value 1900 in

LNK2019 unresolved external symbol "__declspec(dllimport) public: void __thiscall std::_Container_base12@std@QAEXXZ referenced in function "public: void __thiscall std::_String_alloc<0,struct std::_String_Base_types>>::_Free_proxy(void)".......

any idea why is this happening? (i have both the header included and the DirectXTK.lib library linked into the project)?
and is there any simpler way to create textures, without the added whole library just for 1 function?


texts: Workflow for a data-heavy, almost spreadsheet-like management game

texts:
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?


texts: Rotate an object given only by its points?

texts:
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?


texts: 2D collision resolution: works on each axis individually, but not with both combined

texts:
My collision detection method is solid and detects box to box collision every time. Then comes the resolve part which I'm struggling with quite a bit. It works perfectly when I'm manipulating the x-axis and y-axis of the player (tile) but only happens to work when I move on any given axis individually. If I try to move on both axis then the whole thing breaks down and starts acting weird.

I'm trying to implement gravity. And so I keep a constant down force on my player tile. This is when I realized that when I'm applying force on both axis (because gravity is constantly applying force on the y-axis) and moving the player tile right or left on the same time my collision resolve method breaks down.

My collision is working great while moving along each axis individually. Here's the result:

How can I approach collision resolution in order to avoid this type of result?

I'm currently predicting the position the player will be at, then I'm checking every single collideable tile at that position. If I detect a collision, I move the player back along the axis the collision was detected in.

This is my current code with collisions working well on a single axis at a time:

void Tile_Player::Move(double delta, G3::Tile_Map *map)
{
    int xvel = (this->xDirection * (G3::TILE_STEP * (delta/1000)));
    int yvel = (this->yDirection * (G3::TILE_STEP * (delta/1000)));

    G3::xy_pos predictedPos;
    predictedPos.x = this->tile_location.x; predictedPos.y = this->tile_location.y;

    predictedPos.x += xvel;
    predictedPos.y += yvel;

    bool collision_status = false;

    for (int i=0; i< map->GetTotalTileCount(); i++)
    {
        G3::Tile *tempTile = map->GetTileAt(i);
        if (this != tempTile)
        {
            bool coll_bool;
            coll_bool =  this->CheckCollision(predictedPos, tempTile->GetTilePos());
            if (coll_bool)
            {
                //check collision on the left
                if (this->xDirection == -1)
                {
                    predictedPos.x = tempTile->GetTilePos().x+G3::TILE_SIZE+0.1;
                }
                //check collision on the right
                if (this->xDirection == 1)
                {
                    predictedPos.x = tempTile->GetTilePos().x-G3::TILE_SIZE-0.1;
                }
                //check collision on bottom(ground)
                if (this->yDirection == -1)
                {
                    predictedPos.y = tempTile->GetTilePos().y+G3::TILE_SIZE+0.1;
                }
                //check collision on top
                if (this->yDirection == 1)
                {
                    predictedPos.y = tempTile->GetTilePos().y-G3::TILE_SIZE-0.1;
                }

            }
        }
    }

    this->tile_location.x = predictedPos.x;
    this->tile_location.y = predictedPos.y;

    this->xDirection = 0;
    this->yDirection = 0;
}


texts: How do I orbit one object around another?

texts:
I am trying to do animation using glut. I have 2 squares overlapping to each other and i want other square to rotate around this central object without rotating themselves. I want to rotate in orbit manner. I am calculating circular path using parametric equation and translating that one of the square to that distance. i am calling this function in a loop.

Here is my code in which the motion of other square is not in a orbit instead it moves along a diagonal of middle one. Let me know where it is going wrong.
I have added expected image as well


texts: Software Design or Advanced Computer Graphics for Game Dev Wannabe

texts:
So, I've been a programmer for 3 years and am finishing up my first graduate semester. I want to get into independent software( mostly mobile ) development with a interest in game development.

The university I go to does research in software development but not computer graphics, but they do offer  courses in computer graphics and advanced computer graphics. I took the first computer graphics class this semester.

We used very little OpenGL. We have had 4 main projects where we have implemented the algorithms behind anti-aliasing, clipping, polygon filling, implementing our own transformations( replacing glRotate/Scale/Translate ), and phong lighting equation. From talking to a friend, he says it sounds like a good course.

I have a choice to make next semester, take software design or advanced computer graphics. I've talked to the professor teaching the advanced computer graphics class and he says we are going to be implementing the algorithms our selfs again, but it is focused on more ray-tracing type algorithms. I'm not sure how this class could help me in the realm of game development.

Now, the software design class I feel I could really use. I only took one class on software engineering in my undergrad and I have the possibility to do research in software engineering if choose to. I have found my self when working on my own iPhone apps in the past of hating some of the code I wrote. I did some design but just to get things going. I know that I need to do better at software design if I'm going to be a successful software developer.

So, I know I need both but I guess what would be more useful taking at a university? Which ever one I don't take I probably will try to teach myself in my own time. I'm kind of leaning towards Software Design just so I can see how it's really suppose to be done. Where as the advanced computer graphics algorithms aren't subjective in any way and just need to be implemented.

FYI: I won't be able to take the other class in the future as both of these classes are only offered once every 2-3 years.

Description on each class

Advanced Graphics:
Realistic, three-dimensional image generation;modeling techniques for complex three-dimensional scences; advanced illumination techniques;fractual surface modeling; modeling and rendering of natural phenomena.

Software Design:
Software design principles, attributes, models, and methodologies; object-oriented designs; real-time system design;user interface design;design verification; reusability issues;tools;current issues.


texts: Why does my position interpolation code result in "jumpy" motion?

texts:
I am developing an android game with box2d and use a fixed timestep system for advancing the physics.

However as I use this system it requires the box2d positions to be interpolates. I read this article
and have implemented an interpolation method very much like the one in the article.

The method seems to work nicely on the computer but on my phone the positions of objects are very jumpy. There is of course a big frame rate difference between PC and phone, but I think this algorithm should not mind that.

Here is the just of the code if you don't feel like looking at the article :

void PhysicsSystem::smoothStates_ ()
{
    const float oneMinusRatio = 1.f - fixedTimestepAccumulatorRatio_;

    for (b2Body * b = world_->GetBodyList (); b != NULL; b = b->GetNext ())
    {
        if (b->GetType () == b2_staticBody)
        {
            continue;
        }

        PhysicsComponent & c = PhysicsComponent::b2BodyToPhysicsComponent (* b);
        c.smoothedPosition_ =
            fixedTimestepAccumulatorRatio_ * b->GetPosition () +
            oneMinusRatio * c.previousPosition_;
        c.smoothedAngle_ =
            fixedTimestepAccumulatorRatio_ * b->GetAngle () +
            oneMinusRatio * c.previousAngle_;
    }
}

Does anyone know why my game is acting like this?

Thanks for the help

EDIT:
Here is some logging as suggested in the comments bellow log data

EDIT2 :
This log shows the jumpy effect I think ( you can see the position diff is sometimes positive and sometimes negative - and the object are just falling, it should be constant)log data 2


texts: Predicting enemy position in order to have an object lead its target

texts:
In my 2D game I have AI turrets that should assist the player by automatically firing towards enemies. I would like to make them fire intelligently and lead their target instead of just targeting an enemy's current position. So, given the (always constant) velocity and position vector of both the enemy and the turret's projectile, how can I find a vector that represents the actual position the turret must target in order for the projectile to intersect (and hit) the enemy?

Any links to articles that describe the math, algorithms, etc. would be appreciated!


texts:
In the following function I want to change the animation when I touch on the button.
But the game crash and exit. What's wrong with this code ?

 bool GameScene::onTouchBegan(cocos2d::Touch *touch ,cocos2d::Event *event)
{
    Point touchPoint = Director::sharedDirector()->convertToGL(touch->getStartLocationInView());
    touchPoint = blueButton->convertToNodeSpace(touchPoint);

    Rect *blueBottomRect = new Rect(blueButton->getOffsetPosition().x
        , blueButton->getOffsetPosition().y
        , blueButton->getTextureRect().size.width
        , blueButton->getTextureRect().size.height);
    if (blueBottomRect->containsPoint(touchPoint))
    {
        CCLOG("Blue Touched!!!!!!!!!!!!!!!!!!");

        auto blueBody = Sprite::create("body1.png");
        blueBody->setPosition(Point(visibleSize.width / 2 , +220));

        Vector<SpriteFrame*> animFrames;

        animFrames.reserve(7);
        animFrames.pushBack(SpriteFrame::create("body1.png", Rect(0, 0, 99, 153)));
        animFrames.pushBack(SpriteFrame::create("body2.png", Rect(0, 0, 99, 153)));
        animFrames.pushBack(SpriteFrame::create("body3.png", Rect(0, 0, 99, 153)));
        animFrames.pushBack(SpriteFrame::create("body4.png", Rect(0, 0, 99, 153)));
        animFrames.pushBack(SpriteFrame::create("body5.png", Rect(0, 0, 99, 153)));
        animFrames.pushBack(SpriteFrame::create("body6.png", Rect(0, 0, 99, 153)));
        animFrames.pushBack(SpriteFrame::create("body7.png", Rect(0, 0, 99, 153)));

        Animation* animation = Animation::createWithSpriteFrames(animFrames, 0.09f);
        Animate* animate = Animate::create(animation);

        blueBody->runAction(RepeatForever::create(animate));
        this->addChild(blueBody,100);
        redBody->removeFromParentAndCleanup(true);

    }

    Point touchPoint2 = Director::sharedDirector()->convertToGL(touch->getStartLocationInView());
    touchPoint2 = redButton->convertToNodeSpace(touchPoint2);

    Rect *redBottomRect = new Rect(redButton->getOffsetPosition().x
        , redButton->getOffsetPosition().y
        , redButton->getTextureRect().size.width
        , redButton->getTextureRect().size.height);
    if (redBottomRect->containsPoint(touchPoint2))
    {
        CCLOG("Red Touched!!!!!!!!!!!!!!!!!!");

        auto redBody = Sprite::create("RedBody/bodyRed1.png");
        redBody->setPosition(Point(visibleSize.width / 2 , +220));

        Vector<SpriteFrame*> animFrames2;

        animFrames2.reserve(7);
        animFrames2.pushBack(SpriteFrame::create("RedBody/bodyRed1.png", Rect(0, 0, 99, 153)));
        animFrames2.pushBack(SpriteFrame::create("RedBody/bodyRed2.png", Rect(0, 0, 99, 153)));
        animFrames2.pushBack(SpriteFrame::create("RedBody/bodyRed3.png", Rect(0, 0, 99, 153)));
        animFrames2.pushBack(SpriteFrame::create("RedBody/bodyRed4.png", Rect(0, 0, 99, 153)));
        animFrames2.pushBack(SpriteFrame::create("RedBody/bodyRed5.png", Rect(0, 0, 99, 153)));
        animFrames2.pushBack(SpriteFrame::create("RedBody/bodyRed6.png", Rect(0, 0, 99, 153)));
        animFrames2.pushBack(SpriteFrame::create("RedBody/bodyRed7.png", Rect(0, 0, 99, 153)));

        Animation* animation2 = Animation::createWithSpriteFrames(animFrames2, 0.09f);
        Animate* animate2 = Animate::create(animation2);

        redBody->runAction(RepeatForever::create(animate2));
        this->addChild(redBody,100);
        blueBody->removeFromParentAndCleanup(true);

    }

    return true;
}


texts: How should I calculate the new angle/direction of my ball hitting a wall?

texts:
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;


texts: How do you make sure that a component can be applied to very different entities?

texts:
I know there's lots of posts about this sort of thing, and I've read a lot of them, but there's some gaps that I can't seem to fill in my head.

Specifically, I've been reading about the SOLID principle and component-based game development. Lots of these posts explain it but don't really give examples on it.

For example, in a hypothetical RPG game, say there's a player class. The class consists of components like Inventory, Movement, and let's say a Roll component. You make the roll component so the player can use it, that's great and it works for the player. Now say that an enemy has the same roll component, how do you implement it? The enemy won't necessarily have the same animation, same roll distance, etc. Do you make a database with roll animations for different enemies? Do you have an animation variable in the enemy's class specifically for the roll component (even though this seems to break the SOLID principle)? Do you make the enemy class override the roll animation? It's specific things like this that I don't understand how to implement.

Another example of the inventory component. What would be responsible for equipping, dropping, or removing items? Do you put it in the inventory component and create messy code with dependency on knowing the owner of the inventory?

Maybe I'm not understanding SOLID or component based programming properly, I'm not sure.

If anyone has specific examples like this they could explain to me, that would be appreciated.

Thank you!


texts:
These two errors are doing my head in. New to Xcode. So please advise thank you.
FYI
I did not touch or modify anything of the Xcode that was generated by Unity. Upon opening there is a warning that says to set to recommended settings. Other than that just set the provisional file. Set the simulator device then pressed play but these two errors keep showing!
include "Unity/GlesHelper.h" file not found
include "UI/Keyboard.h" file not found


texts: Destroy multiple actors by pressing a button

texts:
I'm making a simple project to learn Unreal Engine.

I have 50 actors (blueprints) and at the start a function will loop 5 times and spawn 5 of the 50 actors randomly.

How can I destroy the actors by pressing a button, irrespective of which of the 50 actors are spawned?


texts:
I have a game, where the user presses a button to spend money and increase the height of a Movie Clip. I use the following: height ++.

The problem:  When I test this out, it seems the width increases, too.  The actual thickness, you could say.  How can I solve this?


texts: Unity - Where do Animation Events fit in the Script Lifecycle Flowchart

texts:
I was looking at the Script Lifecycle Flowchart and suddenly I got thinking about Animation events.

Where do they fit, inside this flowchart? In which position would they be executed?


texts: xna creating game stage management contrls

texts:
I am under planning stage of my game where I am creating controls for my game. I have create below control for stages but have no idea how this we can achieve in xna.

Please also help me with your views regarding how to load, play multiple stages and persist score for each stage in game using xna. What we normally used to do is just put everything in infinite loop but here I want more intelligence in game, as one stage over it should go back to menu. Example can be something like angry bird stages.


texts: My Camera (In Unity) Is Tilting When My Character Moves (2D)

texts: I'm trying to use Cinemachine to follow my player and whenever the player moves left or right everything shifts. I'm not sure whats causing this. I have tried giving the camera a Rigidbody2D and locking the Z. This did not work. I have attached what I think may be the appropriate settings. If you know whats causing this please leave me a comment.


texts: How to make collisionshape2D work from other scene in Godot?

texts: I have created a scene which contains Area2D, CollisionShape2D & AnimatedSprite. Then I imported that scene into a level. At this moment the player should collide with the object taking it as a obstacle. But it doesn't collide with the coin. How can I make collision work from other scene?


texts:
Many aspects of Unlimited Details Unlimited Detail Technology seems dubious to me, even the introductory paragraph (because of the usage of the word unlimited):

  Unlimited Detail is a new technology
  for making realtime 3D graphics.
  Unlimited Detail is different from
  existing 3D graphics systems because
  it can process unlimited point cloud
  data in real time, giving the highest
  level of geometry ever seen.

The quote above is from the no longer existing Unlimited Detail Technology Site (archive.org snapshot from 2011)

My question is: Does this unlimited detail technology actually exist?
And if it does, why isn't it currently being used in games?

Other references to the Unlimited Detail Technology:

Article on Rock Paper Shotgun
A video demonstration on Game
Trailers.com
An interview With
The Creator (Bruce Dell)
Article
on Download Squad

Update

Unlimited Detail recently released a new YouTube video. I'm not any more convinced. I wrote a blog post about it, as did Notch (he thinks it's a scam).


texts: Render 2D texture on the cube texture at given location

texts:
I would like to simulate a moving sun on the sky. What I have managed to do so far is calculating the exact location of the sun, that is the 3D direction vector from the camera's position in the world to the sun. The sky is the cube with 6 faces textured with some cube map texture. The skybox positon is constantly being set to the position of the camera, so that the camera is always in the cube's center.

Now, I have a simple 2D texture of the sun that I would like to render onto the cube map texture using the aforementioned direction vector. Could you please describe how I can achieve this? My reasoning is that I need to bind the framebuffer of the cube map and then render the sun mesh with the correct sun texture. But how do I specify the position of the sun here so that it matches the direction vector I have calculated earlier? Another question is if there might be problem when it happens that part of the sun is supposed to be rendered on one face of the cube texture and the other part on some other face of the cube texture?

Thank you in advance.


texts:
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?


texts: How do you animate/collide against a tessellated mesh?

texts:
Now that I have a implemented tessellation for my mesh, I am trying to understand how I can leverage the generated primitives.

Example:

I have the following track mesh generated procedurally, it consists of quads, in the first picture you can see one of them I am highlighting using the mouse.

In the following picture, the shader applies some tessellation, you can see that now a quad has generated 16 quads.

Question (two-folded):

Now that I have more control points for each of my quad, suppose I want to deform one of them, for instance, to look like the following:

How is one supposed to apply such transformation ?

basically, what in terms of code-behind / shader code infrastructure is required to achieve such thing.

How can collisions be checked for against that deformed mesh ?

from what I've understood, a mesh collider would be unpractical since it's a heavy operation that just forbids real-time updates


texts:
I know that the formula for irradiance at surface point p with normal n given a point light source at position l is:

H = I(cos x) / ||l - p||^2

Where:

x = angle between n and l-p
I() = Intensity of light

But if I have an area light source defined by a polygon P, what is the formula for irradiance?


texts: In Android, is saving game data in a binary file a good approach?

texts: 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.


texts: What makes a path finding heuristic Monotonic vs. Non-monotonic?

texts: 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.


texts: How to detect collision during a cocos2d::Action

texts:
I spent a day trying to hack my own Action class, but given the hurdles I've hit trying to do so, I'm hoping there's some way to work around my problem while still using the built-in (and admittedly powerful) Action class.

To wit, I need to check collision on a linear movement type Action (like MoveTo). It appears the function simply calculates a vector and increases the Node's position on that vector as time elapses. All fine.

Now, I have a collisionHandler function set up within both my Player class and my custom Move class. However, cocos2d automatically schedules actions when they're added to a Node using the runAction method. Because of this, it seems that the collisionHandler never gets called on the Move class. The code, as I imagine it updates, looks like this:

Main{ //main loop
objects->update();
collisionManager->update();
} // all other cocos2d scheduled updates
actions->update(); // the collision doesn't get checked til next frame

Running the collision loop twice per frame must be the wrong answer. So, how do I get it so that both the objects and their actions update before the collision loop runs?


texts: Efficiently detecting objects inside multiple radius

texts: I would like to create a game for mobile that require to calculate multiple time by seconds which moving objects are in the radius of moving points. The game is highly inspired from Gratuitous Space Battles, the radius being from the weapons. Thus, I would like to know if it's realist to expect to be able to know among 1000 moving objects, in which radius they are among 1000 moving points 100 times per seconds on an average android device. In term of complexity, if there is an algorithm better than O(N*M), N being the number of moving objects and  M the number of radius from M moving center and if an algorithm can benefit from the fact that the moving objects are near their precedent position.


texts: Complex, yet simple crafting system model

texts:
I'm working on some arcade shooter/slasher, and the main logline is "Kick'em with everything you want". There's not so many enemies in GDD, main focus is on tons of weapons and gadgets to cause mayhem.
To get weapon, you need to craft it, and now crafting system looks simple, like:

1) You got three slots for weapon parts (like A, B, C)
2) You collect misc weapon parts, and when you got atleast one for every slot, you can craft a weapon (for example, if you got A1, B1, B2, B3 and C1, you can craft such models - A1B1C1, A1B2C1, A1B3C1)

As for me, this crafting system is too simple, because weapon parts will just fall from the top of screen, often enough. That's why I'm thinking about adding some more crafting system levels, like resources (collect 10 scrap pieces to make part A1 or C3), etc.

My question is:
How can i add some more complex, still simple, transparent levels in crafting system?

upd. For example, in Minecraft or Terraria, first 5-10 crafting recipies quite transparent and simple IMHO. But then it turns into huge mess to understand, how to craft this or that (for example, fishing rod)

upd. Okay, somehow i've figured out mechanics like this:
1) Player gather resources (while playing game, automatic gathering from loot)
2) When there's enough resources to craft some weapon part, dedicated icon flashes, so player can craft weapon part in one click (automatic crafting)
3) Having several weapon parts, player can adjust different parts to create weapon (manual crafting)

I think, this will be complex and simple enough, now over-weighted by to many buttons and receipes, still, enough of freedom and manual creativity, trying to mix this and that.


texts: Looking for specific "textured quad" openGL tutorial in c++

texts:
I'm new to openGL and I've been googling around for the old and simple textured quad tutorial in openGL but I haven't been able to find one that suits my needs.

OpenGL3.X compatible
OpenGL|ES 2.0 compatible
AND
Only uses core openGL library (no GLUT, GLEW...)

I'm creating the window and the openGL context with SDL2.

I only need the most basic stuff to draw quads. I'm not interested in any of the new OpenGL features, just in compatibility and cross platformness (Windows, OSX, Linux, Android and iOS).


texts:
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.