texts: How to store the state of the world for a fixed time step?

texts:
Most of the posts on fixed time steps say something like this:

State previous;
State current;

while ( !quit )
{
     double newTime = time();
     double frameTime = newTime - currentTime;
     if ( frameTime > 0.25 )
          frameTime = 0.25;   // note: max frame time to avoid spiral of death
     currentTime = newTime;

     accumulator += frameTime;

     while ( accumulator >= dt )
     {
          previousState = currentState;
          integrate( currentState, t, dt );
          t += dt;
          accumulator -= dt;
     }

     const double alpha = accumulator / dt;

     State state = currentState*alpha + previousState * ( 1.0 - alpha );

     render( state );

How do they calculate and save a State snapshot of the whole world?  do they just make memcpy's or something?  I'm working in Flash and don't have that kind of cloning capability.


texts:
I have Photoshop CS6 (I haven't installed it yet), and I was wondering if there was a good book or tutorial on how to get started on making my own video game textures.

SIDENOTE: I saw a question on this, but it was outdated and from 2011.


texts: Inverting matrix then decomposing gives different quaternion than decomposing then inverting the quat

texts:
I'm getting different signs when I convert a matrix to quaternion and invert that, versus when I invert a matrix and then get the quaternion from it:

Quaternion a = Quaternion.Invert(getRotation(m));
Quaternion b = getRotation(Matrix.Invert(m));

I would expect a and b to be identical (or inverses of each other). However, it looks like q1 = (x, y, -z, -w) while q2 = (-x, -y, w, z). In other words, the Z and W components have been switched for some reason.

Note: getRotation() decomposes the transform matrix and returns just the rotation part of it (I've tried normalizing the result; it does nothing). The matrix m is a complete transform matrix and contains a translation (and possibly a scale) as well as a rotation. I'm using D3DXMatrixDecompose to do the actual decomposition.


texts: Passing an UAV to a Pixel Shader in DirectX11

texts:
I have a compute shader which task is to take an input image and then blur it using a Gaussian filter approach. The input and output for the compute shader looks like this:

//Input and output resources
Texture2D<float4> InputMap : register(t0);
RWTexture2D<float4> OutputMap : register(u0);

The necessary steps for the compute shader setup is shown below:

//Load SRV with the image first
DX::ThrowIfFailed(CreateWICTextureFromFileEx(D3DHelper::GetDevice(), L"Images/floor.jpg", 0, D3D11_USAGE_DEFAULT, D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_SHADER_RESOURCE,
        0, 0, 0, m_resource.GetAddressOf(), m_blurTexture.GetAddressOf()));

//Create UAV
D3D11_UNORDERED_ACCESS_VIEW_DESC descView;
memset(&descView, 0, sizeof(descView));
descView.Format = DXGI_FORMAT_UNKNOWN;
descView.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2D;
descView.Texture2D.MipSlice = 0;

DX::ThrowIfFailed(D3DHelper::GetDevice()->CreateUnorderedAccessView(m_resource.Get(), &descView, m_UAV.GetAddressOf()));

//Blur image with compute shader
Shader::SetComputeShader("Blur", m_blurTexture, m_UAV, 16, 16, 1);
Shader::UnbindComputeShader();

Now if we imagine that the work of the compute shader is done correctly, the last step would then be to bind the SRV/UAV containing the blurred image to the pixel shader stage for the object which will use the texture. However, this texture seems to end up completely black after the compute shader pass if I do the following binding:

D3DHelper::GetDeviceContext()->PSSetShaderResources(0, 1, m_blurTexture.GetAddressOf());

I believe there are a few more steps missing since I need to get the data from the UAV and not the SRV since the UAV contains the output image. What would be the correct approach?


texts:
A common problem in Unity - my OnMouseUpAsButton() is not being called, and I do not understand why. I have attached box collider 2d (though its size is set up during runtime, but by the time I click on it it has proper size and covers the whole button). My object is an UI element, created from prefab during runtime. Here you can see its inspector info:

Code:

using UnityEngine;
using System.Collections;

public class button_controller : MonoBehaviour {
void OnMouseUpAsButton()
{
    Debug.Log("Clicked event button");
    switch(click_action){
        case action.NONE:
            action_none();
            break;
    }
}

I tried going through other threads where people had similar problems but nothing seems to work. Any ideas what might be happening?

EDIT: I found out that if I add a new button , directly from the inspector to the canvas, whose collider is within the canvas all other buttons start working. Interestingly I cannot put this new button anywhere, it has to be at least a bit within the canvas


texts: How do I programmatically animate a .obj model?

texts:
I am developing on Qt, I have tried translate and rotate an .obj model.

I would like to know is there any possibility to do programmatically animate in Qt.


texts: Relative vertical alignment of 3 Texts on Canvas

texts:
This is a menu that appears if I press Enter on the RE4 inventory if an item is selected. I have drawn a thin red rectangle around it:

And here is a video that shows some of the menu's effects.

I am familiar with a simple text canvas.
I understand that I need to make each line a separate "Text" object so that I can scroll up and down through them.

Here is what I have so far:

The problem that I'm facing now is that the Canvas will be scaled at runtime.
I don't work with fixed values.
This is a problem since I don't see how I could easily make it so that each TextLine object fills 33,3% of the canvas.

Am I right to assume that I can only solve this by making a scripts that holds a reference to each TextLine object and which then calculates their position when the scale of Canvas is known?

Or is there any easier solution?

Thank you!


texts:
I have some height-map sampled on a regular grid stored in an array. Now, I want to use the normals on the sampled vertices for some smoothing algorithm. The way I'm currently doing it is as follows:

For each vertex, generate triangles to all it's neighbours. This results in eight neighbours when using the 1-neighbourhood for all vertices except at the borders.

 +---+---+
 ¦ \ ¦ / ¦
 +---o---+
 ¦ / ¦ \ ¦
 +---+---+

For each adjacent triangle, calculate it's normal by taking the cross product between the two distances.
As the triangles all have the same size when projected on the xy-plane, I simply average over all eight normals then and store it for this vertex.

However, as my data grows larger, this approach takes too much time and I would prefer doing it on the GPU in a shader code. Is there an easy method, maybe if I could store my height-map as a texture?


texts: How can this kind of entity/component organization improve cache efficiency?

texts:
I've been reading up about entity component systems as a design pattern for an OpenGL engine. The style I'm trying to implement has entities only being integers, and components being long contiguous arrays of, for example glm::vec3 for a world-position component.

The entity integers then work as indices into those arrays. All of this described best by this post.

As I understand, the main benefits of an ECS would include:

Simplification and elimination of unnecessary dependencies and spaghetti code
Performance boost: contiguous component arrays translate into fewer cache misses and an overall de-bloating of complex inheritance

While I do agree with the first point, I don't understand how the second could be true.

On a regular draw call, you'd need almost always the majority of components. You need position, scale, rotate for loading a MVP matrix into the shaders. You need the mesh and textures for rendering itself. You even need details like light color or whether or not it casts shadows. Everything! This means that you will inevitably encounter cache misses in some form, since you can't fit your component arrays in cache.

Add to that the fact that since the entity integers are indices into the component arrays, all of the component arrays need to grow in size whenever you add an entity - independent of it's type. This means that adding 30 entities with no mesh will inevitable generate 30 empty mesh allocations that will never be used.

How would you implement such a system to truly minimize cache misses without incurring in unnecessary memory waste?


texts: What is the standard way to synchronize sound effects with sprite animations?

texts:
Let's take a situation where you have an RPG with spells and each spell animations have a different number of frames and they have very different requirements for sound effects. Let's assume that each spell has only 1 continuous animation associated with it (as opposed to multiple modular pieces that are used to form a full animation) ala the old 16 Bit Final Fantasy games.

The only way I can think of in order to make sure that the sounds and animations sync up is to:

Get the number of frames of an animation.
Get the time between each frame of the animation. (if it's 30 fps then it's 1/30th of a second per frame.)
Then create a sound file that is exactly the same length as the animation.

So this means that if an animation is 5 seconds long, running at 30 fps, with a total of 150 frames, the sound file will also be 5 seconds long. If the animation should have an "impact" sound on the 30th frame, that means the sound file will include the sound of impact at the 1.0 second mark.

At the end, we start the animation and the sound effect at exactly the same time and hope that the frames and the sound sync up.

This sounds like it could pose problems when frames are skipped or something happens during the animation and the sound gets played slightly too soon or too late, and will cause the sound and the animation to go out of synch. Is this the best approach or are there usually a better way that I'm just not seeing?

The answer doesn't necessarily need to be for Cocos2D specifically if it's conceptual, but if there's a specific solution for cocos2d, I'd love to hear it.

EDIT: I just also realize that with this method, if we happen to go in and adjust the number of frames or timing of the animation later, we MUST also go back and change the sound file. This sounds like a terrible cause for human error (forgetting to update sound files after animation change.) I hope there are better methods out there.


texts: How to do (or code) so that an array of Bullet objects can meet with an array of Zombie objects?

texts:
I just started learning game development using Java.

I have created

ArrayList of class Zombie
ArrayList of class Bullet

Each of the object in the two ArrayList has a variable called rect of type Rectangle which surrounds their own graphics on screen.

My aim is to make an effect when any bullet meets any zombie.

My problem is I don't know how to do "any bullet meets any zombie."

My method: I used the rect variable to test whether both of the object have collided with each other by using the method rect.intersect(r). I'm testing every single bullet in the Bullet ArrayList to see if it has collided with any zombie in the Zombie ArrayList, which means I run through the two ArrayList completely per frame just to carry this feature out. There must be better ways..??


texts:
I've made a simple multiplayer game using socket.io, and took a lot of help from YouTube and the Internet on how to do it. However, the tutorials only talk about how to run the server locally, and none of the ones that I followed ever talked about running the server online - and I looked through a lot!

I think that I only need to add my server IP to my Javascript file, and match the socket.io inspector property value with it.

How do I make my offline socket.io server go online?


texts: How can I pass an external instance to the constructor of an object that's being created using the default XNA XML content loader?

texts:
I'm trying to understand how to use the XNA XML content importer to instantiate non-trivial objects that are more than a collection of basic properties (e.g., a class that inherits from DrawableGameObject or GameObject and requires other things to be passed into its constructor).

Is it possible to pass existing external instances (e.g., an instance of the current Game) to the constructor of an object that's being created using the default XNA XML content loader?

For example, imagine that I have the following class, inheriting from DrawableGameComponent:

public class Character : DrawableGameComponent
{
  public string Name { get; set; }

  public Character(Game game) : base(game) { }

  public override void Update(GameTime gameTime) { }
  public override void Draw(GameTime gameTime) { }
}

If I had a simple class that did not need other parameters in its constructor (i.e., the Game instance), then I could simply use this XML:

<XnaContent>
  <Asset Type="MyNamespace.Character">
    <Name>John Doe</Name>
  </Asset>
</XnaContent>

...and then create an instance of Character using this code:

var character = Content.Load<Character>("MyXmlAssetName");

But that won't work because I need to pass the need to pass the Game into the constructor.

What's the best way to handle this situation? Is there a way to pass in things like the current Game using the default XNA XML content loader? Do I need to write my own XML loader? (If so, how?) Is there a better object-oriented design that I should be using for my classes?

Note: Although I used Game in this example, I'm really just asking how to pass any type of existing instance to my constructors. (For example, I'm using the Farseer Physics Engine, and some of my classes also need a reference to the Farseer World object too.)

Thanks in advance.


texts: What early design decisions are important for creating "performant" multiplayer games?

texts:
I want to create online games and focus on the performance from the beginning.

I searched on the internet, but didn't find any an particular answer concerning the design level or development level aspect, such as

Design Patterns,
Protocols,
Techniques,
Data transfer(games state) ,
Formats(JSON/serialization)

;

which are crucial to create high performance online games can most of the articles are talking about hardware consideration,  but you know that is not what I am looking for.


texts: A* Pathfiding movement is not stopping and constant

texts:
I'm trying to make my player move towards mouse click using A* Pathfinding but I'm having some odd issues that I can't solve.
One of the issues is that player is moving a little bit even though it arrives at the position of the other transform

The second one is that the force is that is applied to the player is not constant, I would like it to keep always the same movement speed. I've tried to change to use transform.Translate to move the player with constant movement speed but it makes the movement to be like walk a little then stop, walk a little then stop...

This is the code that I'm using
using System;
using System.Collections;
using System.Collections.Generic;
using Pathfinding;
using UnityEngine;
using UnityEngine.UI;

public class Player : MonoBehaviour
{

    [SerializeField] private float speed = 100;
    [SerializeField] private Text lifeText;
    [SerializeField] private int life;
    [SerializeField] private GameObject target;
    [SerializeField] private float nextWaypointDistance = 3f;

    //AI configurations
    private Path path;
    private Rigidbody2D rigidbody;
    private Seeker seeker;
    private int currentWaypoint = 0;
    private bool reachedEndOfPath = false;

    // Start is called before the first frame update
    void Start()
    {
        seeker = GetComponent<Seeker>();
        rigidbody = GetComponent<Rigidbody2D>();

        InvokeRepeating("UpdatePath", 0f, .2f);
    }

    // Update is called once per frame
    void Update()
    {
        lifeText.text = "Vida: " + life.ToString();

        if (Input.GetMouseButtonDown(1)) //right click
        {
            Vector2 mousePos = Input.mousePosition;
            Vector2 worldPos = Camera.main.ScreenToWorldPoint(mousePos);
            target.transform.position = worldPos;
        }
    }

    private void UpdatePath()
    {
        if (seeker.IsDone())
            seeker.StartPath(rigidbody.position, target.transform.position, OnPathComplete);
    }

    void FixedUpdate()
    {
        if (path == null) return;

        if (currentWaypoint >= path.vectorPath.Count)
        {
            reachedEndOfPath = true;
            return;
        }
        else
        {
            reachedEndOfPath = false;
        }

        Vector3 direction = (path.vectorPath[currentWaypoint] - (Vector3)rigidbody.position).normalized;

        Vector3 force = direction * speed * Time.deltaTime;

        rigidbody.AddForce(force);

        float distance = Vector2.Distance(rigidbody.position, path.vectorPath[currentWaypoint]);

        if (distance < nextWaypointDistance)
        {
            currentWaypoint++;
        }
    }

    private void OnPathComplete(Path p)
    {
        if (!p.error)
        {
            path = p;
            currentWaypoint = 0;
        }
    }

}

What I want to is to make the movement smoother and with constant movement speed.
Can you guys help me?


texts: How do I use Unity's OnPlayerConnected method?

texts:
https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnPlayerConnected.html

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

public class SendData : MonoBehaviour {

    void OnPlayerConnected (NetworkPlayer player) {
        Debug.Log ("A player connected!");
    }

}

This code, surprisingly, doesn't work!

Expected: The server prints "A player connected!" in the Unity editor debug console.

What happens: Nothing is printed. It doesn't matter if I use print() or Debug.Log().

This script is applied to a standard object in the scene. It has a NetworkIdentity.

I really don't know what else to try. The Unity documentation is very short and gives an example very similar to this. My code should be even simpler than Unity's example but it doesn't work.


texts: How can I Implement spin in billiard game?

texts:
I'm not sure that you played billiard or snooker before.if you played you should know about spin.
but anyway if you don't know about it you can see it in this video

I want to Implement spin like this game

for example difference between Top spin and Back spin is:

Top spin

Back spin

Spin behaviour

if you aim behind the ball you can shoot the ball in all direction

if you aim closest to right you can just aim the right

if you aim closest to left you can just aim the left

I found a same Issue that used Torque in stackoverflow but I don't know why didn't work!

Top Spin

GetComponent<Rigidbody>().AddTorque(Vector3.back * cueStrength );
GetComponent<Rigidbody>().AddForceAtPosition(cueStick.forward * cueStrength,transform.position,ForceMode.Acceleration);

Back Spin

GetComponent<Rigidbody>().AddTorque(Vector3.forward * cueStrength );
GetComponent<Rigidbody>().AddForceAtPosition(cueStick.forward * cueStrength,transform.position,ForceMode.Acceleration);

I noticed that flyordie's snooker didn't use AddTorque.so I don't need answer that Implemented with AddTorque.

Update

What I tried

I add joystick to select spin angle

then I apply spin force ( It seems my spin works but sometimes didn't work that I attached video in end of my question).

this is my code:

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

public class MainBall : MonoBehaviour {

    private Vector3 FirstPos; // store first position as reset position
    public Transform SpinRoator; // spin rotator cylinder that show spin angle
    private Rigidbody rigidbody;
    public bool SpinUsed; // spin should use once
    private float v2;

    private void Start() {
        rigidbody = GetComponent<Rigidbody>();
        FirstPos = transform.position;
    }

    //After goal reset ball position
    public void ResetPos(){
        rigidbody.velocity = Vector3.zero;
        rigidbody.angularVelocity = Vector3.zero;
        transform.position = FirstPos;

    }

    void SpinForce(){
        SpinUsed = true;
        float F = ComebackForce(); // calculate comeback force
        StopBall(); // stop ball
        rigidbody.AddForce(SpinRoator.forward*F);// apply spin force
    }

    // calculating return force after hitting f = m.a
    float ComebackForce(){
        var m = rigidbody.mass;
    var v1 = rigidbody.velocity.magnitude;

    var a = (v1 - v2) / Time.deltaTime;
        var F = m * a;
        v2 = rigidbody.velocity.magnitude;
        return F;
    }

    //stop ball
    public void StopBall(){
      rigidbody.velocity = Vector3.zero;
        rigidbody.angularVelocity = Vector3.zero;
    }

private void OnCollisionEnter(Collision other) {
    if(other.collider.tag == "Ball" || other.collider.tag == "ColorfulBall"){
    if(!SpinUsed){
    SpinForce();
    }
    }
}
}

but What is Problem?!

It seems works correctly but My Problem is sometimes Spin don't work correctly you can see this video that demonstrate this problem.my ball goes wrong direction of spin!!!

1.Ball goes Wrong sometimes

as you can see in above gif ball goes wrong direction!!! ball should go along yellow cylinder but I don't know what is problem of my code!!!

1.Ball goes slow sometimes

another problem is comeback force is slow sometimes!!!
I calculate comeback force F = m.a but why is it slow?!


texts: Black screen after running emulation mode in the Unity Editor for hololens

texts:
I am having issues with black screen when running the emulation mode or simulator for Microsoft hololens. In the preview the camera shows what the user should see. I see no obvious reason to behave like this and no error/warning is given. I am using code snippets from the Origami tutorial,except I chose to use RayCastNonAlloc.

Movement.cs
           public class Movement : MonoBehaviour {
        public GameObject person;
        public float seconds;
    private Vector3 point = new Vector3(0,0,0);
    private RaycastHit[] rayHit = new RaycastHit[5];

void OnSelect()
{
    person.transform.position = Vector3.Lerp(person.transform.position, point, seconds * Time.deltaTime);
}

// Update is called once per frame
void Update()
{
    if (Physics.RaycastNonAlloc(Camera.main.transform.position, Camera.main.transform.forward, rayHit, Mathf.Infinity, ~0) > 0)
    {

        foreach (RaycastHit hit in rayHit)
        {

            point.x = Mathf.Clamp(hit.point.x, -290f, 6970f);
            point.y = Mathf.Clamp(hit.point.y, -40f, 1860f);
            point.z = Mathf.Clamp(hit.point.z, -1700f, 140f);
        }
    }

}
}`

Scene.cs

   using UnityEngine; using UnityEngine.XR.WSA.Input; public class Scene : MonoBehaviour

{

public GameObject cursor;
public GameObject Focused { get; private set; }
public Scene Instance { get; private set; }

private GestureRecognizer recognizer;
private MeshRenderer Renderer;
private readonly RaycastHit[] rayHit = new RaycastHit[5];

void Awake()
{
    Instance = this;
    recognizer = new GestureRecognizer();
    recognizer.Tapped += (args) =>
    {
        if (Focused != null)
        {
            Focused.SendMessageUpwards("OnSelect", SendMessageOptions.DontRequireReceiver);
        }

    };
    recognizer.StartCapturingGestures();
    Renderer = cursor.GetComponent<MeshRenderer>();
}

void Update()
{
    GameObject oldFocused = Focused;

    if (Physics.RaycastNonAlloc(Camera.main.transform.position,Camera.main.transform.forward,rayHit,Mathf.Infinity,~0)>0)
    {
        Renderer.enabled = true;
        foreach ( RaycastHit hit in rayHit)
        {

            cursor.transform.position = hit.point;
            cursor.transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);
            Focused = hit.collider.gameObject;
        }
    }

    else
    {
        Focused = null;
        Renderer.enabled = false;
    }
    if (Focused != oldFocused)
    {
        recognizer.CancelGestures();
        recognizer.StartCapturingGestures();
    }
}

}


texts: How to create JSON file in notepad that will hold my positional vector3 data for one type of object

texts:
I'm trying to get my head around using JSON files to store level data . Specifically in this example is to make my walls. (its a top-down game like pacman). Each wall prefab is a 1x1x1 cube. I just want the JSON to hold the x,y,z. I have seen tutorials about how best to deserialise the data into Unity and I think im fine doing that, but I am unsure of how exactly to word the JSON file.

I see the example on Unity docs says the format is like this:

{"level":1,"timeElapsed":47.5,"playerName":"Dr Charles Francis"}

so, I could just do something like:

{"index":0,"x":5,"y":1,"z":0}

but I know that there needs to be a bit above, similar to XML and of this im clueless of what it needs to contain.

I looked on Json.org but i didnt really understand it still. This is one example:

{
"glossary": {
    "title": "example glossary",
    "GlossDiv": {
        "title": "S",
        "GlossList": {
            "GlossEntry": {
                "ID": "SGML",
                "SortAs": "SGML",
                "GlossTerm": "Standard Generalized Markup Language",
                "Acronym": "SGML",
                "Abbrev": "ISO 8879:1986",
                "GlossDef": {
                    "para": "A meta-markup language, used to create markup languages such as DocBook.",
                    "GlossSeeAlso": ["GML", "XML"]
                },
                "GlossSee": "markup"
            }
        }
    }
}

}

But what is 'Glossary' and 'title' in the context of my game? All I currently have is a cube called Wall, with a script attached called Wall.cs that currently does nothing, but I will be making an array of Wall and plan on using the deserialised data from the json file to lay the Walls[] out using my GameController.cs

Once  I know what to put above and below to open and close the JSON file off, im pretty sure I can get it working how I need it to. I hope that made some sense.


texts:
So, for the past couple of weeks, I've been working on a falling sand simulation inspired by games such as The Powder Toy, Noita, and Sandspiel. I've been making it in Love2D and I'm please with what I got so far. The simulation can handle 59k particles at 60FPS however pretty much anything over that amount will cause the FPS to plummet so I've been thinking of other ways to optimize it.

The way my simulation works is that I have a large table that contains numbers. These numbers refer to an index inside a table which contains particle data. The particle data is structured as:

Name, Color(table containing 4 values, r,g,b,a), Update logic function, Color variation modifier (0 = no color variation between particles)

I've got the options for optimization narrowed down to a pretty small list:

Spatialhashing/Quadtree - splitting the screen into a grid and only updating cells with particles in it
GPU simulation - Moving simulation logic to the GPU
Multithreading - Moving simulation logic to separate CPU threads

The downsides of all of these are as follow:

Spatialhashing/Quadtree - There are no unique identifiers for the particles themselves as they're only stored in the table as the index for their data so it's hard to have a reference that can be added/removed when needed
GPU simulation - I'm not good with shader code and there are no good ways to do GPU code in Love2D that's purely computational.
Multithreading - Similar to GPU simulation, I'm not knowledgable when it comes to multithreading nor do I have any idea of how to parallelize my simulation code.

Some information about how to multithread a falling sand physics simulation comes from the devs of Noita, where they split the world into chunks and updated each on a different thread in a checkerboard pattern (to make ensure that pixels weren't being updated by multiple threads at the same time). They also had 'dirty rects' which showed which particles needed updating which is similar to spatial hashing.

However, the talk the noita dev did just showed what they did, rather than how they did it. Since I lack a lot of knowledge in these fields, I don't really have much to go on for implementing them.

My code is open source and viewable on github. You'll need the latest version of Love2D to run it:

https://github.com/BradBath/Sand (either drag the Sand-master folder on the love2D executable or open the folder in VSCode and use the Love2D plugin to run it via LALT+L)

If anyone has any ideas I could implement some of these optimizations, or has any other ideas for optimization, I'd love to hear them. Thanks!

Here's a gif of my simulation at its current point


texts:
given a set of vertices and triangles for each mesh. Does anyone know of an algorithm, or a place to start looking( I tried google first but haven't found a good place to get started) to perform boolean operations on said meshes and get a set of vertices and triangle for the resulting mesh? Of particular interest are subtraction and union.

Example pictures: http://www.rhino3d.com/4/help/Commands/Booleans.htm


texts:
Could you please list a few free 3d OOP game engines, along with the pros and cons?
Embeddable in VB.net would be great.


texts: Calculate gears rotation for a realtime simulation

texts:
I'm trying to do a game with real time simulations of gears. There is a big Gear with inside a smaller gear.
I managed to draw gears with different diameters but equal size teeth, but if i try to move the smaller one inside the bigger one the movement is odd.
See the animated gif:

The biggest gear is in center C1 and the small in the center C2. I calculate C2 position in this way:
C2.x = C1.x + C1_RADIUS-C2_RADIUS) * cos(t);
C2.y = C1.y - C1_RADIUS-C2_RADIUS) * sin(t);

for t that goes from 0 to TWO_PI in n steps.
I apply as rotation the angle t, but maybe it is wrong and i have to calculate another rotation for get a perfect joint.
EDIT:
I am using radians for rotations and I think this is OK.
My main problem is that I want to achieve a perfect joint between teeth like this example. My teeth are overlapping in some odd way.
EDIT
a working example can be found here: http://www.openprocessing.org/sketch/83665


texts: Unity game in edit the scene mode all of a sudden became incredibly slow/"laggy"

texts:
So I recently have been working on a game. So far I have very few assets in the game, which are a point light, a piece of terrain (which is textured), a player controller and a tree. Everything was going well until I put the tree in the scene. I made  tree and started to add some branches I got to about 8 branches, and then I added 35 leafs. Then the edit scene started to become laggy.
When I played the game it was running perfectly. But as soon as I changed the scene back to edit mode it became laggy again. I then deleted the tree to see if that would solve the problem but it seems to have done nothing at all. I would really appreciate if someone could explain why the edit scene is becoming laggy even though there are only a few assets within the game.

Thanks, Nova


texts:
I'm trying to reproduce several sounds in a game I'm developing in AS3.

The game is like a TD game, and when I got 10+ of the same tower firing at the same time, I hear a horrible: "PRRRRRRRRRRRRRRRRRRRRRR"...

How should I manage this problem?  How do PC games (specially RTS ones) manage this in order to hear something decent instead of an obvious and horrible loop?


texts:
I know what one of the big commonalities I see in ECS projects is that there is a main game loop that iterates through systems and calls their respective update methods (for example, RenderSystem).

I'm a bit stumped on how this applies to an event-based game where the client sends packets of information and you update from there. For example:

MovementPacket

Read incoming movement packet and send to appropriate packet handler, which makes changes to appropriate components regarding entity through systems.
Packets are then sent back through the systems (which work with components to access the data needed to write these packets).

Now, I'm not sure where a game loop really comes in here, since everything seems to be event-based. I'm scared that most of the work I'm doing ultimately for ECS just isn't being done right. My systems are typically becoming "containers that do logic and stuff, but don't operate within a game loop."

In fact, the game itself doesn't have a game loop, since we haven't really found an area to insert it in.

Is the approach just wrong? Is my approach towards interweaving ECS with this packet-based game for the most part incorrect?


texts: Networking to make a single player RPG into multiplayer

texts:
I’ve written a few games in Xcode before and would like to turn one into the simplest possible 2D top-down RPG multiplayer game. Essentially just needing movements around a big tiled map (I love drawing), and chat.
Keen to just host my own server on the iMac I use, with python and twisted framework (new to this but happy to take the time to learn). I’m thinking TCP for chat and UDP for tracking movements but do they need to be on separate servers?
Also for games like this I know there isn’t much on the client side. All my map drawing and game logic is set up in Xcode, which I would prefer to keep working in because I’m familiar with the language and love the sprite kits and tile maps. Do I have to redo it all in python on the server side for scaling in the future? Or for cross platform?
I've done lots of research and found plenty of tutorials, just want to know I’m on the right track. I’m not looking to make a WoW killer just something simple I can gradually build on for fun


texts:
I'm currently working on a ray-casting engine in Java and I can't figure out what's wrong with my code.

For the learning and theory I use:

The permadi tutorial: ( https://permadi.com/1996/05/ray-casting-tutorial-12/ )
When I started having problems with floor-casting I found this: ( https://www.allegro.cc/forums/thread/374305 )

I was happy becaues my implementation was 90% the same as the second code snippet on the linked Allegro.cc page. I added the x and y calculation to my code and I tried, but it didn't work. I tried exactly the same solution from the page but it didn't work.

The interesting fact that my code seems to "work" sometimes and sometimes not.

Furthermore, if I start walking then the floor moves to the wrong direction, sometimes backward for example.

In the beginning of implementing the engine I used the example code from the permadi tutorial too to correct my misunderstandings and so and it worked out well so far.

In this implementation 60° = planewidth. Every other degree is based upon this. Even the toRad function uses ANGLE180 (planeWidth*3) for the calculation.

I think I may not understand something in the math or I don't know, I just couldn't find where the error is.

I looked for the solution on other sites as well but it didn't help.

(Sorry if my english was bad.)

int x,y;
double floorPointDistance;
for(int i = floorCastingStartPixel; i < planeHeight; i++) {
floorPointDistance = ( ( PLAYERHEIGHT * playerPaneDist ) / ( (planeHeight>>1) - i ) ) / (Math.sin(((double)toRad(angle+rayAngle))));

// almost good
x = (int) Math.abs( (-floorPointDistance * sinTable[rayAngle]) + (playerX) ) % 64;
y = (int) Math.abs( (floorPointDistance * cosTable[rayAngle]) + (playerY) ) % 64;

screenBuffer.setRGB(raysCasted, i, Texture.floor.texture.getRGB(x,y));
}

Something very strange is happenning here:

But now it seems to be fine...mostly:

UPDATE

Success!!!!

I just "ruin" the equations a little bit and it's got better.
I corrected the wrong floor-move direction by removing the "-" from the x equation. And I noticed the floor was very rotated, rotated into each other (you can see that "anomaly" in the previous pictures), I removed the cos part from the distance formula and it's got better.

int floorCastingStartPixel = planeHeight>>1;
int x,y;
for (int i=floorCastingStartPixel; i<=planeHeight-1; i++) {
distance = (float) (((float)PLAYERHEIGHT / (i-(planeHeight>>1)) )* playerPaneDist );

x = ( (int) (distance * (cosTable[rayAngle])) ) + playerX;
y = ( (int) (distance * (sinTable[rayAngle])) ) + playerY;

screenBuffer.setRGB(raysCasted, i, addFogEffect(Texture.floor.texture.getRGB(x&63,y&63),distance));
}

The current state:

I did the ceil-casting by "reversing" the for loop (loop variable = 0 and incrementing till it's planeHeight>>1).

UPDATE #2

I just realized that my ceiling don't move correctly...not always.

UPDATE #3

Tried other texture, now seems to move ok, so it could have been just seom optical effect.

And...I noticed thath the floor and ceiling has a little hyperbolic(?) curve. And I just realized that it's like the fisheye-effect.

You have to do fish-eye correction on the floor and ceil distance too!!!!


texts: Is it legal to use a generic celebrity names in a card game?

texts:
Before tagging this as a duplicate to
Legality of using names in a game?, please be aware that it is a more special case than that generic question

So I am working on a card game similar to Cards Against Humanity, where some cards would have celebrities names, the case I am interested in is if the celebrity name is too generic that they can't really claim that this name can only be them, specially there is no context where their field of famous is referred to to confirm the identity.

Example

Lady Gaga - no one can argue that this name doesn't refer to the known celebrity.

But

Will Smith - is too generic, searching linkedin or facebook you will find thousands of people called Will Smith.

I guess if the card says the actor Will Smith then that is different.

Am I wrong in this assumption?


texts:
Let say I have this diagram,

Given that i have all the co-ordinates of outer polygon and the distance between inner and outer polygon is d is also given. How to calculate the inner polygon co-ordinates?
Edit:
I was able to solved the issue by getting the mid-points of all lines. From these mid-points I can move d distance, So I can get three points. No I have 3 points and 3 slopes. From this, I can get three new equations. Simultaneously, solving the equation get the 3 points.


texts:
So in games where there are textboxes with different sizes appearing, how does one actually render them efficiently? Games like Final Fantasy IX have dynamically sized speechbubbles for example, each with a size so it exactly matches the rendered text.

I know the basic idea is to render the frame around the bounding box of the text and with different images for each component of a box: corners, edges, center. Though how should one design that rendering if the edges aren't of 1 pixel in size when one has to compute how often an edge piece needs to be drawn next to each other to form the whole edge of the box.

Here is my naive implementation of a hopefully good enough abstracted method:

public void drawBox(Renderer renderer, int x, int y, int width, int height){
    int es = this.components.getEdgeSize();
    renderer.renderSprite(this.components.getTopLeftCorner(), x, y);
    /* Render top edge of box */
    int i;
    for(i = es; i < width - es; i += this.components.getTop().getWidth()){
        renderer.renderSprite(this.components.getTop(), x + i, y);
    }
    renderer.renderSprite(this.components.getTopRightCorner(), x + i, y);
    /* Render left edge of box */
    int j;
    for(j = es; j < height - es; j += this.components.getLeft().getHeight()){
        renderer.renderSprite(this.components.getLeft(), x, y + j);
    }
    renderer.renderSprite(this.components.getBottomLeftCorner(), x, y + j);
    /*Render bottom edge of box */
    for(i = es; i < width - es; i += this.components.getBottom().getWidth()){
        renderer.renderSprite(this.components.getBottom(), x + i, y + j);
    }
    renderer.renderSprite(this.components.getBottomRightCorner(), x + i, y + j);
    /*Render right edge of box */
    for(j = es; j < height - es; j += this.components.getRight().getHeight()){
        renderer.renderSprite(this.components.getLeft(), x + i, y + j);
    }
    int k = i;
    int l = j;
    for(i = es; i < k; i+= this.components.getCenter().getWidth()){
        for(j = es; j < l; j += this.components.getCenter().getHeight()){
            renderer.renderSprite(this.components.getCenter(), x + i, y + j);
        }
    }
}

I feel that some loops did not have to be done and the loop filling the center feels like it could potentially kill the framerate.


texts:
I'm trying to track playing position every 500ms which i can do but i need it to populate an array which i save to a txt file as a comma delimted list or something.

I have this code so far (which incorporates the player movement code too), which displays the positions in the console:

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

public class CharacterControllerT : MonoBehaviour {

    public float speed = 10.0f;
    public Read_moveT ReadMove;
    [SerializeField] private float _duration = 0.5f;
    private float _timer = 0f;
    public Vector3 PlayerPosT;
    GameObject Mover;
    public Vector3[] PlayerTxyz;

    // Use this for initialization
    void Start () {
        Cursor.lockState = CursorLockMode.Locked;
        Mover = GameObject.Find ("PlayerT");
        ReadMove = Mover.GetComponent<Read_moveT> ();
    }

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

        if (!Input.GetButton ("DoorTrigger")) {
            ReadMove.mUP = Input.GetAxis ("Vertical");
            ReadMove.mLEFT = Input.GetAxis ("Horizontal");
            float translation = ReadMove.mUP * speed;
            float straffe = ReadMove.mLEFT * speed;

            translation *= Time.deltaTime;
            straffe *= Time.deltaTime;

            transform.Translate (straffe, 0, translation);
        }

        if (Input.GetKeyDown ("escape")) {
            Cursor.lockState = CursorLockMode.None;
        }

        _timer += Time.deltaTime;
        if (_timer >= _duration) {
            _timer = 0f;
            PlayerPosT = Mover.transform.position;
            print ("Player:: X: " + PlayerPosT.x + ", Z: " + PlayerPosT.z);
        }
    }
}

I just need these coords to be saved into an array that i can process when the game is over. The problem being that the array will always be (until game over) of undetermined length.

Any ideas?

Thanks,

Paul..


texts:
I just install Flash Player 11 and SDK 4.5 (hero), and test it with a small program. But I find it is still using "software" to simulate 3D API, and

trace("driver info: " + _context3D.driverInfo);

output

driver info: Software

I'm using windows 7, directX works properly, and option "-swf-version 13 -use-gpu" is already added in compiler arguments.

Who can tell me how to enable GPU in Flash Builder?

UPDATE:

context3d is constructed as :

private var _context3D:Context3D;
...
_context3D = stage3D.context3D;

And wmode is set to direct in html.


texts:
Problem
i want to implement a pause state and with a simple conditional inside the update of PlayState is very very simple.
However i think that the pause has to be another state in the StateMachine so i dont know how to call that PauseState and then resume the Play State without calling the init again, i mean, i dont want to start the PlayState from zero
Code
Main
 gStateMachine = StateMachine {
        ['title'] = function() return TitleScreenState() end,
        ['countdown'] = function() return CountdownState() end,
        ['play'] = function() return PlayState() end,
        ['score'] = function() return ScoreState() end,
        ['pause'] = function() return PauseState() end,
    }
    gStateMachine:change('title')

StateMachine
function StateMachine:init(states)
    self.empty = {
        render = function() end,
        update = function() end,
        enter = function() end,
        exit = function() end
    }
    self.states = states or {} -- [name] -> [function that returns states]
    self.current = self.empty
end

function StateMachine:change(stateName, enterParams)
    assert(self.states[stateName]) -- state must exist!
    self.current:exit()
    self.current = self.states[stateName]()
    self.current:enter(enterParams)
end

PlaysState
 if love.keyboard.wasPressed('p') then
        self.paused = not self.paused //Here i pause the game
    end

Resume
Basically I want to make it more pro, and I understand that the correct way to do it according to the design patterns of video games is to incorporate a GameState that is PauseState.
My problem as I was telling you before is that when I make a change state from PlayState to PauseState, and then return to PlayState, the PlayState:init is called again, and I simply want its update not to be called and then resume correctly.
What I want to do is correct ?, Is there any way to do it right ?, I imagine something like stacking the States then Push and Pull them, but I do not know if it is correct


texts:
I am trying to implement a dynamic shadow system for a 2d game using this tutorial :

http://www.gamedev.net/page/reference/index.html/_/technical/graphics-programming-and-theory/dynamic-2d-soft-shadows-r2032

but I am stuck at the point where I need to determine which face is front facing or back facing the light source.

Is there a simple technique to apply in order to find out which face is in front and which one is in back?


texts: AndEngine: How to add multiple fixtures into body?

texts: I want to create a custom body which have very random shape like a table. So how to add/combine multiple fixtures into a body?


texts: How can I handle delayed function calls?

texts:
I have objects, and each object has a function pointer that will be assigned a function. When the object is clicked, the assigned function will be called.
I want to have a function do things with delay, meaning it would look something like this:

void function() {
    doSomething();
    wait(1000);     // either 1000 frames, or 1000 miliseconds
    doSomethingElse();
}

I heard threading shouldn't be abused, and main script should all be put in the same thread. There are lots of game engines out there that can handle such functions with a delay in time. My idea was to call the function in a new thread every time.

Is this a bad idea? If it is, how else would I manage to achieve this functionality?

Edit: the website asked to confirm it's not a duplicate question and I think it's not because it's a bit more complicated of an issue, even though it may use a similar solution.


texts: Why are my records duplicated when writing them to a file?


texts:
I'm trying to build a terrain starting from a heightmap. I've already some ideas about the procedure, but I can't even get started. I feel like I have to use a MeshBuider. The problem is that Visual Studio (I'm using the 2008 version) wants an assembly. Effectively on the MSDN there's a line specifying the assembly needed by the MeshBuilder, but I don't know how to import/load it.
Any suggestions?

Thanks in advance :)


texts: Making a character move along a curved slope in a World with gravity

texts:
I have seen this game

 Fancy Pants 2 . And the thing I noticed apart from the physics and beautiful animations is that the character is moving along slopes , even curved slopes. I have little experience in Box2d, but this concept of curved slopes is new to me. It would be a great help to me If somebody enlightened me on this concept and its implementation. Even If the implementation is not in box2d, it is welcome.


texts: How to determine mouse position outside stage, and center the cursor?

texts:
I was wondering if it is possible to have my flash game determine the position of the mouse, even when the cursor is not inside the stage.

My movie clip should move horizontally between x = 100 and 500, using mouseX for movement:

private var previousX : int;
private var mc : MovieClip;
//...
private function update(e:Event = null):void
{
    var deltaX : int = (mouseX - previousX) / 2;
    mc.x = Math.min(Math.max(mc.x + deltaX, 100), 500);
    previousX = mouseX;
}

The above code works fine, as long as the cursor is above my flash game. When the cursor is outside the stage, mouseX stops updating. I realise that mouseX is probably not what I'm looking for, so I was wondering if there was any other way of finding the cursors position.

I hoped there was a way to set the mouse position directly, so I could center it after every update, so it would almost never be able to leave the frame in the first place. Is that possible?


texts: RAM usage unusually high, but CPU usage relatively low

texts:
I've created a relatively simple game using libgdx, but the RAM usage when I start up the game on my Android device is roughly 600-700 mb, but the CPU usage is only about ~0.05%. I've downloaded a game which seems to use similar components to mine, and its RAM usage is only ~100-200mb.

I use an AssetManager to load all of my assets, which are fair in size (the largest asset I have is probably my main game theme song which is ~3mb; all other graphic assets are ~1-2mb).

Are there any tips for how I can reduce the RAM usage of my game?


texts: How to resize 2D Java game without “squeezing” it?

texts:
I am trying to make my second java game (2D) but i have run in a problem: The game will be in fullscreen, but how can i make it so it is scaled properly for each screen? While researching i found out that (almost) everyone is saying the same thing: render it on a Buffered image first and then render the image on the screen resolution, which i understund how to do ( BufferedImage i = new BufferedImage(width, height, 1); BufferStrategy bs = this.getBufferStrategy();

Graphics2D g2 = i.createGraphics();
if(bs == null){
    this.createBufferStrategy(3);
    return;
}

Graphics g = bs.getDrawGraphics();
//g2.draw....

g.dispose();
bs.show();

) but wont that make everything look squeezed or streched? P.s. if you know any way of making it scale only by keeping the starting resolution (leaving black on both sides) i would accept it

P.s.Sorry for my english.Hope i explained it good enough (if not ask me to clarify)


texts: How to change/modify or animate an existing OpenGL object on Android?

texts:
I maybe know understand it all a little bit better so i thoug i make a new shorter question to eventually get an answer.

Get back or delete an existing OpenGL object, then change it and draw at new. How?

So if and Admin reads this post, he can feel free to delete it.

I'm working on OpenGL since a Week, so i'm new to the most stuff.
(also my englisch isn't the best. Hop you can understand the most anyway)

So i'm working on an Tamagotchi App for a school project and want to make it with OpenGL.
I allready came this far:

But now i want to animate things.
My mind told me that it shoud be possible to change or modify an existing OpenGL object.
In my situation there are 3 opjekts:

Body
Eyes
Mouth

For example her is my code from the mouth:

public class GLMouth {

private int points = 1000;
private float vertices[]={0.0f,0.0f,0.0f};
private FloatBuffer vertBuff;
private FloatBuffer vertBuff2;

public GLMouth(){

    vertices = new float[points * 2];
    for(int i=0; i<= (points+3); i+=3)
    {
      double rad = (Math.PI *i) / points;

      vertices[i]=(float)Math.cos(rad);
      vertices[i+1]=(float)Math.sin(rad);
      vertices[i+2]=0;
    }

    ByteBuffer bBuff=ByteBuffer.allocateDirect(vertices.length*4);
    bBuff.order(ByteOrder.nativeOrder());
    vertBuff=bBuff.asFloatBuffer();
    vertBuff.put(vertices);
    vertBuff.position(0);

    vertices = new float[points * 2];
    for(int i=0; i< (points+3); i+=3)
    {
      double rad = -(Math.PI *i) / points;

      vertices[i]=(float)Math.cos(rad);
      vertices[i+1]=(float)Math.sin(rad);
      vertices[i+2]=0;
    }

    bBuff=ByteBuffer.allocateDirect(vertices.length*4);
    bBuff.order(ByteOrder.nativeOrder());
    vertBuff2=bBuff.asFloatBuffer();
    vertBuff2.put(vertices);
    vertBuff2.position(0);

}

public void draw(GL10 gl){

    gl.glPushMatrix();
    gl.glTranslatef(0.0f, -1.0f, 0.0f);
    gl.glScalef(1.8f, 0.15f, 1.0f);
    gl.glColor4f(0.0f,0.0f,0.0f, 1.0f);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertBuff);
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, points/2);
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glPopMatrix();

    gl.glPushMatrix();
    gl.glTranslatef(0.0f, -1.0f, 0.0f);
    gl.glScalef(1.8f, 1.0f, 1.0f);
    gl.glColor4f(0.0f,0.0f,0.0f, 1.0f);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertBuff2);
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, points/2);
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glPopMatrix();

}

}

In my renderer i just creat a mouth object and then draw it with mouth.draw.

So i thought i have allready drawn the mouth and now i can cange for example the gl.glScalef(1.8f, 0.15f, 1.0f); from that existing mouth to zero with some time in between to let it look like the mouth is closing.

But how can i do that?
I don't find anything with google, mostly because i don't know what i have to look up.
If i understand OpenGL right, than it will just draw new mouths over the original.

edit
Or it is a question about where is the opjekt? Can i save it an take it back (delete it etc) and draw it new with other properties.


texts: Why is "collision" event needed when there is a "trigger" event?

texts:
The "trigger" event in unity is very flexible: it can be set to fire on both dynamic and kinematic bodies, as long as one of them has a collider with the "trigger" flag. On the other hand, the "collision" event is limited to only dymanic bodies.

My question is: why do we need "collision" events at all - why not just always use "trigger" events?

[In other words: why does Unity include these two kinds of events and not just the "trigger"?]


texts: When should I talk to a lawyer about intellectual property for an indie team?

texts: Let's say you have a team building a decent game and all is well technically and people-wise. You feel pretty sure you'll get to a product that can be sold. How does an indie studio (with good practices in this domain) typically manage the IP, esp. trademarking and copyrighting? When's the right time to do this, early or later?


texts: Can Unity 5 or Unreal Engine 4 do computationally identical physics simulation across platforms?

texts:
In order to use certain approaches to multiplayer physics, it requires that the clients calculate exactly the same values for physics simulations. That "exactly" is a very big word here and goes all the way down to the hardware.

Can Unity 5 or Unreal Engine 4 physics engines guarantee numerically exact physics simulations across platforms?


texts: how to convert FoV into zoom 2x, 3x, 4x...?

texts:
so I have the value of the FoV in degrees,
now I need to convert it to a zoom value of 2x, or 3x, for scopes and  binoculars.

I placed some objects equally distanced between each other,
but when I zoom in from FoV 100 to FoV 90, (and I am calling that a 2x zoom), the visible objects in the edges of the reticle are not the ones I expected.
Yes, I am using this big FoV of 100 to 10 just to try to calculate the 2x, 3x value properly.

So I need the ending/maximum FoV to be at 10 degrees.

what happens in the highest zoom levels, from FoV 30 to 10, is that the zooming becomes too high and hard to control, so I wonder if I am calculating it wrong?

I mean, should the FoV steps, to let results of zoom 2x, zoom 3x, be not a fixed value like:
FoV 100 = zoom 1x
FoV 90 = zoom 2x
FoV 80 = zoom 3x
I should instead use some calculation to give me a result something like (or not like):
FoV 100 = zoom 1x
FoV 85 = zoom 2x
FoV 73 = zoom 3x
and what could be such calculation?

or should I use some other rule, like impose some FoV limits and fixed fov values instead of making any calculation?


texts: LibGDX keep camera within bounds of TiledMap

texts:
I have a simple TiledMap which I can render fine. I have a player hopping (with Box2D) around and my camera follows the player around:

cam.position.set(
    player.position().x * Game.PPM + Game.V_WIDTH / 4,
    player.position().y * Game.PPM,
    0
);
cam.update();

However, the camera will move "off" the TiledMap. How could I keep my camera on the TiledMap, so when I near the edges of my map, the camera stops scrolling and the player moves towards the edge of the camera?


texts:
I am using LWJGL libraries to code myself a game. I want to be able to import a project from blender to my game. I have the wavefront .obj reader and it works perfectly for my needs. Although because my model uses multiple images I do not know how to set that up in my game engine. All it does is stretch the first image I send to the shaders across the entire model. Then I ran across a couple videos that makes me doubt that GLSL can support multiple images. Also, I found a couple solutions but they were depreciated because I use LWJGL 3 with slick-util 3 to load the image.

So I would first like to know, does GLSL support rendering multiple images on a single object?

If GLSL can support rendering multiple images on a single object, how would I proceed conceptually to perform this feat?

P.S. Let me know if want images or anything to better understand my question. Thank you all!


texts: What would be the easiest way to keep objects at a constant point on a 2D map, even when off-screen?

texts:
Like in Starcraft, where your army units stay put even though your view is moving around the map.

I have a static tiled map that I made using Mappy and I can display that fine, I just want my off-screen objects to stay put while I am moving my view around. At the moment everything is drawn relative to my view instead of at a global (x, y) position and I would like to change this but I am not sure how.

Would I need another array aside from the one to create my map? That seems like a terrible idea to me.


texts: What is the difference between "stealth" and "social stealth?"

texts:
I was recently researching the stealth mechanics of several games and I stumbled across the distinction of "stealth" (eg. Splinter Cell series) vs "social stealth" (eg. Assassin's Creed series).

What exactly is the difference between these two terms?


texts:
I go back on unsolved question I asked about attaching two models together, could you give me some help on this ?

For example, If I want to attach together Model1 (= Main model) & Model2 ?
I have to get the transformation matrix of Model1 and after
get the Bone index on Model1 where I want to attach Model2 and then apply some transformation to attach Model2 to Model1

I wrote some code below about this, but It does not work at all !! (6th line of my code seems to be wrong !?)

Model1TransfoMatrix=New Matrix[Model1.Bones.Count];

Index=Model1.bone[x].Index;

foreach (ModelMesh mesh in Model2.Meshes)
{
  foreach(BasicEffect effect in mesh.effects)
  {
     matrix model2Transform = Matrix.CreateScale(0.1.0f)*Matrix.CreateFromYawPitchRoll(x,y,z);

     effect.World= model2Transform *Model1TransfoMatrix[Index];
     effect.view = camera.View;
     effect.Projection= camera.Projection;
   }
   mesh.draw();
}


texts: Player Camera Shaking when Running Into Wall in Unity

texts:
I've been working on a 2D RPG game in Unity, and for some reason, whenever my character runs into a wall, the camera begins to shake violently. I have a RigidBody2D and a BoxCollider2D connected to him and a TilemapCollider connected to my Tilemap. The RigidBody component is Dynamic with a gravity scale of 0 (because it's a top-down game). Also, the camera is a child of the player. Here's the script to my character controller:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class PlayerController : MonoBehaviour
{
    // Variable for the player speed and animation
    float speed = 2f;
    private Animator animator;
    private Vector3 change;

    // Called before the first frame is loaded
    void Start()
    {
        // Gets animator component
        animator = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        // Detects change in the player's coordinates
        change = Vector2.zero;
        change.x = Input.GetAxisRaw("Horizontal");
        change.y = Input.GetAxisRaw("Vertical");
        if (change != Vector3.zero)
        {
            // Detects whether the player's animation should play or not
            MoveCharacter();
            animator.SetFloat("moveX", change.x);
            animator.SetFloat("moveY", change.y);
            animator.SetBool("moving", true);
        }

        else
        {
            animator.SetBool("moving", false);
        }
    }

    void MoveCharacter()
    {
        //  Allows movement on the X axis and calculations to allow the player to move
        if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
        {
            transform.Translate(Vector2.right * speed * Time.deltaTime);
        }
        if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
        {
            transform.Translate(-Vector2.right * speed * Time.deltaTime);
        }

        // Allows movement on the Y axis
        if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow))
        {
            transform.Translate(Vector2.up * speed * Time.deltaTime);
        }
        if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow))
        {
            transform.Translate(-Vector2.up * speed * Time.deltaTime);
        }
    }
}


texts: How to correct this issue with a top-down aiming angle in Unity - 2D?

texts:
I'm trying to build my first project and I'd like some input for a math correction. The game is a top down 2D shooter, a bit like the iconic "chaos engine" from SNES.

The issue is that either the player (controller by mouse position) or the enemy don't aim accurately enough on certain angles. I'm using a formula that translates the coordinates of the target point into a rotation, so the sprite faces the target. The bullets are always shot straight. The problem is that they miss the target in certain orientations... it doesn't seem accurate enough. I've been looking for a best approach but so far I haven't found any. Can anyone help? Thank you in advance!

To rotate the enemy I'm using this:

 Vector3 currentPosition = transform.position;

 Vector3 nextPosition = target.transform.position;

 Vector3 directionOfTravel = nextPosition - currentPosition;

 float angle = (Mathf.Atan2(directionOfTravel.y, directionOfTravel.x) * Mathf.Rad2Deg) - 90;
 transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);


texts: What are the current books for DirectX (w/ focus on 3D)?

texts:
For OpenGL, the OpenGL SuperBible 5th edition was just released only a few months ago, and is considered a fantastic, highly rated book for not only learning OpenGL 3 (Part 1 of the book), but it also goes into advanced OpenGL topics in Parts 2 and 3.

For DirectX, what is the current material we should be reading to learn? Books & websites with tutorials welcome. Are there any modern books available that go through the CURRENT version of DirectX that are intended for a beginning audience with a decent grasp of C++, but with no experience for DirectX at all?

This one seems to be highly praised : Introduction to 3D Game Programming with DirectX 10


texts:
I am developing a multiplayer game where a normal character controller user and VR user can participate. So there are two modes of the games through a user can join:

Normal
VR Mode

I am able to manage these modes and user can participate with any mode but the problem is Normal Player(charcter controller) is unable
 to view VR controller(HTC vive Controllers) as these objects are becomes off on the side of character controller. So how do I view VR controller at normal player that what VR player is doing.

I make an object and tried to imitiate it position and rotation with respect to VR controller but it is not working as Imitating source(VR controllers) are off (at the normal player side but working in VR mode) and their postion is not changing. How do you manage to make multiplayer game with VR + normal player? or what else the solution.


texts: How do I change rasterizer state properly?

texts:
To set the rasterizer state I have to ID3D11Device::CreateRasterizerState() and then ID3D11DeviceContext::RSSetState. And then I should ID3D11RasterizerState::Release() it, right?

How about when I want to change the state? Do I follow the above 3 steps again?
When I want to change just 1 setting (i.e. only CullMode) do I still have to fill and set whole structure?
Also, do I have to create and release the state object each time (assuming I don't want to set the exact same state again in the future)?
How about performance? If I set the exact same state again does it do anything? Is there a difference between changing only 1 setting or most/all of them?


texts: How can I package and read multiple asset files into/from one file?

texts:
I want to somehow "pack" (not compress) multiple game files into one bigger file. Something like Valve's .gcf, where reading from the application should be easy; like accessing an ordinary stored file.

I'm aiming for some kind of simple use, something like:

my_asset_file->setAssetFile(ASSET_FOLDER + '/file.ext');
Model *m = new Model();
m->loadFromTxtFile(my_asset_file->openTxtFile('models/props/lamp.obj'));


texts: Free texture sites – is it safe to use their content

texts:
There are multiple free texture sites, like: texturemate.com or plaintextures.com. I am wondering how safe it is to use their content? I imagine that the texture could be withdrawed from the site, making it difficult to prove it was really there. Or: a file can origin from other, restricted source.

I am thinking about using wikipedia Commons, as there is the OTRS system. However most media requires attributing.


texts:
Whats the difference between node-based pathfinding algorithm and the A* among others?

A friend just told me about node-based, but I cannot find much tutorial or information on it.


texts: How can I determine how widespread support of OpenGL ES 3 is?

texts:
I am developing new app in OpenGL which should run on iOS and Android devices.
I'd like to use OpenGL ES 3. For iOS that's not a problem, since any iPhone newer than the 5 has GLES 3.

But I am not sure how wide-spread GLES 3 is in the Android world or if all new devices support it. How can I determine how much support exists for GLES 3 so I can determine if I should use it or fall back to an older version?


texts: How do game engines manage to 'detect' the opengl supported in a computer

texts:
I am learning OpenGL 3.3 and OpenGL 2.1. I want to make a game engine with both. So far I can do advanced stuff with both of them. I noticed that graphics engines like Irrlicht support OpenGL 1.x to 4.x. When i run an Irrlicht program in my computer that supports OpenGL 3.3, it runs perfectly. And when i run it in a computer with OpenGL 2.1, it still runs perfectly.

How does it know that my computer supports OpenGL 3.3, and adapt itself to it. Is it through trial and error? or how are they able to do this. That is a feature i want to incorporate in my game engine.


texts: Can't rotate object after using transform.forward

texts:
I'm using above code to rotate object pointing where it moves:

transform.forward = m_Rigidbody.velocity;

It works fine, however the problem is that I can't rotate this object anymore after set direction.

transform.forward = m_Rigidbody.velocity;
transform.Rotate(0, 0, m_RotateSpeed * Time.deltaTime * 500); // Not Working

Code is simple, first rotate the object to point where it goes and then rotate z axis. But when I ran the game, it just shaking little bit and didn't rotate at all.

Why it doesn't work even rotating code after the transform.forward? Any advice will very appreciate it.


texts: How can I increase the speed and frequency of a spawn?

texts:
I'm using the official Unity tutorial for the Space Shooter game, and I'm at the part where the ability to spawn a set amount of hazards in a wave at a certain delay is introduced.

I want to make it so that at the end of a certain level, the speed of the hazards, and the amount of hazards both increase. I'm pretty sure that can be handled in the game controller, but I don't know the commands I would be needing to use to make that happen. This is the existing code:

public class GameController : MonoBehaviour
{
    public GameObject hazard;
    public Vector3 spawnValues;
    public int hazardCount;
    public float spawnWait;
    public float startWait;
    public float waveWait;

    void Start ()
    {
        StartCoroutine (SpawnWaves());
    }

    IEnumerator SpawnWaves ()
    {
        yield return new WaitForSeconds (startWait);
        while (true)
        {
            for (int i = 0; i < hazardCount; i++)
            {
                Vector3 spawnPosition = new Vector3 (Random.Range (-spawnValues.x, spawnValues.x), spawnValues.y, spawnValues.z);
                Quaternion spawnRotation = Quaternion.identity;
                Instantiate (hazard, spawnPosition, spawnRotation);
                yield return new WaitForSeconds (spawnWait);
            }
            yield return new WaitForSeconds(waveWait);
        }
    }
}

What commands would I need to use to increase the amount of hazards that spawn at the end of each round? And likewise, how could I change the Hazard's script so that it will increase in speed by a certain factor at the end of each round? Is there a way I can reference the hazard's script in this script, by any chance?


texts: Why is my custom shader rendering completely transparent?

texts:
I'm currently trying to learn how to write shaders, so I'm getting my feet wet with Unity's Shaderlab format. One of the first things I tried was to write a surface shader that supports vertex colors being assigned from code. Unfortunately, whenever I try to apply the shader to my object, it just renders the object completely transparent.

Shader "Custom/SVCA" {
    Properties {
        _Color ("Color", Color) = (1, 1, 1, 1)
        _MainTex ("Base (RGB) Trans (A)", 2D) = "white" { }
    }

    SubShader {
        Tags {
            "Queue"="Transparent"
            "RenderType"="Transparent"
        }

        CGPROGRAM
        #pragma surface surf Lambert alpha

        struct Input {
            float2 uv_MainTex;
            float4 color;
        };

        sampler2D _MainTex;
        fixed4 _Color;

        void surf(Input IN, inout SurfaceOutput o) {
            o.Albedo = tex2D(_MainTex, IN.uv_MainTex).rgb * IN.color.rgb * _Color.rgb;
            o.Alpha = tex2D(_MainTex, IN.uv_MainTex).a * IN.color.a * _Color.a;
            o.Specular = 0.2;
            o.Gloss = 1.0;
        }
        ENDCG
    }

    FallBack "Diffuse", 1
}

What is causing this issue, and how can I fix it?


texts: how to avoid Z- axis gravity from affecting my mobile game?

texts: I am making a mobile car game, and as it is a serious game for upper limb rehabilitation. The mobile is attached to the forearm of the patient, hence the forearm movement will move and rotate the car. All i need is to prevent earth gravity from moving my object, I tried to subtract 1g from the acceleromete's reading in z- axis, but the movement did not go rightly. Any help?


texts: How to squash stretch the Bounding box so as to get Good Physics effect

texts: I have Surrounded a game Object with a rectangular Box and applied Physics properties to that Box so that load on the computation gets reduced. But i have a problem, whenever in animation if the Game objects body part goes out of the Box then it will not collide, Is there any solutions?


texts: Character jumping movement in isometric tile

texts: When I want to draw my character moving from one tile to another, I would find the displacement vector between two tile's drawing offset and let the character walk in a linear line toward that direction until it complete this displacement vector. Now, I want to make my character jump from higher/lower tile to lower/higher tile. I have a drawing location (x,y) for the texture, start and end. However, I want it to motion like a projectile,  not a linear line. Therefore, given 2 point, start and end point, how would I motion my character in a jumping motion form (maybe it's a parabolic form)?


texts:
I wanted to know how one would implement this motion blur or fade effect behind the soccer ball  .

Here is what I was thinking . You have the balls current position and you also keep its previous position(couple of sec back). and you draw a "streak" sprite between the 2 points.

I have seen this effect lots of time implemented for projectiles in various 2d games and wanted to know if there is a standard technique.


texts: AudioClip is empty saving recording from Microphone

texts:
EDIT: I updated the code to what I have currently. I'm not sure why but, the editor and my platform complained when I put the WWW in a co-routine, it seems to load the audio clips to the object but I cannot play them. In a script attached to the object I wait until the Audio Clip is loaded before I try to play it.

So I am trying to record some Audio through the microphone and then save an AudioClip to the disk as a .wav file and also save the filepath as a playerpref and then later I can come back and load the string into a url but, for some reason the Audio Clip doesn't get loaded properly as I can see that there is an audio clip on my audio source in runtime but, it has no name and it has no sound on it. However, when I press play in the inspector I can hear my sound

I am using SavWav.cs to save my audio clips to .wav files.

Here is the url(filepath) I am sending to my load method:

string filename = string.Format(@"CapturedAudio{0}_n.wav", Time.time);
string filepath = Path.Combine(Application.dataPath, filename);

Here is the method I am using to get the AudioClip:

private void SpawnObject(string savedNames, Vector3 savedPositions, Quaternion savedRotations)
{

        GameObject cubeToSpawn = Instantiate(cube, savedPositions, savedRotations);
        WWW www = new WWW("file:///"+savedNames);
        cubeToSpawn.GetComponent<AudioSource>().clip = www.GetAudioClip(false, false, AudioType.WAV);

}

The obj is just a cube with an AudioSource attached to it that I instantiate prior to calling this method above.

The filepath works fine for saving but, for some reason it doesn't want to load the audio clip. Any help would be greatly appreciated.


texts: Passing an objects rotation down through its children

texts:
In my topdown 2d game you have a player with a sword, like an old Zelda game.

The sword is a seperate entity, and its collision box "rotates" around the player like an orbit, but always follows the player wherever he goes.

The player and sword both have a vector2 heading. The sword is a weapon object that is attached to the character.

In order to allow swinging in a direction, I have the following property inside sword (RotateCopy returns a copy of the mHeading after rotation)

public Vector2 Heading
{
    get { return mHeading.RotateCopy(mOwner.Rotation); }
}

This seems a bit messy to me, and slower than it could be. Is there a better way to "translate" the base/owner component rotations through to whatever component I am using, like this sword?

Would using a rotation MATRIX be better? (Curretnly rotates by sin/cos) If so, how can I "add" up the matrices?

Thank you.


texts: What do you call the Call-of-Duty-style health system?

texts:
In games like Call of Duty (and many, many other FPSs), there is no visible health bar; instead, as the player takes damage, their vision is slowly obscured by blood that seeps in from the edges. As they heal, the blood clears.

This has become a very prevalent mechanic in modern shooters, but I'm not sure if there is a definitive name for it.

I vaguely remember it being called the "blood barrel" in the game adaptation of 007: Quantum of Solace, but I never actually played that game, I only glanced through the manual a while ago. Also, Quantum of Solace came out after Call of Duty 2 (the first game I know that used this mechanic), so "blood barrel" probably isn't the original term.

This mechanic is very common, so I imagine there must be some term for it.


texts: Moving a game object along a 2d vector by knowing the Rotation in degrees (Unity)

texts:
I am hoping one of you fine fellows can help me again.
Basically I have been making a game like Asteroids in Unity. But its in a 3d world space (pretty much not relevant except I am using X and Z axes, and the rotation angle is on the Y axis).

When the user presses "W" this adds some power towards the thrust. It also records the objects current rotation in transform.eulerAngles.
(i've verified that the angle of y is correct. So a value of 90 is showing when my ship is facing right).

I have used Mathf.Cos/Sin and that angle value to move the object along X,Z axes.

But for some reason it isnt moving in the same direction as it should. -I tried it with some offsets like thrustAngle - 45 (or 90 etc) and it doesnt adjust it as expected. (reducing it be 45 seems to have a bigger impact than expected for example).

Here is the lines of code, have I got the Cos Sin part incorrect?

    void HandleInput(){
    // activate weapon
    if (Input.GetKey(KeyCode.Space))
    {
        FireWeapon();
    }
    // Rotate left
    if (Input.GetKey(KeyCode.A))
    {
        transform.Rotate(0, -rotationSpeed * Time.deltaTime, 0);
    }
    // Rotate right
    if (Input.GetKey(KeyCode.D))
    {
        transform.Rotate(0, rotationSpeed * Time.deltaTime, 0);
    }
    // activate thrusters
    if (Input.GetKey(KeyCode.W))
    {
        thrustAngle = transform.eulerAngles.y -90;
        if (currentThrust < maxThrust)
        {
            currentThrust += accel;
        }
    }
    else
    {
        if (currentThrust > 0f)
        {
            currentThrust -= thrustDecay;
        }
    }
    if (Input.GetKey(KeyCode.S))
    {
        if (currentThrust > 0)
        {
            currentThrust -= decelThrust;
        }
    }

    transform.position += new Vector3(Mathf.Cos(thrustAngle), 0, Mathf.Sin(thrustAngle)) * currentThrust * Time.deltaTime;
    Debug.Log("angle: " + thrustAngle);

    if (currentThrust < 0f)
    {
        currentThrust = 0f;
    }

}


texts: Detect Mouse Enter on An oval shape image in unity

texts: I have an image that is attached to a panel and I want to detect On Pointer Enter and exit. The event is working fine but currently, it is working on the full image while I want to detect this event on an inner oval shape. Actual the remaing are of the image is transparent.


texts:
I am building a physics game engine from the ground up and currently stumped with my SAT implementation. The situation I am having is in regard to Edge cases, if I remove all parallel / duplicate Axis from the possible 15, I run the risk of removing an edge case as seen in the attached photo.

Hoping you guys can give me some pointers, Thanks!
edit: I should state that the way I have my SAT implemented is I have 0-5 cases being the Face contact and 6 - 14 being Edge cases. When I dont remove parallel cases, situations such as the picture below get treated as an edge case

edit: Probably shouldve added this in the beginning but here is the code where I am establishing my Axes to test.
The GetAxisFromEdge function simply takes two vectors and crosses them
The RemoveParralels function loops through the established axis and removes them if there exists a duplicate.
The FixAxes function is something of a patch to fix a greater problem where I needed the axis to face in the direction of one object for uniformity.
std::vector<glm::vec3> AxesToTest;

        glm::vec3 Obj1Edge1, Obj1Edge2, Obj1Edge3, Obj2Edge1, Obj2Edge2, Obj2Edge3;

        Obj1Edge1 = glm::normalize(this->Objects[x]->TransformedPhysMesh[1] - this->Objects[x]->TransformedPhysMesh[0]);
        Obj1Edge2 = glm::normalize(this->Objects[x]->TransformedPhysMesh[1] - this->Objects[x]->TransformedPhysMesh[2]);
        Obj1Edge3 = glm::normalize(this->Objects[x]->TransformedPhysMesh[1] - this->Objects[x]->TransformedPhysMesh[5]);

        Obj2Edge1 = glm::normalize(this->Objects[y]->TransformedPhysMesh[1] - this->Objects[y]->TransformedPhysMesh[0]);
        Obj2Edge2 = glm::normalize(this->Objects[y]->TransformedPhysMesh[1] - this->Objects[y]->TransformedPhysMesh[2]);
        Obj2Edge3 = glm::normalize(this->Objects[y]->TransformedPhysMesh[1] - this->Objects[y]->TransformedPhysMesh[5]);

        AxesToTest.push_back(this->Objects[x]->TransformedNormals[0]);
        AxesToTest.push_back(this->Objects[x]->TransformedNormals[1]);
        AxesToTest.push_back(this->Objects[x]->TransformedNormals[2]);

        AxesToTest.push_back(this->Objects[y]->TransformedNormals[0]);
        AxesToTest.push_back(this->Objects[y]->TransformedNormals[1]);
        AxesToTest.push_back(this->Objects[y]->TransformedNormals[2]);

        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge1, Obj2Edge1)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge1, Obj2Edge2)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge1, Obj2Edge3)));

        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge2, Obj2Edge1)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge2, Obj2Edge2)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge2, Obj2Edge3)));

        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge3, Obj2Edge1)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge3, Obj2Edge2)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge3, Obj2Edge3)));

        glm::vec3 toCenter = this->Objects[x]->Position - this->Objects[y]->Position;

        RemoveParallels(AxesToTest);
        //FixAxes(AxesToTest, toCenter);


texts:
I'm trying to add text to my game using SDL_TTF, and it's working pretty well.

Except for one thing :

My text's SDL_Surface needs a width and a height, if I don't give it one it will automatically set it to 0, making the text invisible.

However, if I insert a value like 100 width and 100 height, it will stretch the image.

I need to know how I would convert ANY font size on the font arial to pixels in width and height.


texts:
I am using mouse position to draw a line using line renderer 2d. What i want is when the line hits a collider it should start to draw on the edge of the collider rather than over the collider. Something like this:

The line renderer will still draw using mouse position. It will just draw on the edge of a collider and move in the direction of mouse postion.


texts: How do I play an animation using lib3ds?

texts:
I am having trouble playing an animation of a .3ds object using lib3ds.

I am able to load the .3ds model with lib3ds. But I can't find a way to play (for example) my 'walk' animation. Where can I find the animation data and how can I play the animation using lib3ds?


texts: How can I implement multiplayer cloaking with visuals that resists client-side hacking?

texts:
I've been thinking about implementing stealth in a multiplayer game. It's a MOBA style game, so think League of Legends (LoL) and Heroes of the Storm (HotS). Multiple clients connect to a single server, which broadcasts the game state to all clients. Clients send their input data to the server, which might reject it when encountering invalid commands, thus rendering cheating impossible (well, in theory).

Now, I mention these games on purpose because both implemented stealth differently. LoL has stealth with two possible states: you're either completely visible or completely invisible. HotS on the other hand, implements stealth in such a way that you can tell by a shimmer in the air:

I think this is a neat mechanic, as it promotes / rewards paying attention to your surroundings. However, this being a multiplayer game made me realize that this might prove easily exploitable.

When you implement stealth in 'the LoL' way, you can simply stop sending player coordinates to the other clients. When the player's character breaks stealth, the server can broadcast the location again.
However, with the HotS model, a shimmer can be seen in the air where the character is moving about. This means that the server must be sending the player's location to the other clients. Which means that players that change the texture or model or even the game code itself could render the cloak mechanic useless. Here is a thread on the HotS boards about it.

My question is whether there is some way to implement cloaking (with a 'shimmer', à la HotS), without having the issue that crafty players can modify the game (data) and 'beat the system'. Is this possible, and if not, how do other multiplayer games with this mechanic deal with this? Is only the LoL style of invisibility uncheatable?

I thought about having the server send bogus 'cloak' locations every now and then, but this also harms fair players that are just paying attention, so that won't do.


texts: Level Modeling Workflows in Maya for Unity

texts:
I'm wondering what the standard workflow for modeling static levels for Unity (or for that matter, other High-Level engines) is? My somewhat limited knowledge tells me that the best process is modeling the entire static level in Maya, texturing, then baking AO and some static lighting into the scene, then importing the single level asset into unity to add dynamic objects.

Is there another way that I should be doing this that is more efficient in a performance sense or from a workflow point of view?

I know the question is somewhat open ended, but generally i'm asking what the standard workflow for level modeling is.

Thanks!


texts: Is SDL conducive to detailed 2D in-Game Animation and intricate particle effects?

texts:
Is SDL (when used CORRECTLY) conducive to detailed in-Game animation and displaying interesting high quality particle effects?

If my question seems too vague, at the other end of this link I have an animation reel:

http://zeebashew.squarespace.com/

(30 seconds in a troop of the kinds of characters I will be using run into screen)

I would like to get my games to run at about the level of pixel-detail (if not slightly better as the video is a little bit overcompressed) with 10-15 characters on screen, and 1-4 pre-rendered 2D explosions flying around at the same time.

I just can't help but wonder, is this even possible in SDL?

I can't stress enough though: I absolutely love C++ so far, and SDL has been really cool, but I would really love to feel more certain that I am learning the specifics of the best tool for what I am trying to do.


texts: How to find 1/3 and 2/3 of the distance between two given points?

texts:
I know how to find the middle of two given points:

var midpoint = (pointA + pointB)/2;

where pointA and pointB are Vector2

I thought that

var thirdBtnPoints = (pointA + pointB)/3;
var twoThirdBtnPoints = 2*(pointA + pointB)/3;

should give me 1/3 and 2/3 between the two points but it doesn't. I guess this might be more of a math question though, but how can I find 1/3 and 2/3 of the distance between two given points?


texts:
I suspect there is a very simple answer to this one but I have been scratching my head trying to figure it out for a while.

I have this piece of code that works fine. It effectively adds the location of the children of my GameObject to a grid array.

  public void AddToGrid()
       {
        Transform[,] grid = new Transform[totalGridWidth, totalGridHeight];
        foreach (Transform children in transform)
           {
               int roundedX = Mathf.RoundToInt(children.transform.position.x);
               int roundedY = Mathf.RoundToInt(children.transform.position.y);
               grid[roundedX, roundedY] = children;

           }
       }

However, I need to modify it so that rather than taking the children of the GameObject that runs this script - I need it of the children of a different GameObject.

i.e. this script sits on GameObject A, however I need to change it to grab the position of the children on GameObject B. I don't want to simply add this script also to B as there is other stuff in the script that won't make any sense and I need to keep the array in A.

I suspect (hope) there is an easy answer here, but am struggling to figure it out.
Thanks for the assistance.


texts: Why is antialiasing dependent on sampling?

texts:
I am thinking about the best ways to render two dimensional objects in the highest detail possible using modern graphics technology and it occurred to me that when I simplify a situation enough, I ought to be able to calculate the exact percentage of coverage of a triangle over a pixel, at least for the cases where an edge spans a pixel. This is, after all, the primary issue that multisampling and supersampling are dealing with, the issue of coverage.

I now realize that the question of how to exactly produce the coverage of the pixel that the vertices lie on is a much more difficult one.

Is it fair for me to say that it is theoretically possible to perform such a calculation on programmable shaders? After all, it's quite possible to compute the area covered by an arbitrary triangle which lies over a grid, on all the grid cells.

I guess I seem to have already come up with an explanation of why not do antialiasing this way: the corners.


texts: Extracting individual components of a vector in the Source Shader Editor

texts:
I'm using the Source Shader editor and would like to mask a vector output to one or two values, yet there is no existing mask node, as far as I can see.

What HLSL code should I use to output what I need? The input would be in the format "x y z". Any help would be greatly appreciated


texts: How do videogames store information offscreen?

texts:
I'm trying to make a videogame from scratch, but I'm really new to this and keep running into basic issues. Most importantly, how do videogames store offscreen information? What I mean is, how does the program know what to display next onto the screen? Or even, if the player changes the environment, how does this change remain for the next time it loads onto the screen?

For example, in New Super Mario Bros, if you hit a ? block and then go off screen, and come back, it still remains hit. How is this information kept and then executed the next time the player loads the block? Why doesn't it just reset?


texts: Capturing small details in textures without making a huge map

texts: Ex. Nuts and bolts on a cabinet. Said items are tiny relative to the cabinet, and on a texture map looks like an indistinguishable dot. Is it worth it to separate these tiny details into a mesh of their own? Obvious cons are increasing poly count and draw calls, disregarding how much of an increase that would be. Is there a generally accepted way of going about this?


texts: Load Material from file path or parse .mat file to Material - Unity

texts:
Is it possible to load a material from a file path? Or, otherwise parse a .mat file saved on disk to a Material usable at runtime?
I had naively thought it would be possible to assign the bytes from a .mat file, as read by File.ReadAllBytes to a Material object, but that does not seem to work.


texts: PhysicsConstraints Module not found in Blender 2.71

texts:
I am trying to export bullet from blender using python console however it raises an error while reaching to import PhysicsConstraints;
The error says Module not found, Since bullet exporter and PhysicsConstraints expected to be present in Blender 2.71,
Can anybody tell me what is this error about? I tried to run the script while I was in Game Engine (Someone suggested to do so in previous answers of a closed thread)
But it didn't work too.

Thanks

Iman


texts:
Wondering the scale basically. The number of shaders a large game or game engine has. I've seen some metal repos but they typically just have 1 or 2 shaders for small demos. I think I've seen a few with 5 or 10, 1 with maybe 20. But I haven't seen anything where there is like 100 or 1,000 shaders or anything like that.

Wondering what the scale is like for typical large games or game engines, if they are on the order of 1-10, or 100, or 1000, sorta thing. And if it's a large number, maybe a quick idea of what the various tasks they are used for would be interesting but not required :). Thank you!


texts: load all files out of folder as resources in lua and love2d

texts:
If i use this code

-- some lua file
-- some code
local IMAGE_FILES = {"file1";"file2";"file3";"file4}
-- some code
function loadRes()
    -- some code
    -- load all images:
    for i,v in ipairs(IMAGE_FILES) do
        img[v] = love.graphics.newImage("data/img/"..v..".png")
    end
    -- some code
end

i have 2 problems!

If i have/want to rename a file, i have to rename it in the IMAGE_FILES table,too. (If i forget to rename it in one place, either in the .lua-file or in the folder, i run into problems)
If i need/want to add another file into the folder, i have to add its name to the variable,too.

For this reasons i want to load data(for example images, music, etc) out of a folder without having to let lua/love2d know the file names beforehand. In other words, is there a way to say to lua/love2d: load all files contained in this "data/img/" folder.

Secondly: Can you get the file type(file ending, like .png) with the solution for my first question?

I'm relatively new to lua and love2d, so i'd really appreciate any help. =)


texts: Incentive for players to choose hard difficulty

texts: In a single-player game with difficulty settings, it seems obvious for players to choose the easy difficulty setting. How can I make incentives for players to choose harder difficulty settings?


texts: Maya - How to clean combine mesh history?

texts:
I've combined a load of meshes using Mesh > Combine. Each mesh was already skinned to my rig. The combine worked ok and the rig / skinning is fine. However I'm left with a bunch of transform nodes:

If I delete history on the newly combined object these nodes are deleted but the skin becomes unbound. If I delete them manually the skin also becomes unbound and the materials disappear from the model. If I export (to Unity) all of these transforms are included, even if I just export a selection of the skeleton & mesh.
How can I get rid of these transform nodes and keep my skinned rig? I've searched online & in the help files and have tried various things for two days now without success.
I'm using Maya LT 2016 SP 4 Ext 3.
Many thanks


texts:
I'm coding a procedural terrain generation based on this article from GPU Gems 3.

But using CPU (not GPU). I'm stuck at generating the procedural terrain. I just can't
figure out how make a 3D texture the way it looks in the article (fig. 1-10). Am I missing something big here? Here is the code:

float CTerrain::DensityFunction(float x, float y, float z) {
    CPerlin3DTexture perl_tex;
    float noise;
    uint32_t octaves = 3;
    float amplitude[10] = {0.25,0.5,1.0,1.9,4.1,8.1,16.1,9,10};
    float lacunarity = 1.5;
    float freq[10] = {4.03,1.96,1.01,0.51,0.2487,0.12563,0.8013,0.39913, 0, 0};
    uint32_t i;

noise = 0.0;
    for(i=0; i < octaves; ++i ) {
        noise += perl_tex.noise(x * freq[i],
                                y * freq[i],
                                z * freq[i]) * amplitude[i];
        x *= lacunarity;
        y *= lacunarity;
        z *= lacunarity;
    }

    return noise;
}

Values (nx,ny,nz) = (128,128,10)

float ***CTerrain::GenerateDensityTexture(uint32_t nx, uint32_t ny, uint32_t nz) {
float step[3];
int32_t i, j, k;

step[0] = 1.0 / (float)nx;
step[1] = 1.0 / (float)ny;
step[2] = 1.0 / (float)nz;
for(i = 1; i < nx-1; i++) {
    for(j = 1; j < ny-1; j++) {
        for(k = 1; k < nz-1; k++) {
            tex[i][j][k] = DensityFunction((float)i * step[0],
                                           (float)j * step[1],
                                           (float)k * step[2]);
        }
    }
 }

return tex;
}

Help, anybody? This is what I get from the above code:


texts:
I've been wondering, how did game programmers make this: https://youtu.be/S6huq2G43Ls?t=4368 possible?

There seems to be some odd morphing of textures when you walk by  objects, and the textures are much higher than should be possible for normal 3D on the GBA. I'm assuming that programmers were hired to create a completely new rendering platform like DX and OpenGL. but how were they able to make graphics look nearly as good as their console (ps2, Gamecube) counterparts?


texts: XNA 4.0 Multiple Textures on same Vertexbuffer

texts:
I have been messing around with XNA for a long while now, but have never really done much more than just copy/pasting tutorials and editing those. Since a bit I have been trying to really start to learn XNA but encountered a problem (or challenge, I suppose) that I can't seem to find any information on anywhere (or its there but I just don't see it).

So my question is.. Is there any way to draw multiple (different) textures on a Vertex Buffer?

I make one large Vertex Buffer out of an array of cubes to make sure no cube-sides are drawn when they aren't visible as well as not having to call the drawing device a million times if I would want to draw a million cubes.

Example, having two cubes in a row would be:

 _ _
|_|_|

But obviously, the middle will never be seen (left cube's right side and right cube's left side) so they are not added to the Vertex Buffer.

So my question is, how do I get a different texture on both of these cubes even though they are part of the same Vertex Buffer?

A cube side is constructed like this, but will obviously have to have something in it that lets the buffer know this part will need this texture (instead of simply a color):

vertices.Add(new VertexPositionColor(new Vector3(x, y + 1, z + 1), Color.Purple));
vertices.Add(new VertexPositionColor(new Vector3(x, y, z + 1), Color.Purple));
vertices.Add(new VertexPositionColor(new Vector3(x, y, z), Color.Purple));
vertices.Add(new VertexPositionColor(new Vector3(x, y, z), Color.Purple));
vertices.Add(new VertexPositionColor(new Vector3(x, y + 1, z), Color.Purple));
vertices.Add(new VertexPositionColor(new Vector3(x, y + 1, z + 1), Color.Purple));

And the Vertex Buffer is filled like this:

if (vertices.Count > 0)
{
    chunkVertexBuffer = new VertexBuffer(device, VertexPositionColor.VertexDeclaration, vertices.Count, BufferUsage.WriteOnly);
    chunkVertexBuffer.SetData<VertexPositionColor>(vertices.ToArray());
}

Pretty standard stuff I believe, but I can't seem to work it out with textures as VertexPositionTexture will only let you add the texture when you assign the effect.. for the entire Vertex Buffer.