texts: Development decision: how to proceed regarding OpenGL

texts:
There is a 3D app developed by someone with OpenGL almost 2 years ago. The development is not finished by the previous developer and I'm assigned the task to finish it, based on customer requests.

I started the development almost a week ago and I've fixed some OpenGL-related issues and added some features. But, there is something that really bothers me and I just thought I'd need advice.

The voices/noises in my head/mind that bother me:

If we stick to our OpenGL, eventually we will lose the Apple ecosystem, and will consequently lose being cross-platform.
OpenGL is low-level, for a simple thing like detecting user-clicks on 3D objects, I need to spend much development time.
If we get high-level: with Unity engine or Unreal engine, we have no problem with any platform even VR/AR. The development time with these engines appears to be much faster. Even with regard to licensing, they are flexible and provide free ones.
As people say, Unity/Unreal is like buying a car and OpenGL/Metal/D3D is like buying a wheel. Maybe my life as a developer would be much easier if Unreal/Unity engine is used rather than a lower-level tool like OpenGL.

Now, I'm goint to talk to my boss regarding above thoughts. I want to ask him if it makes sense to let OpenGL go and just switch to an engine. But before talking to my boss, I just thought I'd ask here to see if it makes any sense or if I'm missing something.


texts: Multisampled Nearest Filtering in PS 2.0 is it possible?

texts:
My game involves blocky, pixelated 3D textures. When using nearest neighbor filtering with a texture sampler, I get the desired result of nicely pixelated textures -- with the caveat that hard lines between pixels are aliased. Here's a screenshot of what I mean:

See the jaggies?

I'd like to know if I can use some kind of screen-space multisampling to fix these jagged edges. I'm using HLSL and pixel shader 2.0. Is it possible to accomplish this in the shader? (Note that MSAA does not work in this case because the aliasing is in the texture sampler, not in rasterizing geometry).


texts: Unity game crashes when opened on some computers but not all

texts:
I'm facing a weird issue where every time I attempt to run a Unity application, it just crashes with no error message or log being generated. I tried running the game, it works on some computers (3) but fails on most (35). Upon attempting to run the application, I get a box that pops up for a second with a red exclamation point, which then crashes. See screenshot below:

I have found people having similar problems, but no real solution.
https://forum.unity.com/threads/solved-crash-when-running-any-unity-application.599953/
https://forum.unity.com/threads/crash-when-opening-any-unity-application.873133/
My game is made in Unity (v2018.1.9f2). Attaching the error logs for your reference. Unfortunately, I do not have the admin privileges to try the citrix solution in lab computers (since they are controlled by the University office).
Error logs:

https://pastebin.com/mcMaD9im
https://pastebin.com/M0e9a9GG
https://pastebin.com/DSRrU8bZ


texts: Suggest a simple Java math library for matrix operations for use with OpenGL (lwjgl)

texts: I'm writing an OpenGL app with Java. I need to do some math for camera and frustum culling (for AABB). Could you suggest a simple and fast Java math library for that?


texts: How to make camera smooth when following player

texts:
When my character moves through my cameras 'FollowPlayer' script, the background just looks really glitchy and bad Is there anyway to fix this?

This is my script:

using UnityEngine;
using System.Collections;
public class FollowPlayer : MonoBehaviour {
    Transform bar;

    void Start() {
        bar = GameObject.Find("PlayerMovingBar").transform;
    }

    void Update() {
        transform.position = new Vector3(
            bar.position.x, transform.position.y, transform.position.z);
    }
}


texts: js canvas tiled map - for loop, while, or matrix

texts:
I am making a top-down view tiled map in canvas, where player is always in the middle of the screen, and map scrolls depending on where you go, like in moba games. I also want it to loop infinitely in every direction.

That means that when I cross the top border of the map I should end up at the bottom of the map, when I cross the left side of the map I should end up on the right side, etc. At the same time I only want the part visible on screen to be rendered.

Normaly I would just use for loop, but in cases when I am at the border, or corner of a map, and I need to display the same map, but the other end of it, it gets complicated with lots of nested loops.

I could make the map as math.matrix, and do multiple operations to fragment it and arrange so that it represents only the part visible on screen, like so:

So when I am at one of bottom tiles for example and I am at the center of the screen, I will need to fill the bottom with top tiles, and since the map is bigger than what is displayed on screen I would need to also extract only part of it to render.

But that would require a few math functions each draw, and I wonder if it is ok to do it.

It is hard to explain, especially in a language that is not my native, but I hope that someone will help me.

What is the right way to do it?


texts: How to normalize angles from points in java

texts:
Previous thread on projectile slopes

What is the velocity of a translating projectile in 2D?

What I'm trying to do

Get the slope at a constant speed for both X & Y Coordinates though I don't have an understanding on how to use Vectors in programming so I'm going off this guys equations but with both X & Y since I don't understand vectors. I can't tell at this point if there a direction or coordinate.

What I've done so far

Got everything ready

What I need help with

What do I have to put in as Syntax to normalize these 2 points even though their coordinates (Based off the answer on the given thread)


texts:
I'm planning on rendering many sprites in my games, but I am not sure which method of storing their data to use. I haven't tried all of them yet, but I want to see if I also have anything important missing. Right now my options are:

Store information such as position, color, rotation, scale, and texIndex in a VBO, and then let the geometry shader output the triangles. (Not sure if possible)
Compute the vertices for all sprites in the CPU and put it all into one VBO to draw. (Sounds like a waste of CPU time, especially in a game)
Store repeated copies of the same four vertices in a VBO, and then use uniforms? (This is just an idea, I have no idea if it works or makes sense) Apparently I can just use instancing for this.

What design should I use to efficiently store sprite data? Do any of my ideas hold?

Edit: I would greatly appreciate if pseudocode could be provided for a solution, although certainly not necessary.


texts: How can I set a ui image canvas to be in front of anything else?

texts:
In the Hierarchy I have a Canvas set to Screen Space - Overlay the canvas name is Scene Fader. and a child disabled ui Image and also a child name Scene Fader Child that is a gameobject with a script attached to it name Scene Fader :

The script that attached to Scene Fader Child is :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class SceneFader : MonoBehaviour
{
    #region FIELDS
    public GameObject fadeOutUIGameobjectImage;
    public float fadeSpeed = 0.8f;
    //public SaveLoad saveLoad;

    private Image fadeOutUIImage;

    private void Start()
    {
        SceneManager.sceneLoaded += SceneManager_sceneLoaded;
    }

    public enum FadeDirection
    {
        In, //Alpha = 1
        Out // Alpha = 0
    }
    #endregion

    #region FADE
    public IEnumerator Fade(FadeDirection fadeDirection)
    {
        fadeOutUIGameobjectImage.SetActive(true);

        float alpha = (fadeDirection == FadeDirection.Out) ? 1 : 0;
        float fadeEndValue = (fadeDirection == FadeDirection.Out) ? 0 : 1;
        if (fadeDirection == FadeDirection.Out)
        {
            while (alpha >= fadeEndValue)
            {
                SetColorImage(ref alpha, fadeDirection);
                yield return null;
            }
            fadeOutUIGameobjectImage.SetActive(false);
        }
        else
        {
            fadeOutUIGameobjectImage.SetActive(true);
            while (alpha <= fadeEndValue)
            {
                SetColorImage(ref alpha, fadeDirection);
                yield return null;
            }
        }
    }
    #endregion

    #region HELPERS
    public IEnumerator FadeAndLoadScene(FadeDirection fadeDirection, string sceneToLoad)
    {
        yield return Fade(fadeDirection);

        SceneManager.LoadScene(sceneToLoad);
    }

    private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
    {
        if (MenuController.LoadSceneForSavedGame == true)
        {
            var saveLoad = GameObject.Find("Save System").GetComponent<SaveLoad>();
            saveLoad.Load(null, null);
        }

        if(MouseHover.loadingwithfolder)
        {
            var saveLoad = GameObject.Find("Save System").GetComponent<SaveLoad>();
            saveLoad.Load(MouseHover.folder, MouseHover.savedGameFName);
            MouseHover.loadingwithfolder = false;
        }
    }

    private void SetColorImage(ref float alpha, FadeDirection fadeDirection)
    {
        if(fadeOutUIImage == null)
        {
            fadeOutUIImage = fadeOutUIGameobjectImage.GetComponent<Image>();
        }

        fadeOutUIImage.color = new Color(fadeOutUIImage.color.r, fadeOutUIImage.color.g, fadeOutUIImage.color.b, alpha);
        alpha += Time.deltaTime * (1.0f / fadeSpeed) * ((fadeDirection == FadeDirection.Out) ? -1 : 1);
    }
    #endregion
}

When in this script I'm enabling true the fadeOutUIGameobjectImage I want that this Image will become in front of anything else all the ui elements and other stuff.
Now there is some ui elements that are in front of it.
This screenshot show the default main menu when running the game :

Then when starting a new game everything is fade out the screen get black using the Scene Fader script but the left ui element is in front of the image in the scene fader script :


texts: Pushing an object on other colliders makes the pusher object go through

texts:
The Wall moves to the right and pushes the Character with it. The character travels along a bunch of Blocks with colliders attached to them.

This is the result:

At some point, the Character gets stuck and the Wall goes through the Character and comes out the other side.

I've tried to play around with the collision detection and other values of the rigidbodies. I tried to add a Physics material with no friction.

I am wondering what could cause this issue.

Here are the values of my GameObjects


texts:
Since I am using NGUI, to capture mouse events I use their methods such as

void OnPress (bool isDown) {

}

How can I check the mouse/touch position that corresponds to this particular OnPress event?


texts: Only send moves for P2P 2 player LAN game?

texts:
I am making a 2D network game. The concept is simple, a player have to shoot the other player to win. I'd like to improve this game ( add a map, items, monsters, w/e ), but later.

This is my first network programming experience. I have little theorical knowledges about packets, sockets, client/server side, what is dangerous to do client sided, but I've never really used them.

Goals set :

This is a 2 players LAN game, no more no less.
No server. Player 1 starts the game waiting for player 2...
... which leads the game open for reverse engineering or packet editing, but w/e, for this kind of game I prefer simplicity over security.

Pretty basic. For a first network game that will never be shared, I take off problems and will see later.

This is where I am : each player is a square that can move in four directions. The approach :

TCP Packets.
Each movement ( each frame a key is pressed to be accurate ), a packet is sent to the other player with his position.
Packets are received each frames before drawing and updating game elements, in the same thread, with a non-blocking receive() function.

And that's it.

My questions :

Is sending a packet for each moves overkill? Will I have problems with this later?
What kind of problem can I meet? mono-thread + non blocking function will be a problem later, assuming the goals I've set?


texts: 2D scene graph not transforming relative to parent

texts:
I am currently in the process of coding my own 2D Scene graph, which is basically a port of flash's render engine.

The problem I have right now is my rendering doesn't seem to be working properly. This code creates the localTransform property for each DisplayObject.

Matrix m_transform =
                Matrix.CreateRotationZ(rotation) *
                Matrix.CreateScale(scaleX, scaleY, 1) *
                Matrix.CreateTranslation(new Vector3(x, y, z));

This is my render code.

float dRotation;
Vector2 dPosition, dScale;
Matrix transform;
transform = this.localTransform;
if (parent != null) transform = localTransform * parent.localTransform;
DecomposeMatrix(ref transform, out dPosition, out dRotation, out dScale);

spriteBatch.Draw(this.texture, dPosition, null, Color.White, dRotation,
new Vector2(originX, originY), dScale, SpriteEffects.None, 0.0f);

Here is the result when I try to add the Stage then to the stage a First DisplayObjectContainer and then a second one.

It may look fine but the problem lies in the fact that I add a first DisplayObjectContainer at (400,400) and the second one within it (that's the smallest one)
at position (0,0). So he should be right over its parent but he gets render within the parent at the same position the parent has (400, 400) for some reason. It's just as if I double the parent's localMatrix and then render the second cat there.

This is the code i use to loop through every childs.

base.Draw(spriteBatch);
foreach (DisplayObject childs in _childs)
{
    childs.Draw(spriteBatch);
}


texts: Collision happens even though the objects are not colliding according to what we see

texts:
I'm trying to build a pool game as my first phaser project.

The biggest challenge today was to make the cue rotate around the white ball. After hours of searching and not finding anything useful (there is an example about rotating points but no sprites) I was able to create something, not very clean but it works.

Here is the white ball

    balls = game.add.group();
    balls.enableBody = true;
    balls.physicsBodyType = Phaser.Physics.P2JS;
    wball = balls.create(350, 240 , 'ballW');
    wball.body.setCircle(15);
    wball.body.setCollisionGroup(wballCollisionGroup);
    wball.body.collides([wballCollisionGroup, ballsCollisionGroup , sidesCollisionGroup , holesCollisionGroup , playerCollisionGroup]);
    game.physics.p2.setImpactEvents(true);

Here is the cue which i call it player

player = game.add.sprite( 0   , 0   , 'player');
game.physics.p2.enable(player);
player.enableBody = true;
player.body.setCollisionGroup(playerCollisionGroup);
player.body.setZeroVelocity();
player.body.createBodyCallback(wball, ballHit , this);
player.anchor.setTo(-0.5, 0.5);
player.pivot.x = wball.x +150;
player.pivot.y = 0;

player.body.x = wball.x  ;

setTimeout(function(){
     player.body.y = 150 ;
} , 1000 );

setTimeout(function(){
     player.body.y = 200 ;
} , 2000 );

setTimeout(function(){
     player.body.y = 240 ;
} , 3000 );

As you can see I have set the y position for player in 3 steps to demonstrate the problem .

It starts at the top of the page and comes down as  soon as i set y=240, which is the wball y a collision happens even though we can see clearly they are not colliding.

Pleaes note both codes are in the create function.
Here is the live code:
http://199.26.84.223/


texts:
I'm making a 3d orthogonal-projected, game using painters' algorithm in java.

I'm able to rotate the objects with incremental rotations (e.g. rotate all objects 10 degrees) using affine transformations, but that involves changing/saving the rotated positions of the objects.

I want be able to rotate using a viewing direction vector. What is the maths and/or java code to do this?

Assume the default viewing direction (no rotation needed) would be (0,0,1) (looking down the z axis).

I can elaborate and/or clarify if wanted.

EDIT: What I'm doing currently:

  for all drawable things:

  // using transform matrices (translate to origin, rotate around origin, translate back)

  rotate around center by x,y,z radians

What I want:

  for all drawable things:

  rotate around center using viewing direction (vector)


texts: c++ static only classes for subsytems and Engine

texts:
From the book Game Engine Architecture

  In C++, global and static objects are constructed before the program’s
  entry point (main(), or WinMain() under Windows) is called. However,
  these constructors are called in a totally unpredictable order. The destructors
  of global and static class instances are called after main()
  returns, and once again they are called in an unpredictable order. Clearly this
  behavior is not desirable for initializing and shutting down the subsystems
  of a game engine, or indeed any software system that has interdependencies
  between its global objects.

The book suggests to implement the subsystems as singelton objects with empty constructor and destructor and add explicit Init() and Dispose() methods, such that the construction and destruction order can be manually specified.
The question is now whether this can be done using global static classes instead of singelton objects, like this:

//Renderer.h
class Renderer
{
public:
    static void Init()
    {
        //init logic
    }

    //Some static, global fields

    static void Dispose()
    {
        //Disposing logic
    }
private:
     //some more static, not global fields / methods
};

//Engine.h
class Engine
{
public:
  static void Init()
  {
    Renderer::Init();
    //etc
  }
  //other stuff

  static void Dispose()
  {
      Renderer::Dispose();
      //etc
  }
};

//Main.cpp

int main()
{
    Engine::Init();
    //some work
    Engine::Dispose();
}

Will this kind of approach also solve the initialization order problem described in the book?


texts: How often should I check for collisions in a Miinecraft-like game?

texts:
I'm trying to build a game from scratch in Dart, similar to Minecraft.

As far as I understood, there are two main functions in a general game loop:

tick: a function that gets executed a fixed amount of times per second independently of the framerate. And I think in Minecraft those are called TPS (Tick per second).
render: a function that draws everything on the screen, called every frame, the frequency of which depends on the device's capabilities. (FPS)

(I am referencing Minecraft as it's a well-known game and it's quite simple)

What I'm trying to understand is at which time should collisions be checked for? Are they checked each time the screen draws (render) or every time the tick function runs?


texts: Move around the object using head tracking movement in Unity

texts:
I am developing an app for Samsung Gear VR with unity.I have added a cube and made the cube move forward on the terrain.

Now I need to move around the cube using head tracking movement.I have referred the below link(Flyer VR movement) .But I am not able to understand the code used in it.

https://unity3d.com/learn/tutorials/topics/virtual-reality/movement-vr

Can anybody help me doing this in a simple way to move around the cube by head tracking


texts:
I'm trying to make a series of text appear programmatically. It's not quite showing up, and I'm struggling to understand exactly why. Any ideas?

GameObject row = new GameObject("Row");
row.transform.parent = panel.transform;
HorizontalLayoutGroup rowLayoutGroup = row.AddComponent<HorizontalLayoutGroup>();
rowLayoutGroup.childForceExpandHeight = false;

GameObject name = new GameObject("Name");
name.transform.parent = row.transform;
GameObject value = new GameObject("Value");
value.transform.parent = row.transform;

Text nameText = name.AddComponent<Text>();
nameText.text = tup.First;
nameText.alignment = TextAnchor.MiddleRight;

Note that this script is run from a Panel, contained within a Canvas.


texts: Is there an algorithm for collision resolution that factors in velocity?

texts:
I'm trying to program collision detection between moving convex polygons. To detect collisions, my program uses the GJK algorithm, and to resolve the collisions, it uses EPA. The problem with EPA is that it returns the vector to resolve the collision with the minimum distance, rather than returning the locations of the polygons at the time of the collision. Is there an algorithm that does that?

Edit: I realize my question is hard to understand, so let me rephrase/slightly change it: What continuous/predictive collision detection algorithm would you suggest?


texts:
The program is supposed to read the pixel color values from an image, and use that data as a map for where to place objects in a game world.

Getting the color values was easy enough:

import numpy
from PIL import Image

img = Image.open("colors.png")
data = numpy.array(img)

The color value should be used to choose a type of object, and the data[ ] index values translated as coordinates to choose where on a surface the object is placed. It's not clear to me how to go about implementing this, I'm still trying to learn python.

I need help with understanding how to structure a system which goes through all the values of the data[ ] array, and creates a map based off of those values. For example, data[0,0] is a red pixel, therefore make an instance of object_type_1 and place it in the top left corner of the screen surface, data[0,1] is a blue pixel, make an instance of object_type_2 and place it 20 pixels to the right of the first object.


texts: What is the different between "LoadSceneMode.Additive" and "LoadSceneMode.Single"?

texts: What is the different between LoadSceneMode.Additive and LoadSceneMode.Single? When should I use one, over the other? I read the documentation, but I can't find any good examples of use for a definitive situation.


texts: Execution order of uGUI events in Unity?

texts:
I'm trying to understand how UI events fit into the overall Unity update loop. Specifically, I want to manually call onClick via script, and then modify the effect of that event within the same frame.

The button disables and enables some objects on click, but I can't find those objects (via transform.Find) immediately after myButton.onClick.Invoke(). They don't appear until the next frame. Yet, if I add a Debug.Break after this frame, the new objects are rendered to the screen. So it clearly doesn't take an extra frame for the onClick event to occur.

The question is, when exactly does onClick happen? And can I write code that does something after onClick but before the frame is rendered?


texts: Context is NULL with SDL_CreateWindowFrom Win32

texts:
There is a VC ++ Win32 project. It connected the library sdl, follows CreateWindowW I have written

 SDL_Window* w = SDL_CreateWindowFrom(hWnd);
 //  SDL_WindowFlags(SDL_WINDOW_OPENGL);
   SDL_GLContext glcontext = SDL_GL_CreateContext(w);
   if (glcontext == NULL)OutputDebugString("null");

But my glcontext == NULL and SDL_GetError returns  The specified window isn't an OpenGL window

But if I use SDL_CreateWindow, context turns out successfully

Even after the creation of the window using

static PIXELFORMATDESCRIPTOR pfd = {
       sizeof(PIXELFORMATDESCRIPTOR), // strcut size
       1,                              // Version number
       PFD_DRAW_TO_WINDOW |    // Flags, draw to a window,
       PFD_SUPPORT_OPENGL, // use OpenGL
       PFD_TYPE_RGBA,          // RGBA pixel values
       24,                     // 24-bit color
       0, 0, 0,                // RGB bits & shift sizes.
       0, 0, 0,                // Don't care about them
       0, 0,                   // No alpha buffer info
       0, 0, 0, 0, 0,          // No accumulation buffer
       32,                     // 32-bit depth buffer
       0,                      // No stencil buffer
       0,                      // No auxiliary buffers
       PFD_MAIN_PLANE,         // Layer type
       0,                      // Reserved (must be 0)
       0,                      // No layer mask
       0,                      // No visible mask
       0                       // No damage mask
   };

   // Did We Get A Device Context?
   hDC = GetDC(hWnd);

   PixelFormat = ChoosePixelFormat(hDC, &pfd);

   SetPixelFormat(hDC, PixelFormat, &pfd);

   // Are We Able To Get A Rendering Context?
   hRC = wglCreateContext(hDC);

   // Try To Activate The Rendering Context
   wglMakeCurrent(hDC, hRC);
   ReleaseDC(hWnd, hDC);
   ShowWindow(hWnd, nCmdShow);

   SDL_InitSubSystem(SDL_INIT_VIDEO);

   SDL_Window* w = SDL_CreateWindowFrom(hWnd);
   SDL_GLContext glcontext = SDL_GL_CreateContext(w);
   if (glcontext == NULL)OutputDebugString("null");

Can not get context. How correctly get the context?


texts: How can I create a GraphQL query with nested {}

texts:
I am using GraphQL plugin from https://github.com/Gazuntype/graphQL-client-unity. I have a long query from which I am parsing it to JSON to get individual values. It all works fine. Unfortunately the problem appears when using SetArgs() in a nested {}. For example, here is my query:
{
  System(ID: "1") {
    model {
      type {
        SystemModel{
          CreationModel(isModelCreated: true) {
          name
          }
         }
        }
     }
   }
}

And here is my Unity code:
public async void GetSystemID () {
        GraphApi.Query query = Graph.GetQueryByName ("System", GraphApi.Query.Type.Query);
        query.SetArgs (new { ID= "1", isModelCreated = true }); //How do I provide isModelCreated here

        UnityWebRequest request = await NestedQuery.Post (query);
        JSONNode itemsData = JSON.Parse (request.downloadHandler.text);
        var parseJSON = JSON.Parse (request.downloadHandler.text);

    }

So in SetArgs, I have to provide a list of arguments, for example ID: "1" and isModelCreated: true. I am able to provide the first argument, but unfortunately the nested query's argument - isModelCreated is not getting recognized as it treats it as:
System(ID: "1", isModelCreated: true) {}

Do I have to add multiple {} so that it comes in right order or is there a cleaner way to achieve this?


texts: How can I blend up to 3 textures on a polygon without blend maps?

texts:
For my voxel game I need to blend up to 3 textures in the same polygon.
It would be preferable if I could specify a texture id for each vertex, but other solutions are accepted as well.

Here's an illustration of what I want.

How can I achieve this type of blending?

Multi texturing with blend maps is NOT a solution.
Also please notice that there will be a lot of different textures.


texts: How can I keep AI from getting stuck on each other?

texts:
I'm currently working on AI and, as stated above, I'm having trouble figuring out how to keep the AI from getting stuck on each other.

More specifically, I'm working on two different behaviors for the AI:

The AI form a group of four, determine which one of them is the strongest and bravest (whichever has the highest number), make that one the leader and then snake behind the leader. This doesn't workout because the leader ends up getting stuck on the others as they attempt to walk through him to form a line.
The AI moves from one room to another. This doesn't work out because the one changing rooms will get stuck on ones that are doing other things or even on other room changing AI.

The way I've programmed it, AI traveling to a destination will calculate which tile gets it closer to it's goal (they use jump point pathfinding to find their way around) and then they calculate which tile they'll move to the next turn. Other AI check to see if a traveling AI is around them and if there is, they move one space to the side (or at least they're supposed to move.)

Does anyone know a way to keep this from happening?


texts: Counting down a number of coins in the same total time duration, no matter the amount

texts:
Math has never been my strong suit and so I'm having trouble figuring out how to write this formula.

When you buy something in my game, the amount it costs to purchase that item will be taken off from your total coin amount one by one. It's a loop that repeats itself till the amount that needs to be taken off is 0.
I have that system set in place, but I need to figure out a way to calculate the speed of decrease, or the time between each coin, making sure that each purchase will last the same amount of time, regardless of how much it costs.

What I figured out is that I need to come up with a formula in which the time it takes between each coins should become smaller/shorter the more coins it costs.

e.g. 10 coins taken from your total coin amount should take as long 200 coins.
10 coins  -> 0.1   seconds between coins -> 1 second total
200 coins -> 0.005 seconds between coins -> 1 second total
500 coins -> 0.002 seconds between coins -> 1 second total
And etc.

It would be greatly appreciated if anyone could push me in the right direction and/or give a little explanation to whether this is possible or not.

Thank you


texts: How can I write my scoring system and add a score multiplier?

texts:
I am new to the scripting world and I am currently trying to add a score multiplier to the game code I am working on.

Right now the score is set to increase as the player runs across the level however I want to set it up so that the players gains X amount of score for every Y amount of distance traveled. I also want to add a multiplier for when they come into contact with certain objects X amount of time. Any help would be greatly appreciated.


texts: How do I simulate the mouse and keyboard using C# or C++?

texts:
I want to start develop for Kinect, but hardest theme for it - how to send keyboard and mouse input to any application. In previous question I got an advice to develop my own driver for this devices, but this will take a while.

I imagine application like a gate, that can translate SendMessage's into system wide input or driver application with API to send this inputs. So I wonder, is there are drivers or simulators that can interact with C# or C++?

Small edition: SendMessage, PostMessage, keybd_event will work only on Windows application with common messages loop. So I need driver application that will work on low, kernel, level.


texts: I have been making my first game but I have encountered a small problem. To show the text when you win, you have to go into a block with the OnTriggerEnter line. I cannot get to this block however, because when I put my player (a sphere) as a trigger it just passes through the ground. How do I fix this?


texts: Why is there such a problem to create realistic eyes in games?

texts:
I mean, even the latest demo from ps4 possibilities or any demo, you can see that the person is not real if there are eyes involved. E.g. if you only see the skin, you may be mistaken, but not if you see the eyes.

Why is it so difficult to achieve believable eyes in game development?


texts: Collision detection and solution causes teleportation on corners

texts:
I am making my own game engine on Python and I got stuck with collision between objects.

# If we go Right
if (collision_rect.right >= object_collision_rect.left) and \
        (collision_rect.left <= object_collision_rect.left):
    if (collision_rect.bottom > object_collision_rect.top) and \
            (collision_rect.top < object_collision_rect.bottom):
        if self.acceleration.x > 0:
            self.acceleration.x = 0
            moving.x = object_collision_rect.left - collision_rect.right

 # Bottom
 if (collision_rect.bottom >= object_collision_rect.top) and \
         (collision_rect.top <= object_collision_rect.top):
     if (collision_rect.right > object_collision_rect.left) and \
             (collision_rect.left < object_collision_rect.right):
         if self.acceleration.y > 0:
             self.acceleration.y = 0
             moving.y = object_collision_rect.top - collision_rect.bottom

There are two more for left and top.

It makes teleporting on corners. And if we change the second conditions from < > to <= >=, we get teleporting on edges, if we have acceleration x and y both != 0


texts: Why the while loop is not pausing the coroutine?

texts:
I'm trying to find a way to pause the game the whole game. timeScale = 0f is not working on coroutines.

I have this script that pause the game on escape key :

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

public class BackToMainMenu : MonoBehaviour
{
    public static bool gamepaused = false;

    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            gamepaused = true;
            Time.timeScale = 0f;
        }
    }
}

And a script with a coroutine :

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

public class DepthOfField : MonoBehaviour
{
    public UnityEngine.GameObject player;
    public PostProcessingProfile postProcessingProfile;
    public bool dephOfFieldFinished = false;
    public LockSystem playerLockMode;

    private Animator playerAnimator;
    private float clipLength;
    private Coroutine depthOfFieldRoutineRef;

    void Start()
    {
        if (depthOfFieldRoutineRef != null)
        {
            StopCoroutine(depthOfFieldRoutineRef);
        }

        playerAnimator = player.GetComponent<Animator>();

        AnimationClip[] clips = playerAnimator.runtimeAnimatorController.animationClips;
        foreach (AnimationClip clip in clips)
        {
            clipLength = clip.length;
        }

        var depthOfField = postProcessingProfile.depthOfField.settings;
        depthOfField.focalLength = 300;
        StartCoroutine(changeValueOverTime(depthOfField.focalLength, 1, clipLength));
        postProcessingProfile.depthOfField.settings = depthOfField;
    }

    IEnumerator changeValueOverTime(float fromVal, float toVal, float duration)
    {
        while(BackToMainMenu.gamepaused)
        {
            yield return null;
        }

        playerLockMode.PlayerLockState(true, true);

        float counter = 0f;

        while (counter < duration)
        {
            var dof = postProcessingProfile.depthOfField.settings;

            if (Time.timeScale == 0)
                counter += Time.unscaledDeltaTime;
            else
                counter += Time.deltaTime;

            float val = Mathf.Lerp(fromVal, toVal, counter / duration);

            dof.focalLength = val;
            postProcessingProfile.depthOfField.settings = dof;

            yield return null;
        }

        playerAnimator.enabled = false;
        dephOfFieldFinished = true;
        depthOfFieldRoutineRef = null;
    }
}

But when I hit the escape key the freeze for a second or two but then the blurry effect in this script is keep on going then it also keep on running the game after this script part. It seems that the timeScale is not pausing the game at all but only for few seconds if at all. Or pausing only some stuff.

What I want is to pause the whole game. Maybe I should use a game state somehow? I don't want to disable/enable the gameobjects in the hierarchy.

I checked again now. For example the player I can't move it with the keys but I can rotate the player looking around with the mouse while in pause mode. But other things are paused like other npc's I have they stopped moving(Not using animation). So some stuff is paused but some stuff not.


texts: Using full resolution of depth buffer for 2D rendering

texts:
I'm working on a front-to-back renderer for a 2D engine using an orthographic projection. I want to use the depth buffer to avoid overdraw. I have a 16-bit depth buffer, a camera at Z=100 looking at Z=0, zNear is 1, and zFar is 1000. Each sprite rendered sets its Z co-ordinates to increasingly distant values, allowing depth test to skip rendering anything which is underneath.

However I'm aware the way Z positions end up with Z buffer values is non-linear. I want to make use of the full resolution of the 16-bit depth buffer, i.e. allowing 65536 unique values. So for every sprite rendered, I want to increment the Z position to the next position to correlate to the next unique depth buffer value.

In other words I want to turn an incrementing index (0, 1, 2, 3...) of the sprite being drawn in to the appropriate Z position for each sprite to have a unique depth buffer value. I'm not sure of the maths behind this. What is the calculation to do this?

Note I'm working in WebGL (basically OpenGL ES 2), and I need to support a wide range of hardware, so while extensions like gl_FragDepth might make this easier, I can't use it for compatibility reasons.


texts: How to pause and unpause the Particular action of a sprite?

texts:
My game has a sprite representing a character.  When the character picks up an item, the sprite should stop moving for a period of time.

I use CCbezier to make the sprite move, like this:

sprite->runaction(x)

Now I want the sprite to stop its current action (moving) and later resume it.
I can make the sprite stop by using:

sprite->stopaction(x)

but if I do that, I can't resume the movement.
How can I do that?


texts: Cross-Platform CocosSharp Content Pipeline Project?

texts:
Just getting started with CocosSharp and Xamarin.Forms and I wanted to move on from using Circles and lines to draw everything. It looks like setting up a MonoGame Content Pipeline project is the way to go.

I've got the tool installed (on my mac). My "game" is actually really simple and is more of a visualization. I want to load up a texture file for a background, an image or two for the foreground, and a largish pile of sound files.

Do I have to manage the exact same files twice, in a separate tool from Xamarin Studio in order to do this? It seems like I'm missing something, but the documentation doesn't talk about cross-platform sharing at all.


texts: Unity blit() not writing to RenderTexture

texts:
I found a nice Gaussian Blur shader online and am attempting to use it to blur a render texture using blit(). However, the render texture remains unblurred. I know for a fact the blur shader works as I've used it to blur the main camera, but it just doesn't seem to want to blit() my render texture.

C# Blur Script:

 void Update()
 {
     if (_material == null)
     {
         _material = new Material(_shader);
         _material.hideFlags = HideFlags.HideAndDontSave;
     }

     RenderTexture rt1, rt2;

     if (_downSampleMode == DownSampleMode.Half)
     {
         rt1 = RenderTexture.GetTemporary(source.width / 2, source.height / 2);
         rt2 = RenderTexture.GetTemporary(source.width / 2, source.height / 2);
         Graphics.Blit(source, rt1);
     }
     else if (_downSampleMode == DownSampleMode.Quarter)
     {
         rt1 = RenderTexture.GetTemporary(source.width / 4, source.height / 4);
         rt2 = RenderTexture.GetTemporary(source.width / 4, source.height / 4);
         Graphics.Blit(source, rt1, _material, 0);
     }
     else
     {
         rt1 = RenderTexture.GetTemporary(source.width, source.height);
         rt2 = RenderTexture.GetTemporary(source.width, source.height);
         Graphics.Blit(source, rt1);
     }

     for (var i = 0; i < _iteration; i++)
     {
         Graphics.Blit(rt1, rt2, _material, 1);
         Graphics.Blit(rt2, rt1, _material, 2);
     }

     Graphics.Blit(rt1, source);

     RenderTexture.ReleaseTemporary(rt1);
     RenderTexture.ReleaseTemporary(rt2);
}


texts: How can I deploy an Android game without going through the marketplace?

texts:
How do I deploy an Android app without publishing it in the marketplace?

Let me back up a minute. I have short release cycles (2-4 weeks or less), and I would like to release a partially complete, unpolished game on my website so people can try it out and give me feedback.

I believe with Android, I need to go through the "Marketplace" and some rigorous process to release my app (which is not something I would do for an in-development version anyways).

So how can I get my under-development version in the hands of players?


texts:
Everywhere I've searched on the internet, people seem to assume that jump point search would not work with weighted grids. So why wouldn't it work with this simple modification to the algorithm:

This diagram here illustrates the circumstances that the traditional jump point search algorithm would add the node x to the open set.

Please note that the black squares are numbered 2 and 4 respectively.

In these two images, the reason x is added to the open set is because the optimal paths to the circled squares from the parent of x must go through x. I propose, that if any path going through x from the parent of x to a node around x is lighter than the corresponding path going around x, x should be expanded.

Example psuedocode:

Please note that weightOfPath should return infinity if any of the nodes are impassable.

Horizontal case:

if weightOfPath(4,x,3) < weightOfPath(4,2,3) or weightOfPath(4,x,8) < weightOfPath(4,7,8):
    addToOpenNodes(x);

Diagonal case:

if weightOfPath(6,x,1) < weightOfPath(6,4,1) or weightOfPath(6,x,8) < weightOfPath(6,7,8):
    addToOpenNodes(x);

Why wouldn't this work?


texts:
I'm working on a simple 3D game. In the game, sometimes the players have to roll die (a D8 to be exact). I wish to represent the rolling die with a 3D model, and I'd like to animate it in 3D space as if it was really rolled.

Can anyone help me describe the way the die spins around in real life?

PS: I'm working on this in WPF, using Storyboards and Rotation3DAnimationUsingKeyFrames


texts:
The most successful competitive game engines like id Tech, GoldSrc, Source and such allow for framerate limitations.

You can play with 30, with 60, with 99, with 72, with 68 etc. In short, you can cap it and control the cap.

I was wondering, how do I limit the framerate?

Not interested in code, but theory.


texts: How to find connected groups in a 2D grid of tiles

texts:
Firstly, my English is very bad, sorry for this. That's why I showed my problem with a picture.

Block[,] sameTiles = new Block[
  WorldController.Instance.World.Width,
  WorldController.Instance.World.Height];

sameTiles keeps the same side-by-side green blocks. My problem is, I need to detect and separate the shapes made of connected blocks so I can access each shape separately. For example, putting each group on a layer of a 3D array:

Block[,,] differentTiles = new Block[
  100,
  WorldController.Instance.World.Width,
  WorldController.Instance.World.Height];

(100 connected shapes are supported at max)

Block[
  ShapeNumber,
  X Coord,
  Y Cood].

Here is my picture, I need to search this array and detect the four shapes of connected green blocks, storing them separately. Picture:


texts: What is the best implementation of an automated tournament?

texts:
Here are the specs so far to give you an idea to the question.

should be fully automate-able
should not inconvenience the player with regards to time
should allow for a voted wild card system
should involve skill
will be done on a limited time frame

Was thinking of using a ladder like system similar to battle net 2.0 but it would seem to need some tweaking to meet all of the above.

Any suggestions on what would be an ideal tournament implementation for such requirements?


texts: How to integrate game logic in game engines

texts:
Recently I'm working on a 2d game engine example in .Net with C#. My main problem is that I can't figure out how I should include the game logic within the game. Currently I have a base engine which is a set of classes that they are running sub-systems like Render, Sound, Input and Core functionality. There is an editor which helps the user to add resources, build levels, write scripts and other stuffs.

I came up with an idea to use Reflection and CSharpCodeProvider from my editor to compile the written code. This way I can get an executable of my product too. This way is quite well but I would like to know what's really the solution and architecture to do this.

My engine's role is 2d platform. The scripting language is C# right now because I can't consist any other embeddable language for now. The game needs compilation and CSharpCodeProvider is the only way for me to do it meantime.


texts: string and int concatenation resulting in null for a Tetris clone?

texts:
I'm writing a tetris clone, and I have sprites (of every possible piece and rotation) loaded through the XNA content pipeline. For example, I have assets "i", "i2", "i3", and "i4" for each rotation of the 4-block-long I-tetrimino. For the O-tetrimino, I only have asset "o", because the O-tetrimino doesn't require any rotations.

I want to load each of these assets into a 2D array of Texture2Ds. Here's my attempt:

1 Texture2D[,] tetriminoTextures = new Texture2D[7, 4];
2 char[] tetriminos = { 'o', 'i', 'l', 'j', 'z', 's', 't' };
3 string t;
4
5 for (int i = 0; i < 7; i++)
6 {
7     for (int j = 1; i <= 4; i++)
8     {
9         if (i == 0 || j == 1) // If char[i] == 'o', then don't consider rotations.
10                              // The square piece doesn't have rotations.
11                              // If j == 1, then leave the asset name as is.
12            t = letters[i].ToString();
13        else // (i != 0 && j <= 2 && j <= 4)
14            t = letters[i].ToString() + j;
15        tetriminoTextures[i, j-1] = Content.Load<Texture2D>(t);
16    }
17 }

However, when I attempt to

spriteBatch.Draw(tetriminoTextures[x, y], /* some position vector */, Color.White);

I get an ArgumentNullException. Apparently tetriminoTextures[x, y] is null when y >= 1 && y <= 3.

I have no idea what's going on. I think it may have something to do with my concatenating a string and an int together in line 14. But I'm getting an ArgumentNullException even when i == 0 && j >= 2 && j <= 4 (i.e. for each rotation of the O-tetrimino excluding the first one), though the if statement in line 9 should have caught these cases. Any help would be appreciated!


texts: How to detect Lagoons and Lakes on a random Island Map

texts:
I have an engine which generates random Islands. At the moment it tends to generate quite a lot of lagoons and lakes. I would like to know of a feasible way of detecting them so that I can mark them as different terrain (i.e., salt water for lagoons).

Note: lagoons must be treated differently than lakes. I don't know what the threshhold for a lake should be, but obviously bodies of water close to the coast should be marked as salt water so the player is affected properly when trying to drink the water.


texts: Why do engines need to be optimized for new processors of the same architecture?

texts: When a new processor generation is released, most websites report that game engines and programs need to be optimized for the new hardware. I do not quite understand why. A processor usually has an architecture that defines what kind of instruction set it uses. The one we all use nowadays is amd_x86_64 . Why would any program or compiler need to be updated if all processors use this same architecture? Surely there are features WITHIN the pipeline of the new processor that optimizes the execution of machine code, but why would the machine code itself need to be changed if the architecture did not?


texts: Element's texture is null - Monogame/XNA, C#

texts:
I have a ArgumentNullException everytime I try to call the Draw() method of my Projectile class in the Game1.Draw() method.

In Game1.cs Initialize() method:

//PROJECTILES INITIALIZATION
        lesProjectiles = new List<Projectile>(20);
        for (int i = 0; i < lesProjectiles.Capacity; i++)
        {
            lesProjectiles.Add(new Projectile(projectileSprite,
                new Vector2(playerPosition.X - 15.5f, playerPosition.Y - 20)));
        }

This is the Projectile class constructor:

public Projectile(Texture2D texture, Vector2 startPos)
    {
            this.projectileSprite = texture;
            this.projectilePosition = startPos;
    }

The -15.5f and -20 values are for placing the projectile at the middle of my spaceship. (Not optimized logic ikr.)

Apart from my whole game logic, let's say I wanna draw the first element of my array. I'm doing that:

In Game1.cs Draw(GameTime gameTime) method:

        spriteBatch.Begin();
        lesProjectiles[0].Draw(gameTime, spriteBatch);
        spriteBatch.End();

And there is the Draw() method from my Projectile class :

public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(this.projectileSprite, this.projectilePosition,
            Color.White);
    }

The returned error:
System.ArgumentNullException: Value cannot be null. Parameter name: texture

I don't understand why the projectileSprite values of my array elements are null, considering it's done in the initialization method whenever the constructor is called.

Thanks for further help, sorry if my explanations are bad


texts: What are pixel-based path finding algorithms? (path doesn't need to be shortest)

texts:
I have a canvas of size of approximately 1000x1000 pixels. I also have a matrix that represents that canvas and returns -1 if that 'pixel' is walk-able. I need to find a path between one of my objects and some endpoint that DOESN'T necessarily need to be shortest. I just need a path.
What algorithm should I use?


texts: resources on creating world editor / game IDE

texts:
The craftyjs javascript game engine is in the process of creating a game builder that will assist the developer in map design, sprites, animations and that kind of stuff.

Are there any good resources on how a game builder should be crafted, both from an ease of use point of view(you need these features, and the world should be displayed like this) and a technical point of view(You need to store the data like this). I figure there should be blogs and articles written by players in the traditional console and pc game industry that we can learn from, but i have a hard time finding any.


texts: How do I procedurally generate rivers on a tilemap with thickness?

texts:
I have read numerous articles on the subject but can find none that can explain to me how it is that procedural river generation achieves a certain amount of thickness to the river. I have managed to pice together that I must search for perpendicular vectors to the one I use to construct the river, but am not sure how that is implemented. I am working on a 2D game with tilemaps implemented and don't know how I iterate through the tiles to achieve the intended result.
I am fairly intermediate when it comes to game development and have just started proc-gen games. Please try to answer simply as to how to do this. I know that others have figured it out and want an answer.
How do I set the thickness of procedurally generated rivers?
EDIT
I am able to code simple straight lines and have access to an astar algorithm to connect two points together, but my river is literally one tile thick. I want to increase its size and I am not proficient in other programming languages enough yet to be able to read through source code.
The rivers I want just need thickness to them. I just need whatever technique others might use to produce rivers or roads thicker than a single tile.


texts: Unity Springjoint2d - how to put collider between anchors?

texts: I want gameobjects to bounce off a line between 2 springjoint points. I placed boxcollider2d (with small Y scale) or edgecollider2d between two Joint points and every frame put it in right place, set different x scale, and set different rotation, but it doesn't work - other objects don't bounce on collision, they go through collider instead. I know that unity collisions work properly when objects move because of velocity instead of changing position every frame. Attaching collider to any of two objects connected by joint won't do what i want. Any ideas how to solve it?


texts: In WebGL, how can I efficiently render a mesh many times per frame, without instancing?

texts:
I'm using WebGL and I want to render a single mesh many times at different locations. I know about WebGL 2's drawArraysInstanced() and drawElementsInstanced() calls, but I think only Firefox supports them now.

The only solutions I see are :

Put all the meshes in a single buffer and render it with a single call to drawArrays()/drawElements(), but that would be a waste of memory because the mesh contains a lot of vertices and if the meshes are not static I would need to re-load the vertices in gpu memory every frame or so.
Have a single mesh in memory and render each instance with a separate call to drawArrays()/drawElements(), updating the model matrix between each call. I don't think that's the best way.

Any ideas?
Thanks


texts: No performance gain from instanced rendering?

texts:
I recently worked through this tutorial about instanced rendering. At the end it promises to draw a huge amount of instances of one model without performance drops.
So I tried some simple instanced rendering to see these effects. So I created a VBO containing four times xyz-coordiantes, vertex color and texcoords.

float[] backgroundData = new float[] {
            -1.0f, -1.0f, 0.0f, 1f,1f,1f,1f, 0.0f, 0.0f, 0.0f,
            1.0f, -1.0f, 0.0f, 1f,1f,1f,1f, 1.0f, 0.0f, 0.0f,
            -1.0f, 1.0f, 0.0f, 1f,1f,1f,1f, 0.0f, 1.0f, 0.0f,
            1.0f, 1.0f, 0.0f, 1f,1f,1f,1f, 1.0f, 1.0f, 0.0f
    };

I also created a VAO and EBO containing the glVertexAttribPointers and indices int[] indices = new int[]{0,1,2,1,2,3};.

Now I draw everything with glDrawElementsInstanced(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0, 10_000). But the Framerate drops as much as if I had the indices 10.000 times in my EBO. Why is the outcome so different? Did I do something wrong?


texts: How can I load 2D texture data without a GraphicsDevice instance?

texts:
We have a client/server architecture for our game with the client being the XNA Game, and the game server is separate and only references XNA.  They both use a shared DLL for networking.  The game server is windows forms for just starting/restarting and some stats output, and does no drawing or anything.

The problem is I need to load Texture2D's on the game server, to get width/height information, and for the server to be able to do per pixel collision detection for its simulation.  However, it seems a Texture2D requires a GraphicsDevice to instantiate.  And it appears a GraphicsDevice requires an XNA Game?

Is there some way I can load a Texture2D into memory on the server without a graphics device, or some way to instantiate a GraphicsDevice to do this (even though nothing is going to be drawn)?


texts: How to run my game outside of visual c++

texts:
I am having trouble running my game. It works fine when I run it from Visual C++, but when I try to open the .exe, it complains that it can't find SDL.dll.

What should I do in order to play the game?


texts: Creating chat bubble using 9-patch and Glyphlayout

texts:
I'm trying to create a chat bubble using 9patch as my background and text in the front.It is not drawing anything and I am unable to find the mistake in my code.

PS: I've taken some help from prev answers to write this code

Here is my code

 public void render(SpriteBatch sb) {

        chatBubble.drawSpeech(str,(int)Gdx.graphics.getWidth()/2,(int)Gdx.graphics.getHeight()/2,sb);

}

and ChatBubble class is given below:

public class ChatBubble {

    private NinePatch ninePatch;
    private Texture bubble;

    private Random rand = new Random();

    BitmapFont font = new BitmapFont();

   public ChatBubble() {

        bubble = new Texture("bubble.png");
        ninePatch = new NinePatch(new TextureRegion(bubble, 1, 1, bubble.getWidth() - 2, bubble.getHeight() - 2), 10, 10, 10, 10);

    }
    int textBoxBuffer = 5; // Allow for box to surround the text
    int textBoxWidth = 80; // the default width of the textbox
    public void drawSpeech(String str, int x, int y,SpriteBatch sb){
        sb.begin();
        GlyphLayout layout = new GlyphLayout(font,str, Color.BLACK, textBoxWidth , Align.left, true);
        ninePatch.draw(sb,x - textBoxBuffer, y - textBoxBuffer,
                layout.width + textBoxBuffer, layout.height + textBoxBuffer);
        font.draw(sb, layout, x, y);
        sb.end();
    }

}


texts: Why do characters only move in 4/8 directions in top games?

texts:
In many top down games, like Zelda (4 directions)

There are only 4 or 8 possible directions.

Why is this? Is it a design choice or a technology limitation? I can't think of any reason that even older hardware couldn't handle 360 degree movement.

If it is a technology limitation, then what is limiting it?

But mainly, why is this such a popular design choice? What are some pros and cons to this limited movement style instead of granting freedom to move in any direction?


texts:
If I have three scrolling/continuous parallax backgrounds, what should be the ideal size (width/height) of the background images assuming I am going to support all devices including the new iPad?

UPDATE:

Only landscape mode
Deployment Target: 4.2+
Same scene will be repeated.


texts: Deproject Screen To World Coordinates (Unreal Engine 4.15)

texts:
I am working on a small game in Unreal Engine 4.15 using blueprints only and encountered a behaviour I don't understand.

The game is based on the Top Down Example. As I'd like to teleport an actor to a world location corresponding to a screen location (i.e. left edge of the viewport). I use "Deproject Screen To World". Giving screen X = 0 and screen Y =  0 as input to this node, outputs world coordinates close to the bottom center of the viewport. In order to get a test actor to move to outputted world coordinates close to the left edge of the viewport, input screen coordinates need to unexpectedly high (around -20000.00 for both x and y). This occurs strange  to me, as the viewport is much smaller (around 1400x740 in editor preview).

I was hoping to use something like -(viewport width/2) for x screen coord (in case the x origin is centered.

Where is the origin for screen coordinates?
What unit are they measured in?

Note: The location on screen is not set from mouse position, so i can not use "Get Hit Result Under Cursor".


texts: Enemy movement in straight line to player in chase game

texts:
I'm creating a game where the enemies spawn randomly on a map then move towards the player every frame at a random speed. The map has no obstacles so the enemies should always move in a straight line. I wrote the movement function a few times but no matter what the enemies always hit 0, 45, 90, 135, 180, 225, 270, 315 angles but never a straight line. Here is an example of the code:

    base_speed = random();

    diff_x = abs(enemy_y_pos - player_x_pos);
    diff_y = abs(enemy_x_pos - player_y_pos);
     if (diff_x > diff_y) {
      y_speed = base_speed;
     } else if (diff_y > diff_x) {
      x_speed = base_speed;
     }

     if (enemy_x_pos < player_x_pos) {
      velocity.x = x_speed;
     } else if (enemy_x_pos > player_x_pos) {
      velocity.x = -x_speed;
     } else {
      velocity.x = 0;
     }

     if (enemy_y_pos < player_y_pos) {
      velocity.y = y_speed;
     } else if (enemy_y_pos > player_y_pos) {
      velocity.y = -y_speed;
     } else {
            velocity.y = 0;
    }

    enemy_x_pos = enemy_x_pos + velocity.x;
    enemy_y_pos = enemy_y_pos + velocity.y;

This is my first attempt at game programming. I guessing it's should use algorithm like Bresenham’s Line( http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm) but my attempts to implement have the same issue. How do I make enemies move in a straight line?


texts:
In my Unity project I have a script that programmatically changes the scaling of an object during the game.

Recently I wanted to add a spawning animation clip to my object, which modifies the object's scaling (but only during a short delay). So I added an animation controller to the object, containing the spawning animation clip.

I can now successfully run the spawning animation but the in-game programmatic scaling changes don't work anymore, even when my animation is not running.

Any idea?


texts: Updating games for iOS 6 and new iPhone/iPod Touch

texts:
Say I have a game that runs full-screen on iPhone 4S and older devices. The balance of the game is just right for the 480 x 320 screen and associated aspect ratio. Now I want to update my game to run full-screen on the new iPhone/iPod Touch where the aspect ratio of the screen is different.

It seems like this can be challenging for some games in terms of maintaining the "balance". For example if the extra screen space was just tacked onto the right side of Jet Pack Joyride the balance would be thrown off since the user now has more time to see and react to obstacles.

Also it could be challenging in terms of code maintenance. Perhaps Jet Pack Joyride would slightly increase the speed of approaching obstacles when the game is played on newer devices. However this quickly becomes messy when extra conditional statements are added all over the code. One solution is to have some parameters that are set in once place at start-up depending on the device type.

What are some strategies for updating iOS games to run on the new iPhone and iPod Touch?

Edit - more info: I wonder what happens with a game like Plants vs Zombies? There's quite a bit of artwork that's probably sized to the 320x480 screen. Perhaps the lawn background's width can be increased while the size of the zombies and the row heights stay the same.


texts: Unity baked lighting - blotchy shadows, bleeding and/or stiching

texts:
I have spent days trying to get baked lighting to look good. I use a simple low-poly style. No matter what I do, I get this type of effect (blotchy shadows and odd dark lines):

Here are my settings:

Baking a scene already takes around 4 hours, not sure I can increase the resolution any more without Unity crashing during the bake. Am I doing something wrong? Feel like Ive tried everything.


texts:
I am trying to get shadowmapping right for my animated models. It works perfectly for static meshes but the animated models are just wiggeling a bit

here's the vertex shader for rendering to the depth texture:

#version 400 core

in vec4 inputPosition;
in vec3 inputNormal;
in vec2 inputTexCoord;
in vec4 weights;
in vec4 joint_index;

uniform mat4 bone_matrix[65];
uniform int animate;
uniform mat4 depthMVP;

void main(){
    vec4 pos = inputPosition;

    if(animate != 0) {

        pos = vec4(0);
        vec4 post = inputPosition;

        for(int i=0;i<4;i++) {
            if(weights[i]>0) {

                pos += (bone_matrix[int(joint_index[i])] * post) * weights[i];

            }
        }

    }

    gl_Position = depthMVP*vec4(pos.xyz, 1);

}

The animation works fine in the second pass but during the first using the vertex shader above the model vertices don't get transformed instead the whole model rotates a little so i get a depth texture with my model in binding pose rotating around the y-axis a little. Weird because i use the exact same bone transformation code as in the second pass shader. So i'm wondering am i missing something crucial in the vertex shader above


texts: How can efficiently I edit my 2D tile-based maps?

texts:
I've been developing a very basic 2D tile-based game for my own experience.
I read what must be hundreds of tutorials on what I found on Google with "tile based maps".

Almost every tutorial I see is an engine that reads a text file and loads tiles based on the numbers in the file, such as:

0,0,0,0
3,0,0,3
2,0,2,2
2,0,2,2

But what if I were making a map that contained several 100 tiles?

surely there's an easier way to make a map than by writing a ton of numbers into a text file? How can this be done quicker?

An idea I had was making the world a single layered image: A layer for the objects/sprites/characters and another on top of that for tiles that should be under you like walls, trees, etc.

Is this possible/worthwhile?


texts: Building different game objects (EG Spells, Items,) for an rpg game

texts:
I believe the best way to manage item data would be to use xml?

For spells would the best option be to create a class (EG Fireball) and define all of the parameters inside of that class? Like Initilize Update and Draw? Then have a class called ParticleEngine and define Inside of fireball the type of particles to use?

Something like ParticleEngine Effects = new ParticleEngine(texture1,texture2,texture3,amountofparticles,offset,delay,life)

Or is there a better way to handle all of this?

What are some different stuctures and or what is the most efficient way of handling all of that data?


texts: What screen resolution do I make an android game in?

texts: Is it safe to assume that most mobile phones and tablets today have moved to 1280x720 resolution and above and make the games in that resolution, scale down for smaller screens or is a smaller resolution like the often used 800x480 still the recommended way to do it and scale it up for larger devices?


texts: Rotating a camera 90 degrees around an object in Unity3D

texts:
I've attached this script to the camera and am using it to rotate the camera around an object. It's currently rotating freely but I'd like it rotate 90 degrees smoothly, over 60 frames, when the button is pressed. So that four presses of the left arrow key would have the have the camera rotate the full 360 degrees over 240 frames and back to it's starting position. I can't seem to figure out how to do this. Any help would be appreciated.

public GameObject targetObject;
public float rDistance = 1.0f;
public float rSpeed = 1.0f;;

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

    // Trigger functions if Rotate is requested
    if (Input.GetKey(KeyCode.LeftArrow)) {
        RotateLeft(true);
    } else if (Input.GetKey(KeyCode.RightArrow)) {
        RotateLeft(false);
    }

}

protected void RotateLeft(bool goLeft)
{

    float step = rSpeed * Time.deltaTime;
    float orbitCircumfrance = 2F * rDistance * Mathf.PI;
    float distanceDegrees = (rSpeed / orbitCircumfrance) * 360;
    float distanceRadians = (rSpeed / orbitCircumfrance) * 2 * Mathf.PI;

    if (goLeft) {
        transform.RotateAround(targetObject.transform.position, Vector3.up, -distanceRadians);
    } else {
        transform.RotateAround(targetObject.transform.position, Vector3.up, distanceRadians);
    }

}


texts:
I currently have an enemy that upon collision kills the player with a kill script, I want to add another collider that acts as the visibility radius for said enemy. However, when adding another colldier with a bigger x radius, the collidier still kills the enemy. Is there any way to assign particular colliders specific methods using

OnTriggerEnter2D (Collider2D var)
{
}


texts: I try to make a Unity Curved Shader with shadow Effect?

texts:
I try to make a curved shader with shadow effect I got a existing curved shader in github and it has no shadow effect i try to modify it but i couldn't find any appropriate solution.

The shaderor helping script link: https://gist.github.com/g0ody/5550039

Curved.shader:

Shader "Platogo/Curved" {
    Properties {
    _MainTex ("Base (RGB)", 2D) = "white" {}
    _QOffset ("Offset", Vector) = (0,0,0,0)
    _Dist ("Distance", Float) = 100.0
  }
    SubShader {
        Tags { "RenderType"="Opaque" }
        Pass
        {
            Lighting Off

        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        #include "UnityCG.cginc"

        sampler2D _MainTex;
        float4 _QOffset;
        float _Dist;
        uniform float4 _MainTex_ST;

        struct v2f {
    float4 pos : SV_POSITION;
    float2 uv : TEXCOORD0;
        };

        v2f vert (appdata_base v)
        {
    v2f o;
    float4 vPos = mul (UNITY_MATRIX_MV, v.vertex);
    float zOff = vPos.z/_Dist;
    vPos += _QOffset*zOff*zOff;
    o.pos = mul (UNITY_MATRIX_P, vPos);
    o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
    return o;
        }

        half4 frag (v2f i) : COLOR
        {
          return tex2D(_MainTex, i.uv);
        }
        ENDCG
    }
}
FallBack "Mobil/Unlit"

}

CurvedAlpha.shader

Shader "Platogo/CurvedAlpha" {
  Properties {
        _MainTex ("Base (RGB)", 2D) = "white" {}
        _QOffset ("Offset", Vector) = (0,0,0,0)
        _Dist ("Distance", Float) = 100.0
        _Alpha ("Alpha", Range(0.0,1.0)) = 1.0
    }
    SubShader {
        Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
        LOD 100

    ZWrite On
    Blend SrcAlpha OneMinusSrcAlpha

    Pass
    {
        Lighting Off

        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        #include "UnityCG.cginc"

        sampler2D _MainTex;
        float4 _QOffset;
        float _Dist;
        float _Alpha;
        uniform float4 _MainTex_ST;

        struct v2f {
            float4 pos : SV_POSITION;
            float2 uv : TEXCOORD0;
        };

        v2f vert (appdata_base v)
        {
            v2f o;
            float4 vPos = mul (UNITY_MATRIX_MV, v.vertex);
            float zOff = vPos.z/_Dist;
            vPos += _QOffset*zOff*zOff;
            o.pos = mul (UNITY_MATRIX_P, vPos);
            o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
            return o;
        }

        half4 frag (v2f i) : COLOR
        {
            return tex2D(_MainTex, i.uv) * float4(1,1,1,_Alpha);
        }
        ENDCG
    }
}

FallBack "Platogo/Unlit Texture Alpha"
}


texts: Unity player movement, rotation breaks the movement

texts:
I'm new on unity and I developed a script to move a player cube:

        var moveSpeed = 5.0f;

        var x = moveSpeed * Input.GetAxis("Horizontal") * Time.deltaTime;
        var z = moveSpeed * Input.GetAxis("Vertical") * Time.deltaTime;

        transform.Translate(
            x,
            0f,
            z
        );

This works fine, the cube moves around the plane.

Then I wanted to make the cube rotate to face the movement, I mean, if the cube is moving to the right, face the right, etc.

the problem is when I change the transform.rotation with the direction position, there is a strange behaviour.

The movement is like WASD (the camera doesn't rotate, but I want to use Input.GetAxis("Horizontal"))

Any idea?

Thanks


texts: So let us assume I have a 3D model of a window and I would like to stretch it like a 9 sliced sprite. How would you go by doing 9 slice on meshes? All I found online was about quads. What about more complicated meshes?


texts:
Possible Duplicate:
  How can I create a random “world” in a tile engine?

I need some advice as to how I should go about coding a 2D Terrain Generator for a game written in C.  I need to create a terrain generator similar to the game minecraft, but in a 2D landscape.


texts: Effective methods to continuously update movement in a tower defense game?

texts:
We are four guys making a Tower Defense game as a project in first grade on a university. The game is going to be really simple!

Three different towers
Three different monsters
One map (maybe add some more if we have time)

The game has to be object oriented.

The class structure is as following

Game - Drawing of graphic, etc.
Level - Every level is an object of this class. Each level has a finite number of wave-objects (in a list)
Wave - Contains a list of monster-objects.
Monster - This is a superclass. We make subclasses for the different type of monsters
Tower - Superclass to the towers. There are subclasses for each type of tower.

We are thinking about how to solve the problem that many objects have to do stuff, at the same time, e.g. move one pixel in one direction.

What we came up with is the idea of implementing av class Timer, to control when objects do things. I am not sure this is the best way to do it. Could someone give some good ideas about how to solve the continious update case?


texts: Black bar in beetween the image when Background move infinite

texts:
I'm trying to scroll my background forever and so I'm using the background image twice. When the first one goes off screen, it should relocate to the end of the second one. However, there seems to be a black bar in between the two images and so it seems that the image is not being moved into place quick enough. What would be the algorithm to do such a thing to give the illusion of a continuous background? I've got this at the moment.i use this line of code for moving the background

>  for 1st sprite poistion

    >     sprite->setPosition(Vec2(0,0));
        sprite->setAnchorPoint(Vec2(0,0));

    for 2st sprite poistion

    > sprite2->setPosition(Vec2(sprite->boundingBox().size.width -10, 0));
        sprite2->setAnchorPoint(Vec2(0,0));

    void HelloWorld::sprite_move(){
    > sprite->setPosition( Vec2(sprite->getPosition().x-1, sprite->getPosition().y));
        sprite2->setPosition( Vec2(sprite2->getPosition().x-1, sprite2->getPosition().y));

        if( sprite->getPosition().x <-sprite->boundingBox().size.width){
            sprite->setPosition( Vec2( sprite2->getPosition().x + sprite2->boundingBox().size.width, sprite->getPosition().y));
        }
        if( sprite2->getPosition().x <-sprite2->boundingBox().size.width){
            sprite2->setPosition( Vec2( sprite->getPosition().x + sprite->boundingBox().size.width, sprite2->getPosition().y));
            }
        }


texts:
I'm trying to get lighting effects on a textured object; I'm using .obj and .mtl files to define them. No matter what I try my object is either invisible, unlit (plain texture), or completely white.

I defined my mtl by having my texture mapped to diffusion (that is, map_Kd texture.png). I found that if I don't set both a Ka and Kd (in addition to the texture) the object is invisible. Also, it seems that the actual ambient values don't change anything - they could be 0 and transparent, as long as they're defined.

If I set my material to have white ambient, diffuse, and specular, then the object is 100% white, no matter what I do with my light source. This is also after I set it to gl_separate_specular_color, as before that, I just got the plain texture. I tried making sure I had a normal defined for at least one face of the model, with no luck. I'm trying to have my texture be dominant, with a little bit of specular lighting on it.

What am I doing wrong? Is the lighting "working" but the all white means I haven't set my shininess properly? Is it being infinitely reflective or something?

Note: I'm using OpenTK and working in C#.


texts: Why does my PixelShader ignore color but respond to alpha changes?

texts:
I started teaching myself some DirectX a short time ago and found something I'm confused about. For some reason, I can only get the color of the model I'm drawing to vary between black and white, depending on the alpha that I set inside the shader.

This is my PixelShader (which compiles successfully during runtime):

float4 PS( VS_OUTPUT psInput ) : SV_Target
{
    return (1.0f, 0.0f, 0.0f, 1.0f);
}

Given the components are r,g,b,a and I'm giving them 1,0,0,1, this should return bright red! Instead, it produces this white area:

I haven't set a blending state.

What am I missing?


texts: unity how to automate changing sprite editor setting

texts:
I have a bunch of hex tiles that I want to import into a tile palette. However their pivot point needs to be set to y 0.35 when the default is 0.5

I could edit the import settings in the sprite inspector or change the pivot point in the sprite editor but that takes forever with hundreds of tiles.

Is there any way I could automate that?


texts: Edit bone transforms for each key frame to fix mixamo animation

texts:
I have downloaded FBX animations from Mixamo.com for use in game.

But seems like the "root" skeleton bone does not have translations in Z axis; which makes animations like climbing a ladder or ledge unusable in game engine.

The animation file does not have any mesh data and has just one animation layer.

So I am trying to write a small utility application using FBX SDK 2017.1 that will:

Read an FBX file that I got from Mixamo.com
For each keyframe translate the root skeleton bone to always maintain an offset in Z direction from pelvis bone
The above step will make the skeleton hierarchy jump due to root bone being translated. So in this step I want to recursively set pelvis bone at an offset for each key frame

Export the edited scene into an FBX file

Here's a code snippet

for (int keyIndex = numKeys-1; keyIndex >= 0; keyIndex--)
    {
        // For each key frame fix the Z transform for ROOT bone
        // Similar loop for PELVIS bone
        FbxAnimCurveKey pRootAnimKey = pRootAnimCurve->KeyGet(keyIndex);

        pRootAnimCurve->KeyModifyBegin();
            float originalValue = pRootAnimKey.GetValue();  // for debugging purposes
            float fixValue = 0.0f;
            FbxAnimCurve *pPelvisAnimCurve = pPelvisBone->LclTranslation.GetCurve(pAnimLayer, FBXSDK_CURVENODE_COMPONENT_Z);
            if (pPelvisAnimCurve != NULL) {
                FbxAnimCurveKey pPelvisAnimKey = pPelvisAnimCurve->KeyGet(animKeyIndex);
                // this "delta" can be a +ve or -ve value calculated from skeleton's Rest/T-pose
                fixValue = pPelvisAnimKey.GetValue() + delta;

                pAnimCurve->KeySetValue(keyIndex, fixValue);
            }

        pAnimCurve->KeyModifyEnd();
    }

I want the root bone to stay in between legs at an offset from pelvis bone, just as it is in rest T-pose.

Issue is that the exported file does have root bone follow pelvis bone's Z translation but after second loop is run and the file is exported my pelvis bone does not seem to follow root bone.
I have tried doing once conversion at a time i.e.

BUGGY animation -> FBX with root following pelvis bone
(1) -> pelvis following root bone

any ideas how to fix this?

There are ways to download mixamo animations without root bone i.e. pelvis is the root bone in that case and manually edit animation in Autodesk Maya to make it work. But I have 2400+ animations that needs to be fixed, so that would be a lot time consuming.


texts: Lets say I have a key and door. My third class (player) needs to pick up a key and open the doors. How should those objects communicate without making too much dependencies between them?


texts: Changing Hitbox from a single spritesheet

texts: I have different animation in a single spritesheet. I wonder how do you guys assigning these hitboxes?


texts: Correct primitive to start with for modified cone shape

texts:
I am very new to Maya and trying to make a Nikon F camera from reference images.

I can't quite wrap my head around how I would make the shape on top of the camera because it is essentially a square cone but has some modifications to the base and front slanted side that I can't seem to achieve with a square pyramid, I believe because of the rules of quad/tri geometries

Is this possible by starting with a square cone? If so how do I apply the relevant loop cuts horizontally and vertically?
Alternatively if is best to construct with another primitive could someone please detail which one?


texts: Stop map from scrolling but let player still move?

texts: I have a basic method of scrolling around on a map (moving the map instead of the player), but at when the player gets to a certain proximity to the edge, how do you stop the map from scrolling, but still allow the player to move around until it is away from that proximity? I'm not looking for any code. Just a suggestion so that I can implement it myself. I can see it visually (creating 4 boxed intersecting boundaries for the player to enter), but not sure how to come about stopping and resuming the scrolling of the map.


texts: I have 2 characters on a sphere. I would like one would move toward the other along the shortest way. How would I go about that?


texts: How to create a path-finder for a map like this?

texts:
I'm not sure if this is considered grid-based, because as you can see there is also a line. And that line is also a non-walkable point, I have no idea how do I create a path-finder with a non-grid-based. Currently I am using pacman-astar grid-based pathfinder, but it won;t fit to my game because I am using a line to block a characters path.

In the image below is the map with lines.

In the image below is the graph, white is walkable, black is not.

In the image below is the actual path-finding, as you can see in the red circle still passing through because I am using gridbased.


texts: What should my map creation workflow be for a turn-based tactics game?

texts:
I am planning to make a tile turn-based game like Final Fantasy Tactics. Now, I am brainstorming of how can I implements the map arena system (the battle arena where there are block by block tile so that character can walk on) such that it is easy to merge an art consisting of whole arena terrain onto the game.

I planned to create a full-map sprite, modelling it after a real place, then put it into the game. The problem is how do I code the program such that it will know the height and location of each tile out of a large single-sprite map? If I am to do that, then I should create some kind of editor that generate such data.

If I implements a tile by tile map creation, such that I use separate art sprite for each tile, then it would be hard to put the full map onto the game. I will have to build the map from tiny sprite, tile by tile.

I would kindly ask any professional or people who have done these type of game before, which method would you suggest me to do?

Another question that I want to ask is, if any of you know, how does game like final fantasy tactics layout their background map to make it look 3D? Do they simply make a sprite tile created from an angled (user's ) view instead of flat sprite with top-view? Or do they simply use flat top-view sprite and maps it on a 3D plane/terrain ?


texts: Monogame - How to correct “brightness-additivity” while using Alpha-Blend-State

texts:
When using

GraphicsDevice.BlendState = BlendState.AlphaBlend;

in monogame

following happens:

Is there any avaible method to keep the color brightness everywhere the same regardless of an overlap?


texts: Why do we say things are rotated around the z-axis in a space graph?

texts:
I've embarked on a journey of game development. I need to learn lots of 3D terminology, since I want to make 3D games. I learned that X is to the right, Y is up, and Z is towards you. Then why when a spatial is rotated we say it is rotated around the z-axis? I couldn't find a specific answer online.

Thanks for reading, and I look forward to your answer.


texts: I wonder about create every game engine module (render, input, sound, etc...) into dlls (renderer.dll, input.dll, etc...). What are pros and cons in your opinion of divide game into set of dlls ? I see only need to write game module in separate dll, to have posibility to create mods.


texts: How to get independent from GLEW dll file

texts:
I'm literally an absolute noob in GL. I just wrote my first GLEW piece of code yesterday:

#include <stdio.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glfw.h>

int main(void)
{
    glfwInit();
    glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4);
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
    glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    glfwOpenWindow(640, 480, 8, 8, 8, 0, 24, 0, GLFW_WINDOW);

    glewInit();

    glfwSetWindowTitle("OpenGL Rules!");
    glfwEnable( GLFW_STICKY_KEYS );

    do{
    glfwSwapBuffers();
    }while( glfwGetKey( GLFW_KEY_ESC ) != GLFW_PRESS && glfwGetWindowParam( GLFW_OPENED ) );
}

This compiles just fine with (using mingw on win8 x64):

gcc opengl.c -lglfw -lglew32 -lopengl32

However, in order to run the output, I have to copy the glew32.dll to the same directory from which I'm running the program. Is there a way to get independent from the dll? Like, compiling once and using without having to carry the dll around?


texts: Java collections and managing simultaneous operations / concurrency (java.util.ConcurrentModificationException)

texts:
Ok, so i have created my first "game" and it uses a lot of java's collections. for example, i have a bunch of monsters in a HashSet which sometimes gives me the fabled java.util.ConcurrentModificationException when i try to modify the HashSet.

Basically im getting these exceptions when im within a for loop and then some other part of the system find it suitable to add or remove an element to/from the collection.

My options as far as i know is:

  1) Use a Thread Safe collection or use Collections.asSynchronizedCollection().

  2) Only work on copies of the collection when looping through it.

My question thus becomes. Is there any other methods more widely deployed solutions in the gamedevelopment world that handle's these issues?

As an example, i thought ive read somewhere that queues are more heavily used instead of collections and that work is done on input and output queues. <-- any elaboration on this would also be appreciated!

Thanks for your time!


texts: Advantages And Disadvantages Of Resource Serialization

texts:
A good example is let's say I'm making a pong game. I have a PNG image for the ball and another PNG image for the paddles. Now which would be better, loading the PNG images with a PNG loader, or loading them in a separate program, serializing it, and de-serializing it in the game itself for use?

The reason why this may be good to know is because it seems like game companies (or anyone in the long run) build all of their resources into some sort of file. For example, in the game Fallout: New Vegas the DLCs are loaded as a .ESM file, which includes everything it needs, all the game does is find it, serialize it, and it has the resources. Games like Penumbra: Black Plague take a different approch and add a folder which contains all the textures, sounds, scrips, ect that it needs, but not serialized (it does this with the game itself, and the DLC).

Which is the better approch and why?


texts:
I'm trying to make my own first person camera controls in unity that use both thumbsticks on a joypad. I have this working fine. However, when I move the right thumb stick (the one uses to look left / right & up / down the camera begins to constantly update.

Here is my joypad movement code:

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

    float speed = transform.localEulerAngles.y + Input.GetAxis("LeftRight") * sensitivityX;

    rotationY += Input.GetAxis("UpDown") * sensitivityY;
    rotationY = Mathf.Clamp(rotationY, minimumY, maximumY);

    transform.localEulerAngles = new Vector3(-rotationY, speed, 0);

}

To control the left thumb stick, I've simply attached the my script to a first person character controller Unity provide.

I know my code is updating every frame, but I assumed that it would only update as and when I press the right thumb stick. If that isn't the case, is there a way I can limit it to only increment when I move the right thumb stick?


texts: SFML - Difficulty with Rect Motion when using 1028x720 image per frame

texts:
Hello their just having a little tediously annoying problem
that I just can't seem to figure out I've tried numerous things
from using for loops on iterators and index values , iterating a index for the usual switch statement  "switch(index)" then rendering the image per frame also tried rendering per delta time all leading to pretty poor results such as
the frames would change but each frame index would have it's own unique
time it took to change too the next frame was rather bizzare actually
anyways the problem is "sorry for that long introduction" :

I'd like to render a HD image animated background in my video game
using SFML and C++ .

The problem is that it won't change the index slow enough
even when using delta time "sf::clock deltaclock = sf::asMilliseconds" , frameratelimiting and or verticlesync also won't move the clip rectangle for the texture correctly enough to give the illusion of an animated hd image...

Id show code but I think the problem doesn't require it
at all unless for showing how to do the solution
all I want is too be able to simply move a clip rect a certain amount
on a 1 HD image per frame for a 3 frame HD spritesheet using SFML and C++.

What that means is I have 3 HD images of 1024 width and 720 height
at different locations on a spritesheet and Id like to use a clip rectangle
too move across this spritesheet fast and correctly enough
to give the illusion that the 3 HD images as a whole 1 HD image
are animated in game without any suttering , lagging or way to fast speeds.

one solution I had was too use a sprite sheet and split up the entire background into little tiles and render them all seperatly using a tilemap text file with numerical digits in it representing certain tiles,etc ... but that seems overkill.

Thank you in advance


texts:
How can I store dialogue so that it could be read for a kinetic (linear) Visual Novel type of game in XNA/MonoGame?

I'm currently using a .txt file, but I noticed that I can't read from a specific line using the System.IO.StreamReader class.


texts: Is it normal to these Xcode prompts/errors when you deploy to IOS Simulator from Unity?

texts:
Just trying out the IOS build process....

Is it normal to see:

Q1 - "upgrade to latest project format - project currently in Xcode 3.1 format, this will upgrade to 3.2" - just click OK and let Xcode do it's stuff?

Q2 - same as Q1 but this time for the message "Remove obsolete build settings - will remove the build setting PREBINDING"

Q3 - also when deploying to "Lastest IOS Simulator" you get the Simulator target produced, but also a non-simulator target which has lots of errors.  So I assume you just ignore this target and not use it in Xcode correct?  (i.e. just use the simulator target that is produced)

Q4 - get a lot of warning after the simulator target is built?  program works ok however....

Images

For Q1 and Q2:

For Q4:

Settings used in Unity:

Errors I see in XCode:


texts: How can I save my game state so it can be resumed when my application resumes?

texts:
I've found that after resuming my game the whole engine is reloaded and application is reinitialized. I want to save engine state and in "onResume," resume the game process from where it left off.

I've tried to save the engine (mEngine) and then after resume the game in "onLoadEngine" return saved engine. I think it is a bad solution and it doesn't work anyway.

What is the best solution for resuming my game (after the power key was pressed, for example) in AndEngine ?


texts: Client Side Logic vs Server Side Logic for HTML5 Game

texts:
I'm writing an HTML5 game that takes place in a single screen and does not have any data that would need to be saved (except for a score). I am writing all of my canvas logic on the front end. because it seemed like the easiest way to program interactions. However Ive been reading on r/gamedev that the best way to organize games is to sent client input to the server and have the server render the results on the client. I have a couple questions about this:

1.) If my game takes place on a single screen (meaning no changes in background, enemies, etc. Think Space Invaders), is it worth putting my game logic on the server?

2.)If I do put my logic on the server, how can i facilitate clean communication with the client? Web sockets? or plain HTTP? Using a WebSocket seems straightforward for this kind of task, but they are not supported by all browsers. On the flip side I'm kind of hazy on how HTTP could be used to send and receive data from the client.

Any advice would be great.


texts: If condition true, but code is not executed in Unity

texts:
I have a script which triggers a movement when a rotation is completed. The script casts the Euler angle of a transform to an int. If it is true, the condition is executed. For some weird reason, the code in the if condition does not execute, even if the condition is true. I have confirmed the condition is true through both my compiler and the debug log.

Here is my code:

if(rotationInitiate)
{
    transform.eulerAngles = Vector3.Slerp(transform.eulerAngles,
        new Vector3(0, 0, angleOfRotation), Time.deltaTime * speedOfRotation);

    Debug.Log(transform.eulerAngles.z);

    if((int)transform.eulerAngles.z == 180)
    {
        Debug.Log("Hurray we have successfully executed the if statement");

        // More rotation stuff
    }
}

As you can see by my log, the angle returns an exact value of 180, but does not enter the if statement to perform the second log output:

Why might my if statement not be executing?


texts:
I'm having some trouble putting together a method that will constantly move a "bullet" in the same direction accurately. Here is what I have so far

public Vector3f moveFromPosition(Vector3f location, float pitch, float yaw, Game game) {
        Vector3f loc = location;
       loc.z += 0 * Math.cos(Math.toRadians(yaw - 90)) - 1 * Math.cos(Math.toRadians(yaw));
       loc.x -= 0 * Math.sin(Math.toRadians(yaw - 90)) - 1 * Math.sin(Math.toRadians(yaw));
       loc.y += 0 * Math.sin(Math.toRadians(pitch - 90)) - 1 * Math.sin(Math.toRadians(pitch));
       return loc;
    }

This method is being called in the render method, so every frame it will move the bullet 1 space depending on the pitch, yaw, and location the bullet was fired from. The pitch and yaw values stay the same each frame, and the vector3f "location" stands for the location the bullet is currently at. The bullet is then translated accordingly depending on the return location from this method.

The x and z values are calculated correctly, but the y value seems to be a little off and I can't figure out why

Here is where the method is being called from

package Entitys;

import Main.Game;
import Model.Model;
import Tools.TrigCalculator;
import org.lwjgl.util.vector.Vector3f;

public class Projectile {

    Model model;
    Game game;
    Entity entity;
    Vector3f startLocation;
    float startPitch;
    float startYaw;
    TrigCalculator trigCalculator;

    public Projectile(Vector3f startLocation, float startPitch, float startYaw, Entity entity, Game game){
        //The location the camera is at, or where the bullet will be fired from
        this.startLocation = startLocation;
        //Camera's pitch when shot
        this.startPitch = startPitch;
        //Camera's yaw when shot
        this.startYaw = startYaw;
        //The entity representing the bullet
        this.entity = entity;
        //The class the calculation moveFromPosition is at
        this.trigCalculator = game.getToolHandler().getToolTrigCalculator();
    }
    /* This move method is being called in the render method */
    public void move(){
        //Translating the entity according the the calculation below.
        entity.setTranslation(startLocation);
        //Here is where the method is called
        startLocation = trigCalculator.moveFromPosition(startLocation, startPitch, startYaw, game);
    }
}

Requested Edit: This is how I create a new projectile

projectiles.add(new Projectile(new Vector3f(loc.x, loc.y, loc.z), game.getCamera().getPitch(), game.getCamera().getYaw(),entity, game));

After debugging the return of game.getCamera().getYaw() and getPitch() both return the correct value. Then it's passed into the startPitch value, which is passed into the moveFromPosition method each frame. Other than that it doesn't change.


texts: How can I implement dynamic button size?

texts:
I'm on the process of planing a sort of a 2D/2.5D, pixel-art multilingual game, while I learn about game development. I have a pretty solid background at programming, but when it comes to game design, I don't know too much. My particular question is about how is the proper/better way of creating and implementing a game text button, but I suppose it can be applied to other GUI elements. What I have found so far, while "googleing"/looking for this specific question, is how to deal with engines or frameworks which have their own way of doing it, but I would like to do it by my own. So to make things clearer, let me expose my vision of potential approaches.

Fixed text in a fixed-size texture

This is an easy way of implementing a text button, as all I have to do is loading and positioning a texture. However, it could be painful to change my .psd files all the time, as I'm working with a multilingual game.

Variable text and fixed-size texture

I could use a texture as a button model and overlap it with all kinds of text of different languages, reading the texts from .xml files. The problem is that a word in a language can exceed its equivalent of another language. A workaround for this could be switching between different font sizes, i.e., a text in a language would be smaller or larger than in another, but this would look ugly.

Variable text and splitted texture

This approach would divide a button texture into 3 different parts: left, middle and right. Then, I would read a text from a .xml file, measure its length in pixels and increase ("multiply") the "middle" part of the texture so that the text could fit on it. This looks fine when working with a pixel-art game GUI, but sounds not fine when working with vectorized images.

Dynamically-generated GUI

I could use OpenGL to render rectangles and use them as buttons, but this would produce quite basic shapes. At most, I would have shaded rectangles with a basic border and some text rendered on it; it would look like a HTML/CSS GUI, which is a way far from a game GUI.

These approaches are just my guesses, as I've never worked in the game industry; I assume that someone experienced can correct me if I deduced something wrong. Another thing is that I think these approaches can work diffently depending of the texture type (e.g. pixel-art and vectorized textures), so you'll be welcome for answering why an approach is better for a texture type or another. There's also a possibility of me being a bad thinker and all of this being a "bullshit", and if it is the case, I hope you share your technique with me.

Moreover, as I said before, this question is specific for a text button, but I think with some adjustments it could cover more GUI elements which have related properties (such as window, text input and the like), so if you include it as part of your answer, it'll be helpful.