texts: How do you create a circular room on a 2D Plane(Similar to Odin Sphere)?

texts:
I'm trying to figure out an optimal solution to creating the illusion of a circular room within a 2D world.

Odin Sphere(Video Example) does this well. As you walk along the X axis the room will eventually wrap around and you'll be back at your original location.

My thought process was to have the level separated into sections and if the player passes a certain point on the X Axis have the initial sections position move to the opposite side.

I'm not sure how to handle enemy or other objects within the section though, if the level section is moved and they're active I'm worried they might fall through the world or other strange behaviors.

Anyone have experience implementing something similar to this?


texts:
I have a long running task (250ms+)that I want to pick up a resultant array from. This job is a path finding service that should run periodically in the background. It's all prototyped in another language using a background Thread.

According to the Unity docs, I should call Complete() when I'm ready for the results of this job. However, I don't know when this task will complete - I don't want my main thread to wait on this job completing. I want this job to run async and to collect the result from a Nativearray:

the resultant search array
null (if it's a first run and still in process.

with concurrent array access protected by a lock. If the job is writing to the array, it should be locked.

What's confusing is that most of the Unity job examples seem to use short jobs that last a few frames, then pick up a result in a LateUpdate() or next Update().  My job is much longer running. Since my job uses no Unity API directly, am I correct that standard c# Threads seem more applicable for my kind of problem?


texts: Unity - export package - but on import, scene and folder structure are different (screenshots)

texts:
I export a package and shows me all the files I am exporting.

When I go to import this package, one of the files is renamed and placed in a folder that no longer exists.

Can anyone explain what is happening here and how I can fix it?

Here is the image of me exporting, including the assets folder in the screenshot.

Then I start a new project, and I try to import that package. But a filename has changed itself, and there is a folder there that I did not export, I actually purposely deleted it and it exported anyway:


texts: Unity IUnityLifecycleManager already exists

texts:
I followed this tutorial https://www.youtube.com/watch?v=OElh7wda4Qc in Unity version 2019.3.1f.1 Personal Edition, but I got 6 errors like this in the console, also I updated to version 3.4.4 via the package manager, because it said that the asset store version was not compatible anymore.

  Library\PackageCache\com.unity.ads@3.4.4\Runtime\Monetization\AndroidPlacementContentOperations.cs(55,40): error CS0433: The type 'IUnityLifecycleManager' exists in both 'UnityEngine.Advertisements.Editor, Version=3.4.2.0, Culture=neutral, PublicKeyToken=null' and 'UnityEngine.Advertisements, Version=3.4.2.0, Culture=neutral, PublicKeyToken=null'

This is the code I am using, its the same as the code in the official website, but personalized to my project.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;
using UnityEngine.UI;

public class adsController : MonoBehaviour, IUnityAdsListener
{
    public bool testMode = true;
    public Button rewardedAd;

    private string storeID = "3509232";

    private string rewardedVideo = "rewardedVideo";

    private void Start()
    {
        rewardedAd.interactable = Advertisement.IsReady(rewardedVideo);
        rewardedAd.onClick.AddListener(ShowRewardedVideo);

        Advertisement.Initialize(storeID, testMode);
    }

    private void Update()
    {

    }

    private void ShowRewardedVideo()
    {
        Advertisement.Show(rewardedVideo);
    }

    // Implement IUnityAdsListener interface methods:
    public void OnUnityAdsReady(string placementId)
    {
        // If the ready Placement is rewarded, activate the button:
        if (placementId == rewardedVideo)
        {
            rewardedAd.interactable = true;
        }
    }

    public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
    {
        // Define conditional logic for each ad completion status:
        if (showResult == ShowResult.Finished)
        {
            // Reward the user for watching the ad to completion.
            Debug.Log("Reward");
        }
        else if (showResult == ShowResult.Skipped)
        {
            // Do not reward the user for skipping the ad.
            Debug.Log("Not Reward");
        }
        else if (showResult == ShowResult.Failed)
        {
            Debug.LogWarning("The ad did not finish due to an error.");
        }
    }

    public void OnUnityAdsDidError(string message)
    {
        // Log the error.
    }

    public void OnUnityAdsDidStart(string placementId)
    {
        // Optional actions to take when the end-users triggers an ad.
    }
}

EDIT:
Looks like I forgot a line in the code and reinstalling the unity ads package now it runs but still gives this warning.

  Please consider upgrading to the Packman Distribution of the Unity Ads SDK.  The Asset Store distribution will not longer be supported after Unity 2018.3


texts: How do I create an animation without noticeable loops?

texts:
I'd like to create vivid idle and passive animations for a creature, but I want to avoid the appearance of obvious loops in the animation and avoid the use of obviously-identifiable pre-baked animation clips.

How can I accomplish this?


texts: Adding air drag to a golf ball trajectory equation

texts:
I'm developing a 2D golf game in VB.NET 2005, but I am stuck on how to implement air or wind drag that should affect the ball.

Already I have these equations for projectile:

\$v_0\$ for the initial velocity of a golfball when hit or fired
Vertical and horizontal components the velocity of the golfball:
$$
\begin{align}
v_x &= v_0 cos(\theta) \\
v_y &= v_0 sin(\theta) - gt*
\end{align}
$$
Vertical and horizontal distance of golfball:
$$
\begin{align}
x &= v_0cos(\theta)t \\
y &= v_0sin(\theta) t - (0.5)gt^2
\end{align}
$$

How do I add air drag to this equation to properly affect the velocity of the golf ball? I don't have any idea how to do it, has anyone worked with similar equations?


texts: How to create memory manipulation and how does it works?

texts: How does memory manipulation works for cheats?, how does one create it, i think it must be something to do with your RAM and changed it to give a different value, but how to create it?


texts: Enemy fire does not travel to player using RayCast2D

texts:
Enemies are using raycast to fire and detect player. The bullet has its own script that makes it move forward after instantiating it, but the problem is that it always moves in the right direction and does not take into account the rotation of the enemy.

Here is my enemy fire script

public class EnemyFire : MonoBehaviour {

    public GameObject ustaazPlayer;
    public GameObject enemyLaser;
    float timeToSpawnEffect = 0;
    public float effectSpawnRate = 4;
    public int damage;

    // Use this for initialization
    void Start () {
        InvokeRepeating("EnemyShoot", 0.00001f, effectSpawnRate);
    }

    void EnemyShoot()
    {
        Vector2 playerPosition = new Vector2(ustaazPlayer.transform.position.x, ustaazPlayer.transform.position.y);  //position of player
        Vector2 bossPosition = new Vector2(transform.position.x, transform.position.y); //enemy location
        RaycastHit2D hit = Physics2D.Raycast(bossPosition, playerPosition - bossPosition, 100);

        //if (Time.time >= timeToSpawnEffect)
        //{
            Instantiate(enemyLaser, transform.position, transform.rotation);
            AudioManager.instance.PlaySound("enemyLaser");
        //    timeToSpawnEffect = Time.time + 1 / effectSpawnRate;
        //}
        Debug.DrawLine(bossPosition, (playerPosition - bossPosition) * 100, Color.cyan);
        if (hit.collider != null)
        {
            Debug.DrawLine(bossPosition, hit.point, Color.red);
            //Debug.Log("We hit " + hit.collider.name + " and did " + damage + " damage.");
            Player player = hit.collider.GetComponent<Player>();
            if (player != null)
            {
                player.DamagePlayer(damage);
            }
        }
    }
}

and here is the script on the laser object

public class MoveBulletTrail : MonoBehaviour {

    public int speed = 200;

    // Update is called once per frame
    void Update () {
        transform.Translate(Vector3.right * Time.deltaTime * speed); //move it forward in the direction it was spawned
        Destroy(gameObject, 1); //destroy the trail after 1 second so that inspector does not get bogged down in them - so much easier than having a shredder!
    }
}

How would I make it shoot towards the player?


texts: Heuristics used for determining device performance

texts:
Often times PC games offer an elaborate settings page which lets you turn 20 different knobs. Users can modify these settings at will in the pursuit of performance, or conversely, visual quality.

But, the first time you launch the game, how does it know what settings to apply? I'm guessing there is something smarter going on than just using the 'MEDIUM' configuration for everything, and then letting the user figure out the right configuration...

In fact, I'd further guess that settings are chosen on first launch in the interest of performance, i.e. the game will choose the correct settings for this particular machine so it can run at 60 FPS and not crash from out of memory... So, if there is indeed a runtime algorithm employed that selects the appropriate settings, what kind of heuristics are used to choose those settings?

Is there a database of devices, or hardware components, that can be used to determine the correct performance of a device? (I assume not.)
Is there a scoring system based on the various specs of system components: system memory size, D3D feature level, GPU memory, etc... This seems more believable, but I'd like to know if there are examples of this being done.

And, there are other strategies that I'm not interested in, e.g. doing a mini profiling run and then determining the correct settings based on framerate of that run. Or, dynamically tuning the performance on the fly, e.g. detect the framerate is dropping, and then somehow degrade the quality to improve.

Both of those approaches aren't what I'm after. I'm looking for some heuristics to employ when the game launches, and I'd like those heuristics to be able to spit out some sort of performance criteria for the device so I can know what settings to run my game at.

If I get it wrong, the user can always go back and turn the knobs in the settings page, but I'd like to do most of the work for them!


texts:
I am making a Voxel game and I'd like to add rivers that can be redirected. So I thought that if a player replaces a river block or digs up a block next to a river block the river would repath itself to the sea. The rivers path would have a direction and a speed in that direction.

The rivers path would be determined by these rules:
If the river can go down in its direction it will and then pick up speed.
or if it has a speed under 2 and it can go sideways and down it will and keep its direction. Otherwise it will keep going in its direction until blocked, where it will pick a new direction. If the river can't go anywhere it will fill up the layer its on like a bathtub and go up.
Repeat until it reaches the ocean.

However I can't figure out how you can know what to fill. The data would be stored in some sort of height map. 1 = same level, 0 = down a level, 2 = up a level

For example:

222222
211112
211112
211112
211112
222222

I can tell that the 2s completely surround the 1s meaning that all the 1s should get filled with water if the river goes up. But how can a computer tell?


texts: Does Apple allow different versions of the same game on the App Store tailored for different regions?

texts:
We are currently in negotiations with a Chinese company to give them the right to re-sell our game in the Asia region.

Now for the Android version they want to sell it trough their website because they want to utilize China specific payment systems. This can be easily achieved by adding an activation system to the app and generating keys for the users who paid.

My problem is with the iOS version. As far as I know there is no way to install an app on iOS outside the app store environment without having a jailbroken phone. Can I just give them the archive of the app from XCode and have them upload it trough their own app store account? Will this cause a problem with Apple that basically the same app will be on the store twice with a different bundle ID?


texts: How to do an anti sway bar for a car in Unity 5?

texts:
I have researched some examples of anti roll bars for Unity but they are all for unity 4 and bellow so they do not work in unity 5. Can someone please assist me in making an anti roll bar script in C# for Unity 5?

Here is the best example I could find (I don't know how to convert it for unity 5):

using System.Collections;

public class AntiRollBar : MonoBehaviour {

  var WheelL : WheelCollider;
  var WheelR : WheelCollider;
  var AntiRoll = 5000.0;

  // Use this for initialization
  void Start () {

  }

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

    var hit : WheelHit;
    var travelL = 1.0;
    var travelR = 1.0;

    var groundedL = WheelL.GetGroundHit(hit);
    if (groundedL)
      travelL = (-WheelL.transform.InverseTransformPoint(hit.point).y - WheelL.radius) / WheelL.suspensionDistance;

    var groundedR = WheelR.GetGroundHit(hit);
    if (groundedR)
      travelR = (-WheelR.transform.InverseTransformPoint(hit.point).y - WheelR.radius) / WheelR.suspensionDistance;

    var antiRollForce = (travelL - travelR) * AntiRoll;

    if (groundedL)
      rigidbody.AddForceAtPosition(WheelL.transform.up * -antiRollForce,
                                   WheelL.transform.position);
    if (groundedR)
      rigidbody.AddForceAtPosition(WheelR.transform.up * antiRollForce,
                                   WheelR.transform.position);
  }
}


texts:
I want my raycast to end at certain height(red line). But as the game is 3D and the camera rotates I can't use a fixed magnitude. What I thought was a stroke of genius, I figured I'd project the height vector(a) to the ray direction to get vector(b). The result is in the right direction, but the magnitude of b is not big enough.

The wanted result is to get the vector b always reach the red line(Magnitude changes depending on the camera). My previous knowledge of vector projection says it should work, but obviously it doesn't. Where am I going wrong here?

---- EDIT: Question clarification ----

Step one: The ray is cast depending on used input. And it fails to hit any of the gameobjects.

Step two: Check the area around the midlevel(redline) to see if any gameobjects are close enough(green circle). For this to work, I need the magnitude of b-vector to use the Ray.GetPoint().


texts: .NET WCF as backend server for iPhone games

texts:
I'm planning to develop an iPhone game. Is it possible to use .NET WCF as a backend?
The server would be windows 2008 and MS-SQL database.


texts: workload not availble on visual studio 2017 setup

texts: i use vs2017 with unity but now when io want to install it on new pc there is a message says: workload unavailable right now. required conditions are not satisfied. not win10 threshold number1 and number2 build number


texts: OpenGL - resize texture when using cubemap

texts:
I want to resize my texture. I am using cubemap to compute reflection. I want to use this cubemap to draw skybox. Skybox is drawn but I want to resize texture down, because it is dilated. As I wrote in my previous question (question), to draw skybox I use shaders:

//vertex shader
uniform mat4 modelViewMatrix;
      uniform mat4 projectionMatrix;

        attribute vec4 position;
        varying mediump vec4 texCoord;
        void main() {
            texCoord = position;
            gl_Position = projectionMatrix * modelViewMatrix * position;

        }

//fragment shader
uniform samplerCube Sampler;

    varying mediump vec4 texCoord;

     void main() {
         mediump vec3 cube = vec3(textureCube(Sampler, texCoord.xyz));
         gl_FragColor = vec4(cube, 1.0);
     }

I send this data:

float vertices[24] = {
    -1.0, -1.0,  1.0,
    1.0, -1.0,  1.0,
    -1.0,  1.0,  1.0,
    1.0,  1.0,  1.0,
    -1.0, -1.0, -1.0,
    1.0, -1.0, -1.0,
    -1.0,  1.0, -1.0,
    1.0,  1.0, -1.0,
    };

In this order to draw cube:

GLubyte indices[14] = {0, 1, 2, 3, 7, 1, 5, 4, 7, 6, 2, 4, 0, 1};

I think, that main problem is in the vertex shader, where I use vertex data as texture coord. But I have no idea how to map vertexes to cube map texture coordinates. Can you help me?
Thanks

Edit:
It is strange, but when I multiply modelviewMatrix with projectionMatrix it does not work.
Now my code is:

    uniform mat4 modelViewMatrix;
  uniform mat4 projectionMatrix;
  uniform mat3 normalMatrix;

    attribute vec4 position;
    varying mediump vec3 texCoord;
    void main() {

        gl_Position = projectionMatrix * modelViewMatrix * position;
        texCoord = normalMatrix * (gl_Position.xyz);
    }

I have attached the screenshot, it looks quite good. Maybe it is distorted, because of the aspect ratio:


texts: How to pin a body in case of collision in Box2D or Farseer?

texts:
I'm trying to get an understanding for the Box2D/Farseer physics engine by implementing a small air hockey simulation.
There, I have the problem that the CPU player attacks the puck, kicks it, but also gets kicked back due to restitution.
I would like the CPU player's mallet to be pinned to where it currently is; being able to kick others, but not getting kicked by something else.

I have tried setting its restitution to  0 but restitution is always the maximum of the two colliding bodies and as the puck has a restitution of 0.9, the mallet will also move.

I have also tried changing the mass of the mallet to a insanely high value but this influences damping again.

What is the best approach to really pin it afte collision?


texts:
I'm developing a game with LibGDX, and right now I'm trying the multiplayer part. I have managed to connect several players through Node.js and socketIO but when I try to make the lobby I am doubting if it's correct to use this.

I have read that it's oriented to web applications, so my question is: Is it advisable to use it with Java? Should I change it?

Thank you for reading and forgive my bad english.


texts: Converting 3 axis vectors to a rotation matrix

texts:
I am trying to get a rotation matrix (in 3dsmax) from 3 vectors that form an axis (all 3 vectors are aligned by 90 degrees each other)

Somewhere I read that I could build a rotation matrix just by inserting in every row one vector at a time (source: http://renderdan.blogspot.cz/2006/05/rotation-matrix-from-axis-vectors.html)

So, I built a matrix with these example vectors

x-axis : [-0.194624,-0.23715,-0.951778]

y-axis : [-0.773012,0.634392,0]

z-axis : [-0.6038,-0.735735,0.306788]

But for some reason, if I try to convert this matrix to eulerangles, I receive this rotation: (eulerAngles 47.7284 6.12831 36.8263) ... which is totally wrong, and doesn't align to my 3 vectors at all.

I know that rotation is quite difficult to understand, may someone shed some light? :)


texts: Why aren't game bullets implemented as if they were real bullets?

texts: Let's say I'm working on a 3D first-person shooter and the boss is a stickler for realism, and orders me to implement the bullets as tiny projectiles that travel, say, 1000 meters per second. What might be some implementation difficulties, gameplay experience changes, etc. that would result from that decision?


texts: Keeping player aligned to grid in Pacman

texts:
I am making a Pacman game using XNA. The game is tile based, with each tile being 32 pixels. As the player moves, I need to know whenever it is perfectly on a tile (ie position of 32, 64, etc...) so that I can check to see if the next tile is free. I am using the following logic to test this.

if (position.X % 32 == 0 && position.Y %32 == 0)
{
    onTile = true;
}

I figure that I need to make the player's speed evenly divide 32. Everything works fine if I make the player's speed an integer such as 4 or 8. But if I make the speed something like 6.4, I end up with positions such as 64.00001, and my if statement no longer works correctly.

How can I keep the player aligned with the grid, while allowing a wider range of player speeds than 1, 2, 4, 8, 16, and 32? Or is there some better way to go about this?

Thanks


texts: www.texture and www.LoadImageIntoTexture both just show red question mark

texts:
I'm trying to use this code I found in the Unity docs to display a remote image on a plane.  However, no matter what URL I try, it only displays a red question mark.

using UnityEngine;
using System.Collections;

public class KnowledgeWall_WeatherMap : MonoBehaviour {

    // The source image
    //public string url = "https://radar.weather.gov/Conus/Loop/northrockies_loop.gif";

    public string url = "http://www.gstatic.com/webp/gallery/1.jpg";

    IEnumerator Start()
    {
        Texture2D tex;
        tex = new Texture2D(4, 4, TextureFormat.DXT1, false);
        using (WWW www = new WWW(url))
        {
            yield return www;
            www.LoadImageIntoTexture(tex);
            GetComponent<Renderer>().material.mainTexture = tex;
        }
    }
}

I also tried the code here, which is slightly different. It gave the same result.
Unfortunately this project is Unity 5.3.6.  How can I fix this so Unity 5 displays the remote image?


texts: What are the most suitable 3D sound engines out there for a FPS?

texts:
We are looking for a good 3D sound engine for a game written in C#.
We know of irrKlang, which looks great but isn't free for commercial uses, nor is it open source.
XNA has an alright one, but it binds us to DirectX and therefore, windows.
Are there any other good free ones out there?


texts: Mimicking enemy boss movement of Wonderboy in Monster Land

texts:
I want to imitate the movement of the "Death" boss enemy in Wonderboy in Monster Land.

At first, I thought it just moves with a sine wave, but it's not. The up and down movement is erratic.

I thought it changes its facing direction at the player's x position, but as you see in the video, it did not change direction when player jumped.

And if the player sits under the boss, the boss just moves up and down and changes direction irregularly.

So far I've tried to imitate its movement with this:

transform.position = pos + transform.up * Mathf.Sin(Time.time * frequency) * amplitude;

I used sine, but it's quite different from movement of the boss. How can I change the behaviour in my game to be more like this boss's movement?


texts:
Currently my collision method is glitchy, because it gets the last "good" position it was when it wasn't colliding and teleports it to that location when it collides with something. This method works, but it causes the sprite to constantly micro-jump while it's touching things.

Any recommendations for a better collision system?


texts: I am trying to make a game that is a collection of mini games. The mini games will unlock daily. There are story for each day. And the story cannot be repeated so for example the player start playing the game on Monday. He/she will unlock the story for day one and the first mini game. To unlock the next story he/she must wait until the next day. If the player skip playing at Tuesday and resume at Wednesday then he/she will lose the second story and the second mini game. My question is how to get current time that is not taken from android settings to prevent cheating? I want to prevent the player from cheating by changing android time from settings.


texts:
This is my second time making and game and I want to make sure that I fit under 50 mbs. So far my plan is to fit all the games artwork into two 2048x2048 sprite sheets. I tested a empty unity3d project and when the apk was made it was 19 035 KB of size. Where does this overhead come from and how can I reduce it?

This is not a duplicate question of this one. I'm asking why building a completely empty project results in a apk with a size of 19 MB. Does this mean that I have limit my assets to 30 MB so that the complete app will be less than 50 or is there a way to strip some of those initial 19 MB.


texts: How to know from which direction there is a collision with an object? In Unity C#

texts: In the game, there is a ball, and moving objects that can hit it. I want the ball to move when an object hits it. But the ball should move to the right direction, the one which the collision was from. I looked for some answers on the internet, however, most codes were in Java script, and those that were in C# weren't helpful because it needed a Rigidbody. The ball is a rigidbody, but the objects that may hit it, aren't. Those are being moved by the CharacterController. The question is how can I detect the collision, to know from what direction it came, and move it to that direction. Thank you.


texts: Best Algorithm for attacking in the Risk Game

texts:
I apologize in advance for my English.I'll try to explain my problem.
I am working on new version of the Risk game. I want to change the attacking algorithm to make it more similar to real life war. The sides which have more armies must have the advantage over the weaker side.

These are the original board game's rules below from Wikipedia:

  Example of matching up attacking (red) and defending (white) dice; in this case the attacker has won the battle. When it's a player's turn to attack, he or she can only attack territories that are adjacent or connected by a sea-lane to his or her own territory. A battle's outcome is decided by rolling dice. The attacking player attacks with one, two, or three armies, rolling a corresponding one, two or three dice. At least one army must remain behind in the attacking territory not involved in the attack, as a territory may never be left unoccupied. Before the attacker rolls, the defender must choose to resist the attack with either one or two armies (using at most the number of armies currently occupying the defended territory[4]) by rolling one or two die. Each player's highest die are compared, as are their second-highest die (if both players roll more than one). In each comparison, the highest number wins. The defender wins in the event of a tie. With each dice comparison, the loser removes one army from his territory from the game board. Any extra dice are disregarded and do not affect the results.

I think these rules are not very good for real life situations because we know from history that large number of armies have an advantage over the weaker side. I have to create the right balance between the two sides during the war.

Currently I am using the following algorithm

army1 = random.Next(1, 20 + (numberOfSolidersArmy1 / 5));
army2 = random.Next(1, 20 + (numberOfSolidersArmy2 / 5));

Then I am comparing army1 and army2 and decrease the number of soldiers by one of the smaller number's side.

What are your suggestions for a better algorithm?


texts:
Given a list of triangle indices, how exactly does one go about converting that to a list of indices with adjacency for a geometry shader?

Note that we're strictly talking about indices here - vertices are present, but we're going to focus solely on indices, because we can use them to match duplicate vertices without having to get into floating-point comparisons and epsilons - that work has already been done.

I know that for any given triangle in the list, indices {0, 1}, {1, 2} and {2, 0} (or {n, n+1}, {n+1, n+2}, {n+2, n} if you prefer) of it form it's edges; the index list is well-formed and respects winding order correctly.

I know that for any given such edge, we can search the entire list for another triangle that uses two of those indices, and the third index of that triangle is the one to use for completing the adjacent triangle for that edge.

I know that in the adjacency list each original triangle is represented by 6 indices, the original indices go into slots 0, 2, 4; the new indices to complete the adjacency go into slots 1, 3, 5.  The index to complete for edge {0, 1} goes into slot 1, the index to complete for edge {1, 2} goes into slot 3, the index to complete for edge {2, 1} goes into slot 5.

What have I tried?

I've tried brute-forcing it, and yes, that will work, but I'm after a more elegant approach.

I've tried Eric Lengyel's edge list builder, but (1) it doesn't seem to respect the original triangle order, (2) it doesn't seem to respect winding order, (3) it's as clear as mud where to go next after you've built the edge list, and (4) I've a suspicion of sample code that has such obvious glaring errors as "triangleIndex" versus "faceIndex" - did the author even compile the code, never mind run it to verify it?

So -- any suggestions or pointers from here on?


texts:
I was playing around on RPG JS and Browser Quest, and the player, when moving, can give the effect of walking behind the trees or houses etc, so the player effectively disappears while it is "behind" the object.

How is this effect created?

I am building and RPG using javascript and canvas at the moment, and would love to try and implement this into the game. I am working on A* movement for my character.


texts:
I have a continuous height-mapped mesh to represent landscape. I use the stencil test to create holes in the mesh. I draw holes to the stencil buffer and then use it to discard mesh fragments. Everything works fine except that my holes are visible through the mesh even if they are occluded by higher ground.

Is there any way to apply depth testing to a hole, keeping my mesh drawn in a single call to glDrawElements?


texts: Networking User Interface Buttons (build queue items)

texts:
I am creating a RTS with Unity/C#, and have noticed a problem synchronising build queues.  Is there an ideal solution to handle button prediction?

I think I may have overengineered the solution... Presently when the client clicks a button, it sends a request to the server.  The server validates the request (cost if applicable) and then returns the order to create the build queue item.  Consequently, when the client clicks a button there's a noticeable lag.

Is server validation for button presses, like build queues, in a client-server model overkill?  What would be the ideal solution?


texts: How to handle input for both UI and game

texts:
So I originally had my input system set up with only the game part in mind.  It listens to keyup/down events, marks the key as pressed/unpressed and then when the next update comes around, it sends out the state, and marks the current state as the previous state.

When I started implementing more complex UI elements, I realized this was a problem.  Textboxes want to be notified of repeated keydown events so you can hold a key, scrollbars want repeated mouse down events, etc.  On the other hand, the game only wants to know if a key is down and needs to keep track of the current/previous state for hotkeys and such.

What I would like to do is find a way to design the input system so it works for both cases.  How can I support the repeating *down messages that the UI needs while also maintaining a current/previous input state that the game needs?

It occurs to me that I could perhaps just separate the two, using the input state manager only for the game input while hooking the UI manager directly into the keyboard/mouse input events.  To me this seems less-than-ideal.  For one, it seems a bit sloppy to be hooking the input in 2 different places.  Also, doing so would remove the ability to send the current/previous input state to the UI.  I'm not sure if this is even needed for the UI though.  Maybe I'm just over-engineering things?  I would like to have that ability if it's needed though.  How have other people set up their input systems in such a situation?


texts: Working With D3D11/OpenGL Shader Reflection

texts:
I've been working in my off-time to do some system design for a game engine as a fun and challenging project, and i've hit a bit of a wall. I've made an interface which is a renderer that i try to incorporate elements similar to both d3d11 and opengl so that implementations of both are still very functional behind said interface. In the process of working with abstracting shaders, i was wondering if there was a way to actually enumerate the uniforms / cbuffers in a shader using shader reflection, rather than query for them by name. In openGL, the only way to set a variable is if you query for it by name (I think), and in d3d11 you are able use the ID3D11ShaderReflection interface, but are only able to query cbuffers and variables by name. My knowledge is pretty new in opengl, but i was wondering if there was a way to grab or make a list of all the uniforms / cbuffers present in the shader, so that i could query the rest of my engine for the values needed.

What this would do for me is simple: Rather than my engine requiring compiled knowledge beforehand of what variables some specific shader might need, it can instead obtain the names and typenames of all the variables it requires to function correctly. Then i can code a resource container that can hold any number of types and resources, which are associated by variable name in a map or similar, which would allow me to compare the names of the values in the resource container, with what the shader required, and then tell you which uniform /cbuffer value you didn't bind to something. Is this possible, because it sounds incredibly useful.


texts: How do i make turn based combat with 10+ players work?

texts:
I am currently developing a game with a turn based combat as focus.

The games battles will need to be able to handle 1 to 20 players (Multiplayer).

Each unit (Player and AI) each has an initiative (higher initiative the higher in order you are)

I am now in the stage where i will start writing the game mechanics for the turn based combat and i believe the classic turn based (individual turns) will take too long especially if someone is AFK or just slow. My initial idea was to add a timer based on the number of players min-capping at 10 seconds, but i don't want to stress out my players.

My other idea is to allow every player and AI select their actions at the same time with a higher timer at 1 minute. When all the players has selected or the time has run out the initiative order are run for each unit with their action.

I am aiming for the second one but i want to know if this is the best way to take. It will add an other dimension of strategy since each player will have to calculate what the opponent will do so they cant take action for what they have done.

Do anyone know an other way to do this?
What would you chose and why?


texts:
I was wondering, if Application.ExternalEval(String script); in Unity3D can return something.

Like:String playerName = Application.ExternalEval("prompt("Please enter your name", "player1")");

Thank you in advance!


texts:
I want to change the reload speed of my player when a button is pressed in the pause menu.

I created a button and attached the following script to it (as suggested by the documentation here: https://docs.unity3d.com/ScriptReference/AnimationState-speed.html ):

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

public class PauseUpgrade : MonoBehaviour {

public Animation reloadAnim;
private float startSpeed;
// Use this for initialization
void Start () {
    startSpeed = reloadAnim["Reloading"].speed;
}

public void upgradeSpeed()
{
    reloadAnim["Reloading"].speed += 0.5f;
}

But this does not work. I cannot seem to drag the reload animation into the public variable declared above. Is this the correct way to solve this?

The above image shows my animation controller for my player. I am trying to change the speed of the "reloading" animation clip.

I am trying to drap the animation clip from my projects folder into the public variable below, but I get a cross sign preventing me from dragging it in as if its the wrong type or something.

Thanks


texts: What happened to sprite::setSize in SFML2?

texts:
I'm porting one of my old projects to sfml 2.0, and I had a background that I scaled using

sprite.setSize(windowWidth, windowHeight)

Now, it seems like setSize has ben removed in 2.0, and I'm wondering what the intended replacement is.

I know there is a setScale function, and that I could do something like:

auto size = sprite.getTexture()->getSize();
sprite.setScale(float(windowWidth)/size.x, float(windowHeight)/size.y);

but I think this is really ugly and clunky, is there another way to do it?


texts:
In a roguelike I'm developing in Ruby, I started with a traditional object hierarchy where all game logic relevant to creatures were contained in the Creature class. Movement logic, for example:

Creature.instance_methods(false)    # => [ :move ]

In my design, the map and creatures are decoupled: the map has no idea what's on a tile and the creature has no idea which kind of tile it is on. What brings them together are coordinates.

Movement logic requires information about where on the map the creature is, so the creature would need access to the map. The map belonged to the game, so I just added a game attribute to every creature as a quick solution. I didn't really want to pass a map instance every time the creature needed to move around because the map the creature is on isn't likely to change.

In the end, I removed the game logic from the Creature class, and separated them into modules:

Game::Logic::Movement.singleton_methods(false)    # => [ :move ]

The way I understand it, these logic modules integrate multiple game parts which depend on each other in a way not easily expressed hierarchically. The methods are just algorithms that operate on the given information. For example, the implementation of the move method:

def self.move(creature, map, dx, dy)
  coordinates = Map::Coordinates[dx + creature.x, dy + creature.y]
  tile = map[coordinates]
  creature.coordinates = coordinates if tile and tile.passable? # Teleport!
end

These methods are called directly from the game loop:

def handle(input)
  case input
    when :up then Logic::Movement.move character, map, 0, 1
    # ...
  end
end

This is how the game is currently organized. Movement is the only game logic I've added as of now, so I think it would be wise if I revised the architecture while it is still small. So, what do you think of it? What are the problems, and what can I do to improve it?

I'm also interested in how it compares to component-based game architecture. I've read a lot about it during my research, and it seems to be the most maintainable and reusable way to write game code. I think it would fit naturally in the Ruby world, due to its dynamic nature and message-based method invocation. The thing is, I really never understood how different components interact with each other, and I'm looking for something I can make sense of.


texts: What's the best way to train PID controllers?

texts:
This is borderline non-gamedev but PIDs are commonly used in games so I thought I'd give it a shot.

I've got a few PID controllers in my game, used for things like steering and throttle control. I'm having trouble tuning them accurately.  It never feels like I'm getting closer to the optimial solution, and it's very tempting to just leave them "good enough" with the odd oscillation or spike I can't get rid of.

The one controller that's driven me to this post with frustration produces minor oscillations for very very small error inputs.  At large inputs it's ok but not very stable.

Does anyone have any tips or resources on how I can train these things more reliably?


texts: Minecraft modding: onLanded and item type/positioning?

texts:
My question is about programming Minecraft mods. So i added a block to my Mod. Now I want, that when you drop a sugar on it, that it waits some time and then, if the sugar is still there, it will consume the sugar and spawn an item that i made for my mod. But I don't know how to test wether the item is sugar. I use the event onLanded with an

@Override
public void onLanded(World worldIn, Entity entityIn)
{
    if(entityIn instanceof EntityItem && !worldIn.isRemote)
    {

    }
}                                                                                }

but I don't know where to specify the item and where to get the position of the block.

I hope anyone can help me and sorry for my bad english I'm not a native speaker. Thank you in advance Nova


texts:
How do I detect if two sprites are being touched at the same time?

I was able to detect one sprite, but not if another sprite is being touched by the second pointer.

if(spr.getBoundingRectangles.contain(x,y))
{
    //do this
}

Then, I created two Vector3 variables for the pointer coordinates, before iterating to each pointer.

for(int i = 0; i < Constants.MAX_POINTERS; i++)
{
    if(Gdx.input.isTouched(i))
    {
        xy.set(Gdx.input.getX(i), Gdx.input.getY(i), 0);
        xy1.set(Gdx.input.getX(i), Gdx.input.getY(i), 0);
        WorldRenderer.camera.unproject(xy);
        WorldRenderer.camera.unproject(xy1);

        if(Spr.getBoundingRectangle().contains(xy.x, xy.y) &&
            Spr1.getBoundingRectangle().contains(xy.x, xy.y))
        {
            score += 1;
        }
    }
}

What happens is that xy and xy1 are always the same, so when I touch the screen with the second pointer, they will just both switch to the new coordinates instead of xy and xy1 having different x and y values.


texts:
I am transitioning my project from Resources to Addressables. Some parts of my game just aren't worth doing asynchronously, and would just cause more problems - but I still want to use Addressables for its other benefits.

Anyway, it doesn't offer any synchronous methods in their API. Unity has an official repository with an example for "synchronous addressables" right here: https://github.com/Unity-Technologies/Addressables-Sample/blob/master/Advanced/Sync%20Addressables/Assets/SyncAddressables/SyncAddressables.cs

Although the code does appear to work in the few tests I've done The code below won't always work, and it doesn't make sense to me anyway. This is the relevant method:

    public static TObject LoadAsset<TObject>(object key)
    {
        if(!s_Initialized)
            throw new Exception("Whoa there friend!  We haven't init'd yet!");

        var op = Addressables.LoadAssetAsync<TObject>(key);

        if(!op.IsDone)
            throw new Exception("Sync LoadAsset failed to load in a sync way! " + key);

        if (op.Result == null)
        {
            var message = "Sync LoadAsset has null result " + key;
            if (op.OperationException != null)
                message += " Exception: " + op.OperationException;

            throw new Exception(message);
        }

        return op.Result;
    }

It will throw an exception if the asset didn't manage to load instantly (the !op.isDone part). Sure, that's technically synchronous, but it seems to ignore the elephant in the room: if the asset is large I would expect it to need a bit more time (i.e. freeze the game), which is fine for my current needs - but instead, the game will just end up crashing because it couldn't load immediately.

What is the most appropriate way to achieve synchronous Addressable asset loading?


texts:
Many phone games restrict the number of turns you can play in a given amount of time. I don't get what is the purpose of this limitation. Is it only to force the player to buy additional turns? Some games don't even allow this for some turn "kinds" (like action A can be played again by spending real money while action B cannot be played again by spending money).

Another possible reason would be to limit the bandwidth usage to their server and make it more predictable over time, but I can't see phone games using so much data.


texts:
I have encountered the following (i think) precision error.

(missing link need 10 rep)

My source of inspiration was:

(missing link need 10 rep)

On the PC everything works fine, but on android it shows those weird squares.

I had the same problem with a procedurally masked sprite. When the radius of the circle was getting too big i had the same error so i changed the mask from a shader radius uniform to a texture mask uniform, so i guess there is a precision problem.

This guy here had the same problem but unfortunately i can't see the answer.

(missing link need 10 rep please someone upvote me.)

The code adapted to OpenGL ES is the following:

#version 100

precision mediump float;

uniform sampler2D tex_diff;
uniform vec2 light_on_screen;

varying vec2 texture_coord;

const int NUM_SAMPLES = 128;

void main()
{
    const float exposure = 0.0225;
    const float decay = 0.95;
    const float density = 0.95;
    const float weight = 3.75;

    // Inner used valuesa
    vec2 deltaTextCoord = vec2(texture_coord.st - light_on_screen.xy);
    vec2 textCoo = texture_coord.st;
    deltaTextCoord *= 1.0 / float(NUM_SAMPLES) * density;
    float illuminationDecay = 1.0;

    vec4 c = vec4(0, 0, 0, 0);

    for(int i=0; i < NUM_SAMPLES ; i++)
    {
        textCoo -= deltaTextCoord;

        textCoo.s = clamp(textCoo.s, 0.0, 1.0);
        textCoo.t = clamp(textCoo.t, 0.0, 1.0);

        vec4 sample = texture2D(tex_diff, textCoo);

        sample *= illuminationDecay * weight;

        c += sample;

        illuminationDecay *= decay;
    }

    c *= exposure;

    c.r = clamp(c.r, 0.0, 1.0);
    c.g = clamp(c.g, 0.0, 1.0);
    c.b = clamp(c.b, 0.0, 1.0);
    c.a = clamp(c.a, 0.0, 1.0);

    gl_FragColor = c;
}

Showing the whole engine is useless since it's huge. All the shader input is correct, the coordinates are correct, the only problem is the inner shader computation.

Anybody encountered this or has any ideas for any workarounds?

Scanned the whole net for a solution for this, and i couldn't seem to find one. Any can point me in the right direction? Or maybe someone encountered this type of error in a different context or in a different shader? Maybe i can apply the same workaround here too.


texts: Slick2D noClassDefFoundError for StateBasedGame

texts:
I'm trying to write a 2D game using slick2D, and I thought I set everything up correctly, but I'm getting this error:

Error: Could not find or load main class javagame.Main_Game
Caused by: java.lang.NoClassDefFoundError: org/newdawn/slick/state/StateBasedGame

My Main_Game class is the class with my main function and it extends StateBasedGame. I can't find this error or how to fix it when I try to search for it.


texts: Is there a way to get mouse coordinates relative to an sfml window without locking the mouse to the window border or monitor edges?

texts:
As the title states, is there a way to get the relative mouse coordinates to the sf::RenderWindow without locking the mouse cursor inside of the window border or monitor edges?

In glfw using a mouse callback function and setting the cursor with a glfw call it grabs the mouse coordinates relative to the glfwwindow but doesn't lock the mouse anywhere, the mouse is free to move on the x-axis as much as the user can drag the mouse.

The sf::RenderWindow function of setMouseCursorGrabbed(boolean, window) is a good function to use but as stated this locks the mouse inside the window.

If there is no way to do this via sfml, then is there a way I can use the glfw callbacks with an sf::RenderWindow?

The goal here is to make a fully rotate-able (360 degree) First Person Camera. I am currently unable to rotate the full 360 degrees, there is about 50 degrees lost when the mouse hits the right or left edge of the sfml renderWindow.

Thanks!


texts:
Let's say you have an n-by-m grid. Some squares are occupied, some are not.

You want to know where in the grid you can fit arbitrary shapes such as to not hit an occupied square. The shapes would variable, and could be x-by-y rectangles, trapezoidal-ish shapes, etc.

Are there algorithmic approaches to this?


texts: Oculus Integration on Unity 5.1.2 not showing Oculus Lenses (like two black boxes) when debugging/editor

texts: I added Oculus Utilities for Unity 5.1.2, created a simple scene, added OVRCharacterController prefab, it works fine like normal fps controller but as far as I know, it should show something like 2 separate display screen on monitor with that black distortion outline frame. I have no hmd. The runtime is running, and OVR service is also running. It is set to extended mode. One thing to note here is that there is no Oculus setting option in player settings.


texts:
I was trying to implement a simple mechanic by drawing a line between the sprite and the mouse, but it's not working that well:

extends KinematicBody2D
onready var player = $CollisionShape2D
var pos_two
var pos
func _physics_process(delta):

    var vel = Vector2()
    pos_two = player.get_position()

    pos = get_global_mouse_position()
    look_at(pos)
    if Input.is_action_pressed("movethere"):
        vel = Vector2(400 , 0).rotated(rotation)
    vel = move_and_slide(vel)
func _draw():
    draw_line( pos_two ,pos, Color(255 , 0 , 0))


texts: Is it legal to use other game's title word in my game's name?

texts:
Is it legal to use e.g. the word "Fortress" in my game’s title?

There is a game called Team Fortress and I think it’s trademarked. I’m thinking of replacing the word "Team" with another word and using that name in my game (with an intent to make money).

Would I get in trouble?


texts: In a client server first person shooter how does the server keep track of each player's hit boxes?

texts: Do all the clients send a transformation matrix for each of the hit boxes which make up the character?


texts: What is the best mechanism for controlling a character in a 2D Android game?

texts:
Im developing a 2D RPG for Android where the character can move up, down, left, and right like in top-down RPGs like Pokemon.

What is the best input mechanism to use to control the character? A virtual joystick seems a bit to complicated for just straight movement.


texts: How can my entities avoid walking on certain tiles?

texts:
In my tile map, created with 'Tiled', I placed some tiles that need to be avoided by my mobiles. Tiles like water or obstacles.

The entities "wander" in the map, choosing random directions, and their position are in world coordinates (float), not grid or tile positions (int). To create a more natural effect, the random directions are similar in a period of time, so no abrupt change of direction occurs.

Is there a way to make entities avoid some tile types, or 'Tiled' tile properties, without losing the "wander" behaviour? I mean, choose random directions that do not reach these type of tiles?


texts: Exported shapekeys to unity don't play correctly (unity 2019 + blender 2.79)

texts:
Hopefully someone can shed some light on this

I select all relevant parts of the mesh and armature etc and export to FBX 7.4 for use in Unity3d The model itself displays fine and so does the armature animations but the shapekeys come out really weird.

Any ideas or do you need more info?


texts: texlod() is not supported on ps_4_0_level_9_3 , how can I do a similar operation in this case?

texts:
Ihave an interesting problem for you guys

I am trying to compile a pixel shader that I ported from GLSL and I am having trouble with a texCUBElod() function that the compiler say's is not supported on the current target, which is ps_4_0_level_9_3  in this case.

Here is the function I am trying to  compile:

uniform samplerCUBE EnvMap;
uniform float EnvMapLod;
float4 FS():COLOR:
{
   float4 color;
  float4 reflected;

   /*
   Processing values
   */

  color = texCUBElod(EnvMap, float4(reflected, EnvMapLod));
  return color
}

The compiler returns this error:

error X4532: texlod not supported on this target

Thank you very much


texts: Rendering another screen on top of main game screen in fullscreen mode

texts:
my game runs in fullscreen mode and uses active rendering. The graphics are drawn on the fullscreen window in each game loop:

    public void render() {
    Window w = screen.getFullScreenWindow();
    Graphics2D g = screen.getGraphics();
        renderer.render(g, level, w.getWidth(), w.getHeight());
    g.dispose();
    screen.update();
    }

This is the screen.update() method:

public void update(){
    Window w = device.getFullScreenWindow();
    if(w != null){
        BufferStrategy s = w.getBufferStrategy();
        if(!s.contentsLost()){
            s.show();
        }
    }
}

I want to display another screen on my main game screen (menu, inventory etc). Lets say I have a JPanel inventory, which has a grid of inventory cells (manually drawn) and some Swing components like JPopupMenu. So i tried adding that to my window and repainting it in the game loop, which worked okay most of the time... but sometimes the panel wouldn't get displayed. Blindly moving things around in the inventory worked, but it just didn't display. When i alt-tabbed out and back again, it displayed properly.

I also tried drawing the rest of the inventory on my full screen window and using a JPanel to display only the buttons and popupmenus. The inventory displayed properly, but the Swing components keep flickering. I'm guessing this is because I don't know how to combine active and passive rendering.

    public void render() {
        Graphics2D g = screen.getGraphics();
        invManager.render(g);
    g.dispose();
    screen.update();
    invPanel.repaint();
    }

Should i use something else instead of a JPanel? I don't really need active rendering for these screens, but I don't understand why they sometimes just don't display. Or maybe I should just make my own custom components instead of using Swing? I also read somewhere that using multiple panels/frames in a game is bad practice so should I draw everything on one window/frame/panel?

If I CAN use JPanels for this, should I add and remove them every time the inventory is toggled? Or just change their visibility?


texts: How to add a fluorescent effect on an image in Unity

texts:
I have recently been attempting to create a true on-screen representation of a fluorescent orange colour on an image. Whereby, I believe post-processing with unity will deliver the best results.

Thus, I was wondering if someone could kindly guide me through the steps to add a fluorescent effect to my image?

As a reference I would like to try match pantone 804c on screen.

Image in question:

I have tried to follow tutorials like this, but unfortunately they all are working on 3D scenes. I have a pre-existing jpg image that I want to modify.


texts:
I am trying to implement cartoon style terrain generation in Unity with perlin noise.

I want to create 3D rolling hills for my game like in mario

The low frequency perlin noise I leverage always gives me realistic rolling hills, but I want that very cartoony edge between elevations and the flat tops.  Any ideas how this may be acheived? I suspect it may have to do with playing with some easing function between neighbouring points (non-linear quantization?).

to expand, could something like this wrapped around a sphere  work (my world will be spherical with displacement).
I would setup a biome etc. but if the aforementioned would work, how would i go about generating the height map texture like the image ?


texts: How to make an articulated mob in Minecraft?

texts:
I am attempting to make a sea serpent, and I want to know how to make it be able to turn in any place, or at each 'segment', somewhat like the snakes in mocreatures. I know how to make mobs in general, rendering and modelling, as well as AI, so it's just this single element.

I am using Forge if that helps.


texts: How do you save the rendering of a tiled map to an image?

texts: Im currently using LibGDX and drawing a tiledmap with the OrthogonalTiledMapRenderer. Is there a way to save one rendering and put it into some file as an image? If you know of a method that doesnt use OrthogonalTiledMapRenderer, thats ok too.


texts: How to map control key to a specific angle or orientation?

texts:
At the moment, I basically have built out a large hash table of various angles and what direction they map to, if the user would press right, up, down, left. This is needed, in my case, as I have a collection of geometries that when the user presses right, they all go right, and when left, they all go left ...

However, when the scene containing these is rotated anything other than its original state, these controls need to be updated/reversed/etc. That is, if you're looking at the scene from behind, pressing left now has the objects all going right, etc.

I was trying to see if there is a simpler way of applying matrix transformations instead of hard coding a large hash table mapping various scene angles to keys.


texts: LibGDX Rotate 2D image with touchDragged() event

texts:
Objective: to rotate an image in the center of the screen with movement equal to left or right touchDragged event.

Right now I have a basic Stage that is created and adds an actor (centerMass.png) to the stage. it is created and rendered like this:

public class Application extends ApplicationAdapter {
Stage stageGamePlay;

@Override
public void create () {
    //setup game stage variables
    stageGamePlay = new Stage(new ScreenViewport());
    stageGamePlay.addActor(new CenterMass(new Texture(Gdx.files.internal("centerMass.png"))));

    Gdx.input.setInputProcessor(stageGamePlay);

}

@Override
public void render () {
    Gdx.gl.glClearColor(255f/255, 249f/255, 236f/255, 1f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    //before drawing, updating actions that have changed
    stageGamePlay.act(Gdx.graphics.getDeltaTime());
    stageGamePlay.draw();

    }
}

I then have a separate class file that contains the CenterMass class, extending Image. I am familiar enough to know I could extend Actor, but I am not sure the benefit I would gain using Actor vs Image.

In the CenterMass class I create the texture, set bounds, set touchable and center it on the screen.

Inside CenterMass class I also have an InputListener listening for events. I have an override set for touchDragged where I am trying to get the X and Y of the drag, and use that to set the rotate actions accordingly. That class looks like this:

//extend Image vs Actor classes
public class CenterMass extends Image {
public CenterMass(Texture centerMassSprite) {
    //let parent be aware
    super(centerMassSprite);
    setBounds(getX(), getY(), getWidth(), getHeight());
    setTouchable(Touchable.enabled);
    setPosition(Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2);
    setRotation(90f);

    addListener(new InputListener(){
        private int dragX, dragY;
        private float duration;
        private float rotateBy = 30f;

        @Override
        public void touchDragged(InputEvent event, float x, float y, int pointer) {
            //get
            float dX = (float)(x-dragX)/(float)Gdx.graphics.getWidth();
            float dY = (float)(dragY-y)/(float)Gdx.graphics.getHeight();

            duration = 1.0f; // 1 second

            Actions.sequence(
                    Actions.parallel(
                            Actions.rotateBy(rotateBy, duration),
                            Actions.moveBy( dX, dY, duration)
                    )
            );

        }
    });
}

@Override
protected void positionChanged() {
    //super.positionChanged();
}

@Override
public void draw(Batch batch, float parentAlpha) {
    //draw needs to be available for changing color and rotation, I think
    batch.setColor(this.getColor());
    //cast back to texture because we use Image vs Actor and want to rotate and change color safely
    ((TextureRegionDrawable)getDrawable()).draw(batch, getX(), getY(),
            getOriginX(), getOriginY(),
            getWidth(), getHeight(),
            getScaleX(), getScaleY(),
            getRotation());
}

@Override
public void act(float delta) {
    super.act(delta);
    }
}

The Problem:
I have not been able to get it to rotate the way I would like. I have been able to get it to shift around in unpredictable ways. Any guidance would be much appreciated.


texts: Is client-side prediction supposed to cause lag?

texts:
I found this general question, but I'd like clarification on a specific point.

Consider this simple scenario:

Client A sends input to move at T0.
Server receives input at T1.
All clients receive the change at T2.

With client-side prediction, client A would start moving at T0, client-side. All other clients receive the change at T2, so to them, client A only started moving at T2.

If I understand correctly, client B will always see client A's past position and not his current position! Is that supposed to happen? How can I sync those clients' world views?


texts:
This screenshot is from Windows app called MyRadar by ACME AtronOmatic LLC. I found their wind direction animation to be very visually appealing and was wondering if anyone knew how to create this animation?

I prefer Java, Python, C++, or MATLAB answers for the code for creating this animation if possible.

Edit: So I know MATLAB and Python already have libraries for creating vector fields. However, I only found the ones that only change the direction and magnitude of the arrow. In this animation, the vector field arrow moves along the vector field.


texts: GLX/X11 Changing the rendering resolution

texts:
I have made a simple application that creates a window with an OpenGL 4.2 context and takes user input.

I have implemented making the window go fullscreen with XRandR and can change the display resolution.

I would like to change this so that I don't have to set the displays resolution and only the window/contexts so that it renders at a lower resolution but the display stays at its default.

How could I implement this? Which extensions provide this or can I do this with XRandR and just manipulating the window rather than the root window(dektop)?

Thanks.


texts:
I want to analyze the each component of my 4*4 ModelView Matrix.

I came to know that the starting 3*3 of ModelView Matrix stores rotation.

If i want my object to have no rotation with respect to camera so My ModelView Matrix looks like this

How to change my ModelView Matrix if i want to have NO Translation or Scaling ? Can anyone explain the Maths behind this


texts: How to know when your game concept is simply not fun and to stop

texts:
I'm a new hobbyist game developer but have yet to come up with something original that I found to be really fun. The hardest part I find about game development is this:

You have an idea that in your head looks like it would be really fun.
You build a quick prototype and you realise that in reality its not so much fun for the user.
You realise that your brain was tricking you by giving you the impression that you had a complete idea but in reality it was skimming over lots of missing details that prevent you from reaching the fun that you envisaged.
You come up with lots ideas to fill in the missing gaps and hopefully make it fun.
You try these ideas one by one but it seems none of them really get you to where you wanted.

When do you know to stop trying these ideas and admit the overall game concept sucks? Do you just keep on iterating on them and hope you find the magic formula?

Do people have any rules they follow in this process?


texts:
I would like to create an object dynamically when the player presses Q and use this object in Instantiate and in transform.Translate.

The problem is that the translation must be outside the if that checks for the Q press, but it applies to the cube that I created inside the if.

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

public class instancier_new_object : MonoBehaviour {

    public float moveSpeed=5f;

    void Update () {
        if (Input.GetKeyDown (KeyCode.Q)) {
            GameObject objet = new GameObject ("objet");
            GameObject cube = new GameObject ("cube");

            cube = Instantiate(
                       objet,
                       new Vector3(1, 2, 3),
                       Quaternion.identity
            );
        }

        cube.transform.Translate(
                 Time.deltaTime*moveSpeed,
                 0,
                -Time.deltaTime*moveSpeed,
                 Space.Self
        );
    }
}


texts: How to display unicode text in monogame?

texts:
I'm looking for ways to draw any characters that may be entered in any language, on any keyboard, so that I don't have any trouble with limited language support in a monogame project.

So far I've only found how to add specific ranges of characters to SpriteFont, which is a bit insane because it means there will be a huge texture with all the characters, and it would probably eat up tons of memory. And then changing font size would mean more textures if I want to keep the quality 100%.

Is there a way to render text without pre-baking textures for every character like that? I've read that it's possible to use DirectWrite, GDI or Windows' means of drawing text to a DirectX texture, but that info is 6 years old, and I'd like to know if there are better ways now.

Update: So far I've found that Awesomium seems to be how people render nice GUIs these days, including the ability to write any text from any unicode region, provided you have the font files to render them. But it would require some alchemy to render that over the game's viewport. I haven't figured out exactly how to do it yet.


texts: How can I make a shader that renders only the scene's skybox?

texts:
I am trying to replicate the following image:

There are a few ways about doing this that involve camera stacking, layers, etc. Is it possible to create a shader that will only render the skybox?


texts: Deferred rendering: camera inside point light's sphere of effect

texts:
I'm trying out deferred rendering and I'm using the tutorials at http://ogldev.atspace.co.uk. I've got the basics working and I'm currently trying to implement the final step from tutorial 37 (http://ogldev.atspace.co.uk/www/tutorial37/tutorial37.html). In the previous tutorial, the author explains how to render point lights as spheres in a second render pass, combing the effect of the lights with the data generated in the geometry buffers in the first pass, and I've got this working already.

In tutorial 37, he explains how to use the stencil buffer to limit the influence of the lighting to only light up objects actually inside the light sphere. He describes how the stencil buffer is set up to decrease the stencil value when the depth test fails for front facing polygons and increase it for back facing polygons, resulting in the stencil buffer containing zeroes for all pixels belonging to objects outside the light sphere (as these will either be in front of the light sphere, leading to the depth test failing both for the front facing and the back facing polygons of the lights sphere, causing the stencil value to first decrease by one and then increase by one, or behind it, leading to neither front facing nor back facing polygons of the light sphere failing the test so the stencil value remains unchanged). Objects inside the sphere though cause the depth test to fail only for back facing polygons, leading to the stencil value being not zero. This will later be used to only render the light sphere on pixels for which the stencil value is not zero.

So far, so good. But then there is a remark saying that the case when the camera is inside the light sphere is left as an exercise for the reader, and this comment puzzles me. Won't it still work the same way? If the camera is inside the light sphere, then objects in front of the light sphere will not be rendered at all (since they are behind the camera). Objects behind it will still not cause the depth test to fail for the back facing polygons of the light sphere (and the front facing polygons will of course not be rendered) so the stencil values for those pixels will still be zero. As for objects inside the light sphere, the depth test for the back facing polygons will fail, causing the stencil value to be different from zero. It seems to me that no special consideration will need to be taken for the case when the camera is inside the light sphere, but maybe I'm missing something. Can someone please help me figure this out?


texts: Collision Response in Entity Components Systems

texts:
This question seems to be a duplicate of mine, but I don't think it is.

I'm trying to build a game using an ECS, but I want this ECS to be as simple as possible, therefore I am eschewing messages.

My question is where should the the behaviours go for collision responses. Not physical responses, but logical response (e.g. bullet hurts player, player picks up health, explosion destroys enemies).

Is there a big HandleCollisionsSystem, or does each type of collision have it's own system or should the logic be in one or both of the colliding entity's components (but a component is just data, right?)

I'm sure there are several approaches, but for the moment I would like to err on the side of simplicity.


texts: Is there a way to get what pixel is being processed within the fragment shader?

texts: In OpenGL, a fragment shader goes through each pixel, right? So is it possible (within the shader itself) to get what pixel it is processing and color each specific pixel?


texts: Which is the best LOD method for planet rendering?

texts:
I'm currently working on my thesis, it is an engine to render terrains of planetary size.

I'm still finishing my research and I have encountered a lot of stuff about this subject, the problem is that I can't decide on which Level of Detail (LOD) method I should use.

I know about geomipmapping, geometry clipmaps (GPU) and chunked LOD by Ulrich that work good on large terrains and can be used to render 6 faces of a cube and then "spherify" the cube by this method and I understand how to implement all of these methods on GPU using C++/OpenGL/GLSL (using methods like ROAM or any other method that doesn't use a cube is out of my reach because of texturing is a pain). Also I recently got into a tutorial of rendering terrains using tessellation shaders here

So, I don't have the time to implement ALL the methods and see which one is the best and more suitable for a planetary scale and I'm asking here to see if someone has made this kind of comparison and help me decide which method should I implement and use (my tutor is kind of crazy and wants me to do something with an icosahedron, but I can't understand that method unless using ROAM)

Anyways, if you can help me decide or have any other suggestion or method I really will appreciate. One condition is that the method should be able to implement GPU side (at least most of it) to prevent CPU bottleneck.

Another request is that I know there are numerical problems about precision with floats when getting a lot of detail in the terrain, I don't know how to solve it, I read a solution in a forum but can't get to understand how to implement, I lost track of that thread and I would like to know how to solve this precision problem.

I'm currently reading about some matrix transformations to solve the float precision, z-fighting issues, frustum culling with dynamic z-values, and data representation for chunks (using patch space with floats and its position in the world coordinates as double) so I think I can solve the precision problem easily. I still need a comparison between LOD methods with your opinions and suggestions to decide which is better for this project. Take in count difficulty of implementation vs visual quality vs performance, I want the best.

Something I forgot to mention is that the generation is hybrid, I mean, I should be able to render the planet entirely using GPU (heights calculated on the fly) and/or using a base height-map image and add details with GPU (vertex shader). Texturing will be a side part I will trouble latter, right now I'm happy using just colors depending on the height, or maybe using some kind of noise texture generated on the fragment shader.


texts: What is the "main" implementation of OpenGL?

texts:
What is the main implementation of OpenGL?

I see GLUT everywhere, but I want to use whatever is closest to an official implementation, or what ever I will have the most control over.

I might not be asking this right since it's contributed to by different parties. Which is why I have been looking at DirectX, but I see more people using OpenGl so I'd like to use that instead.


texts:
I have a layout for my game similar to this:

Where the light gray area is reserved for HUD elements and the dark gray area is reserved for the actual game. One function I want to offer in the dark gray area is the ability to zoom and move around, which works independently from the light gray area, meaning that no matter how far I zoom in/out or how far I move, the light gray area remains unaffected.

How can I do this without always taking the offset center into account? How can I completely separate the game play part and the HUD?


texts: Adding a collider to a wheel in a way that does not interfere with the suspension

texts:
I want to add a collider to a wheel so that it does not interfere with the suspension in any way but will allow the car to run into walls or other cars. The implementation of the wheel is as follows:

Raycast downwards a fixed distance from the wheel's position to see if you are touching the ground. Calculate "spring" (how much the suspension is coiled) and add an appropriate force to the Rigidbody. If there is a collider on the wheel though, then it will just hit the ground and the shocks will not be able to compress because the ground will not get closer to the Raycast origin.

I can't just disable collision between the ground and the wheels, because then if the car falls over its wheels will just fall through the ground. And that's bad because the Raycast would be in the ground.

I have spent the day trying to come up with a solution to this, but can't wrap my head around it. If it wasn't for games like Crossout doing this, I would say it is not possible.

Thanks!


texts:
What term would you use to describe the type of touch gesture whereby the user touches a point on screen, and an object moves (ease-out) to the location where the finger is touching the screen?

Can you tell me the names of the different types of multi-touch gestures (screen-based) such as tap, swipe, etc.?


texts: Unity: How many Raycasts per Sphere Collider?

texts: I understand that a simple sphere collider in Unity is a raycast in all directions with a certain length. How many Raycast events does a sphere collider trigger? At what degree increments are the rays cast?


texts: How to make sure that a GameObject which gets a certain tag first, is allowed to do something first?

texts: I have created a trigger zone to make sure that only one gameobject should pass through the trigger zone at once. Other gameobjects approaching the trigger zone are made to stop just outside the trigger zone if there is already a gameobject in the trigger zone. I could get things working up until here. Now, I need to make sure that the gameobject that got to the trigger zone first and started to wait first is allowed to pass first while others wait and then the second gameobject is allowed to pass and so on. I am stuck at this part.


texts: How do i make an idle-styled counter in Javascript & HTML

texts:
I just started making a basic game in HTML, CSS, Javascript, and JQuery, but I want to have the money add up after a certain amount of time (if you have ever played an idle game, you'd know what i mean) but i cant figure this out.

If anyone could help me out, i would appreciate that.

<!DOCTYPE html>

    <link rel='stylesheet' href='style.css' />

Copper Coins: 0


texts: Is there a standard way to rig a humanoid?

texts:
I am using some placeholder humanoid models for my game, which will be replaced later.  I am concerned that when I replace them, they will not work with my animations, due to different rigging.
Is there a standard rigging that artists use for humanoids?  Such as, is there always a the same number of body parts attached in the same hierarchy, or does this vary based on the artist/studio?  If there is a standard, what is it?  If there isn't how can I ensure that my animations and models play nice?

I use Unity, if it's relevant.
Disclaimer:  I am not an artist, and I have no idea what I am talking about.  Please feel free to ask for clarification.


texts: Drawing and rotating bitmaps (with transparency) efficiently in Android

texts:
I just started making a game for Android and I'm already having some issues regarding performance.

You can imagine the game as being some kind of Tower Defense game with a top-view, and the enemies can move in all directions, so I need to be able to make the sprites rotate in all directions.

I'm currently using a sprite-sheet with transparency for the enemies and using canvas.rotate() to make all the enemies face a given target.

When there are 60 enemies on screen, it takes about 25ms to rotate and draw the enemies, but if I remove the rotation part, it takes about 7 ms. In itself, it doesn't seem too bad, but there are going to be many more enemies at once on screen eventually, with projectiles, other entities, etc. and I'm drawing the background tile by tile (around 80 tiles), so that's 80 more bitmaps to draw, although at the moment it's only 4 different bitmaps being drawn multiple times.

Here is part of the code that draws and rotates the enemies:

In the "render" method in a SurfaceView, called in the gameloop:

for (Enemy enemy : level.getListEnemies()) {
        if (enemy.isVisibleInView(level.getCamera(), screenWidth, screenHeight)) {
            enemy.draw(level.getCamera(), level.getAngle(enemy), canvas, paint);
        }
    }

Enemy.draw:

public void draw(Camera camera, float angle, Canvas canvas, Paint paint) {
    float x1 = this.getPosX() - level.getCamera().getOffSetX() - this.getSizeX() / 2;
    float x2 = this.getPosX() - level.getCamera().getOffSetX() + this.getSizeX() / 2;
    float y1 = this.getPosY() - level.getCamera().getOffSetY() - this.getSizeY() / 2;
    float y2 = this.getPosY() - level.getCamera().getOffSetY() + this.getSizeY() / 2;

    // Rectangles declared in the constructor, change depending on which frame to draw
    drawingLocation.set((int) x1, (int) y1, (int) x2, (int) y2);
    imageSubset.set((int) (frameId * getSizeX()), 0, (int) (frameId * getSizeX() + getSizeX()), (int) getSizeY());

    canvas.save();

    canvas.rotate(angle, x1 + sizeX / 2, y1 + sizeY / 2);
    canvas.drawBitmap(knightAttack, imageSubset, drawingLocation, paint);

    // Heath bars
    paint.setColor(Color.RED);
    canvas.drawRect(new Rect((int) x1, (int) (y2) + 10, (int) x2 + 10, (int) y2 + 14), paint);

    paint.setColor(Color.GREEN);
    canvas.drawRect(new Rect((int) x1, (int) (y2) + 10, (int) (x1 + (((x2 + 10) - x1)) * this.currentHealth / this.maxHealth), (int) y2 + 14), paint);

    canvas.restore();

    // Change frame in the image every SPRITEFRAMELENGTH
    if(frameCount++ % SPRITEFRAMELENGTH == 0){
        frameId++;

        if(frameId > MAXFRAMEID){
            frameId = 0;
            frameCount = 0;
        }
    }
}

Those times I mentionned earlier are by using:

SurfaceView.getHolder().setFormat(PixelFormat.RGB_565);

And creating the images (once, all the enemies use the same image reference):

BitmapFactory.Options op = new BitmapFactory.Options();
op.inPreferredConfig = Bitmap.Config.RGB_565;

Bitmap image = (Bitmap)BitmapFactory.decodeResource(context.getResources(), imageId, op);

if(resizeWidth != 0 && resizeHeight != 0) {
    image = Bitmap.createScaledBitmap(image, resizeWidth, resizeHeight, true);
}

But I noticed that if I don't specify RGB_565, it is much slower because of transparency, especially for the background, which don't have transparency. What's even weirder is that using RGB_565 works properly on my Galaxy Nexus, but on my friend's S3, some images (with transparency) are not displayed at all. I'm using 4.2.1 and he's on 4.1.1.

So, how can I rotate my images more efficiently? Would using OpenGL improve performance a lot or would it be about the same? Is there a better solution?


texts: Sticking the Rigidbody2D player to a moving platform without parenting & transform fiddling

texts:
I have a player entity with Rigidbody2D component and I have a moving platform which is a kinematic Rigidbody2D. Player movement is done by setting it's velocity (body.velocity = newVelocity) and platform is moved via body.MovePosition.
I've made it so that the platform has a sensor which, when triggered, catches the Rigidbody2D of the entity that is on (currently only does that for player) and then I tried the following:

Moving the player along the platform with caughtRigidbody.MovePosition. This keeps the player on the platform but the player is unable to move. It seems that MovePosition overrides any velocity change on the player and keeps him on the platform indefinitely. This would be ideal if I could have this behavior but keeping player movement.

Moving the caught rigidbody by adding platform velocity to the body but it seems jittery and also happens to behave strangely when platform direction changes.

I got the player movement how I want it so I'm not willing to tear out the whole movement code and change the player to kinematic or something like that.
This is the relevant platform code:
public class MovingPlatform
{
    private void FixedUpdate()
    {
        // Only one node (initial position). Nowhere to move to
        if (worldNodes.Length == 1)
        {
            return;
        }

        // Target position reached?
        if (body.position == worldNodes[index])
        {
            // Is last (or first in backwards direction) target?
            if (direction == Direction.Forwards && index == worldNodes.Length - 1 ||
                direction == Direction.Backwards && index == 0)
            {
                // Change direction (forwards = 1, backwards = -1)
                direction = (Direction) ((int) direction * -1);
            }

            // set next target index
            index += (int) direction;
        }

        // Get target
        Vector2 target = worldNodes[index];
        // Get current platform position
        Vector2 position = body.position;
        // Calculate single-frame movement towards target
        Vector2 movementThisFrame = Vector2.MoveTowards(position, target, settings.Speed * Time.deltaTime);
        // Move platform by calculated movement
        body.MovePosition(movementThisFrame);
        // Calculate platform movement velocity (displacement / time delta)
        velocity = (movementThisFrame - position) / Time.deltaTime;
        MoveCaughtRigidbodies();
    }

    private void MoveCaughtRigidbodies()
    {
        foreach (Rigidbody2D caughtRigidbody in caughtRigidbodies)
        {
            // This keeps the player on the platform without jittering, but the player cant move
            //caughtRigidbody.MovePosition(caughtRigidbody.position + body.position - lastPosition);

            // This is spotty. It launches the player off the platform sometime when the platform changes direction
            // if (caughtRigidbody.velocity != velocity)
            // {
            //     caughtRigidbody.velocity += velocity;
            // }
        }

        lastPosition = body.position;
    }
}


texts: How to design simple turn based combat system with multiple difficulties?

texts:
I am developing a small, turn-based game with spaceships.
The user-controlled spaceship has two modes, let's call them offense and defense mode. The user can freely switch between modes.
There are three types of enemy-ships.
Whenever the user's ship meets one or more enemy-ships, a fight calculation should take place, which can have exactly two outcomes: either the user's ship wins (and does not carry away any damage), or the game is over.
Encounters are kinda, but not completely random so one can expect a certain enemy and change the mode accordingly.

For reference, multiple enemy encouters at once might happen, and as a rough idea, the userShip usually is expected to lose if it has to fight 2-5 enemies.
Like 2 are too much, if the active fight mode is disadvantageous, whereas the userShip can win against up to four ships, if the mode is advantageous.
For encounters with multiple enemy types, the numbers shall be somewhere in between.

My requirements for the combat system are:

completely deterministic
one mode must not be clearly superior to the other mode. Ideally, one mode is advantageous against a certain enemy type, while the other mode is advantageous against another enemy type (not sure what to do about the third enemy type though)
must be somehow scaleable, i.e. there should be three difficulty settings which shall be taken into account.
ships have three attributes: Attack, Defense, Speed (however, this isn't set in stone and could be changed at will)

My best idea so far:

assign each ship type base stats (Attack/Defense/Speed, floating point numbers):

userShip:  (10/10/10)
 enemy 1:   (5/10/15)
 enemy 2:   (15/5/10)
 enemy 3:   (10/15/5)

create a modifier-table that multiplicates the userShip baseStats with a multiplicator depending on a) userShip-mode and b) enemyShip-type.
have the combat system compare each of the three stats (if multiple enemies involved, their combined strength), and depending on the difficulty setting, the userShip wins if the difference of at least 2 of the 3 attributes is smaller than . That way, I would have the scalability.

However... I was unable to design the modifier table in a way that the modifiers actually make a noticeable difference AND the user has an incentive to switch between modes when he expects a certain enemy in the next turn.

The biggest problem is the nature of the binary combat outcome. This makes it that the floating point multiplicators neglegible most of the time.

Also, I feel like I have way too many parameters (fight mode, attack, defense, speed, difficulty-setting, modifier) for such a simple calculation, but I cannot really remove any other than the modifier, and they all should be at least a little bit relevant for the combat outcome.

Also, I'm not sure how to deal with the third ship type, as there only are two modes. If the mode does not matter at all, that's poor design I think. I could add a third mode for the userShip, however that would introduce even more parameters for the combat. Unsure about that.

Any ideas how to design a combat system under these conditions?


texts: How to seperate gui input from world input?

texts:
I have a GUI interface and a player that hase code to detect when the mouse is pressed.
When i mess with my GUI buttons the code for the player also fires off; an undesired behavior.  The code in the player is meant for mining or using his current item not meant for buttons.
Some people have suggested using _unhandled_input and mouse filters, but i havent gotten either of those to work.  Im just wondering what the common thing to do in the situation?


texts: Is it possible to use DirectX in pure C program?

texts:
I want to try something simple with Direct Sound. Just want to know if it's possible.

Or maybe I need some other API?


texts: Specular banding with high specular power

texts:
We're having some issues with our ray tracing in DirectX, especially with some serious banding issues with specular. With high specular power (above 8) banding starts. I'm wondering if this is an HDR/LDR issue or could be related to something else, such as normals or other vectors?

UPDATE

Look below for updates.

Here's the relevant shader code for Blinn-Phong on a sphere:

float3 hitPoint = thisRay.origin + thisRay.direction * bestHit.hitT;
float3 normal = normalize(hitPoint - spheres[bestHit.hitID].center);
float3 toLight = pointLights[0].position.xyz - hitPoint;
float d = length(toLight);
toLight = normalize(toLight);

float diffuse = max(dot(normal, toLight), 0.0f);

float3 v = normalize(thisRay.origin - hitPoint);
float3 h = normalize(v + toLight);

float spec = 0;
if (diffuse > 0)
    spec = pow(max(dot(normal, h), 0.0f), specPower) * diffuse;

output[threadID.xy] = spheres[bestHit.hitID].colour * diffuse + spheres[bestHit.hitID].specColour * spec;

specPower equals 8 in this image

specPower equals 9 in this image

Is this as simple as an HDR/LDR issue or is it somehow related to normal precision? I believe I have encountered this issue before in a deferred renderer where normals were of low precision and improperly packed/unpacked but in this case normals are generated on the fly and the whole thing is rendered directly to the backbuffer.

Update 1

I would like to add to the above that triangles suffer the same artifact and they have their normal currently generated in the following way:

float3 normal = normalize(cross(triangles[bestHit.hitID].vertices[1] - triangles[bestHit.hitID].vertices[0],
                                    triangles[bestHit.hitID].vertices[2] - triangles[bestHit.hitID].vertices[0]));

I'd say this makes it even more unlikely that the normal of the surface is the problem. The following image shows what happens when specPower reaches 2048.


texts: How to get rid of an image upon collision detection in SDL?

texts:
I am fairly new to SDL in C, but I have written a simple game whereby a character has to reach the end of a level and avoid bad stars on the way. If he hits a star, he dies. There are also good stars he can collect and get points.

I have set up my point system so now when he hits a good star, he should get a point. However, when he hits a star, he actually gets lots of points, as long as he is touching the star, which I don't want. I think that what's happening is because the stars are moving and he rubs up against the stars; each pixel he moves counts as a new collision so he gets a point per collision. Ideally, he should only get one point per star.

So I have two problems: 1) I need to figure out how to make it so that he can only get one point when he hits a star. 2) Since he is supposed to be 'collecting' the stars, I want to make the star disappear when he collects it.

So it's similar to most of these types of games, whereby, the player collects something, it disappears and they get a point.

EDIT:

This is struct I've made:

typedef struct {
    int x, y, w, h, baseX, baseY, mode;
    float phase;
} Goodstar;

I've then referenced it in another struct like so:

Goodstar goodStars[GOOD_STARS];
SDL_Texture *goodStar;

[GOOD_STARS] is equal to 100.

And then here's my collision detection code:

// Check for collision with good stars
for (int i = 0; i < GOOD_STARS; i++) {
    if (collide2d(game->man.x, game->man.y, game->goodStars[i].x, game->goodStars[i].y, 48, 48, 32, 32)) {
        if (!game->man.isDead) {
            game->man.points++;
        }
        break;
    }
}

So right now it only checks for a collision and then adds a point.

EDIT 2:

This is the code you suggested and it works:

for (int i = 0; i < GOOD_STARS; i++) {
    if (!game->goodStars[i].awarded) {
        if (collide2d(game->man.x, game->man.y, game->goodStars[i].x, game->goodStars[i].y, 48, 48, 32, 32)) {
            if (!game->man.isDead) {
                game->man.points++;
                game->goodStars[i].awarded = 1;
            }
            break;
        }
    }
}

And this is my initialisation code:

  // Initialise stars
  for (int i = 0; i < GOOD_STARS; i++) {
    game->goodStars[i].baseX = 320 + random() % 38400;
    game->goodStars[i].baseY = random() % 480;
    game->goodStars[i].mode = random() % 2;
    game->goodStars[i].phase = 2 * 3.14 * (random() % 360) / 360.0f;
        game->goodStars[i].awarded = 0;
  }


texts: Texturing spherical terrain, seemingly arbitrary distortion

texts:
I'm using this algorithm to find texture coordinates on a sphere:
Wikipedia UV Coordinates

I get the famous seam due to the wrong interpolation, but I also get odd distortions on certain points on the sphere. A picture follows where you can see like five starshaped distortions.

What could cause this?


texts: Why doesn't my material show up on my imported model (Unity / Blender)

texts:
UPDATE :

The material does work on smaller objects like a simple sphere, but not on my big arena model, which is actually imported from blender, any suggestions?

UPDATE :

Tried to export as .fbx, but doesn't change anything.

I've imported this material pack : https://www.assetstore.unity3d.com/en/#!/content/13004

I tried to apply it to my mesh, but only weird things happen, I can't see the texture at all. So I tried to apply this material in the "shader calibration scene" and that worked without any problem, even updating to the standard shader worked fine. So I tried to fix it with the following things :

Rebaking lighting
Restarting Unity
Tweaking the material settings
Tweaking quality settings in Unity
Building the project

All these things couldn't fix it, but it should most likely be related to my project settings, since this material is working in another project (shader calibration)

Here are my quality settings :

I'm not sure, which information is needed to answer the question, but I can provide it if you ask for it.

Update with Object properties :


texts: How do the systems find the entities they should operate on in Entity-Component-System pattern?

texts:
I have read many articles about ECS patterns. Many of them are clear on what the entity and components are  but don't really talk about the system because it "varies" or just use plain English to describe the behavior like "it finds the entities the system should work on", but how exactly that happens?

Let's say we have an Entity class which holds the all the components it needs (Transform, Texture, and Rigidbody). Now I have one system called RenderingSystem that uses Texture and Transform to render the entity to the scene. Then how would this RenderingSystem efficiently find all the Entities that need to be drawn on the scene?


texts:
I asked this earlier in this thread at stackoverflow.com. One of the early comments redirected me here to gamedev.stackexchange.com, so I'm reposting here.

Searching for related questions I found a number of very specific questions, but I'm afraid the specifics have proved fruitless for me and after 4 hours on Google I'm no closer than I started, so I felt reaching out to a community might be in order.

First, my goal: I've never made a game before, although I've muddled over the possibility several times. I decided to finally sit down and start learning how to code games, use game engines, etc. All so that one day (hopefully soon) I'll be able to make functional (albeit simple) games. I can start adding complexity later, for now I'd be glad to have a keyboard-controlled camera moving in a 3D world with no interaction beyond that.

My background: I've worked in SEVERAL programming languages ranging from PHP to C++ to Java to ASM. I'm not afraid of any challenges that come with learning the new syntax or limitations inherent in a new language. All of my past programming experience, however, has been strictly non-graphical and usually with little or extremely simple interaction during execution. I've created extensive and brilliant algorithms for solving logical and mathematical problems as well as graphing problems. However in every case input was either defined in a file, passed form an HTML form, or typed into the console. Real-time interaction with the user is something with which I have no experience.

My question: Where should I start in trying to make games? Better yet- where should I start in trying to create a keyboard-navigable 3D environment? In searching online I've found several resources linking to game engines, graphics engines, and physics engines. Here's a brief summary of my experiences with a few engines I tried:

Unreal SDK: The tutorial videos assume that you already have in-depth knowledge of 3D modeling, graphics engines, animations, etc. The "Getting Started" page offers no formal explanation of game development but jumps into how Unreal can streamline processes it assumes you're already familiar with. After downloading the SDK and launching it to see if the tools were as intuitive as they claimed, I was greeted with about 60 buttons and a blank void for my 3D modeling. Clicking on "add volume" (to attempt to add a basic cube) I was met with a menu of 30 options. Panicking, I closed the editor.

Crystal Space: The website seemed rather informative, explaining that Crystal Space was just for graphics and the companion software, CEL, provided entity logic for making games. A demo game was provided, which was built using "CELStart", their simple tool for people with no knowledge of game programming. I launched the game to see what I might look forward to creating. It froze several times, the menus were buggy, there were thousands of graphical glitches, enemies didn't respond to damage, and when I closed the game it locked up. Gave up on that engine.

IrrLicht: The tutorial assumes I have Visual Studio 6.0 (I have Visual Studio 2010). Following their instructions I was unable to properly import the library into Visual Studio and unable to call any of the functions that they kept using. Manually copying header files, class files, and DLLs into my project's folder - the project failed to properly compile.

Clearly I'm not off to a good start and I'm going in circles. Can someone point me in the right direction? Should I start by downloading a program like Blender and learning 3D modeling, or should I be learning how to use a graphics engine? Should I look for an all-inclusive game engine, or is it better to try and code my own game logic? If anyone has actually made their own games, I would prefer to hear how they got their start.

Also- taking classes at my school is not an option. Nothing is offered.


texts: How do I preserve the image detail when making a texture? Unity

texts:
I have made a texture, set its shader to 'legacy shaders/diffuse' and dragged some images I like into the texture. When using the texture the images don't look as detailed as before. How can I overcome this?

As you can see, it is just one colour, there are no dark spots anywhere.