texts: ECS in MMOs - How to handle IDs for different object types?

texts:
Using a DOD approach, what is the typical way to handle dealing with the actual IDs of game objects?

Obviously, each entity has a unique entity_id that is generated in-game. And using the component system, the game (server side at least) can determine if the entity is an item, an NPC, a player, etc. My question concerns handling the 'data' ID, as in the ID of the item/npc stored in the database.

The first approach I can think of, is just having one gigantic 'entities' table, with columns that can represent what that entity actually is. In this approach, all entities will have a unique ID (ie, the primary key in the database).

The second approach is to have an Items table, an NPC table, a Vegetation table, etc. But assuming on how one designs the table, there can be an item with an ID of 1, and NPC with an ID of 1, and a Tree with an ID of 1.

Because its an MMO, its inefficient to send all data concerning the entity to the player through a packet. Instead, the client side would have the same data set, so that when one of these pre-defined entites spawns in, the packet can simply tell the ID and location, then the client can look up the ID and construct the entity itself.

Would it then be best to have seperate packet types per entity type? This would be necessary if using the second approach, as there can be entities with the same 'data ID'; IE, a 'NPC spawned' packet, an 'Item spawned' packet. But at the same time, I would also need to include a bit of extra data, the entity_id generated in-game, so the server can confirm which entity the player attacked/picked up, etc. This of course means slightly more bandwidth usage.

The first approach would simply mean I have a single packet type, 'entity spawned', with the data ID and location. Because the first approach is guaranteed to have 'unique' data IDs, would I even need to send the 'entity_id', assuming the entity_id is the same as the data ID?

Sorry if this question isn't too clear. I guess the tldr version is: Whats the best way to design the data tables to hold entities, and whats the best way to design the packets that 'send' that entity to the client?


texts: How to seamlessly texture a cube in OpenGL

texts:
I have been following this site as an intro to OpenGL.

After going through the model obj loading tutorial, I wanted to create my own .obj (a cube) as well as my own texture. Following this blender tutorial I created and textured the cube, and exported the .obj and .dds which I am loading in the OpenGL tutorial program.

My issue is that in both cases, the original tutorial .obj/.dds and my own custom one created with blender, the texture for each face of the cube has a slight black edge around it.

I can't figure out how to change this, so that I have a "seamless" texture around the cube, with no black or white edges.

I'm not sure if this is something that needs to be adjusted in Blender, or in the c++ application. Any help would be appreciated!


texts: Finding unoccluded tiles in tile-based game

texts:
I am working on a 2D tile-based game, and right now I'm trying to get a 2d equivalent of shadow volumes to work. I'm having trouble finding the surfaces that should cast shadows. From any point in the game, I need to find either the unoccluded faces, or the whole tile.

My question is, is how can I find these tiles/edges as fast as possible given a point?


texts: How to know if an overriden method calls its super method or not?

texts:
Consider this situation, where a Player class inherits from a more general Actor class:
Actor.gd
class_name Actor extends KinematicBody2D

func _ready():
    print("I am an actor")
    _foo()

func _foo():
    print("I was thinking I was an actor")

Player.gd
class_name Player extends Actor

func _ready():
    print("I am a player")

func _foo():
    print("I was thinking I was a player")

When one instantiate a player in a scene, we have this output:
I am an actor
I was thinking I was a player
I am a player

How to know when a method will call its super class?


texts: In snapshot-based networked game does client store N snapshots as well?

texts:
I understand that in a snapshot-based network replication system the server holds onto N full snapshots and uses incoming ACK'd data from the clients to construct delta snapshots. This makes sense.  What I have not seen a lot of information about is how the client uses that delta compressed snapshot to apply the changes.

Does the client store N snapshots so that it can reconstitute the delta compression against the reference it claims to have, or does it simply have one snapshot state of accumulated deltas? I imagine the former being correct, but the latter being less memory.

I've read How would a game-state snapshot system be implemented for networked real-time games? and and other answers, looked at Fabien's post, and read a couple of articles by Valve, but I am still unclear.

Any thoughts on this?


texts: Add a sound to all the buttons in a project

texts: Is there an option on the texture_button or something like that where you can specify a sound to be played on button-press. I have created a global sound_manager but for the button presses, I have to manually code it everywhere the script has a button_pressed signal. Or some kind of logic that when a button is pressed anywhere in the project, sound_manager plays a particular sound.


texts:
I'm having problems trying to limit the range my camera can pitch. Currently my camera can pitch around a model without restriction, but having a hard time trying to find the value of the degree/radian the camera is currently at after pitching. Here is what I got so far:

    // Moves camera with thumbstick
    Pitch = pController.ThumbSticks.Right.Y * MathHelper.ToRadians(speedAngleMAX);

    // Pitch Camera around model
    public void cameraPitch(float pitch)
    {
        pitchAngle = ModelLoad.camTarget - ModelLoad.CameraPos;
        axisPitch = Vector3.Cross(Vector3.Up, pitchAngle);

        // pitch constrained to model's orientation
        axisPitch.Normalize();
        ModelLoad.CameraPos = Vector3.Transform(ModelLoad.CameraPos - ModelLoad.camTarget,
            Matrix.CreateFromAxisAngle(axisPitch, pitch)) + ModelLoad.camTarget;
    }

I've tried restraining the Y-camera position of ModelLoad.CameraPos.Y, but doing so gave me some unwanted results.


texts: Position Object always at the same distance of 2 other moving Objects?

texts:
I am making a procedural animation of a worm. I have already something working:

(the green dot is the position Target, purple and red are the Head and the Tail of the Worm)
I would like to add another dot in the center of the Worm to simulate the middle body waving up and down while Head and Tail are moving like this:

I thought that it was going to be easy using some kind of 2D joint, but I tried several and I was not able to find a good result.
I was also thinking that maybe I have to make some trigonometry to calculate the possible positions of Center:

Before I over-engineer the solution what would be your approach to solve this?


texts:
A lot of the online games out there have this concept of "User" or "Profile", and the concept of "Player". The "User" has username, password, lifetime stats, ... etc. The player concept is per game basis, and holds volatile information around the currently played match. That's how I picture it, at least.

I am puzzled about how is that usually implemented? Does the player class hold a pointer to the User object, or does it inherit from user? or maybe something else?

I can't completely decouple the two, since during the match, I need to send messages back and forth between "user" and "player" (e.g. update achievements)


texts:
I have enemies that spawn in different positions but what I want to do is that if you don't kill it after three seconds, the enemy disappears (but the spawning keeps happening of course, the enemy will show up again eventually). I tried using a coroutine but after reading the documentation and watching some tutorials I still don't understand very well how it works so I need some help. Thanks in advance.
This is my code so far:

public class TimedSpawn : MonoBehaviour {

    public GameObject spawnee;
    public bool stopSpawning;
    public float spawnTime;
    public float spawnDelay;

    private GameManagerScript GMS;

    void Start ()
    {
        GMS = GameObject.Find ("GameManager").GetComponent<GameManagerScript> ();
        InvokeRepeating ("SpawnObject", spawnTime, spawnDelay);
    }

    public void SpawnObject ()
    {
        if  (GMS.counterDownDone == true){

        Instantiate (spawnee, transform.position, transform.rotation);
     }

        if (stopSpawning) {
            CancelInvoke ("SpawnObject");
        }
    }
 }


texts:
I have a "low poly" surface, where the color palette for polygons is low (e.g. 20 distinct colors). Is there a way to change the color (with a smooth transition) for all polygons painted with a certain color?

Maybe an analogy would be to smoothly make all polygons of a certain color transparent..

Background:

I have managed to get a 2D variant working: load a bitmap on a canvas and use a shader to change the color.


texts: Mismatch between scene view and game view

texts:
In my scene view, it looks like the player is correctly lined up with the map. But when I see it in the game view, it's off. You can see the Game view in the top-middle, and the Scene view in the bottom left. The map sprite in the game view seems to be off by one tile. It could be that the collision is off too.

What could be causing it and how can I fix it?


texts: Does it make sense for a view matrix to have a scale?

texts: When building a view matrix from an SRT matrix multiply, examples (here and here) only ever compose it with a R and T. Does it make sense to have the S component be anything other than the identity? What does it mean to scale the view matrix anyway?


texts: why is Lua so important ( frequently used ) in game development

texts:
I have written some small games for fun myself, but never used Lua myself.

I have seen people discussing Lua's use in games everywhere.

The question is: What benefit can I get from using Lua in game development?

Can someone explain this a little bit to me?


texts: Converting Animation data from Maya to DirectX in C++

texts: I am currently trying to export an animation from Maya and import to a program I am working on. One of the problems I currently have is that when imported, the mesh and animation data looks reversed along the Z-axis. I do know the Maya is right handed where as DirectX is left handed. I was curious if there was a simple solution to this. I was able to convert the mesh just fine, with the help of this web page, http://rastertek.com/dx10tut08.html. But this didn't tell me how to the animation data as well. Any help solving this problem would be awesome. Thanks in advance.


texts: Unity installed version higher than game project version - can't open the game project anymore

texts:
Long story short - I had to uninstall Unity and Unity Hub and reinstall them again.
I ended up installing Unity version 2020.2.1f1.
Some of my game projects were made using version 2020.1.6f1
Now I cannot open them - there is a yellow warning triangle next to those games in Unity Hub.
I am installing version 2020.1.17f1 as I type these.
So my questions:

Is there no backwards compatibility between newer versions of Unity and older games?
How do people deal with this?
I've heard people transition their games during development into newer versions of Unity but I wasn't even able to open the games made with older version.
How would I go around this if I had spent 2 years or more of development time and was suddenly locked out from my game project - how do I prevent situations like these?

Here are my Unity versions installed:

And here are my games (tutorials mostly):

I may have answered my own question, but still need your input guys. I just noticed that there is a 'Select Version' dropdown on the right that allows me to open a game project in Unity version I have installed on my system. Is this how you deal with those issues?


texts: example for creating button programmatically

texts:
Can someone give me an example of programmatically (not using a prefab) creating a button in Unity 5 using C# that has the following features?

a text on the button (that I can change)
an OnClickListener
attached to a script that will store values for the button and contain the OnClick event handler
the create method for the button should return a reference to the button so I can modify it at a later point from another script

My attempt was:

main.cs

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class main : MonoBehaviour {

    public Canvas c;

    // Use this for initialization
    void Start () {
        createButton ("minion",999);
    }

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

    }

    //this is giving a button prefab all the methods from the class btnController
    void createButton(string name,int val){
        GameObject go =new GameObject();
        go.AddComponent<btnController>();
        go.transform.SetParent (c.transform,false); //add the gameobject to the canvas

        go.AddComponent<Button> ();
        //Button btnChild = go.GetComponent<Button> ();
        //btnChild.GetComponent<Text>().text = "hello";//doesnt work
        //go.GetComponentInChildren<Text>().text = "hello!";

        btnController bc= go.GetComponent<btnController>(); //get reference to script for this button prefab
        bc.Setup(name,val);//set values in this script for the GameObject to hold

        GameObject inst =Instantiate (go);
    }

}

btnController.cs

using UnityEngine;
using System.Collections;

public class btnController : MonoBehaviour {
    string name="test";
    int value=6;

    //this script is attached to the button prefab. the onClick of the button prefab points to this OnClick method

    public void Setup(string n, int v){
        this.name = n;
        this.value = v;
        //Debug.Log ("in button setup:"+name+" "+value.ToString());
    }

    //OnClick is public so I can set the On Click () function to this method (in the prefab button)
    public void OnClick(){
        Debug.Log("btn clicked: "+this.name+" "+this.value.ToString());
    }
}


texts: Load the prefab in the array by name in Unity

texts:
I'm using this line of code to select my level, and currently I have different scenes for each levels. I want to be able to reuse the same scene to change levels as well but I don't know how, here's the line:

button.GetComponent<Button>().onClick.AddListener(() => Levels("Level " + button.levelText.text));

Since I'm using string to load my scene with the function below:

void Levels(string value)
{
    SceneManager.LoadScene(value);
}

I really wish I could use prefab name instead the scene name and I don't want to have 20 scenes for it. Any help would be appreciated.


texts: Place tiles along a specific axis / direction

texts:
I want to be able to place tiles only in the direction I've started "drawing" them.
For an example, if I click and hold on tile at position (0,0), and start dragging to the right, I only want to select or draw on coordinates (1,0), (2,0), (3,0) and so on. However, for the next tile, if I point my mouse at the tile (4,1), I only want (4,0) to be selected, aka, ignore the Y changes because I'm currently placing on the X axis.
What would be a good and clean way to do this?
I've tried doing this but not only does it not work well, my code is very bloated because I'm not good at this logic that requires more math than usual. Here's what I tried (needless to say it's very messy and didn't work properly):
private bool isSelecting;
private Vector3Int selectionDirection = Vector3Int.zero;
public List<Vector3Int> selectedPositions = new List<Vector3Int>();
private SelectDirect selectDirect;

    if (Mouse.current.leftButton.wasPressedThisFrame)
    {
        if (UIManager.IsMouseOverUI()) { return; }

        Vector3Int gridPosition = Map.GetGridPosFromMousePos();

        if (Map.IsInsideMap(gridPosition))
        {
            if (!selectedPositions.Contains(gridPosition)) { selectedPositions.Add(gridPosition); }
            isSelecting = true;
        }
    }

    if (Mouse.current.leftButton.wasReleasedThisFrame)
    {
        isSelecting = false;
        selectedPositions.Clear();
        selectionDirection = Vector3Int.zero;
        selectDirect = SelectDirect.None;
    }

    if (isSelecting)
    {
        if (selectionDirection == Vector3Int.zero && selectedPositions.Count == 2)
        {
            selectionDirection = selectedPositions[1] - selectedPositions[0];

            if (Mathf.Abs(selectionDirection.x) + Mathf.Abs(selectionDirection.y) > 1)
            {
                isSelecting = false;
                selectedPositions.Clear();
                selectionDirection = Vector3Int.zero;
                selectDirect = SelectDirect.None;
                return;
            }

            if (selectionDirection.x == 1) { selectDirect = SelectDirect.Right; }
            else { selectDirect = SelectDirect.Up; }

            Debug.Log(selectDirect);
        }

        Vector3Int gridPosition = Map.GetGridPosFromMousePos();

        if (Map.IsInsideMap(gridPosition))
        {
            switch (selectDirect)
            {
                case SelectDirect.None:
                    if (!selectedPositions.Contains(gridPosition)) { selectedPositions.Add(gridPosition); }
                    break;
                case SelectDirect.Right:
                    if (gridPosition.x - selectedPositions[selectedPositions.Count - 1].x == Mathf.Abs(selectionDirection.x) && !selectedPositions.Contains(gridPosition))
                    {
                        selectedPositions.Add(gridPosition);
                    }
                    break;
                case SelectDirect.Up:
                    if (gridPosition.y - selectedPositions[selectedPositions.Count - 1].y == Mathf.Abs(selectionDirection.y) && !selectedPositions.Contains(gridPosition))
                    {
                        selectedPositions.Add(gridPosition);
                    }
                    break;
            }
        }
    }


texts: DDS files with DirectX Tk, Some work, some don't

texts:
I am learning DirectX with the DirectX Tool Kit library and everything seems to be going smoothly but I have run in to a tiny little hiccup.

I am currently trying to load DDS textures from file because this method is easier than loading common JPG or PNG files. The problem is that DDS images I create from Paint.NET work fine. Images in PNG or JPG file formats converted to DDS do not work and my program throws an exception.

So does anyone have experience with this type of problem and if so, how did you solve the problem?
Also is there any workflow oriented software I can use for creating DDS files?

I plan to make my application with DirectX and DirectXTK. (It is too late to turn back now...)


texts: Unity playing run animation but retaining a t-posed model in the background

texts:
I downloaded a character in Mixamo without any animations and then proceeeded to download a separate FBX with animation then without any mesh, so I have 2 FBX files.

I then proceeded to add the model in my scene, add an Animator component and create a AnimatorController. I add the animation in AnimatorController. Here it how it looks like:

So I'm expecting the model to run upon Play and it did but the problem is how its displaying. It looks like this:

The running animation is playing but there's another model at the background following the running model.

I don't know what's happening and what I did wrong. Any ideas, please?

BTW, Rig animation type is set to Generic. I tried Humanoid as well, still the same.

EDIT:

Added images of Heirarchy and Assets

EDIT 2:


texts: How can I resize my Blender models when importing to Unity?

texts:
I made a 3D model in Blender, but when put it in my Unity project and add an FPS-camera the camera is bigger then my model. I used the measurements of Blender (that one cube is 1 meter in Unity).

How can I fix this?


texts: Unity GameView Differrent with CameraView - Dont have 3D environments

texts:
Now on my existing project, if i create new scene, automatically i got my gameview like below :

above game does not have 3d environments outlook, i'm expecting like below (my old existing scene) :

Any Idea to solve this ?

thanks


texts: How does layer based collision affect performance

texts:
In Unity3D, and others, there are Layer Based Collision System which makes collisions only happen between specified Layers.

It defaults to all layers colliding with all others.

Does making use of these setting decrease performance, or increase performance?

I could imagine it decreases it if every potential collision had to be checked for it's layer.
Or are those collisions completely bypassed?


texts: Time-passed check with Pause functionality

texts:
I am working on a game that has a lot of time-passed checks of the following format. These work great, but there is a problem when the game is paused:

If paused for any meaningful amount of time, the if statement will become true.

const t = new Date().getTime(); // Get the current time (in ms)
const fireCooldown = 500; // The time to wait before firing again (in ms)

if(t > lastFireTime + fireCooldown) {
   lastFireTime = t;
   fire();
}

How can I integrate pause functionality into this - in a way where pausing does not make the if statement true?


texts:
I have an FPS controller and I want to change the camera when it collides with a box collider. I think I did it properly but it didn't work. Here's my code:

using UnityEngine;
using System.Collections;

public class change_camera : MonoBehaviour
{
  public Camera Playercamera;
  public Camera Topcamera;

  void OnCollisionEnter(Collision col)
  {
      if (col.gameObject.name == "FPSController")
      {
          Playercamera.enabled = false;
          Topcamera.enabled = true;
      }
  }
}

Thanks in advance.


texts: Creating 3D objects from code and their normals

texts:
I'm trying to create my own 3D objects from scratch so I can generate my own terrain for a game I'm making.

So I created a cube and realized the lighting was strange, I looked up the cause and found that each face needed multiple vertices so they could hold their own individual normal because face x's normal will be different to face y's normal, even though the vertices are the same.

So I re-made my cube this way and went on with my terrain generating code. Now that I'm getting into creating more sophisticated meshes the number of vertices and indices are getting quite high (atleast compared to my cube) and a big reason for it is because I have to replicate a lot of the vertices just to have a different normal.

I just wanted to ask if this is normal (I know, I'm so funny) and that I'm doing everything right? Or is there a simple way for a single vertice to hold multiple normals?


texts: Is naming an app similar to another app legal?

texts:
I just finished my first ever app after 1 month of programming it and I'm ready to put it on the app store/google play. I searched the stores to see if the name i wanted to name my app was still available. Say i wanted to name my app "example App". I found an app named "exampleApp" but the name "example App" was still available. Could I still legally put my app name as "example App" without worrying about getting sued or having to get my app name changed? The game play and graphics are entirely different. Thanks.

P.S. That app also has over 1,000,000 downloads so if I could still name my app "example app" would that be a bad idea and make it harder for people to find my app? Or would it make my app more popular by someone accidentally finding it in the search?


texts: Press multiple switches to unlock the door

texts:
I made 2 scripts, one that is a switcher and one that checks if object is switched (Switch, SwitchCheck).

Switch script (it's on 2 objects that are switches and both objects have colliders with IsTrigger checked):

public var IsPressed : boolean = false;

function OnTriggerStay (){
    if (Input.GetKeyDown(KeyCode.JoystickButton1)){
        IsPressed = true;
        Debug.Log("Switch activated");
    }
}

SwitchCheck script (it's on door that should be opened)

public var Switch1 : Switch;
public var Switch2 : Switch;

function Update()
{
    if (Switch1.IsPressed && Switch2.IsPressed)
    {
        Destroy (gameObject);
    }
}

Now, he problem here is, that it "does" kind of work...after I press the button like 20 times.
My question is, did I write something wrong?


texts: Literature about Open World Games, Freedom to Choose

texts:
I'm doing a diploma thesis about the development of games with freedom to choose or open world.

Topics will be i.e. development issues in programming and the design itself, mechanics etc.

For that I need literature and lot's of it. Do you have any suggestions?


texts:
I'm looking into how to do a game engine using only C and wanted to know how to implement ECS in C.

I didn't find any ECS implementation for C, it only seems to exist for C++.

So I'm wondering... Is it possible to implement such a feature?

And if so, how to implement such a pattern in C?


texts:
I'm researching Monogame. Their goal is to allow "easy" porting of an existing XNA/Windows game to mobile.

Does this mean you can have one solution (theoretically) with shared code, and it works on all three platforms (PC, Android, iPhone)? Or do you need to port your game from PC to Android, and then again to iPhone?

I'm sure "write once, run anywhere" works 80% of the time, I'm not worried about that other 20% like support for GPS, acceleratometer, etc. which doesn't exist on all platforms.


texts:
I am trying to write a fragment shader in GLSL for a fog effect in a 2D game.

Here are some links showing what I'm after.

Here the fog is in the foreground and near the ground:

https://twitter.com/i/status/992811158318075904

Here the fog is on a background layer and fills the screen:

https://twitter.com/i/status/963889084337983488

Here the fog is more subtle and denser near the ground:

https://twitter.com/i/status/1001926421856563205

I am interested in learning how to create these effects. Unfortunately, I am pretty new to shaders and only know how to do elementary stuff like color swaps, outlines, and simple vignettes. It doesn't help that it's hard to find resources on shaders with a bent toward 2D.

In the environment in which I'm working, I can attach a shader script to any of my sprites, parallax background layers, etc.

Does anyone have advice on creating these kinds of effects?


texts: How could I implement collision resolution with MonoGame

texts:
I'm building a game engine (for learning and self-development purpose), and I'm starting implementing collision resolution, I already have the collision detection part but I cant' find any good article or post about that and how to achieve it in details.

Here's my code for the collision detection:

That's the method called in the Update method, the Engine holds a list of BoxColliders called Colliders

private void CollisionDetection()
{
    foreach (BoxCollider boxCollider in Colliders)
    {
        if (!boxCollider.Collider.HasValue) continue;

        var collider1 = (Rectangle) boxCollider.Collider;
        foreach (BoxCollider boxCollider2 in Colliders.Where(x => !x.Guid.Equals(boxCollider.Guid)))
        {
            if (!boxCollider2.Collider.HasValue) continue;
            var collider2 = (Rectangle) boxCollider2.Collider;

            if (collider1.Intersects(collider2))
                boxCollider.OnCollision(boxCollider2);
        }
    }
}

And here's the OnCollision(BoxCollider other) method :

public void OnCollision(BoxCollider other)
{
    if (other.Collider == null || Collider == null) return;

    var rect = (Rectangle) other.Collider;
    var intersect = Rectangle.Intersect(Collider.Value, rect);

    // TODO : Resolve collision
}

I also have basic physic in the Engine so I would like a falling object to stop falling if it is against another collider.

In the case of a player walking on the ground, I guess the ground should apply an opposite force to the player if it collides ?


texts: What is the breakdown of jobs in game development?

texts:
There's a project I'm trying to start for Indie Game Development; specifically, it's going to be a social networking website that lets developers meet through (It's a secret). One of the key components is showing what skills members have.

Question: I need to know what MAJOR game development roles are not represented in the following list, keeping in mind that many specialist roles are being condensed into more broad, generalist roles:

Art

Animator (Characters, creatures, props, etc.)
Concept Artist (2D scenes, environments, props, silhouettes, etc.)
Technical Artist (UI artists, typefaces, graphic designers, etc.)
3D Artist (Modeling,  rigging, texture, lighting, etc.)

Audio

Composer (Scores, music, etc.)
Sound Engineer (SFX, mood setting, audio implementation, etc.)
Voice (Dialog, acting, etc.)

Design

Creative Director (Initial direction, team management, communications, etc.)
Gameplay Designer (Systems, mechanics, control mapping, etc.)
World Designer (Level design, aesthetics, game progression, events, etc.)
Writer (Story, mythos, dialog, flavor text, etc.)

Programming

Engine Programming (Engine creation, scripting, physics, etc.)
Graphics Engineer (Sprites, lighting, GUI, etc.)
Network Engineer (LAN, multiplayer, server support, etc.)
Technical Director (I don't know what a technical director would even do.)

Post Script: I have an art background, so i'm not familiar with what the others behind game creation actually do. What's missing from this list, and if you feel some things should be changed around how so?


texts: sprite jitter when max acceleration reached at camera

texts:
Camera seems making sprite jitter when max acceleration is reached :

Thats my camera code :

            var delta = (float)time.ElapsedGameTime.TotalSeconds * 10;
            var speed = (player.recCamPosition().X - _pos.X) / FocusSpeed;
            _pos.X += speed * delta;
            var speedY = (player.GetPosition.Y - 120 - _pos.Y) / FocusSpeed;
            _pos.Y += speedY * delta;
            Matrix.CreateTranslation(new Vector3(-_pos.X, -_pos.Y, 0));

and here my player physic code :

     if (TileColission(new Vector2(position.X, position.Y +velocity.Y), map, 1))//&& velocity.Y>0
        {
            if (velocity.Y > 0)
            {
                //    Rectangle t = TileColission2(new Vector2(position.X, position.Y + velocity.Y), map);
                //    position.Y = t.Y-16;
                while (!TileColission(new Vector2(position.X, position.Y + 1), map, 1))
                {
                    position.Y += 1;
                }
                StandingOnGround = true;
            }
            velocity.Y = 0;
        }
        else
        {
            position.Y += velocity.Y;
            StandingOnGround = false;
        }
        if (TileColission(new Vector2(position.X+velocity.X, position.Y ), map, 1))
        {
            velocity.X = 0;
        }
        else
        {

            position.X += velocity.X;
        }

all my sprites are round to (int) at his respective drawings methods.

is not very appreciable at gyazo idk why. but the player viber when its moving.
thx for read .


texts:
I am trying to draw projectiles and doing billboarding.  A projectile consists of a bill-boarded "particle" and a "tracer".  When I billboard a projectile, it cannot be seen when the player's viewing direction is parallel to the projectile axis.

How does Halo or other games solve this problem, so that projectiles can be seen from behind.


texts: How to align the corner of the camera with x= 0, y=0?

texts:
I need put Main Camera's bottom left corner at starting position 0, 0 (x, y) so all of its coordinates will be positive coordinates.
I thought to put the pivot at the bottom left corner but I don't know if it is possible.
I thought to adjust it manually, but it displays non-positive, non-integers.

I chose the aspect ratio 16:9 but if I choose the 4:3 proportions, it becomes right:

So, what is the best way to align/put the camera at position 0, 0 at bottom left corner?


texts: How to calculate normal from normal map in world space? (OpenGL)

texts:
I'm trying to do normal mapping in a deferred renderer and I'm stuck on how to implement normal maps. I have a bool that passes whether or not to use a normal mapped value and thus, whether to calculate the TBN matrix. My vertex code for the geometry pass looks as follows:

#version 410 core

layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;
layout (location = 2) in vec2 aTexCoords;
layout (location = 3) in vec3 aTangent; // Optional Texture coordinates
layout (location = 4) in vec3 aBitangent; // Optional Texture coordinates

out vec3 FragPos;
out vec2 TexCoords;
out vec3 Normal;
out mat3 TBN;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

uniform bool hasNormalMap;

void main()
{
    vec4 worldPos = model * vec4(aPos, 1.0);
    FragPos = worldPos.xyz;
    TexCoords = aTexCoords;
    Normal = transpose(inverse(mat3(model))) * aNormal;

    if(hasNormalMap)
    {
        vec3 T = normalize(vec3(model * vec4(aTangent, 0.0)));
        vec3 N = normalize(vec3(model * vec4(aNormal, 0.0)));
        // re-orthogonalize T with respect to N
        T = normalize(T - dot(T, N) * N);
        // then retrieve perpendicular vector B with the cross product of T and N
        vec3 B = cross(N, T);
        mat3 TBN = mat3(T, B, N);
    }

    gl_Position = projection * view * worldPos;
}

Here is where I am confused:

In my calculation, I multiplied T and N by the model matrix which should have moved it into world space. Now transposing (T,B,N) should move me back into model space (I think, I'm not sure). In the fragment shader how do I use the TBN to calculate the normal in world space?

If there are better approaches, they are welcome. Thank you.

Update:
I removed the transposing of the TBN as there's no reason to transform into tangent space if we want to pass it in world space. Now that we have the TBN matrix in the fragment shader, how do we apply it so that the normal is the correct value for lighting? Currently I've done:

#version 410 core

layout (location = 0) out vec3 gPosition;
layout (location = 1) out vec3 gNormal;
layout (location = 2) out vec4 gAlbedoSpec;

in vec2 TexCoords;
in vec3 FragPos;
in vec3 Normal;
in mat3 TBN;

struct Material {
    sampler2D diffuseMap;
    sampler2D specularMap;
    sampler2D normalMap;
    float shininess;
};

uniform Material material;
uniform bool hasNormalMap;

void main()
{
    // store the fragment position vector in the first gbuffer texture
    gPosition = FragPos;

    // also store the per-fragment normals into the gbuffer
    gNormal = normalize(Normal);

    if(hasNormalMap)
    {
        gNormal = texture(material.normalMap, TexCoords).rgb * TBN;
        gNormal = normalize(gNormal);
    }

    // and the diffuse per-fragment color
    gAlbedoSpec.rgb = texture(material.diffuseMap, TexCoords).rgb;

    // store specular intensity in gAlbedoSpec's alpha component
    gAlbedoSpec.a = texture(material.specularMap, TexCoords).r;
}

but that doesn't feel right. I imagine that I would transform the sampled value from the normal map by the TBN matrix to get it in world space. Am I missing something?


texts: Fire Emblem/Advance Wars/Turn Based Strategy like Artificial Intelligence

texts:
I have made a Fire Emblem/Advance Wars like game, and I was wondering if there are any particular techniques in the AI's in those games.

I was wondering how to let the AI make the best decisions. I have the tiles a unit can move to, I have the enemy unit positions and I have formulas to calculate battle outcomes, now I want to add those together so that, for example, the AI attacks the weakest unit, blocks a chokepoint or just moves closer to the enemy if nobody is in range.

What is the best approach to this?


texts: Is my social game technical solution viable?

texts:
I'm currently working on a board social game using HTML5 (canvas) & Asp.net MVC 4, Azure, Sql server, EF.
I'd like to do a server side realtime validation (using Ajax) of a player moves (not more than one every 2 seconds).
The problem is that I can't allow a communication to be longer than 200 ms (time of the client side animation).  On the server side I have to go to the database to do the validation.
I'm not sure that it is possible to keep a good communication speed over time with a growing community.

What would be a better scenario ?

Edit:
An other possibility would be to load the grid answers on the grid load but then every player with a bit of firebug background could get the answers with no pain..
Then I'm forced to go server side.
Maybe the best would be to load in the web role memory all the grids to not have to go to the database.

Another scenario could be:
1 ajax request to check in the server memory the grid solution
1 ajax request to confirm the player move in database
but  it's not cheater safe neither..

Thank for your help

David


texts: How can I use a SharpDX.Toolkit.Game in multiple WPF controls?

texts:
I've implemented a Game class in a WPF app. It works and the animation renders.

I have task to implement another several Controls with SharpDX in the same application window. Each new Game object takes a lot of memory (about 25MB each).

How can I save memory when creating over a dozen controls rendering different animations in SharpDX?

I thought about creating one Game object and share it between different controls.  However, each control contains another animation. Adding new control I tried two things:

create new SharpDXElement for each control, then call Game.Switch(dxElement);
create one SharpDXElement for each control

Both failed: Only one control displays. The rest are invisible.

I also tried quickly switching the dxElement, but that caused blinking.


texts: Procedurally create a polygonal shape filled with texture in unity 2d

texts:
I want to procedurally create a polygonal shape filled with texture in unity 2d (no 3d meshes). Something that looks like this: https://www.conceptdraw.com/How-To-Guide/picture/landscape-plan/Building-Plans-Landscape-Garden-Design-Elements-Roofs.png

As you can see roofs can be rectangles, but also any polygonal shapes.

I have tried so far LineRenderer which outlines a shape but I see no way how to put a texture of the same shape into it.
I have tried sprites as well but I could not find a way to procedurally generate them
I saw an example of https://github.com/epezent/ShapeRenderer and https://assetstore.unity.com/packages/tools/sprite-management/shapes2d-make-art-fast-62586
Ultimately I want something like https://docs.unity3d.com/Manual/9SliceSprites.html for any polygonal shape

Can it be done in vanilla unity 2d? Or should I rely on 3rd party libraries and if so which one would fit best?

p.s. I will most likely overlay that object with PolygonCollider2d for physics


texts: Finding cells within range on a hexagonal grid

texts:
I'm looking for a way to get the cells based on a N range. But no luck.

I'm converting Row Column offset to Cube Coordinate system QR -> XYZ

$range = 1;
for ($dx = -$range; $dx <= $range; $dx++)
{
    for ($dy = max(-$range, -$dx - $range); $dy <= min($range, -$dx + $range); $dy++)
    {
        $dz = -$dx-$dy;
        $points = $hexagon->cube_to_oddq(array($dx,$dy,$dz));
        $x = $hexagon->ver + $points[0] * $hexagon->size * 1.5;
        $y = $hexagon->height + $points[1] * $hexagon->height + ( ($points[0]%2) * ( $hexagon->height / 2 ) );
        $points = $hexagon->drawHex($x,$y, true);
        $pointss = array();
        foreach($points as $p) {
            $pointss[] = $p[0];
            $pointss[] = $p[1];
        }
        imagefilledpolygon ( $png_image , $pointss , 6 , $black );
    }
}

Result:
Inside every hex cell
(First line is QR coordinate)
(Second line is XYZ converted coordinate)

Any advice what I'm doing wrong?

Update:

As requested, the Oddq (Q,R) to Cube conversion XYZ

    $i = $hex[0] = ROW
    $j = $hex[2] = COLUMN
    public function oddq_to_cube($hex){
        $hex[2] = $hex[1];
        $x = $hex[2];
        $z = $hex[0] - ($hex[2] - ($hex[2]&1)) / 2;
        $y = -$x-$z;
        return array($x, $y, $z);
    }
    $curr_cube = $hexagon->oddq_to_cube(array($i,$j));


texts:
Possible Duplicate:
  XNA: How does threading work?

It's my understanding that the Xbox has 3 cores that are available to use. I'm hoping to offload AI to another core, and possibly use another core to see if certain objects are on screen(if so they will be added to a list to be drawn).

How would I go about doing this? It needs to be compatible on the xbox360.


texts: How to apply force towards direction using mouse drag and/or touch input direction and input speed?

texts:
I've to object. I can move object 1 (my Player) using mouse (or Touch for smartphone version).

I want apply a force to object 2 when object 1 hit it. Force direction must be mouse vector direction or touch vector direction.

For Mouse input i'm using event OnMouseDown and OnMouseDrag to determine mouse original position.

But I think this is not the best approach. Behaviour is not what i am expecting

void OnMouseDown()
    {

        mouseDragStartPosition = Input.mousePosition;

        //translate the cubes position from the world to Screen Point
        screenSpace = Camera.main.WorldToScreenPoint(transform.position);

        //calculate any difference between the cubes world position and the mouses Screen position converted to a world point
        offset = transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenSpace.z));

    }

    void OnMouseDrag()
    {

        //keep track of the mouse position
        var curScreenSpace = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenSpace.z);

        //convert the screen mouse position to world point and adjust with offset
        var curPosition = Camera.main.ScreenToWorldPoint(curScreenSpace) + offset;

        transform.position = new Vector3(curPosition.x, ClampY, curPosition.z);
    }

    void OnCollisionEnter(Collision collision)
    {
        Debug.Log("OnCollisionEnter");
        if (collision.collider.tag == "Disc")
        {
            ApplyForce();
        }

    }

 void ApplyForce()
    {
        Vector3 direction = mouseDragStartPosition - Input.mousePosition;
        direction = new Vector3(direction.x, ClampY, direction.z); //ClampY used to not allow +-Y
        DiscRb.AddForce(direction * 1, ForceMode.Impulse);
    }


texts: What is the genre defined by getting as far as possible along an infinite level called?

texts:
I am interested in making a mobile game in the style of an infinite hallway. Like Jetpack Joyride where the background moves and you just steer your guy up or down to avoid stuff. You can have a glimpse here on YouTube of what it looks like.

I have never made one before, in fact, I have no idea what that genre is called...

What is this genre called?


texts:
I have a road network and a vehicle that is current off the roads. I want to find the shortest path to any road. An obvious solution is to run a pathfinding algorithm between the current vehicle location and all the points on the road, but that's hardly scalable.

I am curious to know if there is an algorithm out there that I could use to maximize the performance of this operation.


texts: What kind of algorithms could I use to generate biome borders like in Minecraft?

texts:
After I've found this post I'm curious what kind of algorithms they use to generate these shapes (second image).

I can't imagine that the basic shapes are basing on a perlin or simplex noise or a voronoi diagram. With voronoi I'm a bit uncertain to be honest.

Well, so what do you think. What algorithm could be used to generate biome borders like they do?


texts: How can I improve the efficiency of my procedural terrain generation and smoothing?

texts:
I'm developing an algorithm that generates infinite procedural terrain. It is currently inefficient. How can I improve it?

The algorithm starts by generating a 16×16 height-map with simplex noise per terrain tile, then goes through a few "smoothing iterations" (averaging height relative to neighbors, and adjusting height to look connected).


texts: How are Uniform Layout Qualifiers in GLSL spaced out

texts:
So for attributes the spacing between indexes is vec4, so if I had 2 matrix as an attribute, they'd be layout (location = 0) in mat4 a and layout (location = 4) in mat4 b

If I did the same for 2 uniform matix, what would the index of matrix b be?

Side note: with OpenGL 4, are VBOs also attributes, there isn't a key word for vertex?


texts:
I have a basic character controller set up for a 2D platformer with Box2D, and I'm starting to tweak it to try to make it feel good. Physics engines have a lot of knobs to tweak, and it's not clear to me, writing with a physics engine for the first time, which ones I should use. Should jumping apply a force for several ticks? An impulse? Directly set velocity? How do I stop the avatar from sticking to walls without taking away all its friction (or do I take away all the friction, but only in the air)? Should I model the character as a capsule? A box with rounded corners? A box with two wheels? Just one big wheel? I feel like someone must have done this before!

There seem to be very few resources available on the web that are not "baby's first physics", which all cut off where I'm hoping someone has already solved the issues. Most examples of physics engines for platformers have floaty-feeling controls, or in-air jumps, or easily exploitable behavior when temporary penetration is too high, etc.

Some examples of what I mean:

A short tap of jump jumps a short distance; a long tap jumps higher.
Short skidding when stopping or reversing directions at high velocity.
Standing stably on inclines (but maybe sliding down them when ducking).
Analog speed when using an analog controller.
All the other things that separate good platformers from bad platformers.
Dare I suggest, stable moving platforms?

I'm not really looking for "hey, do this." Obviously, the right thing to do is dependent on what I want in the game. But I'm hoping someone somewhere has gone through the possibilities and said "well technique A does feature X well, technique B does Y well, but that doesn't work with C", or has some worked examples beyond "if (key == space) character.impulse(0, 1)"


texts: Drawing cube in SharpDX, wrong perspective

texts:
I want to draw a cube. This is what i currently have:

As you can see, the perspective is VERY wrong. The the size in the z-direction is too small and the difference between the front and back size is wrong.

My code:

worldprojMatrix = Matrix.Identity;
worldprojMatrix *= Matrix.Translation(0, 0, 10);
//float ratio = ScreenWidth/ScreenHeight;
worldprojMatrix *= Matrix.PerspectiveFovLH(1f, ratio, 1f, 100f);
//worldprojMatrix *= Matrix.RotationY(1.3f);

worldprojMatrix.Transpose();

//update the matrix with a constant buffer
DeviceContext.UpdateSubresource(ref worldprojMatrix, worldprojBuffer);

Vertex Shader:

struct VOut
{
  float4 position : SV_POSITION;
  float4 color    : COLOR;
};

cbuffer meshBuffer  :  register(b1)
{
  float4x4 worldprojMatrix;
}

VOut VShader(float4 position : POSITION, float4 color : COLOR)
{
  VOut output;

  output.position = mul(position, worldprojMatrix);
  output.color = color;

  return output;
}

I tried an ortho perspective, but there is the same problem: the z dimension is too small.

How can i fix that?


texts:
I have three animations, "ShowHit", "WarningFadeInAndOut", "ShowGameOver". They were worked when I was made, but suddenly only "ShowHit" is working. I double checked the logic was correct so that it executes to play animation and there's no problem with my code, but even played animations, just nothing changed in my screen.

I do nothing about animation stuffs, but why it suddenly doesn't work? If I go to animation tab and hit play, it works, but in game, animation just not working at all.

Also in "ShowGameOver" animation, I animated modulate value which was 0 to 1, so make it appears to the screen. However Sometimes when I set the modulate's alpha value to 1.0, I can't see it. Of course visible is checked.

Is all these are just bug or glitch? Why suddenly my animations just not working? Any advice? Using Godot 3.1.1.


texts: texturing a race track - applying variations

texts:
I have created a simple race track in Blender using bezier curve, array and curve modifiers. A track is created from simple planes and the basic seamless asphalt texture looks quite good.

As you can see a basic texture is repeated for a single segment to better match a track scale. I would like to add to the race track some variations, for example a normal map with cracks and transparent texture with tyre marks. I wonder how to achieve a realistic effect. I have two ideas:

prepare many different textures and load them randomly for a track
segment
prepare a few bigger textures, generate somehow a second texture coordinates channel and apply bigger textures for a group of the
segments

but maybe there is better way.

Finally I would like to export that race track (for example as wavefront obj file) and load in opengl graphics engine using assimp library.

How such texture variations are achieved in games ?


texts: Unity: Moving player using Rigidbody with UI Buttons?

texts:
i have been using transform.positionsince the start but now i want to switch to rigidbody instead since i am facing some collision problems. i can use the keyboard to move the player using this code:

input = new Vector3 (Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"));

        if (GetComponent<Rigidbody> ().velocity.magnitude < maxmovespeed) {
            GetComponent<Rigidbody> ().AddForce (input * movespeed);
        }

but since i am building for mobile and have added UI buttons for right/left on screen, i wish to use those for moving my player. how can i use those buttons to move in that specific direction like left for left only and right for right?


texts:
As the title says, I need to draw a shape/polygon in Farseer using debugview.
I have this piece of code which converts a Texture to polygon:

//load texture that will represent the tray
        trayTexture = Content.Load<Texture2D>("tray");

        //Create an array to hold the data from the texture
        uint[] data = new uint[trayTexture.Width * trayTexture.Height];

        //Transfer the texture data to the array
        trayTexture.GetData(data);

        //Find the vertices that makes up the outline of the shape in the texture
        Vertices verts = PolygonTools.CreatePolygon(data, trayTexture.Width, false);

        //Since it is a concave polygon, we need to partition it into several smaller convex polygons
        _list = BayazitDecomposer.ConvexPartition(verts);
        Vector2 vertScale = new Vector2(ConvertUnits.ToSimUnits(1));
        foreach (Vertices verti in _list)
        {
            verti.Scale(ref vertScale);
        }

        tray = BodyFactory.CreateCompoundPolygon(MyWorld, _list, 10);

Now in DebugView I guess I have to use "DrawShape" method which requires:

DrawShape(Fixture fixture, Transform xf, Color color)

My question is how can I get the variables needed for this method, namely Fixture and Transform?


texts:
System Configuration

I have two simulation systems (which I am going to call Sim-A and Sim-B) where I am going to spawn an entity created in Sim-A inside Sim-B.

Expected outcome

The entity created in Sim-A appears in Sim-B in the right position with the correct orientation.

System Input

The position of the entity created in Sim-A received in Lat/Long/Alt format (it assumes WGS-84 spheroid) and the orientation in Euler angles.

The Euler angles would help me to transform an entity from its world coordinate system to entity coordinate system by applying the Euler angles in the order of heading, pitch and yaw. Below is how it is documented.

" The order of rotation is first, rotate about z by the angle psi (), then about the new y (y') by angle theta (T), then about the newest x (x'') by the angle phi (I). The positive direction of rotation about an axis is defined as clockwise when viewed toward the positive direction along the axis of rotation."

However, in Sim-B this rotation is defined in Quaternion and it assumes a perfect sphere for the world (not WGS-84). As a result, I have to convert Euler to Quaternion before sending the information to Sim-B.

I have achieved this by applying ZYX conversion (page A-11) given in [here][2].

Challenge

When I pass the position and orientation of an entity created in Sim-A to Sim-B ( Sim-B uses ECEF system, so I do another conversion to go from LLA to ECEF), it appears in the correct LLA position but its orientation is incorrect (shown in the figure.).

This can be fixed by adding some value to the pitch and roll but it is not mathematically sound. Also, these values might change (haven't tried) if you spawn the entity in a different location of the earth due to its shape.

So, I would like to know the right way of correcting this issue (i.e. how to make the entity to stand upright). Assume that I can get the Up, Front and Right vector of the entity when it is spawned in Sim-B.


texts: OpenAL - alGetSourcei and AL_BUFFERS_PROCESSED gives junk

texts:
Posted this question on SO but got no answers. Maybe somebody can help me here.

I recently had a well-working program which streamed WAV and Ogg sounds with OpenAL. I then decided to abstract the source and buffer objects into C++ classes. I got as far as the source class. My function which returns the number of processed buffers is not altering the integer passed to alGetSourcei.

int ALSource::GetBuffersProcessed() const {
    ALint processed;
    alGetSourcei(this->source, AL_BUFFERS_PROCESSED, &processed);
    int error = alGetError();
    if(error != AL_NO_ERROR)
            return -1;
    return processed;
}

I checked that error is never anything but AL_NO_ERROR. I generate the source in the
constructor:

alGenSources(1, &source);

This also never gives any error.

The actual symptom of this is that processed is declared but not initialised. It's final value is the initial junk value that it starts out with. (Usually something like -8834824334).

Would this be expected behaviour? The OpenAL specification states that the value should be from 0 - any but is not really any more specific than that. The programmers' guide is the same.


texts: How do I handle or manage commands which are sent by server in unity?

texts:
In my game there are 10 objects which are just started running on play as this is a web player game and betting as well and it requires some socket programming.

At run time the commands are sent by server and client machine accepts these commands as well but I don't have any idea that how can I manage these commands and how do I executes that commands as per the requirements?

If anyone knows please try to help me out..!
Thanks


texts:
I'm learning OpenGL and there is something I don't understand regarding model loading.

Lets say I found a free .blend model of a tree. The problem is - currently in my program all models have only one texture. But this model use two textures, one for trunk and another for branches and leaves. Actually trunk and leaves are two separated models on one scene.

What to do in this situation? Editing model manually could take a long time (I'm not an expert in Blender). I could join two textures in one and correct UV's automatically. But most likely a lot of space will be wasted on such an automatically created texture. I could also modify my model format (it's more like memory dump + header actually) so I could store N models with N textures as one object. But using N times more VBOs and textures when you actually need only one is inefficient.

I'm wondering maybe there is a well known tool for automatically joining multiple objects in one? Or maybe some good practice for this case? Or something like this.


texts: Unity3d mesh is getting distorted while animation

texts:
I attached boxing glove to rig using this method
https://stackoverflow.com/questions/34719718/transferring-rig-weights-from-one-mesh-to-another-in-blender-2-76
 It works fine in the blender, But while animating in unity mesh is getting distorted.
Image{https://imgur.com/a/5McCX}
Anyone knows how to fix this?


texts: In games physics engines, what is "tunneling", also known as the "bullet through paper problem"?

texts:
I have recently had an issue where sometimes a collision would not be detected. Someone told me that maybe I had an tunneling issue.
In the context of game development using physics, what is tunneling?

This is a low-ball question; I realized when suggesting someone that maybe they had that issue that we did not have a clear explanation around about what the issue was, so this question is meant to help users explain things with fewer words.


texts: how should a server handle client actions?

texts: So I've just started trying to make a multiplayer pong game and  I have read a lot of different ways to code the connections.  However, I read somewhere that you should have the inputs sent to the server queue up and then the server just processes it at fixed intervals.  However, if this is done, how does the server know, process, and send accurate data based on the time the action was sent?  Because if the data is just queued up, if something happens like 100 ms after another but the server processes them at the same time, wouldn't that mess up the synchronization of the game?  Should the server instead be coded to handle the client actions immediately even if it costs a lot of cpu etc in larger games?


texts: Load a second app in background and launch behind a loading screen

texts:
there is a way to preload an application in android from Unity? I mean.. I'm developing a launcher and every click in icon, should be launch a different game.. so, the time between show a loading animation and open the second app, in android, It's posible to make..  when the loading's animation is fadeout and behind the loading screen, the second app is loaded?

P/D: I have to said that, the launcher is a different application from the game that should be launch.


texts:
I have an android game built with libgdx and what I'd like to do is to add some kind of authentication so I can connect the game with user data to firebase database.
I have some experience with firebase using it in native android apps, but I have no idea on how to connect "native code" with libgdx.
Researching I found these third party libs https://github.com/mk-5/gdx-fireapp/tree/master/gdx-fireapp-core and https://github.com/TomGrill/gdx-firebase
But as it does not provide any example it didn't help me much.
So what's the best way to "mix" native android code and libgdx? I want to be able to achieve things like storing data on db, implementing in-app-purchases, authenticating users. If I'm looking the wrong way please let me know too.


texts: Pan over an image like a map using scroll container in godot?

texts: I want to create a level select screen, the aspect ratio for my game screen is 576*1024 and the image, I am using is 2048*2048. What I want is for the user to scroll the screen and navigate along the path to select levels. I know how to implement just horizontal or vertical scroll, but, for this one, I want the user to be able to scroll in every direction like a map. Can anyone suggest the node setup in the scroll container for that?


texts: Implementing getters for a singleton script in unity

texts:
Ok the title might be a bit confusing but what I want to do is make a getter that returns the class, exactly like unity does with the camera.current.

You should just be able to go class.current and get the running instance of the class but I have no idea how to do this as it would most likely be a static method but how would you return the class form a non static class without some sort of out of class variable? or do you have to make the class static?


texts: Simple project - make a 3D box tumble and fall to the ground

texts:
Possible Duplicate:
  Resources to learn programming rigid body simulation

Hi guys,

I want to try learning rigid-body dynamic simulation. I have done a fluid and cloth simulation before, but never anything rigid. My maths knowledge is limited in that I don't know the notation that well.

Are there any good cliff-notes, tutorials, guides on how I would accomplish a simple task like this? I don't want a super complex pdf that's only a little relevant.

Thanks.


texts: Problem calculating screen point for a point in a 3D world with view matrix and projection matrix

texts:
I am trying to calculate the 2D screen point of a 3D world position. For this I use the multiplication ViewMatrix * ProjectionMatrix. But I am not getting good results and I think I am messing up my calculations or my ViewMatrix itself is wrong (I think the latter).

This is a snapshot of how my ViewMatrix looks like when the camera is looking downwards (at my feet):

 0.362,    0.932,    0.000,    0.000
-2.241,    0.094,   -0.966,    0.000
-0.900,    0.350,    0.259,    0.000
 8.100,  -16.860,    4.598,    1.000

I calculate my left handed perspective ProjectionMatrix manually using 4/3 aspect ratio 60 FOV and using 0.1 and 1000 for my near and far Z. This is the ending projection matrix:

-0.117,    0.000,    0.000,    0.000
 0.000,   -0.156,    0.000,    0.000
 0.000,    0.000,    1.000,    1.000
 0.000,    0.000,   -0.100,    0.000

I multiply the previous 2 matrices with ViewMatrix * ProjectionMatrix and use that as my ViewProjectionMatrix.

Now I need to calculate the clipping space coordinates of the 3D point. I do this as follows:

XMFLOAT4 clipCoords;
clipCoords.x = pos.x * viewMatrix._11 + pos.y * viewMatrix._21 + pos.z * viewMatrix._31 + viewMatrix._41;
clipCoords.y = pos.x * viewMatrix._12 + pos.y * viewMatrix._22 + pos.z * viewMatrix._32 + viewMatrix._42;
clipCoords.z = pos.x * viewMatrix._13 + pos.y * viewMatrix._23 + pos.z * viewMatrix._33 + viewMatrix._43;
clipCoords.w = pos.x * viewMatrix._14 + pos.y * viewMatrix._24 + pos.z * viewMatrix._34 + viewMatrix._44;

Now I convert this to normalised device coordinates:

XMFLOAT3 NDC;
NDC.x = clipCoords.x / clipCoords.w;
NDC.y = clipCoords.y / clipCoords.w;
NDC.z = clipCoords.z / clipCoords.w;

As a final step I convert it to the 2D point on a screen for a given size:

XMFLOAT2 screen;
screen.x = (windowWidth / 2 * NDC.x) + (NDC.x + windowWidth / 2);
screen.y = -(windowHeight / 2 * NDC.y) + (NDC.y + windowHeight / 2);

Can you spot the problem with the above calculation?

Steffen


texts: If filled polygon cannot be drawn via libgdx ShapeRenderer , then what is the work around?

texts:
I know most of you would suggest me to draw a filled polygon by using combination of triangles and rectangles , but that is not possible for complex shapes . I want to basically draw a generic shape on screen , here it is

The above shape needs to be drawn in generic form , i.e
-> the width of each trapezium's upper edge is fixed .
-> the lower edge of the overall compound shape is a constant unit greater than upper edge.
-> this whole compound shape can have arbitrary length and thus number of individual trapeziums that compose the compound shape is not fixed.
I wish to draw each colored trapezium as a filled polygon .
Is there any way of achieving this


texts: How do I get a new license for gDEBugger after the 1 free year?

texts: I downloaded the gDEBugger from gremedy over a year ago, with their one year free license.  The license has since expired and their site says that I'll be presented with the option for 1 year free license the first time I run it after install. This doesn't happen when re-installing, it just tells me the license has expired. How do I get a new license? I use this regularly for debugging shader problems and performance testing my game.


texts:
I really dig the way that the map is moved in Clash of Clans (https://itunes.apple.com/ca/app/clash-of-clans/id529479190?mt=8)...

I can recognize the pinch and finger movement needed for the zooming and the swiping around the map, what I'm looking for is a tutorial in any language that reveals how to test for the map going out of bounds when moved or scaled.

My google fu has failed so far on this one, any hints?

Right now I can perform the scale operations and the movement operations, but I can't figure out how to stop the map from going out of bounds when pinched or scaled.  My code is a crazy mess and makes me think I'm missing the fundamental logic of how this is done.

(I am using Starling with AIR, but a tutorial in any language if you have a link).

Update: this is what I'm basing what I have currently so far:
https://github.com/PrimaryFeather/Starling-Framework/blob/master/samples/demo/src/utils/TouchSheet.as


texts: How do I attach the Visual Studio Code debugger to Godot

texts:
At 3.0 Godot now supports C# and encourages the use of Visual Studio Code to edit this code.

It is not clear how to attach VS Code so that we an apply breakpoints and debug a project at runtime.

I am running:

A recent build of Godot from master (b49ca94 with mono for 64-bit windows)
Visual Studio Code 1.21.0 with these extenstions

C# 1.14
Mono Debug 0.15.8

Mono 5.10.0


texts:
I am working on a multiplayer game for WebGL platform and I am using SocketIo & node.js server for handling the game.

I am facing issues, as shown in the attached image. I have no idea about what these errors mean. I don't think that the issue is from my coding side, as my multiplayer game runs perfectly in standalone builds, with more than 4 instances of the standalone build running.

It does not even open in my WebGL build. Does WebGL does not support threading? What are these errors all about? Can these issues be solved, or do I have to change my whole project implementation?


texts: Unity3D - leaving and then returning to a scene

texts:
Effectively, I need to know how to run a mini game and then return to a scene. I know about

DontDestroyOnLoad (this);

but that works for game objects only and doesn’t do what I need - also because it carries the objects over into the next scene. In my game you play as a computer. When you hack into a computer remotely, you have to go into a sort of mini game where you must traverse the computer for data, experience and end up ‘owning’ the computer, having destroyed its security systems. My problem is that this requires being in a different scene, where the hacking 'minigame' is played out, then return. So I could just make a new scene, fine. But when I have to return to the old scene, it has to kick off from the exact point where I left to hack the computer, as if no time had past and with nothing being different. I am stuck on how to do this, because as far as I know there is no way to write a scenes data to a binary file and the read from it when loading the scene again - and persistent data was the only solution I could think of. Any help is appreciated.

Summary

How to play the scene, load a different scene, finish that minigame and then continue from where you were in the original scene


texts: How do I determine how far to move an object in the client when using client-prediction?

texts:
I have a game server which, for testing purposes, is updating once per second, or 1hz so I can correctly implement client-side prediction. Everything is running locally at the moment so there is no lag issues to deal with, but this setup replicates potential packet loss, or if the server somehow is behind on processing.

I am using Unity for the client. I have a tunnel where the position is updated on the server and then broadcast to each client each tick (once per second). The client simply then lerps between its current position, and the new position received from the server, and this seems to work nicely.

However, as I have set the tick to 1hz, there are unexpected results where the position seems to pulse, rather than smoothly transition. An example can be seen below.

It can perhaps be seen more clearly without lerping

I have tried constantly increasing the tunnel's position in the client, but if it's moved too far in the client, once the server's position is received, it is snapped back to that position which creates some weird rubber-banding like effects even though there is no lag.

How can I determine how much to move the tunnel in the client to create some seamless movement, even when the tick rate is so low? Baring in mind this movement is variable, so it can move faster/slower at times so the movement in the client cannot be a fixed number.

Yes, I can just increase the tick rate which gives smooth movement, however, there is no lag to account for as it's all local so I am just preparing for when I move the server to actual hosting.

Instead of lerping between the current position and the received position, should I be trying to lerp between the current position and the next received position?

Lerp:

        Vector3 currentPosition = transform.position;
        Vector3 newPosition = new Vector3(currentPosition.x, currentPosition.y, tunnelPositionZ);

        transform.position = Vector3.Lerp(currentPosition, newPosition, Time.deltaTime);

DMGregory's solution attempt:

If I decrease the 1.0f for the blend variable, the tunnel will move very slowly and then jolt forward when a snapshot is received. Decreasing the 1.0f to around 0.1f seems to align the speeds but there is still a noticeable jolt.

I'm using the same velocity for the currentPosition and newPosition because the velocity never changes.

    float dT = Time.time - latestSnapshot.arrivalTime;
    float blend = Mathf.Clamp01(dT / 1.0f);

    Vector3 currentPosition = transform.position;
    Vector3 currentVelocity = rigidbody.velocity;

    Vector3 newPosition = new Vector3(currentPosition.x, currentPosition.y, latestSnapshot.tunnelPositionZ);
    Vector3 newVelocity = new Vector3(currentVelocity.x, currentVelocity.y, latestSnapshot.tunnelVelocityZ);

    Vector3 velocity = Vector3.Lerp(currentVelocity, newVelocity, blend);

    Vector3 position = Vector3.Lerp(
               currentPosition + velocity * dT,
               newPosition + velocity * dT,
               blend);

    transform.position = position;


texts: Unity: "inconsistent line endings" dialog shows up ever time I open VS with unity

texts: Everytime I open a script file from unity with visual studio this dialog shows up about normalizing the line endings? What does this mean? I click Yes every time but still can't get rid of it. It only happens when I open a file from unity.


texts:
I've been looking at a 2D physics game called 'Hill Climb Racing' (Android and iOS) and was wondering how they went about texturing the terrain?

I've had a think about it and I've come up with nothing and finding a resource on the web has proved impossible. Please help.

The game mentioned uses Cocos2d. Would it be just as doable in a different environment?

EDIT:

I was looking at another question: Drawing large 2D sidescroller level terrain

The end result is what I'm looking for, but in my mind I was thinking that there would be some way to add this effect (using small textures) to some terrain specified by vertices rather than making a very large image to match whatever is seen in the level.


texts:
I've been looking everywhere and all I can find are tutorials on writing the shaders. None of them showed me how to incorporate them into my scene.

So essentially:

Given an hlsl shader, if I were to have a function called drawTexturedQuad() and I wanted the shader to be applied to the result, how exactly could I do this?

Thanks


texts: What is the order of execution of OnClick and PointerUp in Unity?

texts: I have an UI element in Unity with a Button and a Event Trigger component. The Button component calls a method when the OnClick event is triggered, and the Event Trigger component calls another method when the PointerUp event is triggered. I need the OnClick event to be triggerd always after the PointerUp event is triggered. This seems to be the case, but I'm not sure if I can assume this order of execution is what Unity actually uses. Is this the case or Unity uses a random order of execution?


texts: Modifying Brackeys Unity Inventory Tutorial for Stackable Items?

texts:
I followed this tutorial: https://www.youtube.com/watch?v=w6_fetj9PIw
and the one after it, and it works fine, but now I'm in a situation where I want to be able to stack my items up. I saw there was a thread on the brackeys forums about this a few years(!!) ago, but the files aren't available and I saw people were having issues with it anyway. Can anyone think of a way to modify it and preferably allow for easy loading/saving as well down the road (though absolutely not necessary, I can go down that rabbit hole later), or alternatively point to a different tutorial that would do so? Thanks in advance!

Here's the link to the scripts, I only went up to video 6 so there might be some new stuff in there but it should at least help!
https://github.com/Brackeys/RPG-Tutorial/tree/master/Finished%20Project/Assets/Scripts/Inventory

(note: I added a variable to the item script that keeps track of how many items of that type the player has, but the problem is that when I add a new item to the inventory it keeps adding it to a new slot and messing up the counter because I'm unsure where to check if the item already has a slot in the inventory and what to do about it.)


texts: How to handle shoot instructions, in a multiplayer TD

texts:
I'm currently working on a Multiplayer Tower Defense game, using ImpactJS & Node. I seek some clarification about how to handle projectiles from towers, let me explain.

So the server is running the master game, and the clients just follow the instruction from the server. Lets say there is about 20 towers on the stage, all needs instructions for which creeps to shoot at. Now lets say each towers fires twice in a second, that's 40 shots each second, (worst case scenario) which is 40 request per second to each client, would't this casue alot of stress to the server, saying that we have 50 games running the same time.
So what i am really asking, is this method inefficient, and is there a smarter way to handle all these instructions.

Thank you.


texts: server/client architecture, how to combine physics data, scene graph and database over the network?

texts:
I'm writting a C++ server and a C++ client for a rpg game.

The client is using OpenSceneGraph for rendering the 3D. RakNet is used for communication between the client and server.

At this time, the client and the server can communicate together. I have installed bullet for physics, but I didn't added bullet to the server nor the client.

The first reason is because I would like to know what you think about my idea to put the whole physics on the server and just sending to each clients, the updated quaternions for all actors view by each clients.

My second problem is, I never really used bullet, moreover never with a 3D engine. And I don't know if I need to build a scene graph on the server, or if I have to use another strategy. More precisely, most of such games seem to use a database. I using sqlite in some other C++ projects, so I don't have some question about that, but only about the fact that I never wrote a scene graph, so the question is, should I wrote one database scene graph ? or use a scene graph in memory and using a database to save the whole scene graph ? if so, should I do that every frame ?


texts: List cells in a 2D grid that belong in a sector / portion of a circle

texts:
Are there any algorithms to find out which cells in a 2D grid lie inside/is part of a slice of a circle - a pie slice shaped region?

Essentially, as per image below, I need to list out all the green cell coordinates.

At the moment, I am ray casting (using DDA based line interpolation) from the starting red cell, and sweeping across the area in with (arbitrarily chosen) small fixed angle increments, casting multiple rays; but this does not guarantee all cells will be covered.

Are there any approaches to this problem?


texts: matrix to rotate a vector to a known arbitrary axis

texts:
Let's say I have a vector V (v.x,v.y,v.z) which is normalized and points somewhere in 3d space.  And that I have another vector Z of (0,0,1).  Knowing only these two things I'm looking for a transformation matrix that will take the vector Z and turn it in to V.

Or some other way to get to the vector V from the vector Z.

In my application for this I'll be taking other vectors that are in a Z axis space and putting them in (or rotating them to) the same space as the V vector.  But a proof that it's working will be to take Z and make it V.

I know that if I had this matrix I could multiply the vec3 by the matrix and get the answer.  But making this matrix from only that destination vector is what I'm not sure how to do.

Seems like it might be super simple and that I'm just not thinking of it correctly.  Answer right in front of my face?


texts:
I am making an AI for my checkers game and I'm trying to make it as hard as possible. Here is the current criteria for a move on the hardest difficulty:

1: Look For A Block: This is when a piece is being threatened and another piece can be moved in behind it to protect it. Here is an example:

Black Moves

|W| |W| |W| |W| |
| |W| |W| |W| |W|
|W| | | |W| |W| |
| | | |W| | | | |
| | | | |B| | | |
| |B| | | |B| |B|
|B| |B| |B| |B| |
| |B| |B| |B| |B|

White Blocks

|W| |W| |W| |W| |
| |W| | | |W| |W|
|W| |W| |W| |W| |
| | | |W| | | | |
| | | | |B| | | |
| |B| | | |B| |B|
|B| |B| |B| |B| |
| |B| |B| |B| |B|

2: Move pieces out of danger: if any piece is being threatened, and a piece cannot block for that piece, then it will attempt to move out of the way. If the piece cannot move out of the way without still being in danger, the computer ignores the piece.

3: If the computer player owns any kings, it will attempt to 'hunt down' enemy pieces on the board, if no moves can be made that won't in danger the king or any other pieces, the computer ignores this rule.

4: Any piece that is owned by the computer that is in column 1 or 6 will attempt to go to a side. When a piece is in column 0 or 7, it is in a very strategic position because it cannot get captured while it is in either of these columns

5: It makes an educated random move, the move will not indanger the piece that is moving or any piece that is on the board.

6: If none of the above are possible it makes a random move.

This question is not really specific to any language but if all examples could be in Java that would be great, considering this app is written in android. Does anyone see any room for improvement in this algorithm? Anything that would make it better at playing checkers?


texts:
-> pygame.display.set_mode(display, HWSURFACE|OPENGL|DOUBLEBUF)
(Pdb) s
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  154 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  28
  Current serial number in output stream:  29

I've seen one other answer to this question related to video drivers, but I feel like I've already run my game at least once with the same video drivers installed. I'd just like to know if there's another possible cause for this issue before I reinstall my drivers for the umpteenth time on Linux.


texts: MonoGame - render target drawn below other sprites and in the wrong location

texts:
This seems like a simple thing but still doesn't work. So I'm trying to draw a scrollable log window (not scrolling yet) by using a RenderTarget2D.

There are several bugs:

The text should be drawn on a black background, now it seems transparent
The text should be drawn in the black box below the game area, now it's drawn in the top left corner
The text appears now on the background color only, it should be drawn over the other sprites

What's wrong with my code? The relevant parts are below.

    private GraphicsDevice graphicsDevice;
    private RenderTarget2D logRenderTarget;

    private bool redrawLogFlag;

    public void Init(ContentManager content, GraphicsDevice graphicsDevice)
    {
        this.graphicsDevice = graphicsDevice;
        logRenderTarget = new RenderTarget2D(
            graphicsDevice,
            10,
            10
        );
        Log.LogWritten += SetRedrawLogFlag;
    }

    private void DrawUiComponents(SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(Scavenger.AssetManager.TextureMap["game_area"], Vector2.Zero, Color.White);
        spriteBatch.Draw(Scavenger.AssetManager.TextureMap["log_area"], new Vector2(0, Constants.GAME_AREA_HEIGHT), Color.White);
        spriteBatch.Draw(Scavenger.AssetManager.TextureMap["stats_area"], new Vector2(Constants.GAME_AREA_WIDTH, 0), Color.White);
        spriteBatch.Draw(Scavenger.AssetManager.TextureMap["help_info"], new Vector2(Constants.GAME_AREA_WIDTH, Constants.SCREEN_HEIGHT - 52), Color.White);

        DrawStats(spriteBatch);
        TryRedrawLog(spriteBatch);
        WriteLog(spriteBatch);
    }

    private void SetRedrawLogFlag(object sender, EventArgs e)
    {
        redrawLogFlag = true;
    }

    private void TryRedrawLog(SpriteBatch spriteBatch)
    {
        if(redrawLogFlag)
        {
            redrawLogFlag = false;

            logRenderTarget = new RenderTarget2D(
                this.graphicsDevice,
                Constants.GAME_AREA_WIDTH,
                Log.Height
            );

            this.graphicsDevice.SetRenderTarget(logRenderTarget);
            this.graphicsDevice.Clear(Color.Black);

            for (int i = 0; i < Log.Count; i++)
            {
                spriteBatch.DrawString(Scavenger.AssetManager.Font12,
                    Log.Entries[i],
                    new Vector2(Constants.LOG_MARGIN, Constants.LOG_MARGIN + i * Scavenger.AssetManager.Font12.LineSpacing),
                    Color.GreenYellow
                );
            }

            this.graphicsDevice.SetRenderTarget(null);
        }
    }

    private void WriteLog(SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(logRenderTarget,
            new Rectangle(0, Constants.GAME_AREA_HEIGHT, Constants.GAME_AREA_WIDTH, Constants.LOG_HEIGHT),
            new Rectangle(0, 0, Constants.GAME_AREA_WIDTH, Constants.LOG_HEIGHT),
            Color.White
        );
    }


texts: What's the best way to make a game launcher?

texts:
I am a new game dev, and would like to make a launcher for my games. All my games would be in ONE launcher, and it'd be similar to the Minecraft Launcher. I wanna do it for free too.
The main reason I wanna do it is to update my games. I don't have a file server, so the files would be on Google Drive.
Thanks!


texts:
The camera in my game engine can be modified by following a rectangle properties, that can be scaled, moved and even rotated. I need this effect for the shaking of the screen when a zombie attacks a character.

How should I go about implementing this?


texts: Unity: What does the green line gizmo signify?

texts:
When I place a point light it shows this green gizmo that ends in the terrain.
What's the name of this gizmo?
What does it signify?


texts: Preventing the final segment in a linerenderer from being stiff?

texts:
I am creating a fishing pole, and have the script that draws the line -mostly- worked out using verlet physics. However, the final segment is stiff. The code follows an old Unity3D Subreddit post.

Best way to do fishing line

I was able to read through the advice, and came up with a similar set of classes. They seem to work pretty well, though I have to prewarm the line on startup. My main issue is that my version attaches to two targets.

The first is the pole end, which seems fine, but the final segment is the hook. The last segment for it remains 'stiff', while the rest of the line curves properly. I'm not one hundred percent sure how to fix this, and advice would be much appreciated. The issue appears to be the way I'm setting the final target, but I'm not sure how to normalize it all. The code follows a picture of the stiff segment:

using UnityEngine;

public class LineParticle  {
    public Vector3 pos;
    public Vector3 oldPos;
    public Vector3 Accel = new Vector3(0, -1.95f, 0);
}

using UnityEngine;

public class Line : MonoBehaviour {

    public LineRenderer lineRenderer;

    LineParticle[] lineLength;
    public Transform targetObject;
    public float lineRest = 0.8f;
    public int lineSegmentCount = 30;
    private Transform tc;

    private bool isReady = false;

    private void Awake()
    {
        lineRenderer = GetComponent<LineRenderer>();
        tc = transform;
    }

    public void Start()
    {
        lineRenderer.positionCount = lineSegmentCount;
        lineLength = new LineParticle[lineSegmentCount];

        for(int i = 0; i < lineSegmentCount; i++)
        {
            lineLength[i] = new LineParticle();

        }

        for (int i = 0; i < 450; i++)
        {
            loopRun();
        }

        isReady = true;
    }

    private void Verlet(LineParticle p, float dt)
    {
        Vector3 temp = p.pos;
        p.pos += p.pos - p.oldPos + (p.Accel * dt * dt);
        p.oldPos = temp;
    }

    private void PoleConstraint(LineParticle p1, LineParticle p2, float restLength)
    {
        Vector3 delta = p2.pos - p1.pos;
        float deltaLength = delta.magnitude;

        float diff = (deltaLength - restLength) / deltaLength;

        p1.pos += delta * diff * .5f;
        p2.pos -= delta * diff * .5f;
    }

    private void FixedUpdate()
    {
        if (isReady)
        {
            loopRun();
        }
    }

    private void loopRun()
    {
        lineLength[0].pos = tc.position;

        for (int i = 0; i < lineLength.Length; i++)
        {
            LineParticle lp = lineLength[i];

            Verlet(lp, 0.8f * Time.deltaTime);

            int testLP = i + 1;

            for (int y = 0; y < 6; y++)
            {
                if (testLP < lineLength.Length - 1)
                {
                    LineParticle lp2 = lineLength[testLP];
                    PoleConstraint(lp, lp2, lineRest);
                }

                if (i == lineSegmentCount - 1)
                {
                    lineLength[i].pos = targetObject.position;
                }

                lineRenderer.SetPosition(i, lp.pos);
            }

        }
    }
}


texts: Render video from file to DirectX11 texture

texts:
Is there a way to render a video from file (avi, mp4, etc...) to a texture in a directx11 environment?

If so, how?


texts: Detecting extremely fast joystick button presses?

texts:
Is it usually possible for the player to press and release a button within a single frame, so that the game engine doesn't have time to detect it?

How do programmers usually handle this situation?  Is it even necessary to handle it?

While testing, I was able to press and release a button within about 14 or 15 milliseconds (over 1 click/frame).  I was not, however, able to do this while holding the joystick normally, and the press-release cycle would have to start at almost the exact time the frame starts.

Specifically, I am asking about GLFW's joystick input capabilities.

I am currently using GLFW to make a game, and I've noticed that keyboard and mouse have callback functions, while joysticks do not.  Also, it does not appear to be possible to enable "sticky keys" for a joystick.  (I have only recently started using GLFW, so please correct me if I am wrong, as having either of those would solve the problem.)

Although I am asking about GLFW, answers related to any library/engine/language are welcome.


texts:
I'm making a game where the geographic location of a user is used to give them a little flag icon next to their user name. To do this, I've been using the ipstack API. However, the API only allows up to 10,000 requests per month, and since I make a request every time a user connects, this could easily lead to overuse.

Would it make sense to just store geolocation data on my server and only make a request when an unknown IP connects? Or will the geolocation data ever change for an IP?


texts: How do I hide all the geometry in a scene that is contained in a box object?

texts:
I have a nature scene that "stands" on z = 0 level, basically on the grey grid. I want to hide all the geometry bellow z = 0, which would be under a plane, or inside a very large box.

I don't want to use Boolean because it requires me to update group all my assets and insert them into operand B. But I have moving parts like water and stuff :|

now I KNOW its possible, I have done it like 2-3 years ago but I don't have access to the 3ds file anymore nor could I find the source website :(


texts: When I add in Java transformationMatrix I can't see images?

texts:
When I add in Java transformationMatrix I can't see images moving but when I remove it I can see why and how to fix it? Any ideas how to fix it?

My Renderer class:

public class Renderer {

    private static final float FOV = 70;
    private static final float NEAR_PLANE = 0.1f;
    private static final float FAR_PLANE = 1000;

    private Matrix4f projectionMatrix;

    public Renderer(StaticShader shader){
        createProjectionMatrix();
        shader.start();
        shader.loadProjectionMatrix(projectionMatrix);
        shader.stop();
    }

    public void prepare(){
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
        GL11.glClearColor(1, 0, 0, 1);
    }

    public void render(Entity entity,StaticShader shader){
        TexturedModel model = entity.getModel();
        RawModel rawModel = model.getRawModel();
        GL30.glBindVertexArray(rawModel.getVaoID());
        GL20.glEnableVertexAttribArray(0);
        GL20.glEnableVertexAttribArray(1);
        Matrix4f transformationMatrix = Maths.createTransformationMatrix(entity.getPosition(), entity.getRotX(), entity.getRotY(), entity.getRotZ(), entity.getScale());
        shader.loadTransformationMatrix(transformationMatrix);
        GL13.glActiveTexture(GL13.GL_TEXTURE0);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, model.getTexture().getID());
        GL11.glDrawElements(GL11.GL_TRIANGLES, rawModel.getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
        GL20.glDisableVertexAttribArray(0);
        GL20.glDisableVertexAttribArray(1);
        GL30.glBindVertexArray(0);
    }

    private void createProjectionMatrix(){
        float aspectRatio = (float) Display.getWidth() / (float) Display.getHeight();
        float y_scale = (float) ((1f / Math.tan(Math.toRadians(FOV / 2f))) * aspectRatio);
        float x_scale = y_scale / aspectRatio;
        float frustum_length = FAR_PLANE - NEAR_PLANE;

        projectionMatrix = new Matrix4f();
        projectionMatrix.m00 = x_scale;
        projectionMatrix.m11 = y_scale;
        projectionMatrix.m22 = -((FAR_PLANE + NEAR_PLANE) / frustum_length);
        projectionMatrix.m23 = -1;
        projectionMatrix.m32 = -((2 * NEAR_PLANE * FAR_PLANE) / frustum_length);
        projectionMatrix.m33 = 0;
    }
}

Edit added StaticShader class:

package shader;

import org.lwjgl.util.vector.Matrix4f;

public class StaticShader extends ShaderProgram{

private static final String VERTEX_FILE = "src/shader/vertexShader.txt";
private static final String FRAGMENT_FILE = "src/shader/fragmentShader.txt";

private int location_transformationMatrix;
private int location_projectionMatrix;

public StaticShader() {
    super(VERTEX_FILE, FRAGMENT_FILE);
}

@Override
protected void bindAttributes() {
    super.bindAttribute(0, "position");
    super.bindAttribute(1, "textureCoords");
}

@Override
protected void getAllUniformLocations() {
    location_transformationMatrix = super.getUniformLocation("transformationMatrix");
    location_projectionMatrix = super.getUniformLocation("projectionMatrix");
}

public void loadTransformationMatrix(Matrix4f matrix){
    super.loadMatrix(location_transformationMatrix, matrix);
}

public void loadProjectionMatrix(Matrix4f projection){
    super.loadMatrix(location_projectionMatrix, projection);
}
}

Edit vertexShader.txt

#version 400 core

in vec3 position;
in vec2 textureCoords;

out vec3 colour;
out vec2 pass_textureCoords;

uniform mat4 transformationMatrix;
uniform mat4 projectionMatrix;

void main(void){

gl_Position = projectionMatrix * transformationMatrix * vec4(position,1.0);
pass_textureCoords = textureCoords;
colour = vec3(position.x+0.5,0.0,position.y+0.5);

}


texts: How to organize the highlighting of a 3D object with which contact occurs?

texts:
I want to repeat a certain "Select (); - Deselect ();", as shown in the screenshot.

Prompt with advice how to implement it or what you need to read to implement this feature.

I tried to found something similar to what I want to do.

PlayerInteraction.cs from Farm Alarm game by Brackeys

private void OnTriggerEnter2D(Collider2D col)
    {
        if (target != col.gameObject && target != null)
        {
            Deselect();
        }

        target = col.gameObject;

        SeedBarrel barrel = target.GetComponent<SeedBarrel>();
        if (barrel != null)
        {
            barrel.Select();
        }

        SpriteRenderer[] srs = target.GetComponentsInChildren<SpriteRenderer>();
        foreach (SpriteRenderer sr in srs)
        {
            sr.color = new Color(1f, 1f, 1f, 0.9f);
        }
    }

    private void OnTriggerExit2D(Collider2D col)
    {
        if (col.gameObject == target)
        {
            Deselect();
            target = null;
        }
    }

    void Deselect()
    {
        SeedBarrel barrel = target.GetComponent<SeedBarrel>();
        if (barrel != null)
        {
            barrel.DeSelect();
        }

        SpriteRenderer[] srs = target.GetComponentsInChildren<SpriteRenderer>();
        foreach (SpriteRenderer sr in srs)
        {
            sr.color = Color.white;
        }
    }

}

But if I understand right it's way for 2D.

P.S. Screenshot from the game "Overcooked"


texts: How to bundle JRE with a game on Steam for Mac users?

texts:
Heyo!

I have looked for a step by step tutorial everywhere and haven't been able to find anything so please try to be helpful and fairly slow.

I am creating a game for Steam and I am using Java to write it. I chose Java as  it can be run cross-platform and is the one in which I am the most familiar. On this recent question I asked I was told I could bundle the JRE I needed with the game using a program like Launch4J. But I can't find anything about converting the bundle into an executable that Mac users can run.

So my questions are thus:

1) Are there any step by step tutorials for bundling a completed Java program with the needed JRE into an executable for not only Windows but Mac users as well?

2) And if not, would someone be kind enough to create a quick step by step list of everything I need to do?


texts: Executing commands at the exact same time on 2 or more computers

texts: I have an RTS game, with deterministic simulation, but if I want multiplayer to actually work, I need commands sent between computers to be executed at the exact same time. My game's networking is just sending commands between the players' computers, and the simulator executes the commands in order, which, hopefully, will result in each player seeing the exact same game. However, if the commands aren't executed at the EXACT same time, then the simulation will become out of step and everything will be wrong. How could I do this, and are there other ways to make sure everything is in sync?


texts: Unity adding objects through script to scrollview (SetParent): Objects overlap

texts:
I need to add X objects to a scrollview. I do it like this:

GameObject statsObject = Instantiate(instance.statsObjectPrefab);
statsObject.transform.SetParent(statsParent.transform);

statsParent is the content container if the scrollview.

Scrollview
---- Viewport
-------- Content // This is statsParent

In the pause I see that then objects are added successfully, but they all overlap and no scrollbar is visible.

The content has a content size fitter and a vertical layout group, but I tried now all settings and the result is always the same.

I use Unity 2019.2


texts: How can I keep track of a battle log on a web game?

texts:
Recently I started working on a Web turn-based PvP RPG game. Now I'm working on the battle system but I encountered some issues:

How can I keep track of everything that happens in the battle? It should keep track of the characters on the field, inventory, the damage done etc.

I first thought I would simply put it in the (MySQL) database, but I think it will be too much. Especially if several people are in a battle. I thought of puting this in sessions or cookies but I don't think thats reliable.

Does anyone have an idea how I can do this?


texts: What does this shader error in Löve2D mean?

texts:
What could I've done wrong to get the following error message when trying to create a GLSL shader in Löve2D?

I'm sincerely clueless of what the mistake could be, though I suspect the error being a compile-time error because it's happening during love.load, in which I require the shader from another file (and not during love.draw).

The full code can be found here.