texts:
Hitting a bit of a roadblock with my game's development and I'm just looking for some outside advice.

I'm trying to render a tilemap for my mobile game (Android) and I'm using LibGDX.

Now, here's the issue.  Using my simplified version of LibGDX's own native OrthogonalTiledMapRenderer gives me:

60fps on desktop
~40fps on my Nexus 10 tablet
~20fps on my Nexus S phone

Here's my renderer for reference, it's very simple as to keep performance up.  The function renderTileLayer() is called every frame to render the tiles in the viewport's range.

Now, this is with all tiles in a single TextureAtlas, blending disabled, and actively culling the tiles.  Since this is the beginning stages of the game, anything below 60fps is only going to result in horrid performance later on, so I need to get this fixed.

I don't understand how people are able to render tile maps on mobile devices in their finished games if I seem to be having so much trouble with rendering my own simple 1 layer map with no other objects or lighting effects or particles, etc...

The code for rendering the tiles is as straightforward as possible and results in only 1 render call to the SpriteBatch (no Texture swapping).

Any help/input appreciated!


texts: Unexpectedly fast rotation after refactoring OpenGL code to add more abstraction

texts:
I've been working on an OpenGL program that simply renders a square that rotates in 3D space. The square also has a texture applied to both sides. Here you can see an example screenshot of the program running:

I used very little abstraction in that project and most of the code was in main.cpp (apart from the shader loading and usage).

After finishing this project, I wanted to improve it as much as I could with my current knowledge. I started abstracting away functionality. The final result was a very clean main.cpp file with multiple classes (Mesh, Shader, Resource Manager and Window classes).

Apart from the texture, everything should functionally be the same, but I experienced the following after using the rotate function; left is the abstracted version of the first project, right is the first project:

The square in the new project rotates at a much higher speed than in the previous project. The implementation is the same, as in, the degrees that the square should rotate around the y-axis are the same in both projects - the time the program has been running, which is gotten through GLFW's glfwGetTime().

I checked nearly everything. The .lib files are linked the same way between the projects. There are no differences between the vertex data. Both projects are running in DEBUG mode.

The only difference I could think of is the texture not being applied in the second project, but I recall that the textureless version of the first project was still running with the same speed as it is currently. But rendering a 64x64 texture on a square shouldn't be that expensive to run.

NOTE: I'm using GLM for the matrices and for the rotation transformation.

Does abstracting away all of OpenGL's initializing and buffer code improve performance by that much?

I'm using GLFW for window and context creation, and thus using (float)glfwGetTime() for the angle of rotation along the y-axis.

The second project basically moves over all functionality into categorized classes. So everything to do with meshes was moved to a Mesh class, loading of GLSL shaders and textures was moved over to a ResourceManager class etc. So all functionality should be the same.


texts: Unity how to change material properties at runtime

texts:
I'm working on a unity game where I want to change the color of a material from within a script. The material applies to a line renderer.

I currently have the following script:

using UnityEngine;
using System.Collections;

public class LaserProperties : MonoBehaviour {
    public Vector3 RGBStrengths;
    public LineRenderer lineRenderer;

    /*
     * returns the color in RGB.
     */
    Color getColor(){
        Color c = new Color (0, 0, 0, 1);
        float highest = Mathf.Max (RGBStrengths.x, RGBStrengths.y, RGBStrengths.z);
        c.r = RGBStrengths.x / highest;
        c.g = RGBStrengths.y / highest;
        c.b = RGBStrengths.z / highest;
        return c;
    }
    /*
     * returns the total amount of energy in the beam
     */
    float getStrength(){
        return RGBStrengths.magnitude;
    }
    void Update(){
        updateBeam ();
        Debug.Log (getColor());
    }
    /*
     * set color of the beam to the color of the laser
     */
    public void updateBeam(){
        lineRenderer.SetWidth (getStrength (), getStrength());
        lineRenderer.material.color = getColor ();
        lineRenderer.material.SetColor ("_Albedo", getColor ());
        lineRenderer.material.SetColor ("_Emission", getColor ());

    }
}

And here is the material .

However changing the properties does not result in any chance to the material in question.

Any idea what I'm doing wrong?


texts: Creating a game on Linux with SDL and distributing it

texts:
TL, DR: Will I be able to get a single .exe file which will work smooth in a PC which does not have SDL or so installed ever. If not, how close will be the closest approach?
Yes, now, I want to start game development using C/C++ and I am on a Linux machine.
From the resources on the web, I saw that SDL2 is a common API to use. However, I could not get satisfying answers about the following:
For me, it is important to be able to distrubite my games to my friends(let's say) with little amount of file. So, I wonder how this process works with SDL2. Will it be easy(or even possible, maybe?) to distribute a .exe file to my friends who are using Windows OS and don't have SDL2 installed? If it is so, a short description of the process would be very nice.
To make my point more clear, while I was using pygame module of python to develop a game(which includes sounds, images etc.), I was able to run pyinstaller with --onefile option on a Windows machine to get a single executable (.exe) and my friends who does not have even python installed was able to run the game without any problem. So my question is simply asking that whether it will be similar to this or not with SDL2 case.
Thanks in advance.
p.s: Using a Windows machine to build the game is something I can do.


texts: Correct order of operations in a platformer game loop

texts:
I've run into an issue with my Mega Man engine, and the structure of my game loop is making it very difficult to fix. With Rush Jet, or any falling platform, Mega Man needs to stay attached to the platform as it falls. Right now the best I can do (without resorting to workarounds like magic forcefields that pull him down) has it so that he falls for a single frame when the platform first starts falling. But even this requires the falling platform to pull him down during the collision check. Without this extra step, he constantly "jitters" in falling as the platform descends.

The order of events in my game loop is making this happen. It goes like this:

Mega Man and Rush Jet are flying horizontally for a while.
Thinking phase: Player presses down - the platform decides to set its velocity to downward.
Action phase: Platform moves down, player has no awareness of this.
Reaction phase: The two are not colliding, so no "binding force" check can occur.
Next frame, Mega Man falls. A frame later, gravity catches up and he lands on the platform again, resetting his y velocity to 0.

You can see there the basic order of my loop:

Thinking phase, where you analyze collisions from the previous frame, and any other variables, to decide on state transitions and other adjustments.
Action phase - everyone moves according to their velocity.
Reaction phase - collision checks, adjust positions to fix them. This also handles effects like moving platforms, eg. push the player by some amount. The changes to his velocity are applied in the next frame, during the action phase.

I've tried reordering these steps and various other changes, but they all make the whole thing much worse, with all sorts of bugs. If I need to make sweeping changes to my engine to get these things right, I'd rather know what the "proper" way is before wasting any time.

I know one possible solution would be for the movement step to look at who was touching the platform in the previous frame and pull him then, so they actually move together. That seems too complex though, reaching between components like that. My engine code already feels way more complicated than the original game could have been, suggesting that I'm doing something wrong.

So is there a proper sequence of events? There's another question on here about moving things along with a platform, but that doesn't address the order of events issue which causes my problem. Also, if anyone actually knows the way the classic Mega Man games did it, that would obviously be a huge help.

Find as much of my code as you want at https://github.com/Tesserex/C--MegaMan-Engine/tree/master/Mega%20Man. The CollisionComponent and MovementComponent may be the most useful.


texts: Impulse resolution for purely rotational collisions (relative linear velocity = 0)

texts:
I've been writing a basic physics engine, (loosely) following Randy Gaul's online tutorial. I have been using this equation that he derives:

$$j=\frac{-(1+e)((V^A-V^B)*t)}{\frac{1}{{mass}^A}+\frac{1}{{mass}^B}+\frac{(r^A\times t)^2}{I^A}+\frac{(r^B\times t)^2}{I^B}}$$

(https://gamedevelopment.tutsplus.com/tutorials/how-to-create-a-custom-2d-physics-engine-oriented-rigid-bodies--gamedev-8032)

This equation works well for the majority of all collisions. However, if two objects collide through rotation and rotation alone (that is, their relative linear velocity is 0), an impulse of 0 will be applied since VA - VB is 0. This results in one object clipping into another, passing through as if it were never there. While less noticeable, this can also be a problem for collisions where relative linear velocity is non-zero, but angular velocity is much greater than relative velocity.

This is clearly not how objects would interact with real-world physics. That being said, how would I determine the "effective" relative velocity used in the equation for rotating bodies? I have already tried adding the linear velocity of the collision contact point to the center of mass velocity for both objects, but have gotten unsatisfactory results.


texts: How to make difficulty progression in my endless-runner game?

texts:
I want to further develop this game I created for a game jam. Currently spiders chase squirrels with the same speed. Tree branches are randomly generated. Even if you perfectly time your jumps the spiders will eventually catch you. Squirrels are able to pick up randomly generated acorns to throw at the spiders knocking them back.

I want to implement some kind of difficulty progression. Any ideas are appreciated. My main idea is to accelerate the spiders, but the squirrels can't jump any quicker because of physics. They are propelled by one of two jump strengths, and gravity.

The question is: Would it be a good idea to increase the jump high and/or gravity accordingly to the speed of the spiders? (allowing the player to continue to evade the spiders)

Please take into consideration that other obstacles will be added; for example a bat attacking the squirrel from a hole in the tree trunk.


texts:
Of course, it goes without saying that this can only work when the puzzle is randomly generated (say, something like minesweeper/bejeweled) and not hand-designed levels (such as trainyard, theseus & the minotaur etc).

I am currently thinking that this can instill a sense of urgency to the player and make them feel more challenged. Along with increasing the actual puzzle difficulty, a time restriction could be another way to increase difficulty, and the combination of both can be used as a way to give a sense of progress.

Also possibly, incremental time increases when solving parts of the puzzle (like time extensions in racing games) could be used for these games.

What I'm wondering about is, what's the accepted thought about using time limits? Would they work as I'm currently thinking or am I missing anything?


texts: Particles in particle system not being lit

texts:
I have a sprite that I want to use in my particle systems (it's just 4x4 white square). I'd also like for the particles to be lit (react to lighting within a scene).

Since I'm using 2D Toolkit, I simply created a new tk2d sprite collection of just the single texture, generating normals for it within the sprite collection settings, set the shader for the atlas0 material that's generated to LitBlendVertex and attached the atlas0 material to the particle system.

However, the particles are not reacting to light. I've tried different shaders (both Unity and tk2d) but to no avail. I also messed with the particle systems normal direction setting but still nothing.

Is there something I'm missing to get particles in a particle system to be lit?


texts: Should I create .fla files in Flash Professional and import them into Flash Builder?

texts: With Flash Builder and Flash Professional at my disposal for creating games, I'm having a hard time figuring out if I should be creating the .fla files in Flash Professional and then importing them into Flash Builder, or something else? Does it matter?


texts:
I have an external hardware which gives me quaternion values.
Now I would like to calibrate the device at a certain position and show tilt variations from that position on the UI.
For example, I have a small 3D plane model. Whatever position the device maybe, after calibration the model's back should be facing the user with the tail up and from that position the rotation should be relative to the device's rotation.
How to do that?
Simply recording the quaternion values at the calibration position and using that to subtract from the current quaternion values from the device and setting to the 3D model is not working.

Below is the code where I apply the calibrated values:

imu.xAxis = (Style.qX + (imuData.quatX - Style.bX))
imu.yAxis = (Style.qY + (imuData.quatY - Style.bY))
imu.zAxis = (Style.qZ + (imuData.quatZ - Style.bZ))
imu.wAxis = (Style.qW + (imuData.quatW - Style.bW))

where qX,qY,qZ and qW are the initail postion of the model, quatX, quatY, quatZ and quatW are the current quaternion values from the device and bX, bY, bZ and bW are the quaternion values at the calibration position.


texts: How to add some organization to my PSD Imported image with bones generated by the Skin Editor

texts:
I have an Image in PSB format imported using the PSD Imported and I have generated bones using the Sprite Editor > Skinning Editor, all good.
The problem is that when I try to add some organization to the object in my inspector I can not do it without breaking the Prefab. We can just Unpack the prefab but then I can not modify the bones anymore using the Skinning Editor. I am trap here.
How can I add some organization to the generated Prefab?


texts:
while making my own Snake implementation I decided to use delta time for smoothing movement on screen. The problem is that before Snake was moving fixed amount of pixels every frame, but now when mulitplying snakeSpeed by timeStep it's no longer aligned to the grid. How can I fix it?

Main game function:

void Run()
{
    while (!gameOver)
    {
        Time = (float)al_get_time() * 1000.0;
        timeStep = Time - lastFrameTime;

        Input();

        if (draw && al_is_event_queue_empty(eventQueue))
        {
            al_clear_to_color(al_map_rgb(255, 255, 255));

            UpdateSnake(&snake, timeStep, direction);
            Draw();
            Logic();

            al_flip_display();
            draw = false;
        }
    }
}

UpdateSnake() function (for now it's only one element moving):

void UpdateSnake(Snake *snake, float timeStep, Position direction)
{
    snake->animationTime += timeStep;

    float f = snake->animationTime * snakeSpeed;

    if (f >= 1.0f)
    {
        snake->animationTime = 0.0f;
        f = 1.0f;
    }

    snake->animationOrigin.x = ((int)snake->position.x / BOARD_CELL) * BOARD_CELL;
    snake->animationOrigin.y = ((int)snake->position.y / BOARD_CELL) * BOARD_CELL;

    if (direction.x == 1)
    {
        snake->animationDestination.x = snake->animationOrigin.x + BOARD_CELL;
        snake->animationDestination.y = snake->animationOrigin.y;
    }

    if (direction.x == -1)
    {
        snake->animationDestination.x = snake->animationOrigin.x - BOARD_CELL;
        snake->animationDestination.y = snake->animationOrigin.y;
    }

    if (direction.y == 1)
    {
        snake->animationDestination.x = snake->animationOrigin.x;
        snake->animationDestination.y = snake->animationOrigin.y + BOARD_CELL;
    }

    if (direction.y == -1)
    {
        snake->animationDestination.x = snake->animationOrigin.x;
        snake->animationDestination.y = snake->animationOrigin.y - BOARD_CELL;
    }

    snake->position.x = Lerp(snake->animationOrigin.x, snake->animationDestination.x, f);
    snake->position.y = Lerp(snake->animationOrigin.y, snake->animationDestination.y, f);

}


texts:
I'm writing a browser game in php and Sql. I'm also using Javascript - Ajax and Mysql.

I'm stack on the battle system because I want to Synchronize the turns of the players in the battle.

What I doing is to put two players on a battle. So from the first turn a countDown of 60sec will start.
What I am thinking is to use a server function to check the countdown, not to the client side. This because I think that in that case a bad synchronization will came, instead if it is the server to count down.

But.. how can I let the server do all this stuff?


texts: How can I batch-convert TexturePacker .pvr.ccz files to .png?

texts:
I am a pixel artist with very little programming knowledge. I have read that it's possible to use Texture Packer to do batch conversion of pvr.ccz files to png using the Command Line Tool.

How do I install the Command Line Tool for Texture Packer? It doesnt seem to be installed by default and the info presented when I select 'File'-> 'Install Command Line Tool' makes no sense to me... It says:

Simply add C:/Program Files (x86)/CodeAndWeb/TexturePacker/bin to your path variable or add the following line to your scripts calling TexturePacker:
set "PATH=C:/Program Files (x86)/CodeAndWeb/TexturePacker/bin;%PATH%"

I dont understand how to carry out these instructions..

Then, once I succeed in installing the Command Line Tool, what should I type into the Command Line Tool to convert 50 or so .pvr.ccz files to .pngs in a different folder?

The TexturePacker website has this to say on Batch Converting:

Write a simple batch file containing these lines to do as mass conversion of images:

`@
echo off
for %%X
in (*.png)
do (C:\Programme\TexturePacker\bin\TexturePacker.exe  <parameters>  %%X)`

Please replace with your parameters needed.

Batch converting images to pvr or pvr.ccz

You can use TexturePacker to simply convert a complete directory of images with a single command line call into whatever output format you need (pvr.ccz in this example):

`find <directoryname> -name \*.png | sed 's/\.png//g' | \
xargs -I % -n 1 TexturePacker %.png \
--sheet %.pvr.ccz \
--data dummy.plist \
--algorithm Basic \
--allow-free-size \
--no-trim \
--opt RGBA4444 \
--dither-fs`

Replace  with the directory to search.

So this example is converting png to pvr, I need to go the other way. But I have no idea how to open or install the Command Line Tool from within the Texture Packer GUI...

And then Im not sure how to use the code above to write a 'simple batch file' to carry out the conversion I need?

I'm on a PC with Windows 7.


texts: Got unexpected results from perlin noise. Wondering what it is doing?

texts:
I was just messing around with perlin noise and got this.  Wondering if anyone knows what it is or has seen it before.

Here is the code(LUA with love2d engine):

function love.load()
    love.window.setMode( 1920, 1080, {fullscreen=false})
    --Assuming you called the module perlin.lua
    newperlin = require("perlin2")
    --newperlin is a function that generates Perlin noise objects:

    myperlin = newperlin()
    --333 is seed
    myperlin = newperlin(333)
    mapHeight = 400
    mapWidth = 400

    --then, to create noise:
    scale = 0.007
    map = {}
    for x = 0, mapWidth - 1 do
        map[x] = {}
        for y = 0, mapHeight - 1 do
            map[x][y] = 0
            map[x][y] = --[[map[x][y] + --]](myperlin:noise(x * scale, y
              * scale) + 1) / 2.0 * 255.0
            --The following lines change it from a cloud to a weird image
            smin=0; smax=255
            map[x][y] =  math.floor(( map[x][y] - (-0.5) ) * 255 / ( 0.5
              - (-0.5) ) + 0)
        end
    end
end
function love.draw()
    for x = 0, mapWidth - 1 do
        for y = 0, mapHeight - 1 do
        love.graphics.setColor(map[x][y], map[x][y], map[x][y], 255)
        love.graphics.point(x,y)
        end
    end
end

function love.update()

end

function love.keyreleased(key)
    if key == "escape" then
        love.event.quit()
    end
end

and here is perlin.lua:


texts: No Support for UnityScript (JavaScript) on 2018.3

texts:
Hey I’ve been working on a project for over 3 years and yesterday I have updated the unity from 2018 to 2018.3 and lost support for JavaScript.
All of my scripts attached to gameobjects are there but not working while playing the game.
I’ve tried the UnityScript to C# website but didn’t work.
I’m a macOS user so couldn’t use the converter tool on git (because it’s been developed only for windows).
I’ll appreciate any suggestions.


texts: I'm creating a small fps and I don't know how to create a bullet impact effect. I have a muzzle flare and I have recasting set up but I don't know how to make a bullet impact effect. I've already tried working with the particle system prefab 'Flare' but nothing seems to work for me, please can someone help?  Soon Please


texts:
I want to know how can I define daily monthly challenges in my game? Is this something can be defined locally or its need server and external services? And which servers and technologies can implements that? Is persistent connection or … needed as server should send messages to clients with no request?

Specifically, I use unity.


texts:
I am very new to Unity and game making and would appreciate if you would cope with me.

I have made a very basic prototype of character animation and movement, however trigger that is supposed to fire animation happens after character already moved. I just can't seem to find a way to fix it as SetTrigger is void and not a Task.

See this video for what I mean

The script I am using to fire off animation is the following:

public class Hero : MonoBehaviour {

    public Animator animator;
    public void Down()
    {
        var move = GameObject.Find("Hero").transform.position;
        animator.SetTrigger("moveDown");
        transform.position = Vector3.Lerp(move, move + new Vector3(0, -1f, 0), 1f);
    }
}

How does one make both movement and animation to sync up and happen simultaneously?


texts: Unity3D CrossPlatformInput StandardAsset Multitouch

texts:
I have a small game I am working on, and I am trying to add touch support to it.  Before I try to add that into the real game I wanted to do a test run on a small project.  The project consists of a capsule to be the player, and the application accepts movement from a on screen joystick, and accepts a button click from a UI button.  The button triggers the attack, and the joystick triggers the movement.

Both of these controls work as designed but they will not work together, meaning I can do one or the other.  I was hoping to use the standard asset as to not re-invent the wheel for speed...

below is the code that "Should" be triggering when both controls are used, just as a note this same code works when I use mouse and keyboard together so this is something to do with the mobile stuff..

using UnityEngine;
using System.Collections;
using UnityStandardAssets.CrossPlatformInput;

public class PlayerController : MonoBehaviour
{
    public float playerSpeed = 10f;
    Transform weapon;

    // Use this for initialization
    void Start ()
    {
        weapon = transform.FindChild("Weapon");
    }

    // Update is called once per frame
    void Update ()
    {
        DirectionalMovements();
        ButtonPresses();
    }

    void ButtonPresses()
    {
        if (CrossPlatformInputManager.GetButtonDown("Fire1"))
        {
            weapon.GetComponent<Sword>().AttackOne();
        }
    }

    void DirectionalMovements()
    {
        float moveVertical = CrossPlatformInputManager.GetAxis("Vertical") * playerSpeed * Time.deltaTime;
        float moveHorizontal = CrossPlatformInputManager.GetAxis("Horizontal") * playerSpeed * Time.deltaTime;

        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
        transform.Translate(movement, Space.World);

        if (movement != Vector3.zero)
        {
            transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(movement.normalized), playerSpeed);
        }
    }
}

Any thoughts would be greatly appreciated.. I just do not see why both controls are not picked up here.


texts: How do we attract more developers and other Volunteers to our Open Source MMO Emulation Project?

texts:
I am on a small development team that is tasked with completing the server side programming for an Open Source MMO project that has been in progress for about 5 years now. Approximately a year ago we Open Sourced the project hoping to draw in new developers, this was without much success and in fact we haven't gained even one active developer in our project. The Project Star Wars Galaxies A New Hope, is something near and dear to myself and the other few people working on the project. It is a quest to bring back one of the golden eras in gaming, Patch 14.1 for Star Wars galaxies.

The progress as of this summer was extremely slow and it seemed as if we were taking two steps forward and one back every change we made. The codebase wasn't designed very well and we looked into completely rewriting it from scratch. After a couple of weeks we realized this couldn't be done in a timely manner and perhaps we should take another look at the old core to see if we couldn't revive it. We found it was worth just revamping the old core and continuing to push forward, we've made some really good changes that will help with the future of development. One reason we didn't really want to push heavy developer recruiting was the state of the existing codebase.

Now that it is somewhat cleaned up, how do we go about recruiting quality individuals that are interested in finishing up this Open Source MMO project and delivering what we promised to the community?

Github Project


texts: Available Small Open Source Game Engines for tutorial

texts:
I'm learning to create a game engine from scratch in XNA. I'm seeking examples of very small game engines, specifically the architecture and structure of source files, etc. It should include a scripting engine. Articles are also appreciated.

More specifically, I have a problem knowing how to connect the scripting engine to the rest of the game engine, like loading a models from the script.


texts: Using Quaternions to rotate a player towards a point

texts:
I am attempting to solve a problem involving Quaternions and 3D rotation.

I am using a games engine (Torque 3D) for a project that I am developing. I have modified the gravity system so that the player is pulled in three dimensions towards a central point (the center of a spherical world).

I would like the player to also turn so that their feet are facing this central point, regardless of their position or initial orientation. I want the player to be able to stand on the spherical world, and currently, even though they are being pulled to the center of the world correctly, the orientation doesn't change.

The orientation is held in a Quaternion called "mOrient".

I know that the solution will involve rotation matrices, and probably world/local space translations, but I am not sure how to put all this together.

I am currently attempting this, unsuccessfully:
Assume (0,0,0) is the center point, getPosition() is the position of the player.
mOrient is the players 3D rotation quaternion, this is what I need to change.

  Point3F gravityvec = Point3F(0, 0, 0) - getPosition();
  gravityvec.normalize();

  QuatF q = QuatF(gravityvec);

  mOrient = q;

Does anyone have a solution for this?

I'm programming in C++ inside a games engine, but Pseudocode would be fine, I just need some assistance with the mathematical side.


texts: Since Table.drawDebug is deprecated in libGDX, what should I use instead?

texts:
I am following the "Learning LibGDX Game Development" book to make a simple game. I am in the menu creation section where we create a stage and render it with debug borders.

The book says to use Table.drawDebug(stage) but this static method seems to have been removed from the frameworks Table class entirely.

I am importing com.badlogic.gdx.scenes.scene2d.ui.Table; below is my code:

@Override
public void render(float deltaTime) {
    Gdx.gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    if (debugEnabled) {
        debugRebuildStage -= deltaTime;
        if (debugRebuildStage <= 0) {
            debugRebuildStage = DEBUG_REBUILD_INTERVAL;
            rebuildStage();
        }
    }
    stage.act(deltaTime);
    stage.draw();

    Table.drawDebug(stage);
}

The last line, Table.drawDebug(stage); has the compilation error "The method drawDebug(ShapeRenderer) in the type Table is not applicable for the arguments (Stage)"

Is there a new way to draw the stage in debug mode?


texts:
I have a problem through out my current code where certain Texture2D's are not drawing correctly over each other.

For example, at the start I have sprite font being drawn over a background image and half the text is not shown when I add the image.

        _sb.Draw(_background, new Rectangle(0, 0, 800, 480), Color.White);
        if (isPaused)
            _sb.DrawString(_bigFont, "Resume", new Vector2(295, 200), Color.Black);
        else
        _sb.DrawString(_bigFont, "Start", new Vector2(315, 200), Color.Black);

The text then seems to appear if I change the value of other text on the screen.

Is there something I am missing here?

Thanks.


texts:
Ok to be specific, both of my enemies will continuously play their attack animation even when it is false. I don't understand what I am doing wrong here :(

void OnTriggerEnter2D(Collider2D other){
    //If attack collider is player and we're not attacking
    if (other.name == "Player" && !attacking) {
        attacking = true;
        attackTimer = attackCD;
    }
    if (attacking)
    {
        if (attackTimer > 0)
        {
            Debug.Log ("Decreasing");
            attackTimer -= Time.deltaTime;
        }else if (attackTimer == 0)
          {
            attacking = false;
            Debug.Log ("Done attacking!");
            //attackTimer = attackCD;
          }
    }
}

anim.SetBool ("Attack", attacking);//This sets the animation but it is in my Update function not my OnTriggerEnter2D function


texts: Prefab not working when I import maps form Tiled using Tiled2Unity

texts:
I have correctly created the map using Tiled with no errors or warnings, then i imported the package from tiled2unity, imported the map then waited few seconds and the prefab from tiled2unity appears only after some minutes but not working.
the tiled to unity package imported

The error
the map

Basically i dont see the tiled map in unity after it's imported.


texts: How does Unity know where the character is facing?

texts:
I just learned Quaternion.LookRotation and it's used for rotating an object.
I used it to face my character in the direction where it's moving, but I couldn't understand: how does Unity know which side of my character is the face?
I mean I don't specify front of my character but Unity knows.


texts: movement control with the 2D driving game

texts:
I am working on a 2D driving game.I have a button(forward).I need to move the vehicle by pressing on the button.
When the button is pressed the vehicle should accelerate upto its maximum speed and when the button is release  the vehicle should gradually slow down.

float rotateSpeed=0.1f;
float speedForce = 15f;
float torqueForce = -200f;
float driftFactorSticky = 0.9f;
float driftFactorSlippy = 1;
float maxStickyVelocity = 2.5f;
float minSlippyVelocity = 1.5f;

bool moveForward=false;
bool moveBackward=false;
bool turnLeft=false;
bool turnRight=false;

Vector3 myRot;
void FixedUpdate () {
    Rigidbody2D rb = GetComponent<Rigidbody2D>();
    float driftFactor = driftFactorSticky;
    if(RightVelocity().magnitude > maxStickyVelocity) {
        driftFactor = driftFactorSlippy;
    }
    rb.velocity = ForwardVelocity() + RightVelocity()*driftFactor;

    //Move rover forward and backward
    if(Input.GetKey(KeyCode.UpArrow) || moveForward==true ||  Input.GetButton("Accelerate") ) {
        Debug.Log ("Uparrow....................................................");
        rb.AddForce( transform.up * 0.3f);

    }
    if(Input.GetKey(KeyCode.DownArrow) || moveBackward==true || Input.GetButton("Brakes")  ) {
        Debug.Log ("break....................................................");

        rb.AddForce( transform.up * -speedForce/30f );

    }
    float tf = Mathf.Lerp (0, torqueForce, rb.velocity.magnitude / 2);
    rb.angularVelocity = Input.GetAxis ("Horizontal") * tf;

    if (Input.GetKey (KeyCode.RightArrow) || turnRight==true) {

        transform.Rotate(0,0,-0.5f);
    }
    if (Input.GetKey (KeyCode.LeftArrow) || turnLeft==true) {
        transform.Rotate(0,0,0.5f);

    }

}

Vector2 ForwardVelocity() {
    return transform.up * Vector2.Dot( GetComponent<Rigidbody2D>().velocity, transform.up );
}

Vector2 RightVelocity() {
    return transform.right * Vector2.Dot( GetComponent<Rigidbody2D>().velocity, transform.right );
}

this is working fine but the problem is that when I release the forward button the speed of vehicle is not getting slow down.

Can anybody help me please


texts: In Corona SDK, how do you extract the x1, y1, x2, and y2 coordinates from a line display object?

texts:
I used this command to create a line:

local myLine = display.newLine( 0,-110, 27,-35 )

How can I get the coordinates from myLine? I've looked here and here but the closest thing I could find is myLine.x and myLine.y, which appear to be x1 and y1 (not sure), but I can't figure out how to get x2 and y2.

I want this information in order to detect if two lines intersect on the screen.


texts: How do I set angular velocity/torque so that it's pointing to velocity/direction?

texts:
Right now, when I spawn a shootable object, it goes like this:

Because I just set it's angle to this:

float aimAngle = (float) Math.atan2(velocity.y, velocity.x);
bullet.setBodyAngle(aimAngle);

I want it to be like this:

I think I should use angular velocity or torque, but I have no idea how. I can't just set it's angle like in previous code every frame, because it makes physics collisions glitch.


texts: how to transform the position of an object

texts:
I am trying to transform the position of an object. I have totally 3 Objects and 2 triggers, objects are 1. Left_Wall, 2. Right_Wall, 3. Obstacles. 1st trigger for transform the position of an objects y = -50, 2nd trigger for transform the position of an objects y = -7. Left wall and Right Wall are placed inside the environment. the environment will instantiate automatically for looping. if the player crossed the first environment previous environment will delete automatically. at that time in second clone environment if the player triggered means it will display a message as

  MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
  Your script should either check if it is null or you should not destroy the object.

In first Clone environment its working perfectly. second clone environment its not working.


texts: DirectXTK: SpriteBatch::Begin and Draw methods give LNK2019: unresolved external

texts:
Right now, im using DirectXTK (version 2020.2.24.4) and Visual Studio 2019.

My declarations look like this:

    std::unique_ptr<SpriteFont> m_font;
    std::unique_ptr<SpriteBatch> m_spriteBatch;

and my code look like this:

    m_font = std::make_unique<SpriteFont>(m_device.Get(), L"myfile.spritefont");
    m_spriteBatch = std::make_unique<SpriteBatch>(m_deviceContext.Get());

    m_fontPos.x = 1080 / 2.f;
    m_fontPos.y = 720 / 2.f;

    const wchar_t* output = L"Hello World";
    DirectX::SimpleMath::Vector2 origin = m_font->MeasureString(output) / 2.f;

    m_spriteBatch.get()->Begin();
    m_font.get()->DrawString(m_spriteBatch.get(), output, m_fontPos);
    m_spriteBatch.get()->End();

The functions SpriteBatch::Begin(), SpriteBatch::Draw() and SpriteFont::MeasureString() give me a LNK2019 error.

I found this thread DirectXTK: Only SpriteBatch::Begin and Draw methods give LNK2019: unresolved external. But the answer didnt solve my errors

Thanks in advance!


texts: How do I make a rope from point A to B in Box2D?

texts: I need to make a rope (preferably not elastic) from one point to the next in Box2D. If it helps, I'm trying to develop one of those 2D Spiderman games, like this: http://www.gamesbutler.com/game/4327/Hanger/


texts:
I'm trying to create a staggered isometric map in Javascript.

    var x, y, row, column, top, left,
        width = window.innerWidth, height = window.innerHeight,
        tile = {width: 64, height: 32};

    row = Math.ceil(width / tile.width); // how many rows will be in map
    column = Math.ceil(height / tile.height); // how many columns will be in map

    for (x=0 ; x<row ; x++){
        for (y=0 ; y<column ; y++){
            top = y * tile.height - (y % 2 == 0 ? 0 : tile.height / 2);
            left = x * tile.width - (y % 2 == 0 ? 0 : tile.width / 2);

            $('<div />').addClass('tile').css({
                width: tile.width,
                height: tile.height,
                top: top,
                left: left
            }).appendTo('body');
        }
    }

My formula doesn't work for vertical axis. It creates something like this.
http://postimage.org/image/ekfnlbgoh/

How can I make it work? I need it to be something like this.
http://legendofmazzeroth.wikidot.com/staggered-isometric-maps

Here is the latest code:

    row = Math.ceil(height / (tile.height / 2));
    column = Math.ceil(width / tile.width);

    for (y=0 ; y<=row ; y++){
        for (x=0 ; x<=column ; x++){
            top = y * (tile.height / 2) - (tile.height / 2);
            left = x * tile.width - (y % 2 == 0 ? 0 : tile.width / 2) - (tile.height / 2);

            $('<div />').addClass('tile').css({
                width: tile.width,
                height: tile.height,
                top: top,
                left: left
            }).appendTo('body');
        }
    }

By the way, thanks to you that column/row mistake has been fixed.


texts: Would I need to develop a multi-threaded game or will a single thread suffice?

texts:
So I've been playing around and developing in C++ for a couple years now and have built a very simple C++ game engine for learning purposes. I now want to try and develop a simple 2d, stick figure fighting game for the windows platform. Up until now I have only been focusing on single core development (to keep things simple while learning). I would like to try and develop a game from start to finish and maybe try and release it on some version of a steam website. I know I always learn more when setting higher goals and trying to create a project from start to finish. I will be utilizing some third party libraries such as SDL (or some equivalent) but want main control over engine systems and overall architecture.

Since my game will be a simple 2D fighter on a specific platform (windows) with a goal of 30+ fps is it necessary to try and multi-thread some tasks? Would I be able to accomplish everything I would need to by utilizing just one core? I ask because I know multi-threaded programming is a huge topic and I would have to spend a lot of time researching and learning before actually developing anything substantial.

Edit: This topic is not related to the above duplicate since I'm not asking where I should look for multi-threaded resources, but if I should even consider multi-threading in the first place for my simple game. Want a basic idea of how much can be done with a single core game.


texts:
We're building an AR-enabled app with Vuforia and Unity 2019.3, using the Universal Render Pipeline.
Trouble is, on iOS our models that have normal maps in their materials look totally bad, as you can see.
This is how it's supposed to look: (ignore the differences in the orange background item)

If we remove the normal maps, the models look fine, but since the normal maps add a lot of detail and depth to the scene, we'd rather not ditch them.
We've tried to change the import settings of the normal maps, changing the compression formats and such, but that didn't make a difference.

Here's an image of the material settings:

Is there another solution to fix this?

On Android, there's no problem, by the way.


texts: Taking Physics into account for AI Planning

texts:
What I've seen in most Game Engines and game engine design is that the Physics Engine is the be all end all system.

Basically, AI for example may want to travel to some position, but it simply sends that request (velocity, direction) to the Physics Engine.  If the AI really gets to that position is up to the will of the Physics Engine.

Is there some Design or Physics Engine which will let you plan out how Physics will react? Before it will actually occur?

Take for example that you can do Motion Planning by the AI to nearly eliminate foot sliding.

images from aigamedev.com - Motion Planning for Fun and Profit!


texts: Interesting and simple missions for text-based game

texts:
Can you give me an idea for a simple and interesting mission for online text-based game that doesn't require much reading? Or maybe link to a website with a list with missions?

I love programming, but I hate when it comes to create things like this, because I am not creative at all.

Thank you.


texts: 3D Camera Rotation (Unwanted Roll) - Space/Flight Cam

texts:
I am working on a camera class that will have full range of motion (pitch, yaw, and roll).  When only altering pitch and yaw, I am getting a large amount of roll.

I understand that the issue is related to:
I'm rotating an object on two axes, so why does it keep twisting around the third axis?
However, I have not been able to come up with a solution.  I would like the camera to have all motion (i.e. like a spaceship).  Here is the relevant code:
void Camera3D::update(const glm::vec2 & current_mouse_coords){

    if (m_mouse_first_movement) {
        if (current_mouse_coords.x != 0 || current_mouse_coords.y != 0) {
            m_mouse_first_movement = false;
        }
    } else {
        const glm::vec2 mouse_delta = (current_mouse_coords - m_old_mouse_coords) * mouse_sensitivity;
        pitch(-mouse_delta.y);
        yaw(-mouse_delta.x);
    }
    m_old_mouse_coords = current_mouse_coords;
}

void Camera3D::pitch(const float angle){

    // Pitch Rotation
    const glm::quat pitch_quaternion = glm::angleAxis(-angle, m_camera_right);

    // Update Vectors
    m_camera_up = glm::normalize(glm::rotate(pitch_quaternion, m_camera_up));
    m_camera_forward = glm::normalize(glm::rotate(pitch_quaternion, m_camera_forward));
}

void Camera3D::yaw(const float angle){

    // Yaw Rotation
    const glm::quat yaw_quaternion = glm::angleAxis(angle, m_camera_up);

    // Update Vectors
    m_camera_right = glm::normalize(glm::rotate(yaw_quaternion, m_camera_right));
    m_camera_forward = glm::normalize(glm::rotate(yaw_quaternion, m_camera_forward));
}

glm::mat4 Camera3D::get_view_matrix(){
    m_view_matrix = glm::lookAt(
        m_camera_position,
        m_camera_position + m_camera_forward,
        m_camera_up
    );
    return m_view_matrix;
}

I would like the movement of the camera to be based on local coordinates so the controls (up/down/left/right/vertical up/vertical down) move the camera along its own local axis.
Additional clarification based on the comment below:
If I look up 60 degrees and then left, I would like the horizon to stay level (essentially adding roll in the opposite direction to keep the horizon level)
Any help is appreciated.  Thank you!


texts: Unable to create Shader Object for Geometry Shader (GL_GEOMETRY_SHADER)

texts:
I am just starting with OpenGL using c++ on Ubuntu 18.04. The problem I have is that when I try to link Geometry Shader in my main program, the following function call is unable to create an object (and hence returns 0)
GLuint ShaderObj = glCreateShader(ShaderType);

when ShaderType = GL_GEOMETRY_SHADER.
The error log thrown is: "Error creating shader type 36313".
Here, 36313 is the enum value for GL_GEOMETRY_SHADER.
NOTE: My program runs successfully (with a differing functionality) when I remove the geometry shader, while keeping the fragment & vertex shaders intact.
The following is the source code for my geometry shader:
#version 130

layout (triangles) in;
layout (triangle_strip, max_vertices = 4) out;

void main() {
    gl_Position = gl_in[0].gl_Position;
    EmitVertex();
    gl_Position = gl_in[1].gl_Position;
    EmitVertex();
    gl_Position = gl_in[2].gl_Position;
    EmitVertex();
    EndPrimitive();
}

The flow of the main code is as follows:
During CompileShaders(), the code calls AddShader(ShaderProgram, gs.c_str(), GL_GEOMETRY_SHADER). The following are the first few lines in this function.
static void AddShader(GLuint ShaderProgram, const char* pShaderText, GLenum ShaderType) {
    GLuint ShaderObj = glCreateShader(ShaderType);
    if (ShaderObj == 0) {
        fprintf(stderr, "Error creating shader type %d\n", ShaderType);
        exit(0);
    }
...
}

Here glCreateShader() returns 0 which is why in the following if condition an error is thrown as mentioned previously.
The following are the version details of my setup.
    GLX version: 1.4
        Max core profile version: 4.6
        Max compat profile version: 3.0
        Max GLES1 profile version: 1.1
        Max GLES[23] profile version: 3.1
    OpenGL core profile version string: 4.6 (Core Profile) Mesa 20.0.8
    OpenGL core profile shading language version string: 4.60
    OpenGL version string: 3.0 Mesa 20.0.8
    OpenGL shading language version string: 1.30
    OpenGL ES profile version string: OpenGL ES 3.1 Mesa 20.0.8
    OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10

The following is my hardware information.
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 5500 (rev 09)
    Subsystem: Dell HD Graphics 5500
    Kernel driver in use: i915
    Kernel modules: i915
--
08:00.0 3D controller: NVIDIA Corporation GF117M [GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M] (rev a1)
    Subsystem: Dell GeForce 820M
    Kernel driver in use: nouveau
    Kernel modules: nvidiafb, nouveau

I think this might be some version error. But I am not sure. I would be really, really grateful if someone could help me out with this.


texts: Unity Physics collision metrix doesn't work on ParticleCollisions

texts:
I have this Physics collision metrix(1).
I have Player layer on the ship and PlayerShells on Particles whitch's my shooting.
The problem:
When I shoot, OnParticleCollision on my shells collides with player, but as you can see on the picture it shouldn't happen.
Proofing my theory, I testet it: (2) and (3) screenshoots;
My "collision" code:
private void OnParticleCollision(GameObject other)
        {
            SetDamage(other.GetComponent<ISetDamage>());

            //Creating hit effect
            _mainParticles.GetCollisionEvents(other, _collEvent);
            Vector3 pos = _collEvent[0].intersection;   //hit posotion
            Quaternion newRot =
               Quaternion.Euler(transform.rotation.x, -transform.rotation.y, transform.rotation.z);
               //Tryed to rotate effect like opposite from bullet, but it doesn't work for now

            switch (other.GetComponent<Stats>().GetMatter)
            {
                case Matter.Steel:
                    Instantiate(_hitSteel, pos, newRot);
                    break;
                case Matter.Wood:
                    Instantiate(_hitWood, pos, newRot);
                    break;
                case Matter.Flesh:
                    Instantiate(_hitFlesh, pos, newRot);
                    break;
                case Matter.Dirt:
                    Instantiate(_hitDirt, pos, newRot);
                    break;
                case Matter.Stone:
                    Instantiate(_hitStone, pos, newRot);
                    break;
            }
        }

What am I doing wrong?? :(


texts: Android "Activities" --- one or many for games?

texts:
I've been learning Android in my spare time, and one of the first things every tutorial/guide will introduce to you is the concept of an "Activity."  Everyone loosely defines an Activity as a screen for doing a certain activity.

My question is, how relevant/important is it to have multiple Activities for a game?  Are there any guidelines for breaking a game down into multiple Activities?  To explain what I mean, let's take a game like Final Fantasy.

In Final Fantasy, you have several different screens that get used over and over and over again:

The world/dungeon map
The battle screen
The equip/skills/items menus

Would each of those be an Activity that you swap back and forth between, or would you redraw the screen within one Activity?

Let's say it is all just one "game" Activity --- this raises other questions, such as, what about a splash screen before the game starts that shows your company logo/name and plays a sound?  Should that be considered part of the game Activity, or should it be it's own Activity?


texts: 'Text' does not contain a definition for 'text'

texts:
Not sure why '.text' is not in the Text class. The line with the comment next to it is the compile error.

using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Security.Cryptography.X509Certificates;
using UnityEngine;
using UnityEngine.UI;

using Debug = UnityEngine.Debug;

public class TextTrigger : MonoBehaviour
{
    int n;
    public Text myText;
    public void triggerText()
    {
        n++;
        myText.text = "Button clicked " + n + " times"; //<- Error on this line
    }
}


texts: How to check if a custom Control is focused?

texts:
So I am building custom UI for my MonoGame project. I've gotten pretty far already, having created Controls such as:

Button
Panel
TextBox
Form
ComboBox
CheckBox
etc.

All of these controls obviously inherit from my abstract class Control.

This is how I check for Click on a Control:

if (Destination.Intersects(inputManager.MouseRect) && inputManager.IsMouseClicked(MouseButton.Left)) {
    Click?.Invoke(this, EventArgs.Empty);
    _focused = true;
}
else if (!Destination.Intersects(inputManager.MouseRect) && inputManager.IsMouseClicked(MouseButton.Left)) {
    _focused = false;
}

This method has gotten me pretty far already, but unfortunately it doesn't work when there are multiple TextBoxes: each TextBox I click on will become focused, and any key I press will be typed in every focused TextBox.

Here is how I hacked around this:

Since all Controls (including TextBoxes) the user sees are placed in a certain Panel, they are in that panel's array of Controls.
I added a Panel _parent to the Control class, thus every control would have a reference to the panel that owns it
Then in the Panel class I added a Control FocusedControl, so that every Panel will have one field for its focused control

So now I'm checking like this:

if (_parent.FocusedControl == this)
    // This specific control is focused

Or like this:

if (_parent.FocusedControl != null)
    // There is a focused Control

if (_parent.FocusedControl == null)
    // No control is focused in this panel

This works.

But the problem is that I am doing these checks in the controls themselves, and not, for example, in the Panel class.

This means each control has a reference to the panel that owns it, and that panel has a list of all the controls. Also the panel's public methods and properties are available to the owned control.

This eliminates encapsulation and is effectively terrible design.

I consider this to be a huge mess and a dirty hack. Is there any other way to make sure that a Panel has only one focused Control at a time?


texts:
I have 3 layers of objects in a game that I am working on. The layers are the "map" layer (Background), "UI" layer (Labels, etc), and the "Object" layer (Movable objects). I am working on a 2-D game, although I'm using 3-d meshes to give shadow effects. I've used sorting layers, but I can't get the objects to render in the correct order. Any ideas what I could be doing wrong?

The UI objects are placed on a world space canvas.

What I'm seeing now:

This is a Scene View, rendered in 3-d

The "Ship" is the only object in the sorting layer "Object" (Object hiding underneath "Guadeloupe" text".

Sorting Layers

Any thoughts how to make this work? I would like to keep the objects where they are, due to shadow reasons, if at all possible. Thanks!


texts: Huge performance difference when using drawImage with IMG vs CANVAS

texts:
I put together a couple of simple tests that render an image to a canvas. One renders from an IMG, while the other renders from an offscreen CANVAS. You can see the code and results here: http://jsperf.com/canvas-rendering/2

In most browsers rendering from an image is much faster than rendering from a canvas, except in Chrome, where the situation is reversed. Can anyone explain the reason for the differences? After all, we are rendering the same pixel data to the same destination.


texts:
I'm starting to build a multiplayer iOS game using UDP. I want the game to be playable over cellular networks, but I can't really find that much information on it. Many people say that it's dependent on your carrier whether or not it will work.

I tried searching but I can't really find much info on this topic. I know carriers must allow UDP because of things like video streaming, but what about custom game protocols? Will UDP work over a cellular network? If anyone has a definitive answer or can point me to some resources that'd be great


texts:
I want to simulate a fire in a flat and non flat* surface (fire spread modelling).

I've seen that cellular automata is one of the algorithms that can be used. Are there other algorithms that would be interesting to test?

*adding some barriers like walls


texts: How do I ground my character using capsule colliders?

texts:
I have a problem checking if my character is grounded, and it is tied to the position of the capsule collider. I just started using Unity, so I'm not sure what I did wrong. The problem is that the Physics.SphereCast returns false, like it didn't hit anything.

When I start with the default CapsuleCollider, it seems to work, but my character floats in the air. I only have to lift it's y-position by 0.1, and it stops working. This is demonstrated, in the below image, but you can see this in more detail Here.

Here is the code showing how I detect if I'm grounded. Keep in mind that I'm working with a RigidBody, and not a CharacterController.

  bool IsGrounded()
  {
    Vector3 p1 = transform.position;
    float distanceToObstacle = 0;
    RaycastHit hit;
    Collider collider = GetComponent<Collider>();

    // Cast a sphere wrapping "controller" 0.1 meter down to check if it hits anything
    if (Physics.SphereCast(p1,  collider.bounds.size.x / 2, new Vector3(0,-10,0), out hit))
    {
      distanceToObstacle = hit.distance;
      if (distanceToObstacle < 0.1f)
      {
        return true;
      }
      else
      {
        return false;
      }
    }
    else
    {
      return false;
    }
  }


texts: Manually invoke key callback in (free)glut

texts:
I have to watch the keyboard during rendering.
So, is there a way to force glut to invoke the Keyboard callback immediately?


texts: How to select coordinate position within uv texture in a shader - Unity

texts:
first of all I'm sorry for asking noob-ish question. This is my fifth day trying to make a shader in Unity.

I'm trying to select an area within my UV image as shown below

and here's how it looks like on the mesh

Basically I'm only selecting the red from the UV and apply it to the mesh. I encountered no problem when trying to select from the RGB, but when i try to use the XYZ for the coordinate position, it turns out that the value of x and r is the same, so is y and g, and z and b.

My question is, how to select by the coordinate position in the UV texture?

Thanks.

here's my code :

    Shader "Custom/ASK RGB" {
    Properties {
        _tex ("Tex", 2D) = "white" {}
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Lambert

        sampler2D _tex;

        struct Input {
            float2 uv2_tex : TEXCOORD1;
            float4 pos : TEXCOORD1;
        };

        void surf (Input IN, inout SurfaceOutput o) {
            // my variable used to store the UV texture mentioned
            half4 tex = tex2D (_tex, IN.uv2_tex.xy);

            // my attempt to use position which doesn't work
            half4 texPos = half4(IN.pos);

            half4 tryUV = tex2D(_tex, IN.uv2_tex.xy);

            tex.a = 1 - tex.b - tex.r - tex.g;

            tryUV.a = tex.r;

            o.Albedo = tryUV.rgb * tryUV.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}


texts: The importance of WebGL in the future of game development

texts:
I've recently stumbled upon some pretty impressive Babylon.js and PlayCanvas demos.

Babylon.js example
PlayCanvas example

As a reminder: these frameworks allow 3D rendering in any (up to date) web browser, using the WebGL library.

Along with node.js and Socket.io, those 3D engines make it possible to release real-time multiplayer 3D games.

For sure, such games will never compare to AAA titles running in more native environnments.
But a part of today's video game industry is leaning towards more simple, accessible games. Think about strategy games or (MMO)RPGs for example (or anything that doesn't require very low latency and high reactivity, like FPS do). Those Javascript libraries could do a pretty good job at it.

In addition, they make it easy to create multiplatform games, since any modern device with a web browser can run your game.

Another advantage is the "one click" accessibility (i.e. someone sends you an url -> you click on it -> you're playing the game), which can be a crucial advantage to spread your game.

I've seen some Unity games which could have been made in WebGL with only little drop in performances and visual quality (though I may be wrong here). And they could have benefited a lot from being playable in web browsers.

I'm actually surprised that we haven't already heard of some massively played 3D Web game. Why is it so? Do you think it will change in the future?

Even if one wants to argue that web-games aren't mature enough for 3D, then what about 2D? So many people are using engines such as Unity or Unreal 4 for relatively "simple" 2D games, while they could have made something totally similar with today's javascript, and potentially reached a wider audience.


texts: As an indie developer, what should I learn about the business end of game development?

texts: I assume I should look into intellectual property law, copyright law, and money management, but what else would be good to know? My ideal goal is to be able to handle all legal/monetary business internally, without hiring an outside lawyer.


texts: Game Maker 8.0 - Can a local instance's parent object type be changed?

texts:
I have an object I am adding in dynamically. The object type is a generic object that has two strings that are executed in the step and draw events using execute_string(string);. I find this to be better and more stable than the built-in resource modification functions.

Is there a way to change a local instance's parent object type? I wish to change its type so that it becomes a wall. There will be no conflict in terms of events. I've been reading through the Game Maker 8.0 documentation for some time and haven't been able to find confirmation one way or the other.

It would be greatly appreciated if anyone could solve this issue for me. It would make it far easier for me to deal with my issue.


texts: How does the GPU know how to form triangles for a given mesh?

texts: I have just begun learning shader programing. What I learned is that the rasteriser groups three vertices to form a triangle for doing further operations. If that's true how does the rasteriser determines appropriate vertices which form a triangle in the mesh/geometry?  Is it the 3D software which saves geometry in the proper order in model file like .3ds or .obj, .x or is it the GPU which internally triangulates the geometry irrespective of the order the vertices are passed?


texts: Playing a sprite sheet animation in Cocos2D-x

texts:
I'm trying to create an animation using a sprite sheet in Cocos2D-x. I'm doing the following. The game doesn't crash but the screen is still blank.

bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }

    auto cacher = SpriteFrameCache::getInstance();
    cacher->addSpriteFramesWithFile("BatmanRun-hd.plist");

    Sprite* someSprite = Sprite::create();

    // load all the animation frames into an array
    Vector<SpriteFrame*> frames;
    for (int i = 2; i <= 10; i++)
    {
        stringstream ss;
        ss << "run_" << i << ".png";
        frames.pushBack(cacher->getSpriteFrameByName(ss.str()));
    }

    // play the animation
    Animation* anim = Animation::createWithSpriteFrames(frames, 0.05f);
    someSprite->runAction(Animate::create(anim));
    someSprite->setPosition(100, 100);

    this->addChild(someSprite);

    return true;
}

Is there something I'm missing?
Thanks.


texts:
I have a cave that is inside a mountain (one mesh) that I created in Blender.  I would like to make the cave quite dark inside so that either the player can light it up, or it is lit up with things such as crystals.  Because I have ambient light through the scene, it's proven to be quite awkward to make it dark, and removing the ambient light kinda destroys the look.

I then played around with having a separate material for inside the cave so that I can make it darker, which kinda worked, but then I noticed a big issue with shadows.

The following images is from inside the cave far from the entrance.

The first image is with the default settings for shadow distance (in this case it was 70 in the quality settings).  As you can see in the image, the shadow doesn't fill the cave because of the distance.

Second image is with the shadow distance turned up to make sure the cave is in darkness (not pitch black though, due to ambient lighting), this took the setting from 70 to around 500.

The problem with setting the distance so high, is that it causes artifacts on geometry outside the cave, which look nasty.

What's the best way to make a cave dark (doesn't need to be pitch black) without removing ambient lighting for the whole scene?

I was looking at similar art styles to what I am working on, and Grow Home (Unity) is basically where I am heading.  They have caves which would be acceptable for what I need, but am not sure how they done it.  As far as I know, they have dynamic lighting, as I believe there is a day / night cycle, so I don't think anything is baked.


texts: Box2d/Farseer how to use the World object?

texts:
this question is primarily about farseer but as it is a wrapper around box2d i think it's relevant for both libraries.

I'm in the beginning of developing a simple platform game, and I'm stuck as to how i should use the World object in relation to my "levels". Should I create a new world for each level and load all the contents of my level into this new world. Or should I remove all objects from my world and load in the new contents of the new level?

Any help or suggestions are greatly appreciated.


texts: who turn a moving agent to the specific coordinate

texts: i have a moving agent in gis map that is going to the special Coordinate . with assumption that maximum angel of rotation is predefined, i want the agent turn into specified coordinate (in moving) and then go to that location, what i do for this work please help me.


texts: Calculating other objects based on the transform of another

texts:
What I want to do is create my graphics to be independent of the game framework. So basically the graphics won't know anything until it is told where things are. so the thought was that every GameObject would hold its own transform like here, but then I would also want to calculate the camera, and say a directional light based on these as well.

My thought was to in an update method:

receive a container of objects,
step through them to get the needed data to be rendered (full transform matrix, and enums resulting in model to be rendered, and texture/material to be applied)

3.0 put that data into something like a stack.
3.1. when the player object is found calculate the position of the camera behind/above the player at a determined downward angle, and a directional light in front of the player at the same orientation.

4.in the render method pop the information off the stack to be rendered to the screen.
5.possibly using the frustum of the camera to ignore some objects (can be overlooked)

I have gotten steps 1, 3.0 and 4 completely working, step 2 I can get the enums out, but I still don't know how to apply the transform matrix to be usable (answers to above link would be greatly appreciated), and then 3.1 is a total mystery to me. as stated 5 would be nice, but can be overlooked if not possible (formatting edit requested)


texts: Replace black color by transparent color XNA

texts:
I'm actually trying to replace black color of my texture by a transparent one.

How can I do to remove the black pixels, should I use a AlphaTestEffect, or can I use the BasicEffect?

Thank you.


texts: Generating 'Specially' shaped rooms for a Dungeon

texts:
I've made a fairly simple dungeon generator but now I want to expand on it so that I can procedurally generate a dungeon with irregular shaped rooms. I don't just want any old crazy shapes popping up though, I want to be able to have room types that follow a certain pattern but ultimately have random sizes. I just don't have a clue how to generate rooms that aren't just square.

I have an idea of how to merge squares together to make rooms comprised of other rooms, but I'm more interested in how to get hexagon and octagon shaped rooms, or doughnut-like rooms.
My code for generating square rooms is:

    public static char[,] GetSquareRoom(int width, int height)
    {
        char[,] roomLayout_Square;

        roomLayout_Square = new char[width, height];

        for (int x = 0; x < roomLayout_Square.GetLength(0); x++)
            for (int y = 0; y < roomLayout_Square.GetLength(1); y++)
                if (x == 0 || y == 0 || x == width - 1 || y == height - 1)
                    roomLayout_Square[x, y] = '#';
                else
                    roomLayout_Square[x, y] = '.';

        return roomLayout_Square;
    }

I would like to create more functions like this that will accept a few variables so I can create specific variations of these room-types, so I can input specific number and randomly generated values alike.

:)


texts: How can i instantiate empty gameobject to be position to existing already gameobject?

texts:
When i click on keyboards for example dfrg i want that if i click on space it will add empty gameobject right after the letter g like a space for example: drg hello So there is a space after the letter g and before the hello I want that the empty gameobject will be like space. So if i click space it should be always position after the clone. But not sure how to do it.
The problem is that i instantiate the clone object after if i click on space key. And i also want the space to work for both side/cases if i first click on space before i clicked and did any clones it should be for example: dfrg There are many spaces before the dfrg

using System.Collections;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
 using UnityEngine;

 public class Test : MonoBehaviour
 {
     public GameObject[] prefabs;
     public int gap = 50;
     public int offset = 0;

     private GameObject go;

     void Start()
     {
         prefabs = Resources.LoadAll("Prefabs", typeof(GameObject)).Cast<GameObject>().ToArray();

         foreach (GameObject prefab in prefabs)
         {
             if (prefab.name == "testing")
             {
                 go = prefab;
             }
         }
     }

     void Update()
     {
         if (Input.anyKey)
         {
             if (Input.GetKey(KeyCode.Space))
             {

             }
             foreach (Transform child in go.transform)
             {
                 if (Input.inputString == child.name)
                 {
                     Transform clone = Instantiate(child);
                     clone.parent = transform;

                     clone.transform.eulerAngles = new Vector3(0, 0, 0);
                     offset += gap;
                     clone.transform.position = new Vector3(-offset, 0, 0);
                 }
             }
         }
     }
 }


texts: How to inspect child nodes in IDE debugger?

texts:
Consider an enemy with this node hierarchy:
* KinematicBody2D (Enemey)
|- Sprite
|- CollisionShape
|- Area2D (StompDetector)
   |- CollisionShape2D

With signal from StompDetector to Enemy:
func _on_StompDetector_body_entered(body: Node) -> void:
    if body.global_position.y < $StompDetector.global_position.y:
        die() ## >> BREAKPOINT <<

That does not work as exepcted. How to inspect $StompDetector from the debugger at BREAKPOINT?


texts: Using Volumes to reveal secret doors in UE4 C++ project

texts:
I'm working on a maze project and I would like to have secret doors. My basic idea is to have the walls be destroyed when the player is both within the bounds of a trigger volume, and presses a button. I know the basic way to implement the code, but my main concern is how to handle the volumes. Should I create a class, maybe called "SecretController" that holds the code that says:

"if player is in box[i] and presses fire, destroy door[i]"

This seems like it would work, but I'd rather know before I go create a ton of stuff I'll just have to delete later. Thanks for the help folks!


texts: How can I create and save prefab at runtime?

texts:
In Unity, how can I save prefab at runtime?

Suppose my Player can "place" object, how could I save them as prefab at runtime (but in debug/editor mode)?


texts:
I am getting started with Box2d in AndEngine.
I need to know if there is any level editor to be used with box2d and gives output capatable with AndEngine.

Is there any tool which can help me building complex body with joints like a bike or car?

What do you suggest which is the best way to do this kind of stuff.


texts: Should I use inheritance or interfaces for an inventory system?

texts:
I'm about to start programmin an inventory, harvest and loot system. I will need enemies that drop items, harvestable environmentals that yield resources and an inventory system that takes items and resources.

Should I solve this with interfaces, class inheritance or both? Why?
Or is it just up to my programming style? I'm more familiar with inheritance, but if interfaces give an advantage I'd use them and get used to it.


texts: Checkerboard like rendering does not save performance

texts:
I have a simple scene in Unity with a camera and a quad facing the camera filling the whole viewrect.
The quad has a material with the following shader:
Shader "Skip"
{
    SubShader
    {
        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
            };

            struct v2f
            {
                float4 vertex : SV_POSITION;
                float4 screenPos : TEXCOORD0;
            };

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.screenPos = ComputeScreenPos(o.vertex);
                return o;
            }

            fixed4 frag(v2f i) : SV_Target
            {
                int2 screenUV = (i.screenPos.xy / i.screenPos.w) *_ScreenParams;
                bool skip = (screenUV.x + screenUV.y) % 2 == 0;
                if (skip) {
                    return fixed4(1,0,0,1);
                }else{
                    fixed4 clr = fixed4(0,0,1,1);
                    for (int i = 0; i < 10000; i++)
                    {
                        clr += i % 2 -0.5;
                    }
                    return clr;
                }
            }
            ENDCG
        }
    }
}

The shader returns simple color for an even pixel and runs an expensive computation for an odd pixel.
There is no performance difference between running the expensive operation on all the pixels and running it on just half the pixels.
bool skip = (screenUV.x + screenUV.y) % 2 == 0; // ~13fps
bool skip = true; // ~2300fps
bool skip = false; // ~13fps

Why is there no improvement in performance?


texts: Can geometry grass shaders be painted to a terrain or are they limited to meshes?

texts: So I was follow the roystan grass shader tutourial and although it works well I don't understand the use for it. From what I understand the shader is basically just a flat plane that calculates grass on top of it. If I wanted to apply this grass to a terrain and place it on uneven ground would I have to manually add in a "grass plane" all over the environment and at different angles or am I missing something? Thanks.


texts:
I am trying to make an animtion for my Sword so that when I click with my left mouse button, the sword gets swung. I watched a tutorial video and tried to follow all the steps but whats happening is that the Sword animtion gets played automatically in a loop

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

public class Sword : MonoBehaviour {

    void Update () {
        if (Input.GetButtonDown("Fire1"))
        {
            GetComponent<Animation>().Play("Attack");
        }
    }
}

I know this isn't much to work with but maybe someone knows what I could have done wrong in the previous steps


texts: Help with Unity global illumination removes cel shaded effect

texts: So I am using this toon shader I got from the asset store that supports global illumination. However it seems like the global illumination destroys the cell shaded effect, and when in shadow it looks no different from the standard shader. Could anyone who is knowledgeable about shaders weigh in on what I could do in this situation? Thanks so much!


texts: Drawing in SFML outside of the main function (passing the window over to other fuctions) doesn't work

texts:
Why does the drawn Sprite only appear in the Window when drawn from the main-function, but not when drawn from an external function and how can I change this?

class Class {
private:
sf::Sprite sprite;

public:
Class()
    {
        sprite = initializeSprite(sprite);
    }
};

void Class::draw(sf::RenderWindow& win)
{
    win.draw(sprite);
}

int main(int argc, char* argv[])
{
    sf::RenderWindow window(sf::VideoMode(1920,1080), "Window");
    Class instance;
    while(window.isOpen())
    {
        window.clear();
        instance.draw(window);
        window.display();
    }

    return 0;
}

-> Doesn't work.

int main(int argc, char* argv[])
{
    sf::RenderWindow window(sf::VideoMode(1920,1080), "Window");
    sf::Sprite sprite;
    sprite = initializeSprite(sprite);
    Class instance;
    while(window.isOpen())
    {
        window.clear();
        window.draw(sprite);
        window.display();
    }

    return 0;
}

->Works.

I'm using SFML-2.4.0. It also doesn't work when i use a pointer instead of a reference. What's wrong here?


texts: How to implement a button when the player is in the trigger

texts:
I have implemented this code and it works but i wanna make this work only if i enter the trigger and press the UI button. Right now it is changing scene automatically so, i want to press the button and then change scene. I know how to do this for PC game but not on Android game. I hope you can give me a hand.

Script

public class ButtonScript : MonoBehaviour {

    //public Button btn;
    private bool door = false;
    public bool hasCollided = false;

    public void Update () {

        if(door == true){
            SceneManager.LoadScene("InventoryScene");
            //SceneManager.LoadScene ("Scene1AToBathW");
            //Application.LoadLevel("Courtyard1F");
            //gameObject.transform.position = new Vector3(x,y,z);
        }

    }

    public void OnTriggerEnter(Collider other){
        if(other.tag == "Player"){
            //btn.gameObject.Setactive(true);
            door = true;
            hasCollided = true;
        }
    }

    public void OnTriggerExit(Collider other){
        if(other.tag == "Player"){
            //btn.gameObject.Setactive(true);
            door = false;
            hasCollided = false;
        }

    }

}


texts:
I'm implementing this map of inputs (from the gamecube title Super Smash Bros. Melee) and translating it into code for my game:

The map is depicted using hardware coordinates (the square shape of the map) while the game itself limits the range of inputs to a circle (depicted by the gray circular outline).  If a hardware input is outside the range of the circular game input, then it is rounded down.  This is what causes the radial patterns.  Each colored section is a different output based on the input.  The gray square in the center is the deadzone of the stick.

The zones "fsmash", "usmash", and "dsmash" were easy to code in.  It was as simple as

if (pos.x > 0.80 || pos.x < -0.80) fsmash
if (pos.y > 0.66) usmash
if (pos.y < -0.66) dsmash

My question is how to incorporate the other 4 zones.  It's simple for "jab" as it is in the deadzone so it will be the else condition (when pos.x && pos.y == 0)
The inputs go out radially which seems to suggest it follows the same patterns as the larger zones.  When inputs are outside of the black circle I have drawn, they could be rounded down then I could simply do..

if (pos.x > 0) ftilt
if (pos.x < 0) jab
if (pos.y > 0) utilt
if (pos.y < 0) dtilt
else jab

However I'm not sure of how I could implement it since the cutoff point for the outer zones was the actual implemented radius of the stick in game.  Any help would be appreciated or ask if I need to clarify anything.  Thanks!


texts:
I want to render reflection on a planar surface but the reflecting surface has a texture mapped onto it.Would the normal technique of using stencil buffer and then blending in the reflected image with the reflecting surface in this case?
If not then could some one suggest me how to render reflection on a surface that has a texture mapped onto it?
Thanks


texts: How do I get the collision position of the gaze input

texts: I'm trying to move a Third-Person character by looking at random objects in the scene using the googleVR Rectile, what I had in mind is lerping the character to the collision point position. Any Help how to do this ?


texts: How would I implement a level transition when reaching a cave in Raylib?

texts: I am the developer of an upcoming 2d/3dRPG. I have a simple scene setup where there is a bridge over some acid and a cave entrance-like thing that I want to change the level with. I have used C and C++ in the past, and considered state machines, but I actually have no idea how to do this in raylib. plus I heard it's only that good for transitioning from a title to a game or something, not loading levels on collision. also, the acid has to destroy the player.


texts:
I'm going insane trying to work out why I unable to draw a triangle using VAO and indexing. I have a bunch of redundant vertexes so that i can switch my index array up to test the drawing.

std::vector<glm::vec3> vertices;

//bot left
vertices.push_back(glm::vec3(-0.75,0.9,1));     //0
vertices.push_back(glm::vec3(-0.5, 0.9, 1));    //1
vertices.push_back(glm::vec3(-0.25, 0.9, 1));   //2
vertices.push_back(glm::vec3(-0.0, 0.9, 1));    //3
//mid right
vertices.push_back(glm::vec3(0.75, 0, 1));  //4
vertices.push_back(glm::vec3(0.5, 0, 1));   //5
vertices.push_back(glm::vec3(0.25, 0, 1));  //6
vertices.push_back(glm::vec3(0.0, 0, 1));   //7
//top left
vertices.push_back(glm::vec3(-0.75, -0.9, 1));  //8
vertices.push_back(glm::vec3(-0.5, -0.9, 1));   //9
vertices.push_back(glm::vec3(-0.25, -0.9, 1));  //10
vertices.push_back(glm::vec3(-0.0, -0.9, -1));  //11

The indices are simple:

 GLuint indices[] = {0,5,11};

Here is how I am initialising everything:

glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
glGenBuffers(1, &vbo);
glGenBuffers(1, &ivbo);

glBindBuffer(GL_ARRAY_BUFFER, vbo);

glBufferData(GL_ARRAY_BUFFER, sizeof(vertices),
    &vertices[0], GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE,sizeof(glm::vec3), (void*)0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ivbo);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);

I am rendering with:

glUseProgram(program);

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(1.0, 0.0, 0.0, 1.0);//clear red

glBindVertexArray(vao);
glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, (void*)0);

glutSwapBuffers();

Vertex shader is simple as they come:

#version 430 core
layout(location = 0) in vec3 in_position;

void main(void)
{
   gl_Position = vec4(in_position, 1);
}

Same with the fragment shader

#version 430 core
out vec4 color;

void main(void)
{
  color = vec4(0.0, 1.0, 0.0, 1.0);
}

EDIT: Switching the z coordinate in the vertices to a negative value fixes the problem. What is going on?


texts: How to create loading bar for asset bundles on Unity (without changing scene)?

texts:
So from the official documentation and unity forum now I know that there's async version of LoadFromFile (that I also will probably call UnityWebRequest.GetAssetBundle later for updated asset). Now the problem is where can I call it, and how to get the .progress value, converting from this:

public AssetManager()
{
    if (!useAssetBundle) return;
    foreach (var bundle_name in bundle_names)
    {
        var full_path = Path.Combine(Application.streamingAssetsPath + "/Bundle/", bundle_name);
        var bundle = AssetBundle.LoadFromFile(full_path);
        if (bundle == null) LogHelper.Critical("Failed to load AssetBundle {0}", full_path);
        bundles[bundle_name] = bundle;
    }
}

To this (that obviously wrong):

private List<AssetBundleCreateRequest> loadPro = new List<AssetBundleCreateRequest>();

private IEnumerator<AssetBundle> _loadOneAssetBundle(string full_path)
{
    var creq = AssetBundle.LoadFromFileAsync(full_path);
    loadPro.Add(creq);
    yield return creq.assetBundle;
}

public AssetManager(MonoBehaviour parent)
{
    if (!useAssetBundle) return;
    foreach (var bundle_name in bundle_names)
    {
        var full_path = Path.Combine(Application.streamingAssetsPath + "/Bundle/", bundle_name);
        var bundle = parent.StartCoroutine(_loadOneAssetBundle(full_path)).assetBundle; // NOPE T_T)
        if (bundle == null) LogHelper.Critical("Failed to load AssetBundle {0}", full_path);
        bundles[bundle_name] = bundle; // NOPE 'n')
    }
}

public void Update()
{
    var progress = 0f;
    foreach (var pro in loadPro)
    {
        progress += pro.progress;
    }
    LogHelper.Debug("Progress %f",progress);
}


texts:
I'm developing a simple game for the iphone and am struggling to work out the best way for the camera to follow the main character. The following picture hightlights the three main components:

There are 3 components to this:

Circle - the main character
Green line - terrain
Black background

The terrain is simply made from an array of points (approx 20 points per screen width). The terrain is moved in the x direction relative to the black background in order to keep the circle in its position shown. The distance to move the terrain is simply:

movex = circle.position.x - terrain.position.x

with a constant to fix the circle at some distance from the left of the screen.

I am struggling to determine the best way to position the terrain in the y plane keep the focus in the character. I want to move the terrain in the y direction smoothly and not fix it to the position of the circle, so the circle can move in the y plane.

If I take the same approach as the x positioning, the character is fixed at a point on the screen and the terrain moves. I could sample some terrain points either side of the character and produce an average, but in my implementation this was not smooth. I thought another approach might be to create a camera 'line' that is a smooth version of the terrain line and make the camerea follow this, but I'm not sure if this is the optimum solution. Any advice is much appreciated!


texts: Multiplayer / Networking options for a 2D game with physics

texts:
Summary:

My 50% finished 2D sidescroller with Box2D as physics engine should have multiplayer support in the final version. However, the current code is just a singleplayer game.

What should I do now?
And more important, how should I implement multiplayer and combine it with singleplayer?
Is it a bad idea to code the singleplayer mode separated from multiplayer mode (like Notch did it with Minecraft)?

The performance in singleplayer should be as good as possible (Simulating physics with using a loopback server to implement singleplayer mode would be a problem there)

Full background / questions:

I'm working on a relatively large 2D game project in C++, with physics as a core element of it. (I use Box2D for that)

The finished game should have full multiplayer support, however I made the mistake that I didn't plan the networking part properly and basically worked on a singleplayer game until now.

I thought that multiplayer support could be added to the almost finished singleplayer game in a relatively easy and clear way, but apparently, from what I have read this is wrong.

I even read that a multiplayer game should be programmed as one from the beginning, with the singleplayer mode actually just consisting of hosting an invisible local server and connecting to it via loopback. (I found out that most FPS game engines do it that way, an example would be Source)

So here I am, with my half finished 2D sidescroller game, and I don't really know how to go on.

Simply continueing to work on the singleplayer / client seems useless to me now, as I'd have to recode and refactor even more later.

First, a general question to anybody who possibly found himself in a situation like this:

How should I proceed?

Then, the more specific one - I have been trying to find out how I can approach the networking part for my game:

(Possible solutions:)

Invisible / loopback server for singleplayer

This would have the advantage that there basically is no difference between singleplayer and multiplayer mode. Not much additional code would be needed.

A big disadvantage: Performance and other limitations in singleplayer. There would be two physics simulations running. One for the client and one for the loopback server.

Even if you work around by providing a direct path for the data from the loopback server, through direct communcation by the threads for example, the singleplayer would be limited.

This is a problem because people should be allowed to play around with masses of objects at once.

Separated singleplayer / Multiplayer mode

There would be no server involved in singleplayer mode.

I'm not really sure how this would work. But at least I think that there would be a lot of additional work, because all of the singleplayer features would have to be re-implemented or glued to multiplayer mode.

Multiplayer mode as a module for singleplayer

This is merely a quick thought I had. Multiplayer could consist of a singleplayer game, with an additional networking module loaded and connected to a server, which sends and receives data and updates the singleplayer world.

In the retrospective, I regret not having planned the multiplayer mode earlier. I'm really stuck at this point and I hope that somebody here is able to help me!


texts:
I need to make grid based levels with 3d models for a dungeon crawler ( as a recent example Legend of Grimrock), but i need to have several layers and place entities with properties and position, angle, etc.
I was considering Tiled, using layers as height for each level, but it's very hard to work with and visualize.
What can i use for this pourpose?
The output format needs to be json, xml, or something i can use on my engine.
Ideally i'd want something like Tiled with a 3d visualization/edit mode and support for loading models or at least some visual representation of them.


texts: Basic tutorial/introduction for 3d matrices, idealy in c++, without openGl or directX

texts:
I am wondering if there is a simple tutorial that covers the basics of how to initialize rotation, translation and projection matrices, and how to multiply them, and how to get the screen coordinates afterwards for a 3d point.

Idealy, the tutorial comes with compilable code and is not dependent on any 3rd party library.

Searching the internet, I found lots of tutorials, so this is not the problem. Yet, it seemed all of these either covered openGl or directX, or they were theoretical in nature.


texts:
I concider myself an amateur, but I have quite some experince in Unity3D.

Over the course of the next three years - before I can quit my job and go to colledge - I want to make ONE game.

Now the question that bothers me is which gameengine to choose:

A) Unity3D, because I know it well and the community is great (even though I didn't touch it for a year or so)

B) GoDotEngine, because it's open source, still beeing improved and very lightweight

C) Blender, because Python (though..who really uses blender for games? and I kinda hate blender)

Initially I wanted to go with GoDot, since it is  a lot like Unity and OpenSource, but I fear that the community is to small to help me out, if I get stuck and I really need to finish this, if I want to spend three years on it.


texts: How would you design a transformation matrix to project absolute coordinates to any orthographic projection desired?

texts:
I am attempting to make an RTS based on AoE II HD Edition. I want to have ease of control by designing a transformation matrix given any style of projection I want.
This is a good example of what I mean. So, given each of those three angles, and any absolute x, y, and z, how can I design a transformation matrix to multiply the absolute position by to get the projected position on the screen? I just want full control, and I need to get better at matrices. I am about to graduate High School but I hardly learned anything related to matrices. Only a little in Physics and a little in Algebra II with Trig.

I just need to know how to create the matrix.

Also, after that, how would I convert a projected matrix back to the original position? Dividing it (Although, I know matrices can't divide - I mean multiply by the inverse)? Thanks so much for any help!


texts:
We are developing a scene that will involve heavily interacting with a "touch screen monitor" in the scene.. Because the workflow of the touch screen will need to be dynamic we are creating a REST API that Unity will fetch JSON data and use that to build out the various parts of the UI. For instance, we get a JSON file that has a list of users and attributes and build out UI elements with that data.

The question is should I build out the display and underlying logic as a 2D scene that I add in to our 3D room or just build it all in the 3D scene.

I want to abstract away as much of the logic as I can for the interactive screen; I want to make sure we can drop this screen in a different Scene down the road without too much reverse-engineering.

Sorry if this is a straightforward question, my background is software dev, not game design.


texts:
I am looking to make a php/mysql/javascript based rpg on a site. I am trying to figure out the best method when it comes to items, quests, etc. For instance should I make classes for each item type and then store just the item level etc in the database, thus making a object of the item when the player starts playing. Or to store the full item data in the database and update that as the player plays.

I figured the object one would cause less calls to the database but I then wonder how would I go about this method. That is I know how to make the classes etc, but what would the method be when the player logged in and you needed to get their inventory etc.

Any advice on how to go about this would be nice, any tutorials you know of etc too. Thanks.


texts:
I begin to use Unity 5. I added a terrain and a skybox in my game but there is always reflection of sky on my terrain. As you see in the picture. I added texture to solve the problem. But the reflection of skybox is always there.
Why terrain is too shiny and like mirror in Unity 5?
Am I missing something?

Thanks in advance...


texts: How to translate vertex buffer coordinates in 2D

texts:
I am trying to (using a 2D Directx9 engine library) rotate/translate a set of points in a vertex buffer.

I understand how this would be done in a 3D system - i.e using the vertex shader stage of the rendering pipeline with transformation matricies...

But Im not sure that applies in 2D? (or am I wrong).  I don't know where any of the vertex shader stage happens in 2D? or whether it happens at all.

Basically I can create a transformation matrix using some thing like D3DXMatrixTransformation2D()
and I know how to apply that to an LPD3DXSPRITE object (using Sprite->SetTransform()),  but how can I apply that transformation matrix to a set of 10+ coordinates stored in a vertex Buffer instead of a sprite.

Any help or suggestions would be greatly appreciated.
Thanks


texts: How can I provide a mechanism for users to increase the gameplay speed?

texts:
I am developing a tower-defense game and I want to permit user to change game engine speed ,for example rotation speed of towers,rockets speed ,enemies moving speed ,counters and etc proportionally.
Is it any way to increase/decrease speed of game engine or any other way similar to it?


texts:
I got a simple method of detecting collision between two objects. The next step is to figure out what side of the hitbox was hit so I know whether I need to push the other object back in X or Y axis. I am using 6502 assembly to keep things simple. This means that some modern methods are too slow. Here is some known information about the objects:

object X/Y positions
object A begin above/below and to left/right of object B
object X/Y speeds
hitbox top/left/bottom/right bound distance from object position
the amount of hitbox overlap in X/Y axis

Also there should be a way to detect if a corner is hit so that can be treated differently (eg. when hitting top corner favor pushing object on top of the other object, landing on it, rather than pushing the object aside and falling)


texts: How do I calculate the tangent to a point on a circle?

texts:
I have a line that is from the center of a circle to a point on it's edge that is changing constantly (radius is drawn to a point orbiting a circle)
I want to make a line tangential to the circle whose midpoint is always the orbiting point. I know how to do it on paper but coding it in logic is the problem. Can someone show me how or point me to resources that I could use that would help me?

    public Line calculateTangent(Circle ball){

    //the point orbiting the circle
    circleEdge = new Vector2f((float)(radius*Math.cos(angle*Math.PI/180f)), (float)(radius*Math.sin(angle*Math.PI/180f)));
    //the line that I want to be perpendicular to at all times
    radiusLine = new Line(ball.getCenterX(), ball.getCenterY(), circleEdge.getX(), circleEdge.getY());
    //no idea how to do this last part
    perpendicular =

    }


texts: Cocos 2D putting things on the cocos thread or not?

texts:
We are using Cocos 2D for Android and are unsure if it's a good thing to execute our non-ui tasks on the Cocos thread as a way to get the animations in our game to pause.

What is the recommended practice?


texts: Does Animator.SetBool take precedence over Animator.SetTrigger in Unity's Animator?

texts: I've got an Animator with transitions from Idle to Walk or Dash. Walk requires isGrounded to be true and a float MoveX to be greater than .2. The Dash animation requires Dash trigger is returned. In my code, when the shift key is pressed I call anim.SetTrigger("Dash"), if a Walk key is pressed, I set anim.SetBool("Idle") to false and begin increasing MoveX. The problem I'm noticing is that when I play, and hit the dash button, it first starts walking and then after playing that animation it will then perform the dash animation. Looking in the animator as this is happening, it's clear that the walk animation plays in full before moving to the dash animation. What can I do to give priority to the Dash animation when that button is pressed?


texts: Cost of Unity Local Multiplayer VS Unity Online Multiplayer

texts:
I know that making multiplayer games in Unity costs money because of the servers that are used in connecting the players. So basically its free upto 20 CCU and then it increases as per the CCU. Its true for the online multiplayer games.

But for local multiplayer games(LAN), should it cost the money for using it? Because we converted one of the devices in the local as the server and we don't need their servers. So am I thinking right ?? Or I am going wrong somewhere?

Just wanted to be clear about how to make a local multiplayer and not an online multiplayer.

Also wanted to ask if Photon supports local multiplayer?

Basically I am confused about how to make offline local multiplayer game.