texts:
I need to draw a brick curved path but i need to be able to put an arrow pointing to any a brick by API. something like this:

i thought to use canvas but i'm not sure i can get a reference to each brick and fire events.


texts: How to detect when the mouse is over a particular enemy collider, without falsely selecting bullet colliders?

texts:
I have an enemy shooting around. My game mechanic involves hovering over the enemy with the mouse to drain its health. While the enemy is moving, you need to follow it with your mouse. If you don't succeed to follow it and the mouse leaves the enemy's collider, the enemy's health should be refilled.

The trouble is that the enemies' bullets have also a collider, and OnMouseOver acts weird when more colliders appear on top of each other.

How can I only select a particular Layer for the enemy to detect only that layer without acknowledging the bullets layer?

My Code so far:

public class FightDarkalls : MonoBehaviour
{

    [Header("Guidance Light On?")]
    public bool _guidanceLight = false;
    [Header("Target Settings")]
    public GameObject _monster;
    public GameObject _targetEffect;
    public Animator _TargetEffectAnim;
    public LayerMask _monsterLayer;
    int _layer;
    [Space]
    [Header("Damage Darkall")]
    public float damage = 0.1f;
    public float damageSpeed = 2.5f;
    [Header("OBJs to deactivate when Darkall dead")]
    public GameObject[] _deactivateOBJsOnDeath;
    [Header("Health Settings")]
    public GameObject _healthBar;
    public float startingHealth;
    public float health;
    public GameObject _deathDarkallParticle;
    //Animator
    private Animator _anim;

    Vector2 mousePosition;
    public LayerMask _interactLayer;

    private void Start()
    {
        _targetEffect.SetActive(false);
        _anim = GetComponent<Animator>();
        _TargetEffectAnim = _targetEffect.GetComponent<Animator>();
    }

    private void Update()
    {
        CheckIfGuidanceIsActive();

        _healthBar.transform.localScale = new Vector2(health, 1f);

        _deathDarkallParticle.transform.position = Vector2.Lerp(_deathDarkallParticle.transform.position, _monster.transform.position, 100f * Time.deltaTime);

        SetMousePosition();
    }

    void CheckIfGuidanceIsActive()
    {
        if (GameObject.Find("_GuidanceLight").GetComponent<FollowCursor>   ()._guidanceActivated == true)
        {
            _guidanceLight = true;
        }
        else
            _guidanceLight = false;
    }

    private void OnDrawGizmos()
    {
        Gizmos.DrawSphere(mousePosition, 1f);
    }

    private void OnMouseOver()
    {
        if (_guidanceLight)
        {
            //[DAMAGE]\\
            health -= damage * Time.deltaTime * damageSpeed;
            _anim.SetBool("TakeDamage", true);
            //Activate Target Effect
            _targetEffect.SetActive(true);
            _TargetEffectAnim.SetBool("OnDarkallOver", true);
            //Damage the target
            //Kills the target
            if (health <= 0f)
            {
                foreach (GameObject _dOBJs in _deactivateOBJsOnDeath)
                {
                    _dOBJs.GetComponent<SpriteRenderer>().enabled = false;
                }
                //Change Cam Shake to another OBJ
                GameObject.Find("Main Camera").GetComponent<CameraShake>().CamShakeEffect(0.1f, 0.5f);
                health = 0f;
                _deathDarkallParticle.SetActive(true);
                _deathDarkallParticle.GetComponent<ParticleSystem>().Play();
                _monster.gameObject.SetActive(false);
                Destroy(_monster.gameObject, 3f);
            }
        }
    }
    private void OnMouseExit()
    {
        _anim.SetBool("TakeDamage", false);
        //If failed to kill, reset health
        health = startingHealth;
        //Deactivate Target
        _targetEffect.SetActive(false);
        _TargetEffectAnim.SetBool("OnDarkallOver", false);
    }

    void SetMousePosition()
    {
        mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    }
}


texts: How can I play an animation only using C#, without animation controller, or create an animation controller at runtime entirely from script?

texts:
I've been looking around for a while trying to figure out how to play simple animations with Unity via ONLY C# script, with no drag-and-drop involved. So far I've found various tutorials explaining how to manually set up a animation controller for each object, then manually select each animation state and manually create a transition then manually set the transition length to the most minimum possible etc...

I was wondering if there's a simple way to just do something like...

gameObject.playAnimation(
    "stand still /* which would be the name of the action state created in blender or other animation software*/",
    "loop");

...WITHOUT creating an animation controller manually at all, I haven't been able to find any resource to do this simple thing yet.


texts: How can I create a 3D point cloud in WPF?

texts:
I need to render some 3D points with WPF. How can I do this?

I need an easy and fast solution to just render this point cloud. No lights, no texture, no sound, no physics, just colored 3D points in a space with rotating camera.

How can I do this without having to learn Direct3D/OpenGL/any complex 3D engine?


texts: How do I tell if my enemy can see my player?

texts:
Given a player and an enemy with position, and given the direction vector of each, how  can I tell if one can "see" the other?

In other words, how do I test if one position with direction is in front or behind another position with direction?

For my purposes, 'in front of' means directly in front of, or 90 degrees to either side.


texts:
I am trying to make a particle system that is activated by sound. Like emitting on the beat resizing on the beat and such things.  I found some nice tutorials on how to make things like Windowsmediaplayer visualsynths but they dont really help me to convert it to a particle system.

Anysuggestions how i could do this ?


texts: Renaming Texture 2D nodes in Unity's shader graph?

texts:
I am new here so thanks for having me. I have a query regarding renaming the Texture 2D nodes I have created in my first Shader graph.
I have setup a shader graph with a normal map, base colour, smoothness and ao. These are showing up as exposed parameters which is just what I wanted so I can drag and drop new texture maps for the other materials easily (please see screen shot attached).
I would love to be able to name each of those Texture 2D maps accordingly so it is clear where each map from the assets folder needs to be dragged.
E.g The Texture node that contains the normal map is simply called 'Normal' instead of 'Texture 2D', the base colour map named 'base colour' etc.
Atm I have 4 exposed parameters all called Texture 2D.
Not the most serious of issues I would agree, but I feel like I must be missing something. No sign of a 'rename' option for those nodes.
Any help very much appreciated.
Cheers
Nick


texts:
What is the best practice in regards to storing vertex data in Open GL?  I.e:

struct VertexColored {
    public:
        GLfloat position[];
        GLfloat normal[];

        byte colours[];
}

class Terrian  {
    private:
        GLuint vbo_vertices;
        GLuint vbo_normals;
        GLuint vbo_colors;
        GLuint ibo_elements;

        VertexColored vertices[];
}

or having them stored seperatly in the required class like:

class Terrian  {
    private:
        GLfloat vertices[];
        GLfloat normals[];
        GLfloat colors[];

        GLuint vbo_vertices;
        GLuint vbo_normals;
        GLuint vbo_colors;
        GLuint ibo_elements;
}


texts: Strange collision behaviour in 2D game even though the collision is very basic

texts:
I have a player ship (cube) and some enemy laser projectiles. When the player ship has position X values greater than 1, collision with the enemy projectiles occur but when it has lower X values, the projectiles pass through.

If the image below is too small to view, you can refer to this link.

There are two screens in the image. The above image is where the collision occurs and the below one is where the laser projectiles miss the player ship. (You can see in a larger image better the tiles. When the collider of the player ship goes below the central horizontal line, collisions do not occur). Let me post the scripts for projectiles and player ship.

LaserProjectile

public class LazerProjScript : MonoBehaviour {

    private float speed = 5.5f;

    // Update is called once per frame
    void Update ()
    {
        // translate
        transform.Translate (new Vector3 (0f, -1f, 0f) * speed * Time.deltaTime);

        // destroy the projectile once it's out of screen
        if(transform.position.y <= -10)
            Destroy(gameObject);
    }

    void OnCollisionEnter(Collision other)
    {

        if(other.gameObject.tag == "Player")
        {
            print ("lazer on collision enter!");
            print ("hit player");
            other.gameObject.GetComponent<PlayerController>().hp -= 1;
            Destroy(gameObject);
        }
        if(other.gameObject.tag == "Enemy") return;

    }

}

Player Controller

public class PlayerController : MonoBehaviour
{
    public int hp = 100;
    public float speed = 0.3f;

    // Update is called once per frame
    void Update ()
    {
        /*********************************************************/
        /********************** TRANSFORM CODE *******************/
        /*********************************************************/
        //horizontal <- || -horizontal ->
        //vertical down || -vertical up
        float h = -Input.GetAxis ("Horizontal")*speed;
        float v = -Input.GetAxis ("Vertical")*speed;

        // do not let the ship get out of the camera
        if (Input.GetAxis ("Horizontal") < 0 && transform.position.x <= -11.8) {
            h = 0;
        }
        if (Input.GetAxis ("Horizontal") > 0 && transform.position.x >= 11.8) {
            h = 0;
        }

        if (Input.GetAxis ("Vertical") > 0 && transform.position.y >= 8.2) {
            v = 0;
        }
        if (Input.GetAxis ("Vertical") < 0 && transform.position.y <= -8.2) {
            v = 0;
        }

        transform.Translate (h, v, 0);
    }
}

Please note that neither the player ship nor the laser projectiles are isTrigger, isKinematic. Both have their Z values 0 all the time when they translate.

I cannot identify the problem. If the collider is above X=1 axis, there's no problem. If it's below that, collision does not occur! What is this, how can I solve this problem?

EDIT

Well, I played with the positions a bit and it got stranger. If projectiles start moving towards the player when they are in some range, they collide but if they travel for a certain amount of time (i.e. if they are more distant than some distance) they do not collide. I changed the Y values of the projectiles and one collided with the player even though it was below the X=1, and the other just passed through.

EDIT2

If I do not move the player, the projectiles miss. When I move the player, collisions occur whatever the distance was.


texts: Deferred contexts and inheriting state from the immediate context

texts:
I took my first stab at using deferred contexts in DirectX 11 today. Basically, I created my deferred context using CreateDeferredContext() and then drew a simple triangle strip with it.

Early on in my test application, I call OMSetRenderTargets() on the immediate context in order to render to the swap chain's back buffer. Now, after having read the documentation on MSDN about deferred contexts, I assumed that calling ExecuteCommandList() on the immediate context would execute all of the deferred commands as "an extension" to the commands that had already been executed on the immediate context, i.e. the triangle strip I rendered in the deferred context would be rendered to the swap chain's back buffer.

That didn't seem to be the case, however. Instead, I had to manually pull out the immediate context's render target (using OMGetRenderTargets()) and then set it on the deferred context with OMSetRenderTargets().

Am I doing something wrong or is that the way deferred contexts work?


texts:
I want to use Unity UGUI to custom a slider and the final looking show be like this:

And the images I use are:

But I found it hard to accomplish:
The handle will be screeched and the fill will not be fully filled with the handle

Can somebody tell me how I could accomplish this?


texts: How to properly looping movement of an object

texts:
I would like to create an intelligent (universal) class to looping movement object, like sliding doors, etc.

I've thought to declare two vectors:

From
To

And a Speed variable.

Then looping. I don't know how to check when current position is >= then To and looping reverse, considering that you can have starting position (x or y or z) greater then arriving position.

Thanks


texts: What is grid in Unity and how can I implement it?

texts:
I'm a beginner. I need to place a grid on my map in Unity and would like to access it to place a simple object on mouse click. How can I achieve this ?

I am unable to understand the grid functionality, should I have to write code for a 2D array or is there something in Unity that I can access, and what is basically the grid like something when I click my background image ?


texts: Unity using 40% GPU for just a UI interface on ultra but 90 on low?

texts: So I made some software using unity for my FRC team. All this application is, is just a User Interface with labels, input fields, buttons, etc... When I choose the quality to be on Ultra, I will get about 50% GPU usage but when on very low, I got 90%, close to 100%. How can I optimize my software to use much less of the GPU(Preferably less than 15%)? I am measuring with the Task Manager Performance Menu


texts: How should I handle animation state systems in derived classes?

texts:
I'm trying to get some kind of state system for my game objects.

I have a base Actor class that is derived by classes like Policeman, Informant or Brawler. Each of those classes describes different functionality, but I want as much of the functionality to be shared.

On of those is animation system. Each class has their own states (for example Policeman has Walking, Shouting and Shooting, while Informant has Idle and Whispering).

What is the best way of handling such states? Do I have the Actor class have something like

enum ActorState
{
state1,
state2,
state3,
...
}

And just map each behaviour of appropriate actor (Policeman, Informant, etc) to ActorState, so that the rendering system of ActorState can take over?

Or maybe is there some better solution that people use.

Game is 2D, sprite based, and I'm using Unity3D system, with Actor being a component to GameObjects.


texts: Examples of interesting implementations of character stats?

texts:
I've got this BBG going ( http://ninjawars.net ), and the character stats currently are simplistic.  I'm looking to add a few stats to the current 1/2 (strength and maximum hitpoints, essentially).
I've come up with: (strength (unchanged), speed, stamina, and some others that are somewhat interesting wildcard stats).
However, I'm not satisfied with how boring the effects of some of these stats are, because they're very linear.  Better stat, better effects of the stat, but the stats don't interact with each-other, there's no Rock-Paper-Scissors interaction, having more is always better all the time.

So what I'd really like is to see examples of interesting character stats or effects of stats?

Examples that I can think of off hand:

Call of Cthulu's Insanity stat (things get really weird/chaotic if you start losing sanity)

White Wolf stats, to a certain extent (the stats themselves have some basic effects, and all skills effectiveness base themselves off of stats as well)

What are some other ways people have used stats to check out?


texts:
Game work with the old version 2.0.6. But they get this error after switching to 2.4.2

TypeError: this.scale.setScreenSize is not a function

any Idea how to solve this ?


texts: Apply impulse in direction line is pointing with force proportional to the length of line

texts:
I have a line perpetually pointed at the mouse and originating at the player, but the length is limited to a certain value.

I also can create a circular object on demand in Box2D (specifically the love2d bindings). I would like to apply an impulse on the new object that will send it flying in the direction of the line, with force proportional to the length of the line (that specific proportion is not important).
The object should not roll along that line like a cannonball in a cannon barrel, but it should begin its journey in the direction of the line, such that a user can intuitively direct the projectile (all my attempts* at solving this issue have led to some angles (45/135) having similar projectile directions as flat angles (0/180), which means the angle is not functional as an aiming mechanism). I suppose a successful implementation might look like this:

I have been looking through tutorials and haven't found an answer. I see whisperings of ways to do it by simply supplying the angle (if I read the pages correctly) but Love2D's function does not support that.

The way in Love2D to apply a linear impulse is Body:applyLinearImpulse( ix, iy, x, y ) with ix and iy being the x and y components of the impulse, and x and y being the position to apply the impulse (default to origin of body).

*The best I have tried is to apply the distance of the line as the x/y components in applyLinearImpulse. This creates the awful failure I mentioned earlier where the angle of the line does not produce much difference in the angle of the projectile (but it does produce a tiny amount, with extremely diminishing returns as the line approaches a 90 degree angle / vertical line).


texts:
I am working on playing different animation of key press.Below are the animation element attached to my player

Initially run animation is played.I have written code to play "Jump" animation on keypress.

The problem is that when I press the key "Jump" animation will be played,But this animation is played again and again.

I need to play the "Jump" animation only once.Then I need to switch to run animation

Here is the code written

public bool run=false;

void Update () {
    if(Input.GetKey(KeyCode.R))
        {
        run = true;

        }
    if (run == true) {

        GetComponent<Animation>().Play("Jump");
        GetComponent<Animation>().wrapMode = WrapMode.Loop;
    }
}


texts: 3D Coulomb Friction - Use Collision Impulse To Calculate Friction Force?

texts:
I've been using this document to learn how to implement a very basic physics engine. The section on Coulomb Friction on page 55-56 (marked as pages 43-44) confuses me.

It observes that the friction force can be calculated using the collision impulse (jr). This seems strange. Envision an object falling very quickly onto a plane with a slight incline. The object is rotating in the opposite direction it would if it were rolling down the incline. When the object makes contact, it will have a small velocity along the tangent, but a huge normal impulse (jr). This will result a very large change in velocity along the tangent (t hat) opposite to the direction of motion. This will push the object up along the surface (bad!) with a notable amount force. My implementation confirms this.

Can someone explain to me how this all fits together? I'm very confused.

P.S. I don't think trying to provide an example of my implementation here is relevant, either the effect I'm explaining cannot occur (in which case there is a bug, which I can find myself), or I'm misunderstanding the equations, in which case the implementation is inherently broken


texts:
I have a 2d game I've made using OpenGL ES. The game contains a large quad that fills the entire screen (as a background image) and many smaller quads that make up a number of balls that bounce across the screen.

To illustrate displaying a ball, I may have a single quad with vertices (0,0),(0,1),(1,1),(1,0). I then fill this quad with a texture (a colored ball).

I am wondering if I need to perform back-face culling (for performance reasons). Given these 4 vertices, I assume a polygon is drawn to connect them. Is it actually the case that two polygons are drawn? One facing forward and another one facing the back? I'm struggling to understand.

I have tried getting face culling working and I think I've succeeded, but I've not really noticed any difference in rendering times.

Not sure if relevant, but here is my environment setup code:

gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glDisable(GL10.GL_DEPTH_TEST);
gl.glViewport(0, 0, width, height);
gl.glLoadIdentity();
gl.glMatrixMode (GL10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrthof(0, width, height, 0, 0, 1);
gl.glMatrixMode (GL10.GL_MODELVIEW);


texts: Have a simple enemy detecting he touch a wall to make him stop/turn around

texts:
I am doing a very simple scene with a cube sliding on the "ground". Once the cube reach a wall, he is blocked.

I want to detect the wall to make the cube go in the other direction. I used OnCollisionEnter but it is triggered at the scene start as my cube touch the ground.

I could make a difference between grounds and wall, but my game will make the whole scene rotate, and floor will become wall and wall floor.

I wanted to add "physics whatever object" to allow a left/right detection but i cannot add collider or rigidbody to my cube.

How can i have a cube knowing when he touch a wall without having a false positive with the ground ?


texts: Getting the height of Keyboard on Android

texts:
Hi I need to know the height of my keyboard so I can move up some textfield I have in my app. I'm using cocos2D-X but the app don't recognize the keyboardWillShow method.

Thanks


texts: Detect when item has been dragged & dropped onto an inventory slot

texts:
In my inventory system I want to be able to drag and drop items into inventory slots.
I managed to make it work, but only in a weird way:

When the player starts dragging, it picks up the item and it follows the mouse's position.

When they release the button outside the inventory, the item's position is restored to the slot from which it was picked up.
I use GameObject mouseReleasedObject = eventData.pointerCurrentRaycast.gameObject; to detect whether the drag was released over an inventory slot.

The problem is that when the player drops it on a possible inventory slot, the same "restore to previous slot" behaviour happens.
That's because the mouse is top of the dragged item and the slot as well but the item is rendered above everything else.

How can I make the dragging ignore the item itself, and detect the slot underneath?
Start dragging:
    public void OnBeginDrag(PointerEventData eventData)
    {
        GameObject draggedObject = eventData.rawPointerPress;
        if(draggedObject.GetComponent<RectTransform>() is null) return;

        if(draggedObject.tag == "InventoryItem")
        {
            Debug.Log("InventoryItem drag has started!");
            dragStartSlot = draggedObject.transform.parent.gameObject;
            draggedItem = draggedObject;
            draggedItem.transform.SetParent(canvas.transform);
            draggedItem.transform.SetAsLastSibling();

        }
    }

End dragging:
    public void OnEndDrag(PointerEventData eventData)
    {

        GameObject mouseReleasedObject = eventData.pointerCurrentRaycast.gameObject;
        if(draggedItem is null) return;
        Debug.Log("Released at: "+mouseReleasedObject.gameObject.name);
        if(mouseReleasedObject.transform.tag == "InventorySlot")
        {
            if(mouseReleasedObject.transform.childCount < 1)
            {
                //  the inventory slot is empty, we place here the item!
                draggedItem.transform.SetParent(mouseReleasedObject.transform);
                draggedItem.GetComponent<RectTransform>().localPosition = Vector3.zero;
            }
            else
            {
                //  the inventory slot is taken, we swap the items!
            }
        }
        else
        {
            //  the item is not released on a proper slot, we restore it's position!
            draggedItem.transform.SetParent(dragStartSlot.transform);
            draggedItem.GetComponent<RectTransform>().localPosition = Vector3.zero;
        }
    }


texts: Why would someone want to store images as YCbCr instead of RGB in RAM or in GPU memory?


texts: Circular draggable UI element in Unity canvas

texts:
I am trying to implement my own runtime color picker that's easy to use for touch interfaces. I want the hue slider to be a ring, along these lines, except the whole ring texture would rotate when dragged.
I have scavenged enough code to get a raw image object rotating when dragged in a UI canvas in the manner I'm looking for:
    private float baseAngle;
    private Vector2 pos;

    public void OnBeginDrag(PointerEventData eventData)
    {
        pos = transform.position;
        pos = eventData.pressPosition - pos;
        baseAngle = Mathf.Atan2(pos.y, pos.x) * Mathf.Rad2Deg;
        baseAngle -= Mathf.Atan2(transform.right.y, transform.right.x) * Mathf.Rad2Deg;
    }

    public void OnDrag(PointerEventData eventData)
    {
        pos = transform.position;
        pos = eventData.position - pos;
        float ang = Mathf.Atan2(pos.y, pos.x) * Mathf.Rad2Deg - baseAngle;
        transform.rotation = Quaternion.AngleAxis(ang, Vector3.forward);
    }

Since it doesn't use colliders, how can I limit the draggable region to a circle within the square bounds of the texture? Even better, also limit it to a ring rather than a whole circle. Will I have to implement my own check based on some pure math or is there a built in way?
thanks!


texts: Using Graphics from my Frame's paint() gives cutting effect every call to repaint()

texts:
Every frame the run() method of my thread calls the repaint() of the frame subclass, in this frame subclass I override the paint(Graphics) and since I want to have different screens from my game I pass the Graphics g parameter to an instance of the PlayScreen class where I do my drawing for that particular screen. The issue comes whenever the run() calls repaint() and the tile start to flash rendered on and off. I am starting to suspect that the issue comes from the order in which I set my repaint() and draw() calls.

GameObject(class with run method).

@Override
public void run() {
    isAlive = true;
 try{
     while(isAlive){
     Thread.sleep(17);
    screen.repaint();
     }
 }catch(Exception x){

 }

}

Screen class that extends Frame

@Override
public void paint(Graphics g) {
    playScreen.draw(g);

}

PlayScreen(where the tiles are rendered)

public void draw(Graphics g){
    for(ArrayList<Tile> tileArray: tiles){
        for(Tile tile : tileArray){
            g.drawImage(tile.getTile(), tile.getX(), tile.getY(), null);
        }
    }

}


texts: XNA games C# application executable work on one win7 not the other one

texts:
Our company wrote a game in XNA studio 4 almost ten years ago. we try to reinstall it in win7 with only the executable. Both installed XNA Game Studio 4.0. Below is the environments parameter I can find. The one on the laptop is not rendering the effect(I am new to this, this is my guess).

Laptop
Desktop

OS
win7 Service Pack1
win7 Service Pack1

DirectX version
11
11

Graphic Card
AMD firepro M4000 Mobility Prographics
integrated GPU Intel HD graphics 4600

Chip Type
AMD FirePro(0x682D)
Intel(R) HD graphics family

We don't know what make these two executable behave differently. Part of the window image just not shown. Second check on the source code, the different between the image that can be show and can not be shown on the failed Laptop is working one is using Bitmap and the not working on is using Texture2D with  Microsoft.Xna.Framework.Graphics Effect with passes. Any ideas. Thanks.


texts:
I have added Bullet to my game engine. So far I am using translation and rotation, and it works fine. But now, I want to scale my geometry (eg. user can drink some potion an became small :-)).

I am using

btWorldTransform.setOrigin(origin);
btWorldTransform.setRotation(rotation);

to set position of bullet body directly (it is done only once in initial object placement in scene or in case of teleportation etc. otherwise position is updated by bullet and forces)

Now, if I put object into scene, I set its btCollisionShape and that has some fixed size. Now, I change size of my scene object, graphics has scale, but what to do with bullet collision shape?

I have found setLocalScaling method, but I am not sure if it is, what I want. Can someone verify this?


texts: Turn-based Client-Server Card Game - Unicast (TCP) or Multicast (UDP)

texts:
I am currently planning to make a card game project where the clients will communicate with the server in a turn-based and synchronous manner using messages sent over sockets. The problem I have is how to handle the following scenario:

(Client takes it turn and sends its action to server)

Client sends a message telling the server its move for the turn (e.g. plays the card 5 from its hand which needs to placed onto the table)
Server receives messages and updates game state (server will hold all game state).
Server iterates through a list of connected clients and sends a message to tell of them change in state
Clients all refresh to display the state

This is all based on using TCP, and looking at it now it seems a bit like the Observer pattern. The reason this seems to be an issue to me is this message doesn't seem to be point-to-point like the others as I want to send it to all the clients, and doesn't seem very efficient sending the same message in that way.

I was thinking about using multicasting with UDP as then I could send the message to all the clients, however wouldn't this mean that the clients would in theory be able to message each other? There is of course the synchronous aspect as well, though this could be put on top of the UDP I guess.

Basically, I would like to know what would be good practice as this project is really all about learning, and even though it won't be big enough to encounter performance issues from this I would like to consider them anyway.

However, please note I am not interested in using message oriented middleware as a solution (I have experience with using MOM and I'm interested in considering other options excluding MOM if TCP sockets is a bad idea!).


texts: Creating 3D Models for Game similar to Tron in Blender

texts:
How can I create 3D Model of objects with glowing edges (just like in Tron) using Blender ?

Note : I am a beginner in Blender


texts: How do I determine wall direction, with information of normal and incoming direction?

texts:
What is formula and theorys used to determine wall direction, with only knowing the normal of the wall and the direction of the incoming object?

This answer has already stated a formula, but I don't know where it came from, and I am in need of understanding.


texts: Rotate object always at same speed on screen, no matter camera distance?

texts:
I am rotating a globe like XCOM's hologlobe,

I rotate it using Quaternion.RotateTowards(Quaternion from, Quaternion to, float maxDegreesDelta).

I found a good value for maxDegreesDelta, in my case it is 5.0f.

There is a limit on how close or far the camera can be, let's assume clos is 1.0f and far is 2.0f.

I want to be able to zoom into the globe, but obviously when I do, it rotates a bit too fast then.

When zoomed out, rotation speed is satisfying:

When zoomed in, rotation is too fast, making it more difficult to manipulate:

And the problem is even more evident as game view size gets bigger, i.e. fullscreen.

Using Mathf.Lerp and Mathf.InverseLerp, I've tried to make maxDegreesDelta and mouse delta proportional to the distance the camera is but it's hardly convincing.

Note: I rotate the globe, not the camera.

Question:

How can I ensure object rotates at same speed on screen, no matter how close or far camera is ?

Code:

(assumes there is a sphere of radius 0.5 at Vector3.zero and camera is positioned at Vector3.back)

using UnityEngine;
using UnityEngine.InputSystem;

namespace Test2
{
    public class GeoScapeController : MonoBehaviour
    {
        #region Public

        public Transform TargetObject;

        public Camera TargetCamera;

        [Range(0.01f, 1.0f)]
        public float Sensitivity;

        public bool Smooth;

        public float ZoomDistanceMin;

        public float ZoomDistanceMax;

        #endregion

        #region Private

        [SerializeField]
        [HideInInspector]
        private Quaternion TargetRotation;

        [SerializeField]
        [HideInInspector]
        private int ZoomLevel;

        [SerializeField]
        [HideInInspector]
        private int ZoomLevels;

        [SerializeField]
        [HideInInspector]
        private Vector3 ZoomVector;

        [SerializeField]
        [HideInInspector]
        private Vector3 ZoomVelocity;

        private void Reset()
        {
            Sensitivity = 0.05f;
            Smooth = true;

            ZoomDistanceMin = 0.625F;
            ZoomDistanceMax = 1.25F;
            ZoomLevels = 10;
        }

        private void Start()
        {
            TargetRotation = Quaternion.LookRotation(TargetObject.forward, TargetObject.up);
            ZoomVector = TargetCamera.transform.position;
        }

        private void Update()
        {
            var mouse = Mouse.current;
            var delta = mouse.delta.ReadValue();
            var scale = new Vector4(-1.0f, +1.0f, +1.0f);

            var x = mouse.leftButton.isPressed ? delta.y * scale.y * Sensitivity : 0.0f;
            var y = mouse.leftButton.isPressed ? delta.x * scale.x * Sensitivity : 0.0f;
            var z = mouse.middleButton.isPressed ? delta.x * scale.z * Sensitivity : 0.0f;
            var r = Quaternion.AngleAxis(x, Vector3.right) *
                    Quaternion.AngleAxis(y, Vector3.up) *
                    Quaternion.AngleAxis(z, Vector3.forward);

            if (Smooth) // hopefully, quaternion limits won't be crossed !
            {
                TargetRotation = Quaternion.RotateTowards(TargetRotation, r * TargetRotation, 2.5f);

                TargetObject.rotation = Quaternion.Slerp(TargetObject.rotation, TargetRotation, Time.deltaTime * 5.0f);
            }
            else
            {
                TargetObject.rotation = TargetRotation = r * TargetRotation;
            }

            var wheel = (int) mouse.scroll.ReadValue().y / 120;
            if (wheel != 0)
            {
                ZoomLevel = Mathf.Clamp(ZoomLevel + wheel, 0, ZoomLevels);
                var lerp1 = Mathf.InverseLerp(ZoomLevels, 0, ZoomLevel);
                var lerp2 = Mathf.Lerp(ZoomDistanceMin, ZoomDistanceMax, lerp1);
                ZoomVector = Vector3.back * lerp2;
            }

            TargetCamera.transform.position = Smooth
                ? Vector3.SmoothDamp(TargetCamera.transform.position, ZoomVector, ref ZoomVelocity, 0.3f)
                : ZoomVector;
        }

        #endregion
    }
}


texts: How can I make bullets come from a character's eyes, but look like they come from the gun?

texts:
How can I make bullets in a first person shooter look like they come from the gun, but actually come from the eyes of the character? The problem is that since the camera (the character's eyes) are in a different position than the gun, bullet animations coming from the gun won't end up at the crosshairs. This guy manages to do it, and it's more obvious at 5:17 when the bot is shooting at him. This also happens in CS:GO

I was thinking that maybe the final destination of the bullet is calculated, and then the path is traced backwards to the gun from there, but it's just a guess.


texts: No perfomance gain on LIBGDX GLES with sampler2D[]

texts:
I'm trying to render 3 textures 400 times (first,second,third 400 times). I use vertex shader that takes attribute tex_id; - this is the id of texture to use. In fragment shader i have sampler2D textures[3]; and binding them via setUniformi("textures[0..3],0...3);
So i draw all textures in one draw call binding them once. In desktop i have really fast results, but on GLES there is no difference at all. Using 1 draw call with 1 tetures binding, or using 400 drawcalls with 400 textures bindings has same fps. Why? First i think about gles limitations of lower android versions, then try adroid 4.4+ with API18 glSurfaceView20, but nothing changes.


texts:
I have two texture2d , one of these is a mask texture and have 2kind color
and i use that for mask (filter) second texture2D
something like

     float4 tex = tex2D(sprite, texCoord);
float4 bitMask = tex2D(mask, texCoord);
if (bitMask.a >0)
{
 return float4(0,0,0,0);
}
else
{
      return float4(tex.b,tex.g,tex.r,1);
}

but because mask texture is just two color the result is too jagged
i want know how i can do some antialiasing for edges that smooth these
ty for reading and sry for my bad english


texts: Making neural nets more efficient in Unity

texts:
Some backstory: currently using a Asus x555la so not the fastest laptop. Computing power is kind of the problem.

Hi there. I am currently doing hand tracking in Unity. I have developed a half-and-half approach to cut down lag and CPU stress (using one half image processing and one half good old fashioned neural nets). I am trying to embed an object detection neural net in Unity, and I have done so using TensorFlowSharp, but I can't figure out how to cut down lag. It's currently managing around 1FPS. How do I speed up neural nets in Unity. It doesn't have to be loads, just around 30FPS.

Has anyone had any experience using neural nets in Unity, and how did you make it work well?


texts: I am using LibGDX to make a very simple game. I am going to hire someone to create a splash screen logo since I'm artistically challenged. I want to order a vector graphic so I can scale it later if needed. What would be a decent size to use as a baseline (in pixels) that would scale relatively well on desktop/android/ios/etc?


texts: How can I bundle assets into an executable from my Game Maker-like editor?

texts:
I am attempting to implement a simple "game-maker" solution. I'm working with Visual Studio, in C#, using MonoGame. I'd like the games my editor creates to be stand-alone executables, with their art resources bundled within them so that they are not loose in a "data" folder next to the application.

I'm not sure how to implement that, though. If I create a game from my editor, how can the resulting game data be made distributable within the executable?

I'd like it so that the end result allows you to first open the editor and create and save a game, then go to that directory and run that game with its own executable.


texts: How to increase fighting stats of a player without increasing HP?

texts:
I'm currently making a simple game that requires a fighting system. The game consists of many (more than 100) levels that the player needs to go through to get to the end. In each level you get to fight creatures and monsters, and you evolve your skills by doing so (there are also other ways to do that but they're not relevant for the purpose of this post). The problem I'm having is that when the player reaches the higher levels, the fights become very hard to balance:

To calculate the damage the player does to the enemy, I was basing it on the player's fighting skill (which goes up with each fight) and the opponent's fighting skill (which is based on the level). However, if I make it so the damage is proportional to the ratio of the skills, when both skills are high, neither of them will do much damage. On the other hand, if I base it on the difference of these skills, a player with less stats than a monster can't to any damage to it (which is not what I want, as some monsters may have more fighting skills but you have more health, and vice-versa).

My question is if there's any easy way to calculate the damage that would scale well when both parties are very strong.


texts: How to make it possible to change the width of the stripes?

texts:
I am making a shader to create stripes based on this tutorial, but I cannot set the width for each stripe and make a shader that accepts light.
Shader "Unlit/Stripes-2"
{
    Properties{
        [IntRange] _NumColors("Number of colors", Range(2, 4)) = 2
        _Color1("Color 1", Color) = (0,0,0,1)
        _Ratio1("Width 1", Float) = 0.1 // Width for first color.
        _Color2("Color 2", Color) = (1,1,1,1)
        _Ratio2("Width 2", Float) = 0.1
        _Color3("Color 3", Color) = (1,0,1,1)
        _Ratio3("Width 3", Float) = 0.1
        _Color4("Color 4", Color) = (0,0,1,1)
        _Ratio4("Width 4", Float) = 0.1
        _Tiling("Tiling", Range(1, 500)) = 10
        _WidthShift("Width Shift", Range(-1, 1)) = 0
        _Direction("Direction", Range(0, 1)) = 0
        _WarpScale("Warp Scale", Range(0, 1)) = 0
        _WarpTiling("Warp Tiling", Range(1, 10)) = 1
    }

        SubShader
    {

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #include "UnityCG.cginc"

            int _NumColors;
            fixed4 _Color1;
            fixed4 _Color2;
            fixed4 _Color3;
            fixed4 _Color4;
            int _Tiling;
            float _WidthShift;
            float _Direction;
            float _WarpScale;
            float _WarpTiling;

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

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

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

            float2 rotatePoint(float2 pt, float2 center, float angle) {
                float sinAngle = sin(angle);
                float cosAngle = cos(angle);
                pt -= center;
                float2 r;
                r.x = pt.x * cosAngle - pt.y * sinAngle;
                r.y = pt.x * sinAngle + pt.y * cosAngle;
                r += center;
                return r;
            }

            float random(float2 uv)
            {
                return frac(sin(dot(uv, float2 (12.9898, 78.233))) * 43758.5453123);
            }

            fixed4 frag(v2f i) : SV_Target
            {
                const float PI = 3.14159;

                float2 pos = rotatePoint(i.uv.xy, float2(0.5, 0.5), _Direction * 2 * PI);

                pos.x += sin(pos.y * _WarpTiling * PI * 2) * _WarpScale;
                //pos.x *= _Tiling;

                int value = floor((frac(pos.x)) * _NumColors + _WidthShift);
                value = clamp(value, 0, _NumColors - 1);
                switch (value) {
                    case 3: return _Color4;
                    case 2: return _Color3;
                    case 1: return _Color2;
                    default: return _Color1;
                }
            }
            ENDCG
        }
    }
}


texts: Run FSX (Flight Simulator) on remote desktop

texts:
Obviously I cannot run FSX in a remote desktop session. When I try to start it appears the message: Flight Simulator cannot run during a Remote Desktop session and will now quit

Especially for development (coding on a second machine) a RDP session would be handy. Any workarounds for this?


texts:
I am very new to open gl and am struggling to understand relation between vaos vbos and ibos
like how is currently bound vao related to currently bound ibo?

now i am trying to render 4 triangles with vertex data and index data for ibo as

float vertices[] = {
        -0.5f, -0.5f,  2.0f,     1.0f, 0.0f, 0.0f ,1.0,
         0.5f, -0.5f,  2.0f,     0.0f, 1.0f, 0.0f ,1.0,
         0.0f,  0.5f,  2.0f,     0.0f, 0.0f, 1.0f ,1.0,

         0.0f,  0.0f,  1.0f,     1.0f, 1.0f, 0.0f ,1.0,
         0.0f,  0.0f,  3.0f,     0.0f, 1.0f, 1.0f ,1.0,
         0.0f, -1.0f,  2.0f,     1.0f, 0.0f, 1.0f ,1.0,
    };

    float vertices1[] = {
        -0.5f, -0.5f,  0.0f,     1.0f, 0.0f, 0.0f ,1.0,
         0.5f, -0.5f,  0.0f,     0.0f, 1.0f, 0.0f ,1.0,
         0.0f,  0.5f,  0.0f,     0.0f, 0.0f, 1.0f ,1.0,

         0.0f,  0.0f, -1.0f,     1.0f, 1.0f, 0.0f ,1.0,
         0.0f,  0.0f,  1.0f,     0.0f, 1.0f, 1.0f ,1.0,
         0.0f, -1.0f,  0.0f,     1.0f, 0.0f, 1.0f ,1.0
    };

    unsigned indices[] = {
        0,1,2,3,4,5
    };

    unsigned indices1[] = {
         0,1,
         1,2,
         2,0,
         3,4,
         4,5,
         5,3
    };

and i am creating vaos  and ibos as:

unsigned int VBO[2], VAO[2], IBO[2];
    glGenVertexArrays(2, VAO);
    glGenBuffers(2, VBO);
    glGenBuffers(2, IBO);
    glBindVertexArray(VAO[0]);

    glBindBuffer(GL_ARRAY_BUFFER, VBO[0]);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO[0]);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);

    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 7 * sizeof(float), (void*)0);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, 7 * sizeof(float), (void*)(3 * sizeof(float)));
    glEnableVertexAttribArray(1);

    glBindVertexArray(0);
    //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

    glBindVertexArray(VAO[1]);

    glBindBuffer(GL_ARRAY_BUFFER, VBO[1]);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices1), vertices1, GL_STATIC_DRAW);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO[1]);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices1), indices1, GL_STATIC_DRAW);

    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 7 * sizeof(float), (void*)0);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, 7 * sizeof(float), (void*)(3 * sizeof(float)));
    glEnableVertexAttribArray(1);

    glBindVertexArray(0);
    //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

And I am drawing it as:

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO[0]);
        glBindVertexArray(VAO[0]);

        glDrawElements(GL_TRIANGLES, sizeof(indices1) / sizeof(unsigned), GL_UNSIGNED_INT, 0);

        glBindVertexArray(0));
        //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO[1]);
        glBindVertexArray(VAO[1]);

        glDrawElements(GL_LINES, sizeof(indices1)/sizeof(unsigned), GL_UNSIGNED_INT, 0);

        glBindVertexArray(0));
        //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

If i dont unbind vao in the draw call then it will not be drawn as expected i.e. partially drawn lines or missing triangles.
Are'nt vaos supposed to override any previous bindings and bind a new one specified?
Even if i dont unbind vao after setting glVertexAttribPointer I get a blank screen! Then I got Totally confused on when to bind before doing what.
What does vao hold other than vertex attribute?like can i unbind ibo before vao?


texts: Can't get my android device to be connected to my game via Unity Remote5

texts:
Im trying to test out my game on Unity Remote5, but no matter what I try I can't seem to get it to work...

I enabled the needed settings in the dev settings. downloaded the android sdk and adb controller, tried having my phone on different usb settings (MTP, PTP,etc...) and still can't get it to work.

I'm using a Meizu m3 note, if anyone else has got one to work.


texts:
Hello I need to open a page in unity and save some of it's contents but I have absolutely no idea how I should do it.

Thanks for help.


texts: Depth Peeling implementation problem: How to render the next layer? (OpenGL)

texts:
I try to implement order-independet transparency sticking to the pseudo code in the linked paper (page 4). I can't figure out how they are able to do this in OpenGL.

I am rendering the scene two times in two different framebuffers and then want to blend the two. The first rendering uses the normal depth test GL_LESS. So I receive the nearest fragments in the first framebuffer.

I want to render the second nearest fragments in the second framebuffer. In the pseudo code they use the depth test GL_GREATER for this. But this would result in having the "farest" fragments in the second framebuffer, right?

So how can I render the "second nearest" pixels to a framebuffer? Which depth test would be right and how to apply it in OpenGL?


texts: What is the easiest way to make an object follow the edge of a sprite?

texts: I have a rounded rectangle sprite and another sprite that's just a circle. I want the center of the circle to follow the edge of the rounded rectangle. Is there any easy way to accomplish this task? I've seen other answers that talk about curve and AI predictive algorithms, but they all seem more complicated to implement that for my current needs. Is using these algorithms necessary for what I'm trying to do, or is there an easier way to make one sprite follow the edge of another?


texts: If a MMORPG does not have a limit on the number of players, will all players eventually focus on the same server?

texts:
Consider a WOW-like MMORPG game. The only difference between it and WOW is that there is no limit on the number of players (Suppose that there is no limit on hardware performance and network bandwidth).

For such a game, developers can still open multiple servers for players to play.

My question is:

Assuming that the game can run steadily over a long period of time, will it eventually lead to the concentration of all players on the same server?

Whether the answer is yes or no, is there a corresponding economic, sociological and ecological model behind it?

(This may be an open question, I am not sure if I should ask questions here, but there seems to be no better place to ask. I hope that I can get some inspiration through discussion)

Thanks.


texts:
How can I support multiple monitors in mono game ? As far as I know I can not override OnPreparingDeviceSettings and in GraphicsDeviceInformation class there is no DeviceName property in Adapter.

Thanks.


texts: how do game implement customization of characters

texts: I am looking to create a game a rpg. I want to add customization of character so that each players char is unique. How do i do it?


texts: how to render small texture on another texture?

texts:
can anybody help me to render small texture on another texture.
i.e
I have one background image, when user touches on the screen it should draw small(circle or any object) on it.

can anybody suggest me good tutorial to starts with it?


texts: Netty: Disconnect client from server keeps reconnecting automatically

texts:
I have a game that connects to a server using the Netty API. Everything works correctly it seems when I click 'Login'; it will connect to server. However i've added an ingame button 'Back To Lobby'. All this button does is call channel.disconnect(). However when it goes back to the login screen it continously reconnects on its own. Is there something I am missing?
My goal is to make it disconnect from server completely and only reconnect when user clicks login again.
Client Task Class:
public class ClientConnectionTask extends Bootstrap implements Runnable {

    /**
     * The game context
     */
    private GameContext context;

    /**
     * The worker
     */
    private EventLoopGroup worker = new NioEventLoopGroup();

    /**
     * The IP Address to connect
     */
    private String ip;

    /**
     * The callback to notify
     */
    private ClientConnectionCallback callback;

    public ClientConnectionTask(GameContext context, String ip, ClientConnectionCallback callback) {
        this.context = context;
        this.ip = ip;
        this.callback = callback;
    }

    @Override
    public void run() {
        group(worker);
        channel(NioSocketChannel.class);
        option(ChannelOption.TCP_NODELAY, true);
        handler(new ChannelInitializer<SocketChannel>() {
            @Override
            protected void initChannel(SocketChannel socketChannel) throws Exception {
                ChannelPipeline p = socketChannel.pipeline();
                p.addLast("encoder", new PacketEncoder());
                p.addLast("decoder", new PacketDecoder());
                p.addLast("handler", new ClientChannelHandler(context));
            }
        });

        try {
            ChannelFuture future = connect(ip, Constants.PROTOCOL_PORT).syncUninterruptibly();
            if (future.isSuccess()) {
                callback.onSuccess(future.channel());
            }
            future.channel().closeFuture().sync();
            future.channel().flush();
        } catch (Exception e) {
            e.printStackTrace();
            callback.onFailure();
        } finally {
            worker.shutdownGracefully();
        }
    }

}

Login method:
    public void connect(final String displayName, String ip, String code, int team) throws UnknownHostException {
        haveServerResponse = false; // reset for next connect
        if(!RandomUtils.validIP(ip) && RandomUtils.validUrl(ip)) {
            try {
                InetAddress address = InetAddress.getByName(ip);
                ip = address.getHostAddress();
            } catch(UnknownHostException e) {
                return;
            }
        }
        service.execute(new ClientConnectionTask(this, ip, new ClientConnectionCallback() {
            @Override
            public void onSuccess(Channel channel) {
                serverChannel = channel; // initialize the server channel
                connectScene.setState(ConnectionSceneState.CREATING_PROFILE);
                sendLoginPacket(code, displayName, team); // send login packet
            }

            @Override
            public void onFailure() {
                // only show if server appears dead
                if (!haveServerResponse) {
                    connectScene.loginFailed();
                    dispose();
                }
            }
        }));
    }

When debugging it seems like some threads are still staying alive, which may keep it from disconnecting completely. Sometimes it disconnects completely other times it just auto logs in.


texts:
(Here I eat my words on Meta about posting Unity questions on Unity Answers... since that site is less responsive than this one.)

Unity provides cell-based Occlusion Culling (via Umbra, I believe). However, a newer feature that it supports is Occlusion Portals.

The question is, if BSP-based occlusion culling is already a feature of Unity, what do portals add, and how?

PS. This question is not "What are portals?" -- I'm aware of the original Quake BSP-style portals -- which is partly why I find the explicit portal concept in Unity odd, since it uses BSP anyway.


texts:
I've been wondering if it's possible to load a large map made with Overlap2d before I get started with my project.

A large map for me is something equivalent to a map from recent open-world RPGs like The Wichter 3, but in 2d.

The map is drawn in advanced (it's not procedurally generated), and the game will be for Android devices so I thought a large map should be loaded in chunks.

Is it possible to load a large map mad with Overlap2d in LibGDX?


texts: How to implement bullet physics in libgdx

texts: I am new at game development want to know that how can I implement bullet physics in libgdx. I searched lot of things on Internet but nothing found worthy.


texts: How to implement friction in a physics engine based on "Advanced Character Physics"

texts:
I have implemented a physics engine based on the concepts in the classic text Advanced Character Physics by Thomas Jakobsen. Friction is only discussed very briefly in the article and Jakobsen himself notes how "other and better friction models than this could and should be implemented."

Generally how could one implement a believable friction model on top of the concepts from the mentioned article? And how could the found friction be translated into rotation on a circle?

I do not want this question to be about my specific implementation but about how to combine Jakobsens ideas with a great friction system more generally. But here is a live demo showing the current state of my engine which does not handle friction in any way: http://jsfiddle.net/Z7ECB/embedded/result/

Below is a picture showing and example on how collision detection could work in an engine based in the paper. In the Verlet integration the current and previous position is always stored. Based on these a new position is calculated. In every frame I calculate the distance between the circles and the lines. If this distance is less than a circles radius a collision has occurred and the circle is projected perpendicular out of the  offending line according to the size of the overlap (offset on the picture).

Velocity is implicit due to Verlet integration so changing position also changes the velocity. What I need to do know is to somehow determine the amount of friction on the circle and move it backwards parallel to the line in order to reduce its speed.


texts:
Using the library GLFW, I can create a fullscreen window using this line of code.

glfwOpenWindow(Width, Height, 8, 8, 8, 8, 24, 0, GLFW_FULLSCREEN);

The line for creating a standard window looks like this.

glfwOpenWindow(Width, Height, 8, 8, 8, 8, 24, 0, GLFW_WINDOW);

What I want to do is letting the user switch between standard window and fullscreen by a keypress, let's say F11.

It there a common practice of toggling fullscreen mode? What do I have to consider?


texts: How do you calculate the nearest point on 2 curves?

texts: Given the points of a line and a quadratic bezier curve, how do you calculate their nearest point? .... Similarly, given the points of 2 curves, how do you get the nearest point?


texts: I just wonder how does these maps like in this video are made. http://www.youtube.com/watch?v=TM6kcOau5oQ  I was looking for some tutorials on the web but no success. All I found was some 2D Vectors (Matrixes) with 0,1,2 values on it but I think these maps are generated and stored in a different ways. Can somebody help me or give me some advice about these maps.  I saw some presentations about indie games and I was just amazed by these games. I want to make my own game. I am a beginner and already started an XNA book and some tutorials. I would like to learn how these games are made. Thanks!


texts: Why are the randomly generated numbers not random?

texts:
I'm trying to make a game where the damage you deal is rolled by a dice. It all works. However, it keeps on giving the same values in a row so it isn't entirely random

ini_open("Health.ini");
attack = ini_read_real( "Attacks", "Felix", 0);
ini_close();
global.damage=0
repeat(attack){
global.damage=irandom(6)
}

if (global.damage ==0){instance_create_depth(300, 400, 0, obj_numbers0)}
if (global.damage ==1){instance_create_depth(400, 400, 0, obj_numbers1)}
if (global.damage ==2){instance_create_depth(500, 400, 0, obj_numbers2)}
if (global.damage ==3){instance_create_depth(600, 400, 0, obj_numbers3)}
if (global.damage ==4){instance_create_depth(700, 400, 0, obj_numbers4)}
if (global.damage ==5){instance_create_depth(800, 400, 0, obj_numbers5)}
if (global.damage ==6){instance_create_depth(900, 400, 0, obj_numbers6)}

The attack value is 1 because it is only one dice that is used for damage for now. The software I am using is Game Maker Studio 2


texts: Why are there no sophisticated construction animations in RTS games in general?

texts:
I want to code a small demo to test what degree of detail regarding animations, is possible in modern RTS/building games and which of them have the largest impact on the playing experience. Similar to the first few minutes of a '0 A.D'/AoE game. (No music and art assets, no story, as simple as possible.)

All building animations in RTS and building games are made rather modest. They simply arise from the ground or jump from one state of completion to the next accompanied by some particle effects.
The Settler games are the only ones known to me, that model the transportation of goods to the building lot and make the area plane, before they build on it.

In the demo I mainly want to focus on the construction process, that should be continuous. The building material is to be represented by objects in the game world. Based on a predetermined pattern, workers shall combine these building materials piece by piece to a building.

Had one of you the same idea and experienced difficulties, that led them to the adoption to a simpler animation/building scheme? Are there computational problems, because this approach needs to many calculations (e.g. for collision detection of the building blocks)?

List of different ways construction has been done in RTS / building games before:

Positions of interest are stored in the links.

Sprite fades in:

Settlers 1

Completed building emerges at desired location:

Anno 1404, Anno 2070, (haven't checked the early ones)

Stronghold, Stronghold Crusader 2 (and 1)

Building arises from ground (without or with worker units bashing the ground)

0 A.D.

Godus

Dawn of War (with extra animation, while the building is ascending)

Incremental, stepping animation (without or with moving/non-moving worker units):

Age of Empires 2

Age of Empires 3

Incremental, continuous animation (without or with moving/non-moving worker units):

?

WarCraft 3 (a mixture of different animation types)

StarCraft 2 (similar to WarCraft)


texts: how to use glm::rotate with a eulerangle?

texts:
I have a vec3 to represent my object's orientation/rotation but the glm::rotate method expects a quaternion. If I just convert it to a quaternion like this:

glm::quat rot = rotation;

The W value will just be zero, right? And then there won't be any changes in rotation.

In my code I just want to be able to do rotation.x += 5.0f; in the update method of an object.

This is the method I'm using for my transformations:

glm::mat4 GameObject::Transform(glm::mat4 model, glm::vec3 position, glm::vec3 scale, glm::quat angleAxis)
{
    model = glm::translate(model, position);
    if (angleAxis.w > 360.0f)
    {
         angleAxis.w -= 360.0f;
    }
    else if (angleAxis.w < 0.0f)
    {
         angleAxis.w += 360.0f;
    }
    model = glm::rotate(model, angleAxis.w * toRadians, glm::vec3(angleAxis.x, angleAxis.y, angleAxis.z));
    model = glm::scale(model, scale);
    return model;
}

Currently I'm just passing on that rotation vec3 to that angleAxis quaternion parameter but that obviously doesn't work.

This is how i currently calculate my front, up, and right vectors:

void GameObject::calculateCameraView()
{
    front.x = cos(glm::radians(rotation.x)) * cos(glm::radians(rotation.y));
    front.y = sin(glm::radians(rotation.y));
    front.z = sin(glm::radians(rotation.x)) * cos(glm::radians(rotation.y));
    front = glm::normalize(front);

    right = glm::normalize(glm::cross(front, worldUp));
    up = glm::normalize(glm::cross(right, front));

    front.y = invertMouse ? front.y * -1 : front.y;
}


texts:
Possible Duplicate:
  Car engine sound simulation

M working on 3d car racing game . Being assigned the task of creating sound effects for the car. I have all the sounds with me like idle engine sound , onLow sound, onMid sound and onHigh sound ......now the issue is i dont know how actually the other games use these sounds to create awesome sound effects ..
 Does anyone have any idea how to implement my sounds for car when it runs and changes gear all that ?

EDIT:-

When the car is at start line there would be idle engine sound.
on 1st gear the sound of accelerating car till 2nd gear.
before second gear the car sound drops (actual rpm of car drops) then gear shift and again boost in the sound and so on..

I need to simulate these events in the game. I am given with three sounds :-

sound for low speed
sound for mid speed
sound for high speed

these are steady sounds of engines at a particular rpm levels of a engine...
Hope now things are clear

Thanks


texts: How to make a cube fall from the edge when part of it is outside in Unity

texts:
Let's assume I have a 1x2x1 cube and it is balanced over an edge, since the weight of the cube is distributed perfectly, it doesn't fall, how to make it fall when part of the cube is over the edge?

I have tried adding invisible objects to both ends of the cube and then adding another invisible object on the edge so when they collide I change the center of mass of the cube, this seems to work but I think it is overly complex since I have to add that invisible object around all edges of my scene.


texts: How to deal with collision detection result

texts:
I have a render loop. In it I always call the update() method which moves all the objects in their own directions. Then after that I call checkCollision on each object with each object like that:

for (GameBodyObject gbo1 : objects) {
   for(GameBodyObject gbo2 : objects) {
      if(!gbo1.equals(gbo2)) {
         gbo1.checkCollision(gbo2);
      }
   }
}

btw I am using Circle as collider

now in checkCollision I first check if they collide and then if yes I calculate the displacement like this:

if(CircleCollider.collide(p1, r1, p2, r2)) {
   double totalR = r1 + r2;
   double a = new Vector(p1.getX() - p2.getX(), p1.getY() - p2.getY()).getAngle();

   double intersection = Math.abs(totalR - p1.distance(p2));

   return new Vector(Math.cos(a) * intersection, Math.sin(a) * intersection);
} else {
   return new Vector(0, 0);
}

then I move the GameBodyObject by this displacement vector like this:

public Point moveByVector(Vector v) {
    if(v.getX() == 0 && v.getY() == 0) {
        return this;
    }
    double a = v.getAngle();
    double l = v.getLength();
    x += l * Math.cos(a);
    y += l * Math.sin(a);
    return this;
}

However I get a bouncing effect so the one gameBodyObject goes into another gameBodyObject and back and again into that gameBodyObject and back. I want it to stop, not to bounce.

How could I do that?

One way that come up to my mind is that I will check for collision in the update() function directly and if it occurs I won't move the guy, but then it may get stuck if he runs into another gameBodyObject...

How should I deal with that?

(BTW did you play Dota 2? I want the mechanics similar to that game so that one player can block another player and trees are static so they don't move so the player can't push them instead he stops...)


texts: failbit is being set and I can't figure out why

texts:
I'm writing a MIDI file loader. Everything is going fine until at some track I get a failbit exception while trying to read from file. I can't figure out why, I've checked the file size and it's ok too.

Upon checking "errno" and it returns "0".

Any ideas?
Thanks.

The snippet follows:

file.read(reinterpret_cast<char*>(&mHeader.id), sizeof(MidiHeader));

mTracks = new MidiTrack[mHeader.nTracks];
for (uint i = 0; i < mHeader.nTracks; ++i)
{
    // this read fails on 6th i. I've checked hexadecimal file and it's
    // ok so far.
    file.read(reinterpret_cast<char*>(&mTracks[i].id), sizeof(uint));
    if (file.fail())
    {
        std::cerr << errno << std::endl;
        massert(false);
    }
    massert(mTracks[i].id == 0x6B72544D);

    file.read(reinterpret_cast<char*>(&mTracks[i].size), sizeof(uint));
    mTracks[i].size = swapBytes(mTracks[i].size);

    mTracks[i].data = new char[mTracks[i].size];
    file.read(mTracks[i].data, mTracks[i].size * sizeof(char));

    totalBytesRead += 8 + mTracks[i].size;
    massert(totalBytesRead <= fileSize);
}


texts: SDL2 - Why use `SDL_Window* win` and not `SDL_Window win`?

texts: Is there a reason to allocate the window on the heap and not the stack?


texts: Blender: Setting additional properties per face

texts:
I wish to use Blender to model level for 3D game.
Level is a set of Meshes.
I have to set special (additional) properties per face (triangle).
These properties are like integer number or vector or color.

Ideally I would select a set of faces and set TAG1 to be 7 and TAG2 to be (1.0, 0.0, 0.0) and TAG3 to be Red for these faces.

TAG1 is Integer
TAG2 is Vector
TAG2 is Color

Also I would like to be able to export that model in some format like Collada or OBJ.
I use ASSIMP to convert model in my game internal format.

I believe OBJ does not support extra properties.

It sounds like very common task for gamedev. But I can't find any simple solution that does not require to create my own 3D editing tool.

Also I can consider using other 3D modelling tool if it has such functionality.


texts: In unity i have this code that has to make a lot of allocation but no new variables are creates, but still the RAM usage just keeps climbing

texts:
So I have this code that has four for-loops inside each other, so there are a lot of actions, but no new Space should be needed. Still, when trying to run this, Unity stops responding and in the Task-Manager I just see the RAM-Usage steadily climbing up while the CPU-Usage is pretty much constantly on 10%.

This is the Code:

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

public class SceneGenerator : MonoBehaviour
{

    public GameObject spawnee;

    // Start is called before the first frame update
    void Start()
    {
        pos4d mpos = new pos4d();
        float r = 1;

        pos4d campos = new pos4d();
        campos.s = 3;

        pos4d viewpos = new pos4d();
        viewpos.s = 3.5f;

        //pos4d[,,] grid = new pos4d[10,10,10];
        pos4d dir = new pos4d();
        pos4d raypoint = new pos4d();

        for (int i = 0;i < 10;i++) {
            for (int j = 0;j < 10;j++) {
                for (int k = 0;k < 10;k++) {
                    /*
                    grid[i,j,k] = new pos4d();
                    grid[i,j,k].x = i/10-0.5f;
                    grid[i,j,k].y = j/10-0.5f;
                    grid[i,j,k].z = k/10-0.5f;
                    grid[i,j,k].s = 3;
                    */

                    dir.x = (i/10-0.5f - viewpos.x)/10;
                    dir.y = (j/10-0.5f - viewpos.y)/10;
                    dir.z = (k/10-0.5f - viewpos.z)/10;
                    dir.s = (3 - viewpos.s)/10;

                    raypoint.x = i/10-0.5f;
                    raypoint.y = j/10-0.5f;
                    raypoint.z = k/10-0.5f;
                    raypoint.s = 3;

                    for (int step = 0;step < 1000;step++) {
                        Debug.Log("" + (i+j+k+step));
                        if (Mathf.Sqrt(Mathf.Pow(raypoint.x - mpos.x,2) + Mathf.Pow(raypoint.y - mpos.y,2) + Mathf.Pow(raypoint.z - mpos.z,2) + Mathf.Pow(raypoint.s - mpos.s,2)) <= r) {
                            Instantiate(spawnee,new Vector3(i/10-0.5f,j/10-0.5f,k/10-0.5f),Quaternion.identity);
                            break;
                        }
                        raypoint.x += dir.x;
                        raypoint.x += dir.y;
                        raypoint.x += dir.z;
                        raypoint.x += dir.s;
                    }
                }
            }
        }
    }

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

    }
}

public class pos4d {
    public float x = 0;
    public float y = 0;
    public float z = 0;
    public float s = 0;
}
```


texts: Any link / tutorial of how to develop MVC pattern?

texts:
I want to learn how to develop a MVC pattern, but i can't find any site in where they focus it to Games and not to Browser / Windows calculator.

Would anyone please link me a tutorial of how to develop MVC patter for games?

Thank you very much


texts: Zooming in so a smaller portion of the game scene fills the entire screen

texts:
so i am creating a game similar to super-smash-bros, in which the camera should zoom in on players when they are close together, and scale back when they are apart. I create a window for my game via

m_pWindow = SDL_CreateWindow("First SDL game attempt", SDL_WINDOWPOS_UNDEFINED,
                SDL_WINDOWPOS_UNDEFINED, 1000, 1000, SDL_WINDOW_SHOWN);

and then initialise my render via

m_pRenderer = SDL_CreateRenderer(m_pWindow, -1, SDL_RENDERER_ACCELERATED);

and when i call render for my buffer, it simply calls

SDL_SetRenderDrawColor(m_pRenderer, m_clearRed, m_clearGreen, m_clearBlue, 0xff);
SDL_RenderClear(m_pRenderer);
SDL_RenderPresent(m_pRenderer);

Now i am wondering where in this solution should i implement the camera, if you could point me in the right direction that would be great. For example, i have a player positioned at {500, 800}, and another at {300,800}. I want to zoom in on this point of the screen. The total window is 1000x1000, but rendering {x = 200->600, y = 600->1000} is what i want to achieve.

I have currently tried using

SDL_Rect rect;
rect.x = 0;
rect.y = 0;
rect.w = 900; //TEST VALUES
rect.h = 900; //TEST VALUES
SDL_RenderSetViewport(m_pRenderer,
    &rect);

But this simply doesn't render part of the screen, as opposed to scaling the entire view.

Any other help would be greatly appreciated


texts: What is an active Indie iOS development community?

texts:
I've just gotten into iOS development, and would love to develop some games, but need inspiration/support, all that stuff a great community gives you.

Does anyone know of a community to get involved with?


texts: How to balance this Pokémon simulator metagame by feedback?

texts:
This is a Pokémon simulator where you build a team of 6 pokémon and battle with someone. Unfortunately, some Pokémon are stronger than others and only a few of the hundredth species are practical. I'm trying to create a metagame where all of them are competitive. For this, I am tagging a Pokémon with a parameter (level) that changes it's strength and scales up/down depending on the it's performance. That is, if the system detects Mewtwo is overperforming, it should decrease it's level tag until Mewtwo is balanced.

The question is: how can I identify if a Pokémon is causing an unbalance? The data I have is the historic of the battles (player 1, player 2, pokémon list, winner). The most basic solution I can think of is victory/loss counting.


texts: Help to understand directions of sprites in XNA

texts:
If I want to move a sprite to the right and upwards in a 45 degree angle I use

 Vector2 direction = new Vector2(1,-1);

And if the sprite should move straight to right

 Vector2 direction = new Vector2(1,0);

But how would I do if I want another directions, lets say somewhere between this values? I have tested with some other values, but then the sprite either moves to fast and or in another direction than I expected!? I suspect it's about normalize!? Another thing I have problem with to understand.

I'm doing a simple asteroids game as a task in a class in C# and XNA. When the asteroids hit the window borders, I want them to bounce back in a random direction, but I can't do this before I understand how directions and Vector2 works. Help is preciated! Thanks!


texts: Downsides of using a 8192 x 8192 texture?

texts:
So I am using Unity to build a 2D game and one thing that I needed is to be able to render a lot (talking about 10s of thousands) of sprite to the screen so I have a custom solution that basically is a single game object with a script that uses Graphics.DrawMesh() with pretty good results right now. Now I know another way to reduce draw calls is to have a few materials as possible (as I believe a single mesh can only use 1 material) so I was think about using a 8192 x 8192 texture as basically my main (maybe only texture) as with 64 x 64 sprites, I can fit a bit over 16000 sprites which should be more than enough for all the sprites in the game world).
My question is whether or not there is any major downside of using a texture of this size? I am sure there are decides and video cards that would not support this but I am curious as to what those are. Would current gen / next gen consoles support this? At what point would video card not support this? For the game I am working on mobile / VR is not a concern.
If this texture size would restrict support too much, what about 4096 x 4096?


texts: Can I generate collision boxes from a model file with BepuPhysics and XNA?

texts:
I am currently developing a game using BepuPhysics in XNA 4.0, and I am trying to reasonably match the in game collision Entities with the Model they are associated with.

My current workflow involves guessing what size the various segments of the model are, guessing a size and position of a box to match each segment, and throwing stuff at it to see if I'm right.

This is not an efficient process.

Is there a way to automatically generate the Entity from the Model?
If not, is there some other way to speed up my workflow?


texts: What is the appropriate way to implement wobble/balance mechanics in Unity 3D?

texts:
We are trying to implement a minigame where the player character sits on a bouncing ball, and needs to a) hit forward to move forward and b) hit left/right to adjust against the the ball's natural wobble (in other words, if the ball leans left, you must hit right).

We have tried implementing this by setting the bounciness and weight on the ball so that it bounces naturally when the player is not on it, then fixing the player model to the ball (in other words, treating them as a single unit), then having the CharacterController control the unit while it continues bouncing.

However, no matter how we tune the various factors (bounciness, weight, input multiplier, gravity), the ball remains quite sensitive and eventually spirals out of control. We would particularly like to allow the player some opportunity to regain control.

I have played a number of games that require some kind of reflex-based wobble/balance mechanic. Is there a general approach here that we are missing?

This question is for a small academic project, so we're wondering if there's a specific component we need, or part of the Physics engine we've missed, or technique we should look up - but please don't post code. There are no project requirements here except using Unity 3D (e.g. the assignment is not "implement a bouncing ball minigame").


texts: Using a particular font in a commercial game

texts:
I'm working on a game I intend to sell, and I want to use this font. The license says:

  "You may NOT copy or distribute the font outside of the licensed
  household, company, school or institution. Please ask external
  contacts who want to use the font to purchase their own license at
  www.CheapProFonts.com."

However, my plans are to use a tool to output a texture using this font to use as a bitmap font in my game. Does this mean I can do so, and sell my game with the font in it?


texts: Time calculation between openGL update calls

texts: In XNA, the system calls update and draw function with the time information. This contains information such as how much time has passed since last update was called. This makes easy to integrate time and do animation calculation accordingly. But I dont see any such mechanism in openGL. I see openGL requires programmers to have their own implementation which could be buggy or inefficient. Is there any standard (and efficient) code that demonstrate this practice in openGL?


texts: How to get the angle to an object from angle you are facing

texts:
I am making an creature simulator where the creatures have a neural net for a brain.

One of the inputs to the net is the angle it has to travel to go to be facing the nearest piece of food. I can get the nearest piece of food, but I need a way of getting the angle it needs to travel to be facing the piece of food.

For example, if it was facing the food, it would be zero, and if it was facing away it would be 180. I got the creatures angle, if it is facing up it would be 0 degrees, and if its facing right its 90 degrees.


texts: Playing a Song causing WP7 to crash on phone, but not on emulator

texts:
I am trying to implement a song into a game that begins playing and continually loops on Windows Phone 7 via XNA 4.0. On the emulator, this works fine, however when deployed to a phone, it simply gives a black screen before going back to the home screen. Here is the rogue code in question, and commenting this code out makes the app run fine on the phone:

// in the constructor fields
private Song song;

// in the LoadContent() method
song = Content.Load<Song>("song");

// in the Update() method
if (MediaPlayer.GameHasControl && MediaPlayer.State != MediaState.Playing)
{
    MediaPlayer.Play(song);
}

The song file itself is a 2:53 long, 2.28mb .wma file at 106kbps bitrate.

Again this works perfectly on emulator but does not run at all on phone. Thanks for any help you can provide!


texts: Projecting onto different size screens by cropping

texts:
I am building a phone application which will display a shape on screen. The shape should look the same on different screen sizes. I Decided the best way to do this is to show more of the background on larger screen keeping the shapes proportion the same on all screens.

My problem is I am not sure how to achieve this, I can query the screen size at runtime and calculate how different it is from the six is designed for but I am not sure what to do with this value.
What kind of projection should I use for my orthographic matrix an hour will I display more on larger screens and not loose information on smaller screens?


texts:
As the title says…. :( nothing is drawn on screen… is there something I'm missing?

Mesh *Mesh_Create(GLfloat vertices[], GLuint indices[], GLfloat uvs[], GLfloat colors[])
{

Mesh *mesh = (Mesh*)malloc(sizeof(Mesh));

mesh->vertices = (GLfloat*)malloc(sizeof(vertices));
memcpy(mesh->vertices, vertices, sizeof(vertices));

mesh->indices = (GLuint*)malloc(sizeof(indices));
memcpy(mesh->indices, indices, sizeof(indices));

mesh->elementCount = sizeof(indices) / sizeof(GLuint);

glGenVertexArrays(1, &mesh->vao);
glBindVertexArray(mesh->vao);

glGenBuffers(1, &mesh->vbo[VERTEXBUFFER]);
glBindBuffer(GL_ARRAY_BUFFER, mesh->vbo[VERTEXBUFFER]);
glBufferData(GL_ARRAY_BUFFER, sizeof(mesh->vertices), &mesh->vertices, GL_STATIC_DRAW);
glVertexAttribPointer(0, 2, GL_FLOAT, false, 0, 0);
glEnableVertexAttribArray(0);

/*glGenBuffers(1, &mesh->vbo[TEXTUREBUFFER]);
glBindBuffer(GL_ARRAY_BUFFER, mesh->vbo[TEXTUREBUFFER]);
glBufferData(GL_ARRAY_BUFFER, sizeof(uvs), uvs, GL_STATIC_DRAW);
glVertexAttribPointer(1, 2, GL_FLOAT, false, 0, 0);
glEnableVertexAttribArray(1);
*/
glGenBuffers(1, &mesh->vbo[INDICESBUFFER]);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh->vbo[INDICESBUFFER]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(mesh->indices), &mesh->indices, GL_STATIC_DRAW);

/*glGenBuffers(1, &mesh->vbo[COLORBUFFER]);
glBindBuffer(GL_ARRAY_BUFFER, mesh->vbo[COLORBUFFER]);
glBufferData(GL_ARRAY_BUFFER, sizeof(colors), colors, GL_STATIC_DRAW);
glVertexAttribPointer(3, 4, GL_FLOAT, false, 4 * sizeof(GLfloat), NULL);
glEnableVertexAttribArray(3);*/

/*glBindVertexArray(0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);*/

return mesh;
}

Mesh *Mesh_CreateQuad()
{

GLfloat vertices[] = { -0.5,  -0.5,
                        0.5,  -0.5,
                        0.5,   0.5,
                       -0.5,   0.5 };

GLuint indices[] = { 0,1,2,
                      0,2,3 };

GLfloat uvs[] = {   0 , 1,
                    1,  1,
                    1,  0,
                    0,  0 };

GLfloat colors[] = {    1, 1, 1, 1,
                        1, 1, 1, 1,
                        1, 1, 1, 1,
                        1, 1, 1, 1 };

return Mesh_Create(vertices, indices, uvs, colors);
}

void Mesh_Render(Mesh *mesh)
{
    glBindVertexArray(mesh->vao);
    glDrawElements(GL_TRIANGLES, mesh->elementCount, GL_UNSIGNED_INT, &mesh->indices);
}


texts: Box2DLights in libGDX - Bad quality of the light gradient on Android

texts:
I am facing a problem while porting one of my libGDX project from desktop to Android : My game uses Box2DLights. While the light effect look very fancy on the desktop version of the game, it looks really ugly on the Android version. The light gradient is not smooth at all. Take a look at the comparative screenshot below :

To use Box2DLights in my game, I use this code in my GameScreen :

 rayHandler = new RayHandler(world);
 rayHandler.resizeFBO(Gdx.graphics.getWidth()/5, Gdx.graphics.getHeight()/5);
 rayHandler.setBlur(true);
 RayHandler.useDiffuseLight(true);
 rayHandler.setAmbientLight(new Color(0.15f, 0.15f, 0.15f, 0.1f));

Of course, I tried to play with different parameters, such as :

RayHandler.useDiffuseLight(fasle);

Or

rayHandler.diffuseBlendFunc.set(GL20.GL_DST_COLOR, GL20.GL_SRC_COLOR);

Or

rayHandler.shadowBlendFunc.set(GL20.GL_DST_COLOR, GL20.GL_SRC_COLOR);

Everything I tried so fare gave the same ugly light gradient. I already played games that uses Box2DLights that rendered very well on my tablet, thus, I don't think it's due to a limitation of Android.

Does anybody know what's the trick to overcome this problem ?

Thanks !


texts: place sprites in grid pattern within an area

texts:
I have been trying to do this for a few hours in unity now but cant get my head around it. basically i have 4 points(vector3) 1 each for the 4 corners topleft, topright, bottomleft, bottomright. now i have a sprite that i use as a block what i want to do is basically fit X number of blocks within the four points. see the image below. Icant think of a way to do this right now.
I would really appreciate any help in how to achieve this. thanks for helping.


texts: How can I add my custom mob to my minecraft game?

texts: So, I'm obviously not a very experienced mob maker, so ill just get to the point. after I made a custom mob, I had no idea where to put it, how to make sound, how to make an egg for it etc. would anyone be able to walk me through the process of adding it to my game?


texts: In Java swing, while handling a 2D top down game, how should I handle scaling for quality transformations (mainly screen rotation)

texts:
For my top down game, I plan to have screen rotation where entities don't rotate, but everything else does. I am using a raster array to store my image so I don't have to render things stacked on each other. I have my game scaled by three, however so pixels are 3 times as large and take up 9 times more space meaning that when I do a matrix rotation for everything except the player and entities, the pixels are very badly rotated as it is rotating then scaling afterwards.

Essentially, I copy whatever pixels I need to to the main image (both arrays of pixels), then after that it is scaled by three and drawn to the actual screen (with the Java Graphics). Mainly, I would like to do quality rotations and scaling means that I cannot do that.

Also off a little bit from the question, how would you recommend I handle the rotation so that the entities stay upright and everything except the map moves while keeping collision and logic working fine. Similar to how the game Realm of the Mad God works.

I am willing to change my rendering logic a bit, however I want to keep it as efficient as possible. I can also change my game into 3D in order to have higher quality walls and such.

Overall, I am asking:
How should I handle scaling so that I can use high quality transformations and how would I efficiently and effectively implement screen rotation.

All help is appreciated, thanks.


texts: Is there any "object" in monogame for windows phone 8, that is similar to Toast in Android?

texts:
The title pretty much sums it all.

Is there any "object" in monogame for windows phone 8 (for monogame to be exact), that is similar to Toast in Android?

My purpose is to give a notification / hint at what user do, until certain period / until next user input.

For example:
If the player tapped "attack", then there is text shown "Select your target" in either top or bottom screen. Just like Toast in android.

Note 1 : I can do it manually, but i'm just curious. If I can use a pre-made function (such as Toast) it'll be simpler to implement, rather than making it myself.

Note 2 : Mine is a turn based tactic game (such as FF Tactic)

Thank you.


texts: How can I economically check if a UI DropDown is open or closed?

texts:
I've recently come across a problem with the UI DropDown component. I would like to resize other UI components depending on whether the dropdown is opened or closed. Unfortunately, the dropdown dynamically creates and destroys its own "Dropdown List" component, making it difficult to check whether it is open or not, without having to check with Update or FixedUpdate (both being expensive on the performance).

I have tried to implement a solution with event handlers, but it seems as if the even handler triggers before the "Dropdown List" is created. Thus this does not work.

Am I simply missing an easy way to check whether the dropdown is open or closed?


texts: When should I hard-code data versus load external data?

texts:
I'm a thousand or so lines of code into making my own 2D space-based game, which creates networks of randomly generated star systems and populates them with a random selection of planets, stations, ships and weapons.

There will potentially be hundreds of different stations/ships/etc that the game will need to use - so here's what I was wondering. Should I spend the time to create a 'softcoded' data-loader, which would store all of this information in (for example) XML files, and would therefore be somewhat easier to modify later, or should I simply go with what I've been doing right now - hardcoding all of the objects into the main engine of the game.

I'm the only person on the project, and as I said, it's only a hobbyist thing I'm doing in spare time away from university. But would the community recommend investing in creating an entire extra system of storing data in additional files?

What are the benefits of softcoding data in a way like this, versus simply hardcoding it all via constructors? Is there a long-term benefit to having external files that can be modified - if I'm not looking for the game to have 'mods', is it necessary to have external files? If it's just a hobbyist thing that I might give up on in a few weeks or months, should I waste time on this?


texts: Unity2D: Using UI buttons to move Player

texts:
I've created a script that allows my player to move using UI button, however my player's movement isn't very smooth or flowing, instead it's very clunky and somewhat looks like my player is teleporting. I tried following tutorials on YouTube, however I was having problem with accessing the 'Unity Standard Assets' as for some reason it wasn't there. I read up for information about people re-importing it into their projects only to have it mess up parts of their games. Overall I was wondering if there any one can help me fix my problem! Thank you :)

My script:

public float moveSpeed;

void Update () {
    if (moveRight == true) { // Here I have tried methods like Addforce and velocity, but for some reason it wasn't working!!
        GetComponent<Rigidbody2D>().AddForce (transform.right * maxSpeed);
    } else if (moveRight == false) {
        GetComponent<Rigidbody2D>().AddForce (transform.right * maxSpeed);
    }
}

public void MoveLeft() {
   transform.position -= transform.forward * Time.deltaTime * moveSpeed;

  // moveRight = false;
}

public void MoveRight() {
   transform.position += transform.forward * Time.deltaTime * moveSpeed;

 // moveRight = true;

}


texts: How to model the double jump in Super Mario using projectile motion

texts:
So the single jump in Super mario games follows a curved trajectory of the formula s = s0 + v0t + ½ at2. The double jump in mario consists of two different parabolas combined. I know that the max height of the first jump is the beginning of the second jump and the gravity doubles by the end of the second jump making a faster landing than the first. Would it be a piece-wise function or how would it work?
*Could anyone guide me through/ explain what equation would that result in? Any help would be very much appreciated!
If anyone needs me to explain more, please let me know.
Here is a link to explain my question https://www.youtube.com/watch?time_continue=1096&v=hG9SzQxaCm8&feature=emb_title
@ 17:58
I would be very grateful for any help :) Even if it is only ideas, thanks


texts:
I'm using SDL and I need to quickly fill a lot of polygons (fake 3D walls, made linking calculated points with the SDL_RenderDrawLine() function, that I need to colour).

I tried to implement the filledPolygon() function from SDL_gfx.h but since I didn't see any improvement, I gave up.

I also searched for a multithreading implementation but after some tries I understood that it wasn't the best way to deal with my problem.

Finally, I tried to make a for loop where I call SDL_RenderDrawLines() every time.

Yes, I know that's the worst thing that I could do (indeed I ascertained that whats slowing down my program is that continuous function calling in the loop) but I don't really know what to do.

What's the best way to accomplish flood filling in SDL2?

I'm using SDL_RENDERER_ACCELERATED flag and I need to render even 150/200 polygons without any problem. With the actual code a single polygon placement is capable of slowing by 4 times my program so I can barely place a small polygon without making the program useless.

Thanks in advance for any helpful answer.


texts:
I'm trying to rotate my Turret.png (small Gunhead with a laser in front) towards the mouses location on the screen. I tried just using my method for rotating projectiles towards the next step on their trajectory, but this produces unexpected results. Not only does the image not rotate about a fixed point, it also will clip based on the original images bounds.

My goal is for the turret to rotate about a fixed point on the gun head, so that the laser always points towards the mouse and the gun head is at a fixed position.

Here is an example of how I'm trying to get it to rotate; in this example the rotation was 78 degrees done in Illustrator. The red dot represents the origin.

My current code is as follows,

This method updates my Gun Tower and tells the turret the angle to rotate to:

 public void setTargetAndDirection(int x, int y)
        {
                setTarget(x, y);
                deltaX = getTargetX() - getX();
                deltaY = getTargetY() - getY();
                turret.setRotatedImage(turret.getActiveImg(), -getTargetAngle());

        }

This is the method that actually handles the rotation:

      public void setOriginRotate(BufferedImage imageIn, float angle)
  {
      GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment()
                                .getDefaultScreenDevice().getDefaultConfiguration();

      int transparency = imageIn.getColorModel().getTransparency();
      BufferedImage temp =  gc.createCompatibleImage(
                              imageIn.getWidth(), imageIn.getHeight(), transparency );
      Graphics2D g2d = temp.createGraphics();

      int x = xLoc;
      int y = yLoc;

      g2d.setColor(Color.RED);

      AffineTransform at = AffineTransform.getTranslateInstance(x, y);
      at.setToRotation(Math.toRadians(-angle));
      g2d.setTransform(at);
      g2d.drawImage(imageIn, 0, 0, null);

      g2d.dispose();

      displayImg = temp;

      dispSizeX = displayImg.getWidth() / sizeMod;
      dispSizeY = displayImg.getHeight() / sizeMod;
  }

Any help would be greatly appreciated.


texts: How to view 360 degree images in Unreal Engine 4

texts: Is there any way I can view 360 degree images in UE4, Ive read about possibly mapping it onto a hollow sphere however it always seems warped. I am working on a virtual tour and would like to be able to transition between multiple 360 images such as the ones found here : http://www.wpanorama.com/panoramas.php?page=01n . I am new to Unreal Engine and any help would be greatly appreciated. Ideally I would like to have it mapped to a sky sphere with the image on the sky sphere changing based on the "point" the user clicks on however I am not sure how I could go about this.


texts:
Do any games use the GPU for more game tasks than just rendering, as a way to reduce the game's load on the CPU?  I'm most interested in games which use either Valve's Source engine or the UDK.

Is it possible/effective to even do such a thing?


texts: Animations not working on custom actor in LibGDX

texts:
I have this code for rendering a sprite, retrieved from a TextureAtlas

public class SpriteActor extends Actor {
private Sprite sprite;

public SpriteActor(TextureAtlas atlas, String spriteName) {
    sprite = atlas.createSprite(spriteName);
    this.setWidth(sprite.getWidth());
    this.setHeight(sprite.getHeight());
    this.setBounds(0, 0, this.getWidth(), this.getHeight());
}

@Override
public void act(float delta) {
    sprite.setPosition(this.getX(), this.getY());
    sprite.setOrigin(this.getOriginX(), this.getOriginY());
    sprite.setRotation(this.getRotation());
    sprite.setScale(this.getScaleX(), this.getScaleY());
}

@Override
public void draw(SpriteBatch batch, float parentAlpha) {
    Color color = new Color(this.getColor().r, this.getColor().g,
            this.getColor().b, this.getColor().a * parentAlpha);

    batch.setColor(color);
    sprite.setColor(color);

    sprite.draw(batch);

}

}

EDIT: Using actions with a Image actor in the same stage works, It's only my actor that doesn't

When I set the transparency like this : actor.setColor(1, 1, 1, 0.5f);
I can see the sprite becoming half transparent; or, if I set the position manually (actor.setPosition(0, 30);) I see the sprite to the correct position; but if I try to use actions (import static com.badlogic.gdx.scenes.scene2d.actions.Actions.*; [...] actor.addAction(fadeIn(3) or actor.addAction(forever(rotateBy(45), delay(1))) they just do nothing.

Do I need to implement something to have predefined actions working on my code? Or what do I need to make this code work?