texts: Creating a seamlessly looping 2D multiplayer level?

texts:
A discussion came up recently about how to create a 2D side-scrolling multiplayer game that can have an looping level design (Think of Starbound and how their worlds are looping).

I thought the simplest way would be to have a rectangular map with trigger zones which could teleport players from one side to another. However the obvious issue with this approach is the case of having multiple players at edge of the map at once. You don't want to just teleport players in front of each other and you would need a way to transport players without having other players disappear.

To append this idea and fix the issue I came up with the following:
have a trigger zone (red square in image) where players will be able to see a "clone zone" (green square). In this green square, objects from the opposite side of the trigger zone would be copied into its corresponding clone zone (can be seen with A & B shapes). When a player gets to the starting edge of the "clone zone" they are teleported to the other side of the map.

In this example Player 2 would think they are seeing Player 1, however they would actually be seeing his clone and vice versa.

This seemed a bit extreme and complex for the problem at hand. My question now is to know if this solution is a good approach to tackling the issue, or is there a simpler way to solve this problem?


texts: Animate Loading Screen During CPU-Heavy Scene Load

texts:
I have a scene with lots of lightweight objects and one that takes anywhere between 10 and 45 seconds to load.
At a high level, the Awake method does...

Query database
For each result do some (fairly heavy) calculations
Populate a list
Use that list to generate game objects

[Only the last step of which requires the main thread]
I have another scene to display a loading screen. It has a UI panel with a shader that shows an animation.
The Loading screen starts a coroutine to switch level...
private IEnumerator LoadNewScene() {
    AsyncOperation async = SceneManager.LoadSceneAsync("GalaxyMap", LoadSceneMode.Single);
    while (!async.isDone) {
        yield return null;
    }
}

At which point, the animation freezes for 10-45 seconds while the heavy object loads.
In an attempt to make the animation CPU-independent, it's coded as a shader using the built-in _Time property.
I assume this is because my heavy object's Awake() is running on Unity's main thread and thus is blocking updates to the shader.
If so, I can move a lot of the heavy lifting onto a background thread, but I can't work out how to release the thread back to Unity temporarily.
The Awake() method isn't async, and any attempt to create a Task and wait for it will just block the same thread.
Conversely, I could have a completion callback for when the load is done. That would allow me to release the main thread sooner, however, Unity would think my scene had finished loading prematurely and remove the loading screen.
How can I either:

Release control of the thrad intermittently so Unity can refresh the UI
Explicitly tell Unity when it should consider a scene "loaded" and ready for display

?


texts:
I am currently working on a game inspired by traditional 2D Zelda games ("Link To The Past", etc.) in Unity using the 2D settings.

I am looking for the best way to handle objects that the character throws and how to handle the collisions correctly given the perspective of the camera. A thrown object is rendered further up the screen to create the illusion it is in the air however due to this it will collide with enemies and objects that are not on it's current plane.

Below is a screenshot of "Link To A Past" for those who aren't familiar with the perspective of the game.

I have thought about two ways to potentially implement this system but both don't feel like good the solutions.

Turn off collision during the throw until near the end of the throw. I feel for this solution that different colliders would be required to ensure the correct object is experiences the collision. The issue I see with this solution is that it doesn't account for taller objects. If I throw an object directly at a wall the object should detect that.
A system where using Unity's physics layers I turn layers off during the flight and based off the location of the thrown object. For example turning off the physics layers of objects that are above the object but shouldn't be hit due to the perspective. This method seems like a lot of work but could be a solution to the problem.

Any thoughts for better solutions or refinements would be much appreciated.


texts: Libgdx Application terminate in an unusual way

texts:
I am developing simple multiplayer game using libgdx and box2D. And Im getting error below.

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
AL lib: (EE) alc_cleanup: 1 device not closed
Assertion failed!

Program: C:\Program Files\Java\jre7\bin\javaw.exe
File: /var/lib/jenkins/workspace/libgdx/gdx/jni/Box2D/Dynamics/b2Body.cpp, Line 419

Expression: m_world->IsLocked() == false

I checked similar issue in SO which suggest that I may cause if we destroy Body before our World Stepping but its not case here.
While trying to debug this error I found that following code is causing error:

public void updateScene(PlayerStatus playerStatus){
    Vector2 pos = playerStatus.getPosition();
    Player coopPlayer = coopPlayers.get(playerStatus.getId());
    if (coopPlayer !=null){
          coopPlayer.b2body.setTransform(pos, 0);     //Main cause of error
          coopPlayer.setPosition(pos.x - coopPlayer.getWidth() / 2, pos.y - coopPlayer.getHeight() / 2);
    }
}

Any help is greatly appreciated.


texts: How to purposely overscan a Unity Camera?

texts:
For many shader effects that use the scene color, we want this color to be displaced along the object plane. Think water, glass, heat distortion, etc.
However, of course, if this happens near the edges of the screen there is no valid data available to pull from beyond those edges.
Is there a way I can purposely overscan the camera so that there will be available data for these shaders to use?


texts: How do I create good looking plasma explosion effects?

texts: Is this just a billboard quad with a bloom shader?


texts: How to cover the widest range of computers when publishing?

texts:
When you plan a game, or even when you already made a game, and its time to publish, you wonder how much of your audience is covered by the game technology demands.

I'm directing this essentialy to casual games, as I constantly see people having old laptops and being unable to replace them. Laptops with integrated cards whose OpenGL version doesn't even support textures larger than 1024x1024. These people may be avid gamers as well, and a reasonable share of the audience to consider giving them the chance to play casual games, once they cannot play any blockbusters.

As I've seen happening, a very "noticeable" example is Angry Birds. It's gameplay is merely casual (I think nobody disagrees here) and still, it uses so high resolution textures that at least OpenGL 2.0 or around is needed, which blocks away a lot of people.

So, the actual question is: what is a good tradeoff for this issue? Would it be better to just sacrifice the texture resolution for everyone, but have more supported hardware? Would it be better to keep the high quality and just slice the textures into smaller ones, sacrificing the performance a little bit? What else?

Any ideas about this topic are welcome for discussion.


texts: Using deltaTime and Frame Rate Independence

texts:
I'm working on one of my first games and I've read that linking your game logic to FPS is bad because it will run differently at different FPS (obviously).
I have already made some of the basic game dependent on frame rate and now that I know this, I would like to unlink the logic and render. I've learned that LibGdx has deltaTime in its render method for this, however I believe I'm misunderstanding how I am to use it.

For example, my movement currently looks something like this:

if (rightKeyisPressed)
    setVelocityX(movementSpeeD)
playerPos.add(getVelocity)

In my case, I would like the player to move 6 units per second. Since I built this on 60 fps, that means that movementSpeed is 0.1. Now the way I have seen deltaTime used is by scaling the movementSpeed based on the time like this:

setVelocityX(movementSpeed * deltaTime)

However, now I move very slow because delteTime is a very small number. How can I make movement still the same speed without depending on the fps?
Sorry if I'm missing something obvious, I just can't seem to wrap my head around this.


texts: After rotated by Z-axis, X/Y axis still rotating just like z is 0

texts:
I'm making aerial vehicle controller, which can rotate 3 axis: X(Pitch), Y(Yaw), Z(Roll).

Rotating x(pitch) and y(yaw) axis works fine, however after I rotated z(Roll) axis, x/y rotation gave me weird result, it seems like it still rotating just like z axis didn't rotated(0).

First I thought that it was some kind of gimbal lock problem, but it wasn't, it still happens using quaternion.

Here's the video I demonstrate:
https://www.youtube.com/watch?v=8cdBSxcmiWE&feature=youtu.be

Note that I tried all these and had same results:

# Using Euler
rotation.x += pitch

# Using Euler II
rotate_x(pitch)

# Using Quaternion
var qRot = Quat(transform.basis)
var r_euler = qRot.get_euler()
var new_rot = Vector3(r_euler.x + pitch, r_euler.y, r_euler.z)
qRot.set_euler(new_rot)
var new_basis = Basis(qRot)
var new_transform = Transform(new_basis.x.normalized(), new_basis.y.normalized(), new_basis.z.normalized(), transform.origin)
set_transform(new_transform)

Is there a something that I missed? Any advice will very appreciate it.


texts: LibGDX. How to fill background with shader?

texts:
I want to make background of my game like lava via perlin noise.
I've read some tutorials but they were too old and some api calls aren't exist already.
If I understand right in libgdx I need to create a runtime-generated texture (FrameBuffer) on x=0 and y=0 with width=Screen width and height=Screen height and apply shader to it.

I tried to do:

class A extends ApplicationAdapter {
    FrameBuffer   background;
    ShaderProgram shaderProgram;

    public void create() {
       background = new FrameBuffer(
           Pixmap.Format.RGBA8888,
           Gdx.graphics.getWidth(),
           Gdx.graphics.getHeight(),
           false
       );
       shaderProgram = /* stuff to pickup .vert and .frag */
    }

    @Override
    public void render () {
        Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        background.begin();
        batch.setProjectionMatrix(
          new Matrix4().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight())
        );
        batch.begin();
        batch.setShader(shaderProgram);
        batch.end();
        background.end();
    }
}

My shaders are simple red fill programs:

//Vertex
attribute vec4 a_position;

uniform mat4 u_projTrans;

varying vec2 v_Pos;

void main() {
    gl_Position = u_projTrans * a_position;

    v_Pos = gl_Position;
}

//Fragment
#ifdef GL_ES
    precision mediump float;
#endif

uniform mat4 u_projTrans;

varying vec2 v_Pos;

void main() {
    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}

Nothing has been drawn. I expect that all my viewport become red

Function that picks up shaders is working, i tested at sprites


texts: What are good ways to keep the player spending in a single-player RPG?

texts:
I'm designing a game where I want the player to take the in-game money into consideration as opposed to majority where they just get rich pretty much all the time with nothing meaningful to spend it on. What are some good ways to keep them spending their money without making it feel like a tedious chore?
I'm already planning to have monsters nor quests not give gold.
And if preventing them from becoming extremely rich eventually is not possible, at least mitigate "easy" ways of generating infinite income. I want them to struggle with their money.


texts: Is this the right architecture for our MMORPG mobile game?

texts:
These days I am trying to design architecture of a new MMORPG mobile game for my company. This game is similar to Mafia Wars, iMobsters, or RISK. Basic idea is to prepare an army to battle your opponents (online users).

Although I have previously worked on multiple mobile apps but this is something new to me. After a lot of struggle, I have come up with an architecture which is illustrated with the help of a high-level flow diagram:

We have decided to go with client-server model. There will be a centralized database on server. Each client will have its own local database which will remain in sync with server. This database acts as a cache for storing things that do not change frequently e.g. maps, products, inventory etc.

With this model in place, I am not sure how to tackle following issues:

What would be the best way of synchronizing server and client databases?
Should an event get saved to local DB before updating it to server? What if app terminates for some reason before saving changes to centralized DB?
Will simple HTTP requests serve the purpose of synchronization?
How to know which users are currently logged in? (One way could be to have client keep on sending a request to server after every x minutes to notify that it is active. Otherwise consider a client inactive).
Are client side validations enough? If not, how to revert an action if server does not validate something?

I am not sure if this is an efficient solution and how it will scale. I would really appreciate if people who have already worked on such apps can share their experiences which might help me to come up with something better. Thanks in advance.

Additional Info:

Client-side is implemented in C++ game engine called marmalade. This is a cross platform game engine which means you can run your app on all major mobile OS. We certainly can achieve threading and which is also illustrated in my flow diagram. I am planning to use MySQL for server and SQLite for client.

This is not a turn based game so there is not much interaction with other players. Server will provide a list of online players and you can battle them by clicking battle button and after some animation, result will be announced.

For database synchronization I have two solutions in mind:

Store timestamp for each record. Also keep track of when local DB was last updated. When synchronizing, only select those rows that have a greater timestamp and send to local DB. Keep a isDeleted flag for deleted rows so every deletion simply behaves as an update. But I have serious doubts about performance as for every sync request we would have to scan the complete DB and look for updated rows.
Another technique might be to keep a log of each insertion or update that takes place against a user. When the client app asks for sync, go to this table and find out which rows of which table have been updated or inserted. Once these rows are successfully transferred to client remove this log. But then I think of what happens if a user uses another device. According to logs table all updates have been transferred for that user but actually that was done on another device. So we might have to keep track of device also. Implementing this technique is more time consuming but not sure if it out performs the first one.


texts:
I have a class which is changing the player speed. Here is the code:

using UnityEngine;
using System.Collections;

public class MultiplySpeed : MonoBehaviour {
    public int multiplier = 2;
    public Controls player;
    bool flag = false;
    void OnTriggerExit(Collider c){
        if(c.tag == "Player"){
            player = c.gameObject.GetComponent<Controls>();
            if(!flag){
                multiplySpeed();
                StartCoroutine(powerUp());
            }
            flag = true;
        }
    }
    public IEnumerator powerUp(){
        yield return new WaitForSeconds(10);
        backToNormal ();
        StopCoroutine(powerUp ());
    }
    public void multiplySpeed(){
        player.speed = player.speed * multiplier;
    }
    public void backToNormal(){
        player.speed = player.speed/ multiplier;
    }
}

I have two problems, the first one is that after starting the coroutine and the flag varaible is set to true, the method OnTriggerExit is called once again, and the flag is false and everything is executed again. The second problem is that the method backToNormal seems like it's never executed, it simply multiplies the speed and never take it back to normal.

Any help is appreciated.


texts:
I'm planning to use a quadtree for optimizing collision detection. But this quadtree can handle only one type of objects (so I used a base class for my objects).

If I use double dispatch after two object pointers are returned by the quadtree in a collision (derived from the same base class that the quadtree can handle) knowing their ID that identifies their type (an int in the base class) , how am I able to use these pointers with their respective type in order to double dispatch?

A LIMITED SOLUTION:

Before double dispatching, I could make a resolver function that combines both IDs as they were flags into a single parameter, and make a switch that decides which type are obj1 and obj2.

However, its still not very elegant. Any solution or better way to do this? thanks.


texts: Libgdx Do a fixed rotation for orthographic camera

texts:
I'm trying to rotate my OrthographicCamera in the render loop to a fixed angle, but I can only make the camera spin. This is the code that I have:

in create():

OrthographicCamera camera = new OrthographicCamera();
camera.setToOrtho(true, 100, 100);
camera.position.set(50, 50, 0);
camera.update();

in the render loop:

camera.rotate(30);
camera.update();

The camera keeps spinning each frame. But I'd like the camera to stay at 30 degrees.

I have already seen this answer:

https://stackoverflow.com/questions/16509244/set-camera-rotation-in-libgdx

But I don't like it because this code is too drastic.
I wonder if there is a more "common" way to do this.


texts:
I'm attempting to do something that resembles the safe zone in PUBG (PLAYERUNKNOWN'S BATTLEGROUNDS), a circular area on the map that shrinks over time.

On map screen:

draw circle at rand X Y, 300 pixels wide

After say 5 minutes, I want to edit the X, Y and WIDTH of the circle so the new, smaller circle sits at a random position inside the old one.


texts: How do I change x,y,z coordinates if I want to make a perspective projection?

texts:
How do I supposed to modify x,y,z coordinates to make the perspective projection? I'm talking not about matrix, could you explain me each coodinate specifically? Like, x =... y=... z=...
I'm asking because the structure of my project does not contain matrix and vectors.


texts:
I'm having a small issue where if I collide with another object (let's use a simple cube) with my player (this player is just a sphere), the ball will infinitely roll in the opposite direction and WILL NOT STOP. my code is as follows:

using UnityEngine;

public class PlayerController : MonoBehaviour
{
    private Rigidbody rb;
    private float moveHorizontal;
    private float moveVertical;

    public float moveSpeed;

    // Start is called before the first frame update
    private void Awake()
    {
        rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        moveHorizontal = Input.GetAxis("Horizontal");
        moveVertical = Input.GetAxis("Vertical");
    }

    private void FixedUpdate()
    {
        MovePlayer();
    }

    private void MovePlayer()
    {
        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
        rb.AddForce(movement * moveSpeed);
    }

I even changed the ForceMode to ForceMode.Impulse so be able to see what it was doing a little easier, and it is in fact slowly rolling away infinitely with no way to stop it.

Both objects have a Rigidbody for them to be able to react to being hit. This is my first time messing with 3d. I tried to do something like this to make it not roll away on impact

private void OnCollisionExit(Collision collision)
    {
        if (collision.collider.gameObject.layer != LayerMask.NameToLayer("Ground"))
        {
            rb.velocity = Vector3.zero;
        }
    }

But then if I want to jump on the cube (lets say the cube is an enemy and I'm jumping on it to kill it), then it acts very wonky each time it touches the edge of the cube and I haven't made it on top (again, because the velocity is being set to zero).
I am all out of ideas and would love some input here!

EDIT: I now realize that the ball will slowly roll forever even without collision and just simply moving. I am very lost !


texts: What is the correct order to multiply scale, rotation and translation matrices for a proper world matrix?

texts:
Assume DirectX as the platform, if that is important. (Pretty sure it isn't)

Assuming I have a proper scale, rotation and translation matrix, in what order do I multiply them to result in a proper world matrix and why?

By "proper", I mean "I could throw them straight into DirectX and get the most commonly-used 3D frame."


texts: How does flash store (represent) movieclips and sprites?

texts:
When we draw any object in flash and convert it into a movieclip or a sprite, how is it stored or represented in flash. I know in vector art it is stored or represented as line segments using formulae. Is there any way to get the vertices of the shape that was drawn?

For example, lets say a simple rectangle is drawn and is converted to a movieclip. Is there anyway to obtain the vertices and the line segments from the sprite? So that its shape is obtained. Enough information should be obtained so that the shape can be replicated. That's the key - replication.

In simple terms, where does flash store information about a shape that has been drawn so that we can obtain it and attempt to replicate the shape ourselves?


texts:
I'm considering the idea of taking shaders written in HLSL and running them in an AviSynth plugin to process videos. This would allow accessing various shaders, and also to have GPU acceleration. I'm a .NET programmer and have no experience with HLSL, Direct, C++ or AviSynth plugin development. It's a lot to learn at once. So before spending too much time into it, I have a few questions.

Can it easily be done to run a HLSL script in c++, copy the input frame data, and copy the output frame data back, doing a bridge between 2 interfaces?
On computers not supporting OpenCL, will the HLSL script still run on the CPU or refuse to run at all?
I haven't yet found any sample using HLSL that compiles. I can't use Windows Store Templaes on Windows 7 and ActiveX SDK samples run on outdated components that aren't compiling. Where can I find a good tutorial or sample to get started?

This right here seems to describe the basics of what needs to be done.
Loading and using an HLSL shader?


texts: HDR mode in windows makes build version of Unity game look washed out

texts: I've got a 2D Unity game I've been working on. The development computer is hooked up to a TV that supports HDR. If I turn on the "Play HDR Games and Apps" switch in windows then run the build version of my game the colors all appear overly bright and washed out. It looks fine in the editor though and looks fine when the windows HDR mode is turned off. Is there a setting in Unity that can stop this problem?


texts:
I have a small house with point light in it. But as you see, directional and sky lighting affect inside lighting. It's too bright.

How can I make that inside is only affected by point light and not by directional light. Or maybe just a small amount of directional light.


texts: Ogre3D how to use many images in a particle system

texts: In the example I found, it usually uses one images for a particle system. Is it possible to use multiple images in a system?


texts: How do I quantify the curvature of a touch swipe?

texts:
I'm implementing a touch controller for my game.

I am attempting to imitate Tiki Taka Soccer's "ball shooting" controls (gameplay video), where the curvature of the player's swipe affects the curve of the shot's trajectory.

Basically, I want to move the object to where the user raised their finger, but also apply a curve to the movement, corresponding to the curve of the swipe.

How can I do this?

I'm using Unity 5, and I'll be using the Lean Touch plugin from the asset store to capture swipes.


texts: MiniMax not working properly(for checkers game)

texts:
I am creating a checkers game but My miniMax is not functioning properly,it is always switching between two positions for its move(index 20 and 17).Here is my code:

 public double MiniMax(int[] board, int depth, int turn, int red_best, int black_best)
 {

  int source;
  int dest;
  double MAX_SCORE=-INFINITY,newScore;
  int MAX_DEPTH=3;
  int[] newBoard=new int[32];
  generateMoves(board,turn);
  System.arraycopy(board, 0, newBoard, 0, 32);
  if(depth==MAX_DEPTH)
  { return Evaluation(turn,board);}
  for(int z=0;z<possibleMoves.size();z+=2){
        source=Integer.parseInt(possibleMoves.elementAt(z).toString());
        System.out.println("SOURCE= "+source);

        dest=Integer.parseInt(possibleMoves.elementAt(z+1).toString());//(int[])possibleMoves.elementAt(z+1);
        System.out.println("DEST = "+dest);
        applyMove(newBoard,source,dest);
        newScore=MiniMax(newBoard,depth+1,opponent(turn),red_best, black_best);
        if(newScore>MAX_SCORE)
        {MAX_SCORE=newScore;maxSource=source; maxDest=dest;}//maxSource and maxDest will be used to perform the move.

        if (MAX_SCORE > black_best)
        {
            if (MAX_SCORE >= red_best)
                break;  /*  alpha_beta cutoff  */
            else
                black_best = (int) MAX_SCORE;  //the_score
        }
        if (MAX_SCORE < red_best)
        {
            if (MAX_SCORE<= black_best)
                break;  /*  alpha_beta cutoff  */
            else
                red_best = (int) MAX_SCORE;  //the_score
        }

  }//for ends

  return MAX_SCORE;
 } //end minimax

I am unable to find out the logical mistake. Any idea what's going wrong?


texts: Quaternion Rotation after performing previous rotations

texts:
Have Quaternion \$ Q\$ which is rotated on the \$X\$ axis 90 degrees.

\$Q\$ is now \$ (0.707106, 0.707106, 0, 0)\$.

I want to rotate \$Q\$ another 90 degrees by a different pivot \$P\$ so i will calculate \$ Q * -P  * Q^{-1}\$, save the \$x,y,z\$ coordinates in \$ res(x,y,z)\$ and then \$ res = res + P\$. This should give me the offset between the new coordinates and the old ones, however in my case i get a big translation on the \$ Y \$ axis.

Example 1

Here i do both rotations around the same pivot, compared to first center then pivot.

Example 2

i do both rotations around the same point \$C(-0.5,0.5,0.5)\$ if it matters, for the second rotation i first rotate the pivot with the current rotation to get actual coordinates of the pivot.

I do all calculations in object space where the object center is at 0,0,0

---EDIT CODE

Before i start a rotation i calculate where the pivot should be at the current rotation like this, it only happens when there are no active rotations, i choose to rotate by vertices[3]

state.currentPivot = state.rotation * vertices[3];

this is the part of the update function that gets executed during rotations

for (auto& rotationRule : v_rotationRules)
{
    if (deltaTime >= rotationRule.startTime && deltaTime <= rotationRule.endTime)
    {
        state.rotation = glm::rotate(state.rotation, glm::radians(rotationRule.degrees), rotationRule.axis);
        state.rotateAroundPivotWithQuat();
    }
}

TranslationMatrix = glm::translate(glm::mat4(1.0f), state.rotatedPosition());

    ModelMatrix =
        TranslationMatrix *
        glm::mat4_cast(state.rotation) *
        ScaleMatrix;

glm::vec3 ObjectState::rotatedPosition()
{
    return position + rotationOffSet;
}

void ObjectState::rotateAroundPivotWithQuat()
{
    glm::vec3 negp = - currentPivot;
    glm::vec3 res = rotation * negp;
    rotationOffSet = res + currentPivot;
}

When a rotation is over i add position += rotationOffSet, happens at the end of it, and make it equal to (0,0,0) again.

in the gifs, the first value of rotationOffSet has the high offset on y axis, as i checked in debugger.


texts: How would I achieve diablo like 2D isometric projection?

texts:
I am in the process of coming up with an idea for a game, and I would like it to be isometric like Diablo. The problem is I have no idea how it achieves the effect of height like in the following screenshot (on the columns):

Whatever the case, I'm sure it is going to be harder to achieve then creating a traditional isometric game, but any ideas regarding the topic would be greatly appreciated.


texts: How can I get my game to show up in the Games Explorer on Windows?

texts:
I want to create an installer for a game which allows for an icon to be put in the Games Explorer for Vista and Windows 7.

I have created the GDF, then built the script for project and obtained the .h, .gdf and .rc files. But I can't compile (using Visual Studio 2010) the .rc file into an executable to be used after that in order to create the installer. I get the following error after I set the executable path:

  "Could not load file or assembly'Microsoft.VisualStudio.HpcDebugger.Impl, Version 10.0.0.0, Culture=neutral, PublickKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."

Any ideas what I'm doing wrong?


texts: What would be the benefit of placing all of a room's textures on an object outside of the camera's view?

texts:
Pokémon XD: Gale of Darkness does an odd thing with textures. As described in this video, all textures for a room are placed on an object outside of the camera's view:

  This kind of caught me off-guard. I wasn't really expecting anything to be on the other side of this room, but when I turned the camera around, it was all the textures that were inside this room plastered into one spot. Now I can't explain this whatsoever; I've never seen this in any other game that I've covered. But what's really odd is that this isn't an isolated case, this happens periodically throughout Pokémon XD. Now it's not in every room and city, but from time to time, you will see its textures on some type of object in an area that's off-camera.

What would be the benefit of doing this? The scene is shown to the player all at once after loading, so I'm not seeing how it would help with loading times or anything.


texts: Having Problems in PyGame with Mouse Cursor and Sprite Collision

texts:
I know something is not right but I'm just starting out and hit a wall.
Basically, I just want to MouseClick on a Sprite and make something happen.
The mouse clicking itself works, the sprite collision itself works but not when I try to collide the mouse clicking with a sprite.
def new(self):
    self.foodbowl_img = pg.image.load(path.join(self.img_folder, BOWL_IMG)).convert_alpha()
    self.foodbowl_img_rect = self.foodbowl_img.get_rect()
    self.cursor_img = pg.image.load(path.join(self.img_folder, CURSOR_IMG)).convert_alpha()
    self.cursor_img_rect = self.cursor_img.get_rect()

def events(self):
    for event in pg.event.get():

        # Mouse Input
        # I know that pg.mouse.get_pos() does not belong in the event method ...
        # ... and I'll change this so bear with me.
        self.mx, self.my = pg.mouse.get_pos() # saves mouse position to mx and my

        if event.type == pg.MOUSEBUTTONDOWN:
            print("This click works.")
            if pg.sprite.groupcollide(self.cursor, self.foodbowl, False, True):
                print("This click does not work.")

In my sprites.py I have the Cursor Class:
class Cursor(pg.sprite.Sprite):
    def __init__(self, game):
        self.groups = game.all_sprites, game.cursor
        self.image = game.cursor_img
        self.rect = self.image.get_rect()
        self.hit_rect = CURSOR_HIT_RECT
        self.hit_rect.center = self.rect.center

... and the Foodbowl Class:
class Foodbowl(pg.sprite.Sprite):
    def __init__(self, game, x, y):
        self._layer = ITEMS_LAYER
        self.groups = game.all_sprites, game.foodbowl
        pg.sprite.Sprite.__init__(self, self.groups)
        self.image = game.foodbowl_img
        self.rect = self.image.get_rect()
        self.pos = vec(x, y)
        self.rect.center = self.pos
        self.hit_rect = BOWL_HIT_RECT.copy()
        self.hit_rect.center = self.rect.center
        self.content = BOWL_CONTENT

I also tried numerous and different variations of:
#if self.foodbowl_img.get_rect().collidepoint(x, y):
#if pg.sprite.groupcollide(self.cursor, self.foodbowl, False, collide_hit_rect):
#if self.foodbowl_img_rect.colliderect(self.cursor_img_rect):
# colliding = self.foodbowl_img_rect.colliderect(self.cursor_img_rect)

Alas, nothing works...
Any help is much appreciated.


texts:
I couldn't really find any tips on this (or perhaps I just lack the proper words once again), but I'm thinking about how to get some retro looks (SNES 16 Bit, specifially) using a modern system. Basically, the game still runs with the native resolution, however, vertially and horizontally we're limited to 256x224 (512x448). The colour palette is not an issue nowadays.

So I basically came up with this idea and am wondering if it's a smart approach (using OpenGL):

Create Orthogonal Projection Matrix with 256 units width and 224 units wide.
Use a fragment shader that doesn't do anti-aliasing on the textures, so the textures are upscaled to look pixel-y.

Since I couldn't really find a shader for 2), I also came up with a plan b):

Same as 1a)
Don't use textures at all, replace pixels with 1x1 coloured quads, convert spritesheets to 3D models made of quads.

I think plan a) seems more realistic, however. But I do wonder how other games (Shovel Knight, Freedom Planet) approach a pixel-y, retro look that stays true to the systems of 20 years ago.


texts: Apply transform.Translate to a specified object in the script

texts:
In Unity3D, if I place a C # script including transform.Translate on an object "A" in the hierarchy, it animates the translation of this object A.

How in C# can I apply that transform.Translate effect onto another object defined in the script itself?

I want to write a script similar to this:

using UnityEngine;
using System.Collections;

public class Create_Objects : MonoBehaviour {

    public float moveSpeed = 2f;
    public Transform otherObject;

    void Update ()
    {
        if (Input.GetKeyDown (KeyCode.Q))
        {
            GameObject Object1 = new GameObject ("Object1");
        }
        otherObject.Translate (Time.deltaTime * moveSpeed, 0, Time.deltaTime * moveSpeed);
    }
}

But somehow I want that otherObject that I'm translating to refer to the Object1 I created when the user pressed "Q".

Thanks DMGregory for your last code!... and finally, same as before but the objects are created and translated from position of each previous object creates.

What is the new C # code?


texts: Creating or saving model (.fbx or .stl) file in XNA

texts:
I have drawn a 3-D Sphere in XNA with the help of vertices (without fbx file).

Now I want create a .fbx file or .stl file of this 3D sphere from XNA, is there any way to do this?

or how can I save this sphere to any format type file.


texts: What are the steps to instantiate a button in Unity?

texts:
Given a Canvas test_canvas containing a Button test_button and an empty GameObject that manages instantiation and scripts and the like called test_manager, what are the steps to instantiate this button through code as opposed to having it already there?

I've tried making the button a prefab and instantiating it as I would any other object but that didn't work. I tried making the canvas a prefab and then trying the button but nothing. I've searched around for quite some time and there's mention of RectTransform and SetParent but steps or specific details would clear up my confusion


texts: How can I change the speed flag for random or not random at run time?

texts:
This method is being called by Update()
private void SpeedUpdater()
    {
        if (changeSpeedOnce == false)
        {
            foreach (WaypointsFollower follower in waypointsFollowers)
            {
                if (randomSpeed)
                {
                    follower.speed = Random.Range(minRandomSpeed, maxRandomSpeed);
                }
                else
                {
                    follower.speed = speed;
                }
            }

            changeSpeedOnce = true;
        }
    }

I'm using the changeSpeedOnce flag helper to assign the speed to the followers once either random or the constant speed.  but then when the game is running changeSpeedOnce is true and if I want to change the randomSpeed flag again I need somehow somewhere to set the changeSpeedOnce to be false again.
I don't want to use a button or an input key for that but using the randomSpeed flag.


texts: How can I get a Box Collider's "corners" (vertices) positions?

texts:
I attached a Box Collider to a object, which has not the center as its pivot.
Now I need the 8 corner points.

Right now I can only get the points in a unrotated state. But whenever I rotate the Object (which rotates in the center of the boxCollider) - everything gets messed up, because the rotation alters the gameObject-Position.

EDIT2: Solution

public Vector3[] GetColliderVertexPositions (GameObject obj)
{
    BoxCollider b = obj.GetComponent<BoxCollider>(); //retrieves the Box Collider of the GameObject called obj
    Vector3[] vertices = new Vector3[8];
    vertices[0] = obj.transform.TransformPoint(b.center + new Vector3(-b.size.x, -b.size.y, -b.size.z) * 0.5f);
    vertices[1] = obj.transform.TransformPoint(b.center + new Vector3(b.size.x, -b.size.y, -b.size.z) * 0.5f);
    vertices[2] = obj.transform.TransformPoint(b.center + new Vector3(b.size.x, -b.size.y, b.size.z) * 0.5f);
    vertices[3] = obj.transform.TransformPoint(b.center + new Vector3(-b.size.x, -b.size.y, b.size.z) * 0.5f);
    vertices[4] = obj.transform.TransformPoint(b.center + new Vector3(-b.size.x, b.size.y, -b.size.z) * 0.5f);
    vertices[5] = obj.transform.TransformPoint(b.center + new Vector3(b.size.x, b.size.y, -b.size.z) * 0.5f);
    vertices[6] = obj.transform.TransformPoint(b.center + new Vector3(b.size.x, b.size.y, b.size.z) * 0.5f);
    vertices[7] = obj.transform.TransformPoint(b.center + new Vector3(-b.size.x, b.size.y, b.size.z) * 0.5f);

    return vertices;
}

Found that:

Most efficient way to get the world position of the 8 vertexes of a Box Collider (C#)


texts: What article discusses weightmaps for ai control?

texts: A while back, I read an article on using weightmaps to control ai movement, particularly in an RTS environment. I can't find the article again, so perhaps someone here read it? I'm not asking for a list, there's a specific article I'm looking for, and so far I haven't found the magic query on google to find it.


texts:
Ok here is what I have done. I have made a simple test game where you move a character around. I built it and installed the app onto 2 different devices (as it will be a multiplayer game later).

Phone1 - Samsung Galaxy S4 (Android version 4.4 kit kat I know I need to update it)

Phone2 - LG G Stylo (Android version 5.1 lollipop)

My SDK - I have android 6.0 (API 23) installed everything up to date.

Phone1 plays it flawlessly no errors. Phone2 plays it until it freezes at random times. Not much going on in the scene as far as graphics. I kept it pretty simple.

Some debugging I did was to check the logcat. No errors are shown! The only thing I notice is that the frames just stop. So I go to developers options on both phones and check the box that allows you to see every update. I find out that after a while Phone2 stops updating the games frames, which freezes it. It is no longer calling Update(). Phone1 keeps running perfectly no crash yet.

What am I doing wrong? I am guessing it's a version issue but I don't know where to go from here.


texts: Accelerate a Bullet on The Right Direction

texts:
I'm creating a simple asteroids 2D game with XNA so I can learn more on game development, I've started by reading this tutorial and, with my previous knowledge from developing Windows Phone applications, I've started changing the code. I've designed a simple isosceles triangle that is rotated with the accelerometer, like this:

private void CurrentValueChanged(MotionReading e)
{
    // Check to see if the Motion data is valid.
    if (motion.IsDataValid)
    {
        triangle.Update(MathHelper.ToDegrees(e.Attitude.Yaw));
        System.Diagnostics.Debug.WriteLine("Yaw: " + MathHelper.ToDegrees(e.Attitude.Yaw));
        System.Diagnostics.Debug.WriteLine("Angle: " + triangle.getAngle());
    }
}

The triangle.Update just changes the batch.Draw rotation parameter.

I'm also creating a "bullet", when the user clicks on the screen, using a circle texture, what I want to know is how I can point this "bullet" to the direction that the triangle sprite is heading.

PS: The triangle "point", where the bullet should be fired, is exactly the width / 2.


texts: Problem when importing color in hexadecimal format from an ini file

texts:
In my game I can import a color correctly when it is in the "engine format".
Example ("color.ini"):
[color]
color1="c_black"
color2="c_green"
color3="c_navy"

These colors were seen in this link:
https://docs2.yoyogames.com/source/_build/3_scripting/4_gml_reference/drawing/colour/index.html
It turns out that I can't import the color when I use its hexadecimal code (only the colors from the previous link don't supply me).
Example ("color.ini"):
[color]
color1="#FA8072"
color2="#FAEBD7"
color3="#E0FFFF"

Codes taken from this link:
https://celke.com.br/artigo/tabela-de-cores-html-nome-hexadecimal-rgb

I tried lowercase variations, with $ instead of # and nothing worked.

It is not even a case of seeing the wrong color, but of changing nothing (it always turns white).

I am using the function (asset_get_index) to apply the color.

Link where I looked for a solution before coming here:
https://www.reddit.com/r/gamemaker/comments/cc0dk6/saving_a_colour_to_an_ini_file/?ref=readnext

Code in my game (works in all colors that don't come as hexadecimal):
color[i]=ini_read_string("color","color"+string(i),"");

Draw:
draw_sprite_ext(spr_Barra,0,290,97+25*(i-1),1,1,0,asset_get_index(color[i]),1);

Code I tried, based on one of the comments, from the question:
result=0;

zero=ord("0");
nine=ord("9");
a=ord("A");
f=ord("F");

for(var i=1;i<=string_length(color1);i++){
    c=ord(string_char_at(string_upper(color1),i));
    result=result<<4;

    if (c>=zero && c<=nine){
        result=result+(c-zero);
    }else if(c>=A && c<=f){
        result=result+(c-a+10);
    }
}

I used the function (show_debug_message) to see the result of the code and got nonsense results:

1024, 2048

Link to see the code base I tried:
https://www.reddit.com/r/gamemaker/comments/9nyjbu/hexstringtonumber_script/


texts: I found one web site http://e-sim.org/googleMap.html which is similar to my game idea. But I have no experience on game maps developing. Can anyone share ideas how to make similar functionality like that map, for example how indicate neighborhood position? Any better ideas for 2d map


texts: Overlap transparent particles without blending? (Unity)

texts:
I'm trying to create a continuous output of light from an object (like the exhaust of a space ship), and I thought I'd use particles to achieve this. But I'm running into a problem with alpha blending.

I'd like to decrease the particle system's alpha over time, but because there's such a high density of particles, they end up evaluating to a solid color for most of the system's duration.

This blog post basically shows what I'm trying to achieve: https://mispy.me/unity-alpha-blending-overlap/

The idea is to use a stencil test to make sure pixels in a sprite/particle aren't gone if they're overlapping another sprite/particle.

Pass
{
    Stencil
    {
        Ref 2
        Comp NotEqual
        Pass Replace
    }
}

Then the author adds an alpha cutoff to make sure transparent pixels on an underlying sprite don't prevent new pixels from being written.

half4 frag (v2f i) : COLOR
{
    half4 color = tex2D(_MainTex, i.uv);
    if (color.a < 0.3)
        discard;
    return color;
}

But this solution requires you to eliminate soft edges, so I'm thinking it wouldn't look good in a particle system. The author also hinted at an alternate solution involving ZTest, but I can't visualize what that would be.


texts:
I'm trying to understand batching and I'm not sure to understand how to do that, can I have more informations please? Here is what I found for the moment:

Batching informations

There is many types of batching:

Sprite batching
Geometry batching
???

Sprite batching

This method is useful to draw all sprites with only one draw call.
To do that, a SpriteBatcher class need to get all the mesh with the same Material and the same Geometry (sprite = square geometry).

Get Sprites with same Material
Send all Sprite's matrix to a Sprite shader    (http://antonholmquist.com/blog/sprite-batching-opengl-es-2-0/)

Geometry batching (With static geometry)

Merge meshes's geometry, so you we can draw all meshes in one draw call.

Get all static meshes
Merge meshes's geometry and calculate their position with there matrix (Compute a single VBO and IBO)
Hide original mesh to avoid twice draw.

Am I right with that?
Thanks!


texts: What would make a good cursor movement sound effect?

texts:
I know specific questions like this are very borderline on acceptable - but I am having massive trouble finding a non-annoying sound effect for moving the cursor in my game.

The game is a Fire Emblem like SRPG and think it would be cool if I could have a little sound each time the cursor ticks in a menu/selection of character/etc. - it should be a non-intrusive sound (keeping in mind I can adjust volume).

What have you guys used for something like this? Going to various free soundclip sites putting in "cursor move" isn't doing much for me.


texts:
I thought that we could re-use the same shadowmap for every light. But I've seen an industry article suggesting that you can't re-use shadowmaps between lights, and have to use separate surfaces.

Do we need one shadowmap per light? Or one for the whole process?


texts: Understanding Unity3d physics: where is the force applied?

texts:
I'm trying to understand which is the right way to apply forces to a RigidBody.

I noticed that there are AddForce and AddRelativeForce methods, one applied in world space coordinate system meanwhile the other in the local space.
The thing that I do not understand is the following: usually in physics library (es. Bullet) we can specify the force vector and also the force application point.

How can I do this in Unity? Is it possible to apply a force vector in a specific point relative to the given RigidBody coordinate system?
Where does AddForce apply the force?


texts: Importing a File Containing Two Objects from Blender into Unity Leads to a Single GameObject Not Two

texts: I have two separate objects in a Blender file (say a cube and a sphere). Unity import this file (OBJ type) as a single gameObject which is not want I want. I want cube and sphere to be two separate gameObjects.


texts: Licensing classic (vintage) car models for game

texts:
I know that I cannot use real car models in a game without permission. However, I am interested in a classic (vintage) cars from era before 1950. Some of the companies no longer exist, or were bought by some other company and this by some other company etc. Some cars had custom-made chasis on top of a "skelet".

How is licensing for those cases? Same as for "today" cars, or is there any exception? Something like books where from certain date there are no longer copyrights.


texts: Switching between world and battle scene with no or minimum loading?

texts:
I am making a strategy game where the player roams a grid map.
When the player encounter enemy on the map he is transferred to a "battle" scene where two armies are fighting in turn based battle.
Imagine Heroes 3 like game.
My question is:

Should I load the battle scene in additive mode and temporary hide the "world map" and when the battle is finished to just show the "world map" and hide the "battle" scene?

Or i should unload the world scene and load the battle scene, and when the battle is over -> unload the battle scene and load the world scene ?

I think the 1st approach will give me less loading time between the two scenes, but will require more RAM ?
Second approach is standard one, but i will have loading between the scenes ?
My idea is to have no or minimal loading between battle and world scenes.
What do you guys thing ? Did you know what is the best practice in this case ?
By the way, i am using Unity as a engine.


texts: Storing Prefab properties in a scene and applying them to prefab instantiated via Addressables

texts:
I am working on a small script to replace Prefabs in a scene with Addressable versions of the same prefab. This is working so far by creating a second scene with the Prefabs stripped out an a small loader object in their place. When the 2nd scene run the addressables are instantiated and everything is fine.
However, this only works for the absolute base simple case of no changes to the default prefab properties. What I am trying to solve now is storing the current settings of the prefab along with it's addressable reference so that they can be reapplied when it is instantiated.
So far I have looked at PropertyModification to get a list of all the properties and their values, but as this is an Editor only structure it is no good for the instantiation of the objects at runtime. I was thinking I could store the property names and values, but cannot find anyway to then reapply those values back to the newly instantiated object.
Is there any way I can apply (ideally wholesale without the need of custom instantiation scripts) the stored properties to a prefab ?
Thanks in advance.


texts: Implementing camera for 2d side scroller game?

texts:
I'm implementing a 2D side scroller for iOS (using C/C++ with OpenGL) (beat'em up style like double dragon/final fight ).

My scenes are composed of one cyclical background image ( the end of the image connects perfectly with the beginning ). This is to produce a cyclical scroll effect.

I was wondering how could I implement a camera that follows my player movement ?

( Resources / Links are greatly appreciated with explanations :) )


texts: How to create a similar 2.5D art style character

texts:
EDIT: I am asking about the characters not the 2.5 scene

I am the graphic designer of a game and I want to recreate the look and feel of these images:

My questions are:

Does this style have a specific name?
Can you link me to tutorials for this game style?


texts: Implement Displacement Mapping: Gaps along seams

texts:
I am implementing Displacement mapping using DirectX 11 with its new tessellation stages.
Diffuse map and displacement map are generated by xNormal.
The result after I applied displacement mapping is cracked so badly.

Then I realized the values in the texture along seams are not the same/continuous, so I just use diffuse texture as displacement map, and the diffuse color is all-red.

The result is better but still 1-pixel gap along the seams.
I was confused by the little gap, so I enlarged the colored-part in the texture using MS painter, then the gap disappeared!

Now I just don't understand where the problem is. Even if the value along seams from different part of the texture is the same (red in this case), there are still gaps on the result model.

Here are the result screenshots. (reputation too low to post multiple links!)
http://imgur.com/a/OT2tt

I tried all sample filter here(MSDN) but nothing helps.

What causes the gap? It will be better if the problem can be solved by just modifying texture instead of changing my code.


texts: 2D Spaceship Thruster Movement - Turning

texts:
I have a spacecraft (shown in the image) built out of ‘blocks’ / 3D planes. It is drawn within a 3D space, but I’m ignoring the Y axis for now and keeping things on a “2D” XZ axis.

The ship has a number of thruster blocks (represented in blue); each of which should fire depending on user input (does the user want to go forward? or turn left? etc).

Although the image doesn’t show it, each thruster is oriented in a logical direction; i.e the thrusters labelled A & E point left, B & F point right, thrusters G & H point down, thrusters C & D point up.

Thrusters are placed arbitrarily around the ship. There is no actual 'Thruster A' or 'Thruster B'; I'm just using the spacecraft in the above image as an example.

I already have the following which works for forward/backward thrust and strafing (in pseudo code):

foreach(thruster in ship.thrusters) {

    // Forward thrust
    if(keyPressed W) && thruster.direction == ShipLocalSOUTH) {

        thruster.fire();
    }

    // Backward thrust
    if(keyPressed S) && thruster.direction == ShipLocalNORTH) {

        thruster.fire();
    }

    // Strafe Left
    if(keyPressed Q) && thruster.direction == ShipLocalEAST) {

        thruster.fire();
    }

    // Strafe right
    if(keyPressed E) && thruster.direction == ShipLocalWEST) {

        thruster.fire();
    }

    // Turn left
    if(keyPressed A && ??) {

        // ??
    }

    // Turn right
    if(keyPressed D && ??) {

        //??
    }
}

class Thruster {

    private thrusterPower = 10;

    public void fire() {

        shipRigidbody.AddForceAtPosition (thruster.transform.forward * thrusterPower, thruster.transform.position);
    }
}

My problem lies in determining which thrusters to fire to turn the ship.

I’ve done a lot of googling on this and have found quite a lot of info already. I.e:

Using Torque and Thrusters to Move and Rotate a Player-Designed Spaceship

However my maths/trig skills are - to be blunt - crap and so I’m hoping to get a somewhat simpler explanation or even some code to help me understand and solve this problem. I'm not aiming for superbly accurate physics, just something that is fun to play.


texts: Is a simple PolygonCollider2D really worse than several BoxCollider2Ds?

texts: In my scene I have very simple quadrilateral blocks, which I'm considering using PolygonCollider2D for. These blocks will be the building blocks of the scenery so there will be a lot of them, and I'd like to use the most efficient technique for them. Now, since I don't really know what kind of optimization Unity does for collisions, I was wondering: would rotating and combining several BoxCollider2Ds be more efficient? And is a quadrilateral BoxCollider2D even worse than a rotated BoxCollider2D (which from a mathematical point of view wouldn't be able to apply an AABB collision scheme either) in the first place?


texts: How do I seperate my game and game engine into seprate projects?

texts:
I am trying to separate my game from the game engine, both written in Java. Currently, they are in two separate packages, but I would like to separate them into different projects.

A main method in "Project B" starts a game loop in "Project A". This loop needs to call back to methods in "Project B". What is the best method to achieve this, without "Project A" being aware of the specific implementation of "Project B"?

"Project A" (Engine - Library):

public class Engine {

    public static void start() {
        init();
        // Call Game.getInstance().init() from Project B.

        while (true) {
            input();
            // Call Game.getInstance().input() from Project B.

            update();
            // Call Game.getInstance().update() from Project B.

            render();
            // Call Game.getInstance().render() from Project B.
        }

        cleanUp();
    }

}

"Project B" (Game - Executable)

public class Main {

    public static void main(String[] args) {
        Engine.start();
    }

}

public class Game {

    private static Game instance = new Game();

    private Game() {}

    public static Game getInstance()
        return instance;

    public void init()
        // Do Stuff

    public void input()
        // Do Stuff

    public void update()
        // Do Stuff

    public void render()
        // Do Stuff

}


texts:
In libGDX there is a simple fade Interpolation that speeds up towards the end of the action animation. But what I am looking for is the reversed of it, it needs to start fast and slow down near the end. Is there a Interpolation function for that or how can I create this effect myself?

Currently i'm directly just initiating the action from the actor.

actor.addAction(Actions.moveTo(currentTouch.x - actor.getWidth() / 2,
 currentTouch.y - actor.getHeight() / 2,
 .2f,
 Interpolation.fade));


texts: I want to erase the image for mouse pointer in unity. My pointer should be as a eraser. What is I do create the eraser? My sprite is always change because it provide from the server. Please help me.


texts: Loading and drawing materials using Lib3ds

texts:
Hey all, i'm currently using Lib3ds to load models into my C++/OpenGL project. So far, i've been follow the model loading tutorial found here.

The tutorial gives a good example of how to draw the vertices and normals using VBO's, but so far i've been lost as how to do the same thing with materials.

Could i get an explanation/example of how to both load and draw materials of my meshes using Lib3ds and OpenGL?


texts: How is actual object size in a scene calculated?

texts:
I've got stuck with 'pixel per unit' parameters and object scale.

I've created two different sprites. A background picture, 1000x1000 pixels, and another one for a 'player', 200x200 pixels.
I've added two empty game objects, with default transform, so positions are (0; 0; 0) and scale is (1; 1; 1). I added a sprite renderer to both of them, and assigned the required sprites. Both sprites have 1 pixel per unit.

And the 'player' in the scene looks much more bigger than the background.

I expect that if ppu=1, then the background would have a size of 1000 units, a player 200 units and it would be 5 times smaller.

What am I doing or understanding wrong? What is an actual object size?


texts: Why is my bullet disappearing after I release the shoot button?

texts:
I'm making a game using DirectXTK for my university project. When I press space bullet moves forward like I wanted, but when I let go it stops my bullet from moving. How do I keep the bullet moving when space was pressed?

void update
{
  //shooting
  if (kb.Space)
    Shoot(true);
  else
    Shoot(false);
}
void Render()
{
  if (draw)
  {
    for (int i = 0; i < 10; i++)
    {
      m_projectile[i]->Draw(m_bullet[i], m_view, m_proj, Colors::Red);
    }
  }
}
bool shoot(bool test)
{
  shoot = test;
  draw = true;

  //bool isShot = false;
  if (!shoot)
  {
    for (int i = 0; i < 10; i++)
    {
      m_bullet[i] = Matrix::CreateRotationY(m_ship._42) * m_ship;
    }
  }
  else
  {
    m_bullet[0] = Matrix::CreateTranslation(-Vector3::Forward *float(1))*Matrix::CreateRotationY(0.f) * m_bullet[0];
    //m_bullet *= Matrix::CreateTranslation(-Vector3::Forward);
  }

  return draw;
}


texts: How do I access a struct that resides within a struct in blueprints?

texts:
I have a struct: "FOuterStruct"

This is defined in code such that it contains another struct type:

Struct OuterStruct
{
    UPROPERTY(...)
        FInnerStruct memberStruct;
}

Now.

When I break an FOuterStruct apart within blueprints, I do not get the FInnerStruct as a pin on the resultant node.

How am I to edit/access this FInnerStruct?


texts: Compression and encryption are different things AFAIK, so why even use compression if you have to still decompress anyway, is this just to reduce distribution size or is there some other reason?


texts: How can I ensure character weapon is also included in collision detection?

texts:
I have two models, my player character and her weapon. Each can be controlled independently (that is, I allow the player to aim the weapon). The object hierarchy is:

Character (with CharacterController)

Weapon

Block

The character collides with the block correctly (both behave as solid objects), but the weapon passes through the block. What components does the weapon (or block) need so that it also behaves as a solid object? (In other words, it must not pass through the block. The block should stop the weapon from moving.)

I have tried adding rigid bodies to both weapon and block, including enabling and disabling Kinematics on each, to no avail. When they do collide, they move through each other rather than behaving as solid objects. If I tick a few constraints, they behave as solid objects, but affect each other's movement and/or rotation. If I tick all the constraints, then they no longer behave as solid objects and move through each other again.


texts: C# - separate sprite for 2d character and arms

texts:
I'm making a 2D action platformer in C# (not using XNA).

So far I have the character drawn on the screen, animating and moving. The sprite sheets provided by the artist have the character and arms in two different sheets. And this is my problem.

How would I go about adding the arms to the character? I have a general idea that I would draw the 1st hand (one further away from screen) then character and then the other hand (the one closer to the screen). What I have an issue with is, how could I combine them into one object in order to make coding the movement and actions easier? Also I guess I should use anchor points to make positioning of individual parts easier, and also to make my life easier when I start adding weapons.

The actual case becomes a bit more complex as the arms sprites have to be changed depending on the type of the weapon the character is using. Also the hand on the arm closer to the screen is missing a thumb which is so that it could be animated during a reload with certain weapons.

I guess I'm looking for a way to construct a player object from the separate sheets in order to keep that full character easily drawable, since in some cases, the whole object should be switched, like a climbing animation or acrobatic move animation have arms on the character already.

Thank you in advance.


texts: Single Letter/ Alphabet recognition in AR

texts:
I am developing an AR game with unity where I need to recognize alphabets in runtime. I have tried vuforia but it does not support single letter recognition. OpenCV is an alternative solution, but I don't understand how to detect text in Runtime with OpenCV.

I have also tried object recognition, NFT and markerless tracking. But all of these failed because a single letter does not have enough feature to get detected.

I am really new in Augmented reality and image processing. Can anyone give me a guideline or plan what I should do?
I am using this letter blocks from amazon https://www.amazon.ca/gp/product/B0006MU23W/ref=s9u_simh_gw_i1?ie=UTF8&pd_rd_i=B0006MU23W&pd_rd_r=22ef1e20-b08e-11e7-91cc-bbe5f37c0d0f&pd_rd_w=wCg3M&pd_rd_wg=NG8Lg&pf_rd_m=A3DWYIK6Y9EEQB&pf_rd_s=&pf_rd_r=TH85A9MZFVDZPD8YYR5P&pf_rd_t=36701&pf_rd_p=09a46553-65cf-45b2-8aaa-e9bb559981ab&pf_rd_i=desktop


texts: How to sync gamestate between server and clients in turn based 4x game?

texts:
Background information:

I am developing a game similar to other 4x games like Sots, MoO,...

I am storing all information about the game(like star/planet/ship/fleet positions, owners and a lot of other stuff) in a data structure in memory. I call this structure the datastore.

I have one client act as server.

All clients should have a copy of the datastore, because in case the server disconnects another client could overtake the server role.

On the end of every turn all changes the clients did should be stored in the server datastore.

If it is important I use C# and Unity Pro.

Question:

After all client changes are applied to the server should I just copy the complete datastore to each client or is the way to go to sync only the changes made?

I would appreciate to get answers that not only include personal opinion but more about drawbacks or advantages of the different approaches.


texts:
I'm looking for help involving rayCast in Corona SDK. If you haven't see it here's a link talking about it along with a demo. WEll in the demo you tap on a space and the ray is recasted and bounced if possible. What I'm trying to do and have failed to figure out is if it would be possible to have this rayCast done live? For example a scenario this would be helpful...
http://www.coronalabs.com/blog/2013/05/07/physics-raycasting-and-reflection/

A 2D shooter with a laser sight - you move your finger to aim and the red dot on the receiving end of the bullet shows live where in the level you're aiming. So if I drag my finger down to aim down, I see the laser dot correlate with my finger. Is this possible?

If that doesn't make sense, we can use the demo. You tap and the laser updates its path. Would it be possible to drag your finger and see the path update and reflect in real time?

Thank you very much to anyone who can help with my issue. I've seen this sort of thing done in other games but there's no telling what engine or alternative method they used. Thanks again for your time.


texts:
I'm trying to implement the Seperating Axis Theorem by following this article I found on MDN.
Unfortunately, I'm not too geometry savvy and I wasn't able to find any good, simple implementation examples around the internet. I've tried to search for the specific concepts that the article mentions, but I'm not sure that I'm on the right track and I've got several doubts about this.
Here's what I did so far:
export class Point {

    constructor(x, y) {

        this.x = x;
        this.y = y;
    }

    rotate(pivot, angle) {

        let s = Math.sin(angle);
        let c = Math.cos(angle);

        let p = new Point(this.x - pivot.x, this.y - pivot.y);

        return new Point((p.x * c - p.y * s) + pivot.x, (p.x * s + p.y * c) + pivot.y);
    }

    compare(point) {

        // todo
    }
}

import { Point } from "./Point.js";

export class Line {

    constructor(p1, p2) {

        this.p1 = p1;
        this.p2 = p2;
    }

    getSlope() {

        return (this.p2.y - this.p1.y) / (this.p2.x - this.p1.x);
    }

    getNormal() {

        let dx = this.p2.x - this.p1.x;
        let dy = this.p2.y - this.p1.y;

        return new Line(new Point(-dy, dx), new Point(dy, -dx));
    }

    getYIntercept() {

        return this.p1.y - this.getSlope() * this.p1.x;
    }

    getPointProjection(point) {

        let slope = this.getSlope();
        let yIntercept = this.getYIntercept();

        let slope2 = -1 / slope;
        let yIntercept2 = point.y - slope2 * point.x;

        let nx = (yIntercept2 - yIntercept) / (slope - slope2);

        return new Point(nx, (slope2 * nx) + yIntercept);
    }
}

import { Point } from "./Point.js";
import { Line } from "./Line.js";

export class Polygon {

    constructor(...points) {

        this.points = points;
    }

    overlaps(polygon) {

        let side = new Line(this.points[0], this.points[1]);

        let axis = side.getNormal();

        function findMinAndMaxProjectedPoints(polygon) {

            polygon.points.forEach(point => {

                let projection = axis.getPointProjection(point);

            });
        }

    }
}

Did I implement the various formulas correctly?
How should I "keep track of the highest and lowest values" for each polygon? How am I supposed to determine which projected points are the lowest and which are the highest?
How do I check for gaps between the highest and lowest projected point of the two polygons?


texts: Draw a line along one continuous edge of a curved mesh

texts:
I have a rectangular mesh, but the mesh is curved:

I want to draw a line along one side of this curvy mesh.

Currently I can easily draw line along a side of a flat rectangular mesh by getting the mesh's min and max bounds. But what should I do to draw a curved line along the border of mesh from one of its side edges.?


texts: Can't build UE4 sln after regenerating it from uproject file

texts:
I was having issues with code, so I decided to regenerate my projects SLN file, and then rebuild the whole project.
It was a really bad idea, I can't even open my project again.
Anytime I try to start the project, it says, the project was build with a different version of the engine... although it wasn't.
When I choose yes for rebuilding now I end up with a message on screen saying, that it can't be built, and I should rebuild manually...
I had a look around and found this:

I deleted my Intermediate and Config folders
I right clicked my uproject file, and chose generate VS solution.
I double clicked that, and chose build and rebuild for all
the solutions in there and

I get this error message after the build finished:
Severity    Code    Description Project File    Line    Suppression State
Error (active)  E0493   no instance of overloaded function "std::pair<_Ty1, _Ty2>::pair" matches the specified type GITVR   C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\tuple   991
Error (active)  E0145   member "FBulkDataStreamingToken::InvalidOffset" may not be initialized  GITVR   E:\Jani melok\Unreal\UE_4.25\Engine\Source\Runtime\CoreUObject\Public\Serialization\BulkData.h  196
Error (active)  E0145   member "FBulkDataBase::InvalidToken" may not be initialized GITVR   E:\Jani melok\Unreal\UE_4.25\Engine\Source\Runtime\CoreUObject\Public\Serialization\BulkData2.h 109
Error (active)  E1574   static assertion failed with "TAtomic is only usable with trivial types"    GITVR   E:\Jani melok\Unreal\UE_4.25\Engine\Source\Runtime\Core\Public\Templates\Atomic.h   537
Error (active)  E0145   member "FName::StringBufferSize" may not be initialized GITVR   E:\Jani melok\Unreal\UE_4.25\Engine\Source\Runtime\Core\Public\UObject\NameTypes.h  466
Error (active)  E0145   member "FNavigationLinkBase::InvalidUserId" may not be initialized  GITVR   E:\Jani melok\Unreal\UE_4.25\Engine\Source\Runtime\Engine\Classes\AI\Navigation\NavLinkDefinition.h 40
Error (active)  E0145   member "Chaos::FImplicitObject::D" may not be initialized   GITVR   E:\Jani melok\Unreal\UE_4.25\Engine\Source\Runtime\Experimental\Chaos\Public\Chaos\ImplicitObject.h 121
Error (active)  E0145   member "FShaderParameterBindings::kInvalidBufferIndex" may not be initialized   GITVR   E:\Jani melok\Unreal\UE_4.25\Engine\Source\Runtime\RenderCore\Public\Shader.h   574
Error   C4102   'https': unreferenced label GITVR   E:\Jani melok\Unreal\UEProjects\MyProjectname\Plugins\VictoryPlugin25\Source\VictoryBPLibrary\Private\VictoryBPFunctionLibrary.cpp  1736
Error   MSB3073 The command ""E:\Jani melok\Unreal\UE_4.25\Engine\Build\BatchFiles\Build.bat" GITVREditor Win64 Development -Project="E:\Jani melok\Unreal\UEProjects\MyProjectname\GITVR.uproject" -WaitMutex -FromMsBuild" exited with code 6.    GITVR   C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets

44

EDIT: tried the steps advised by Ben from here, but still getting errors...


texts:
How would I work a spawning algorithm into a sim engine with variable time steps?

If each engine step is, say, 1/30 of a second and I have some event occur with a 0.001 probability each step, how do I translate this to an engine with a variable time step? At the end of 1 second I could have nothing spawned or (in a very unlikely event) I could have as many as 30 spawned.

Now if the engine hasn't done an update for a full second, how can my spawner simulate the same behaviour and probabilites? What if my steps are much smaller, say 1/100 or 1/1000 of a second?

What algorithms can I use?


texts: Unreal Engine: Third person example project and multiplayer

texts:
I was fiddling around with multiplayer stuff in Unreal Engine. I looked into events that run only on server, multicasting events, replication of variables...

But there is something that I dont quite understand: When I load the Third Person example proyect, and enable more than one player, I can see the position and movements of the players being replicated on all clients.

While I understand that the position and the rotation of the players being replicated successfully (since the replication option is enabled in the pawn's blueprint option), I don't really understand why the animations are being replicated. I don't see any reference in the blueprint making animations replicated over the network.

Are pawn animations implicitly replicated on clients when replicating the actor's position? Am I missing some option/configuration I'm missing?


texts: How can I detect touch intensity or pressure via libGDX?

texts: How can I detect the intensity of touch pressure in libGDX? For example, low pressure, medium, medium-high, high and so on. There are some questions about it but there aren't answers for libGDX.


texts: Does a patch of simplex noise sum up to zero?

texts: Just for interest, when sampling simplex noise in any given dimension, would the sum of all samples run towards zero?


texts: Is there an existing Quadtree implementation in libGDX?

texts: I've seen a lot of sites that recommends to use Quadtree for splitting the array by levels and nodes for a better performance for example in CollisionSystem there's a lot of collisions needs to be handle. I need to ask this question because I'm planning to create my own Quadtree class, if there it didn't exist.


texts: Shader and Texture Scrolling depending on Direction

texts:
I am trying to scroll a texture using its uv in Unity but I don't get the result I need.

The aim is to have two components, the speed and the direction. I would like to define the direction in normalized values and the speed should influence the velocity of the scrolling according to the direction.

If I change the speed at runtime, I don't want to have some hiccups but maybe this should not be handled but the GPU.

How can I do that in a better way, maybe using matrix ?

Here is an example but the result is not as good as expected.

uv.xy = uv.xy + frac(_Time.y * float2(_Direction.x, _Direction.y));


texts: Designing score system: Combos, chains, multipliers and bonuses

texts:
I am making a breakout-clone, I not want only want it to feel "arcade" for home users, but it will have a arcade version (although probably noone will buy, and I will only use the machine to amuse other people...), this make scoring, and high-scores a important part of it, it has no multiplayer, with the community existing around how to score higher and higher scores.

Being a breakout game, if the score is just linear, everyone that "finish" the game, will attain the same maximum score... Obviously this is undesirable, specially because the game DOES have a end, you cannot play it forever until you lose...

So, how to design some decent score system? Currently I added a multiplier, and it increases when you kill several blocks fast, but this has the unintended side effect of creating absurdly high scores near the end of the game when you are highly powerful (yes, my game is not only about batting the ball :P) and can clear a whole bunch of blocks at once...

To make it more clear, you have 5 frames to kill another block and increase the multiplier, on the start of the game, only batting the ball, this only happen when you manage to get the ball stuck behind the wall (something that is desirable to reward... several players plainly have a CRAVING to attempt that), and if you are a MASTER breakout player, you can score on the first five levels something like 100k points... Yet, on one of the late levels, if you use in a mediocre way (not even good way) the powers, you can easily rack-up 2 million points in a single level (and no, my game does not have points padded with 0! Some stuff DO reward you with 1 point, or 10... It is just the multiplier increase of 5 frame kill that skyrocket...)

I want to add more mechanics, fix this one, and make lots of stuff rewardable, stuff that make the screen shine, blink, show pretty stuff and make the player go "WOW, DID YOU SEE THAT?" and tap his friend in the shoulder, and then when he make it on purpose he screams: "HAHAAAA, I AM AWESOME AND YOU SUCK!!! DO IT TOO!! I DARE YOU!!!"

Note: Although the theme here is breakout, no problem in crossing genres, shmups are particularly good in this area, Radiant Silvergun for example was plainly great... But of course, it need to still be applicable on a breakout :)

Meta question: How I create tags? If I really can't, can a moderator put some decent tags for me? Like scoring, or chain-system, or stuff like that? Otherwise we will end with thousands of stuff with the same tags: design, writing and C++... or generic stuff like that.


texts: How to handle player input in online game with ping jitter?

texts:
I'm currently working on an online game and basing my networking architecture around this Source Multiplayer Networking article. However, I'm a little stuck on how the user input works. The article describes that a snapshot of the keyboard/mouse state is sent from the client at the same tick rate the server is running. I am doing this in my game, which seems to me working pretty good, but the simulation on the server is slightly different then the client prediction resulting in the clients player eventually becoming out of sync with the server. I believe this discrepancy is a result of ping jitter.

For example, if the client is sending input every 25ms, theoretically if the server is receiving input every 25ms it will have an identical simulation. However, with any jitter, the server might not receive any input for 30ms for example. This means it will not be able to process the input until the next tick because it didn't arrive on time, and the entity on the server will become out of sync with the client eventually.

What are some methods for solving this issue? Maybe I'm missing something in the Source Multiplayer networking example. If anyone could explain better or provide any advice it would be much appreciated.

Thanks


texts: Is there any way to have fonts in game without making a separate Content Project and adding a .spritefont file in the new 3.3 Monogame? You can now load other resources directly from the Content folder but not spritefonts...


texts: Getting user id from one scene then to the next scene

texts:
I'm new to multiplayer and photon so pardon me if this question is somewhat frequent.

I have successfully set up my project to start from a main menu - waiting room - actual gameplay scene.
However I couldn't search my way through getting a sort of user id from waiting room(ie; order of user joined to waiting room) then use it in the gameplay scene to manipulate sort by score / by hp / etc.

Perhaps I got the while concept of having to identify unique players via such variable? I'm not quite sure. I just got my foot in the multiplayer development realm, so please go easy on me.

// Edit

Sorry for my initial question being quite vague.
Basically, I'm trying to replicate this with Photon.
I've got various things set up but was stuck at where designating individual players to individual player info panels as if captured(Get WHAT to connect to those UI elements I've got set up).

It'd be simple enough even for me if this was a singleplayer, but since it's not I'm also refactoring a lot on the way as well.
Thanks to both of the answers given so far I'm looking into Photon UtilityScripts(To a novice to anything simply directing where to look helps a ton, so thanks again), but since I'm not quite there yet I'll update my progress.


texts: Framerate on AIR for Android - Actionscript 3

texts:
I am currently working on making Android apps using AIR for Android.

This is a sample file and package that I am running to test the FPS and Memory usage of my application while it is not even doing anything,

it appears to hit flat at
6,975,488
FPS:
0

Which from what I can work out is 7 megabytes and a frame rate of 1/0 frames per second...

I was wondering if anyone could help me improve the way I write as3 in order to improve this and get my framerate back up to scratch.

Also I was wondering if people thought it was generally better to mix timeline and package coding or stick to just package/class coding.

Been working on this and my other file for a few days now, I am hoping to get some sleep and solve it in the morning as I know this file is a mess and that there is way too much going on in one file, but I thought after having cut everything out except the base key functions as well as leaving the memory/fps tracer there would bring the fps back up to 60 but it does not appear to have done so.

I have also noticed a blank AIR template running the mem/fps test seems to hit 60fps no problem, I guess I will just have to trace out that data 24/7 while developing so as to keep on top of it.

I apologise because I know my coding is terrible and probably very messy/poorly written.

Thank you for any help in advance.

package com.qr.maze{
import flash.desktop.NativeApplication
import flash.desktop.SystemIdleMode;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.utils.getTimer;
import flash.system.System;
[SWF(width="480",height="800",frameRate="60",backgroundColor="#000000")]
public class menu extends MovieClip{

    public function menu(){
        NativeApplication.nativeApplication.systemIdleMode=SystemIdleMode.KEEP_AWAKE;
        NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN,keyOn);
        NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE,onActivate);
        NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE,onDeactivate);
        NativeApplication.nativeApplication.addEventListener(Event.EXITING,onDeactivate);
        this.addEventListener(Event.ENTER_FRAME,performMemTest);
        this.addEventListener(Event.ENTER_FRAME,performFrameTest);
    }protected function keyOn(e:KeyboardEvent):void{
        if(e.keyCode==Keyboard.BACK){e.preventDefault();}
        else if(e.keyCode==Keyboard.HOME){onDeactivate(null);}
        else if(e.keyCode==Keyboard.MENU){e.preventDefault();}
    }protected function onActivate(e:Event):void{}
    protected function onDeactivate(e:Event):void{NativeApplication.nativeApplication.exit();}
    public function performMemTest(e:Event):void{trace(System.totalMemory);}
    public function performFrameTest(e:Event):void{
        var prevTimer:Number=0;
        var curTimer:Number=0;
        var frames:int;
        frames+=1;
        curTimer=getTimer();
        if(curTimer-prevTimer>=1000){
            trace("FPS: "); trace(Math.round(frames*1000/(curTimer-prevTimer)));
                prevTimer=curTimer;
                frames=0;
        }
    }
}
}


texts: Launching a projectile and landing it in a specific spot with different elevations?

texts:
I have a starting position for a projectile and a target position I want it to land on given an initial x and y velocity.

Doing this on a level field is fairly straightforward but I'm struggling to figure out how to do it on two different levels.

I've crudely illustrated what I'm trying to accomplish:


texts: How does OpenGL know which buffer to draw?

texts:
I have been trying out some OpenGL things and was wondering something:

How does OpenGL know which buffer to draw when glDrawElements is called (since there are three)?

Here's a code snippet (from a tutorial):

    // Use our shader
    glUseProgram(programID);

    glm::vec3 lightPos = glm::vec3(4,4,4);
    glUniform3f(LightID, lightPos.x, lightPos.y, lightPos.z);
    glUniformMatrix4fv(ViewMatrixID, 1, GL_FALSE, &ViewMatrix[0][0]); // This one doesn't change between objects, so this can be done once for all objects that use "programID"

    glm::mat4 ModelMatrix1 = glm::mat4(1.0);
    glm::mat4 MVP1 = ProjectionMatrix * ViewMatrix * ModelMatrix1;

    // Send our transformation to the currently bound shader,
    // in the "MVP" uniform
    glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &MVP1[0][0]);
    glUniformMatrix4fv(ModelMatrixID, 1, GL_FALSE, &ModelMatrix1[0][0]);

    // Bind our texture in Texture Unit 0
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, Texture);
    // Set our "myTextureSampler" sampler to use Texture Unit 0
    glUniform1i(TextureID, 0);

    // 1rst attribute buffer : vertices
    glEnableVertexAttribArray(0);
    glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
    glVertexAttribPointer(
        0,                  // attribute
        3,                  // size
        GL_FLOAT,           // type
        GL_FALSE,           // normalized?
        0,                  // stride
        (void*)0            // array buffer offset
    );

    // 2nd attribute buffer : UVs
    glEnableVertexAttribArray(1);
    glBindBuffer(GL_ARRAY_BUFFER, uvbuffer);
    glVertexAttribPointer(
        1,                                // attribute
        2,                                // size
        GL_FLOAT,                         // type
        GL_FALSE,                         // normalized?
        0,                                // stride
        (void*)0                          // array buffer offset
    );

    // 3rd attribute buffer : normals
    glEnableVertexAttribArray(2);
    glBindBuffer(GL_ARRAY_BUFFER, normalbuffer);
    glVertexAttribPointer(
        2,                                // attribute
        3,                                // size
        GL_FLOAT,                         // type
        GL_FALSE,                         // normalized?
        0,                                // stride
        (void*)0                          // array buffer offset
    );

    // Index buffer
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbuffer);

    // Draw the triangles !
    glDrawElements(
        GL_TRIANGLES,      // mode
        indices.size(),    // count
        GL_UNSIGNED_SHORT,   // type
        (void*)0           // element array buffer offset
    );

I have absolutely no idea how it would possibly know that the first buffer is the one that contains the vertices, and the others non-drawable information like UVs.

Can someone help me with this?

Thanks


texts: Problem with preloading plist file in Cocos2d-x

texts:
I am using Cocos2d-x engine with 3.2 version.

In my splash screen I am prefeching a plist by below line

SpriteFrameCache::getInstance()->addSpriteFramesWithFile("ui.plist");

Now inside game when I am creating a sprite I am getting an assert fail error

Sprite *ss = Sprite::createWithSpriteFrameName("pause.png");

  Assert failed: Invalid spriteFrameName: pause.png

Also when the splash screen is removed, I am getting the below line in console

  cocos2d: TextureCache: removing unused texture:
  D:/cocos2dx/projects/ABCD/Resources/mid/ui.png

Is there anything I need to add or something?
I was doing the same thing for 2.x and was working but not in 3.2

EDIT:
In 3.x if you are calling this line
Director::getInstance()->purgeCachedData();, remember that it will delete all textures from the cache memory. So handle all sprite-sheets manually.


texts:
Hello I am working on a hovering triangle (equilateral triangle). The triangle should allways rotate at a constant speed and hover over the ground. The problem is if I setAngularVelocity it does rise and fall to the ground (repeatingly).

I have been following this tutorial for the hovering.
I rely have bad knowlege about RayCast and box2D (basics).

private float targetHeight = 7;
private float springConst = 100;
private float distanceAboveGround;
private HoverTest callback;
private Vector2 start = new Vector2(),
                end = new Vector2(),
                vec = new Vector2(0, -targetHeight);

private void physics(float delta) {

    float frameTime = Math.min(delta, 0.25f);
    accumulator += frameTime;
    while (accumulator >= Const.TIME_STEP) {
        playerBody.setAngularVelocity(1);

        start = playerBody.getPosition();
        end = playerBody.getWorldPoint(vec);
        world.rayCast(callback, start, end);

        if (callback.isHit()) {
            distanceAboveGround = start.sub(callback.getPoint()).len();
        }

        if (distanceAboveGround < targetHeight) {
            distanceAboveGround += 0.25f * playerBody.getLinearVelocity().y;

            float distanceAwayFromTargetHeight = targetHeight - distanceAboveGround;
            playerBody.applyForceToCenter(0, springConst*distanceAwayFromTargetHeight, true);
            playerBody.applyForceToCenter(0, playerBody.getMass() * -world.getGravity().y, true);
        }

        world.step(Const.TIME_STEP, 8, 3);
        accumulator -= Const.TIME_STEP;
    }
}

EDIT: I found that if i flip the triangle on a other side it falls and then does nothing. I think that has to dowith the end vector (is no longer pointing down).
How could I get it allways point down?


texts: Is it worth to implement game mechanics/rules separately from the main code?

texts:
Not sure whether it fits the scope of this community, or should go to Stackoverflow instead.

Let's suppose that I want my game be easily extendable in its core, i.e. I want that a lot of people, even without decent programming knowledge, would be able to not only tweak existing rules, but even add totally new game mechanics into it. I'm not good programmer myself, but I'm ready to learn, I'm just need some directions and assurance it can be done.

What I've thought about is whether it's possible/feasible to somehow implement game mechanics separately from the main utility code? I mean, for tabletop games we have those rulebooks which don't contain actual algorithms of all actions, but rather describe some protocols and limits, referencing context of each such item heavily. Is it possible to do something similar for PC game, like, describe all the rules in some very high-level, easily readable (and changeable) by a human programming language, which is then "consumed" and parsed by the utility code into a working instance of game mechanics?

That really seems like I need to write my own language and a compiler for it )) Which I won't be able to do, of course. But may be there is an easier approach to the problem?

FYI: my language of choice for the utility code will be Python 3.x


texts: Rendering Unity across multiple monitors

texts:
At the moment I am trying to get unity to run across 2 monitors. I've done some research and know that this is, strictly, possible. There is a workaround where you basically have to fluff your window size in order to get unity to render across both monitors.

What I've done is create a new custom screen resolution that takes in the width of both of my monitors, as seen in the following image, its the 3840 x 1080:

How ever, when I go to run my unity game exe that size isn't available. All I get is the following:

My custom size should be at the very bottom, but isn't. Is there something I haven't done, or missed, that will get unity to take in my custom screen size when it comes to running my game through its exe?

Oddly enough, inside the unity editor, my custom screen size is picked up and I can have it set to that in my game window:

Is there something that I have forgotten to do when I build and run the game from the file menu? Has someone ever beaten this issue before?


texts: Animating sprites at different speed than what the game runs at

texts:
I am building a Javascript/canvas platformer game, and it's coming along nicely. The only problem I've really run into where I can think of any solution at all is the animation of my player sprite.

The game loop is running every 16ms, which equates to 60fps. On every game loop, I'm using a method of my player class (called draw) to draw the player sprite. The sprite looks like this: http://i.imgur.com/uM3Un.png

On every call of the draw method, I am advancing the "frame" of the player sprite, to give the illusion that the player is moving. As far as I know, this is common practice. However, due to my draw method being run every 16ms with the game loop, my player sprite is animating extremely quickly, and it doesn't look realistic at all.

Is there a way to slow this down to a pre-defined speed, or will I have to resort to adding loads of duplicate frames to my player sprite? Obviously that's not a great solution, as to make it look realistic at a game speed of 60fps I'd need to have a LOT of frames.

Here's my relevant code:

// Sets off the main game loop
setInterval("gameLoop()", gameSpeed);

function gameLoop() {
    // Updates
    player.update();

    // Draw
    c.clearRect(0, 0, canvas.width, canvas.height);
    player.draw();
}

// Then in my player class...

this.draw = function() {
        if(this.state == "idle") {
            c.drawImage(this.idleSprite, this.idleSprite.frameWidth * this.idleSprite.frameCount, 0, this.idleSprite.frameWidth, this.idleSprite.frameHeight, this.xpos, this.ypos, this.idleSprite.frameWidth, this.idleSprite.frameHeight);
            if(this.idleSprite.frameCount < this.idleSprite.frames - 1) { this.idleSprite.frameCount++; } else { this.idleSprite.frameCount = 0; }
        } else if(this.state == "running") {
            var height = 0;
            if(this.facing == "left") { height = 37; }
            c.drawImage(this.runningSprite, this.runningSprite.frameWidth * this.runningSprite.frameCount, height, this.runningSprite.frameWidth, this.runningSprite.frameHeight, this.xpos, this.ypos, this.runningSprite.frameWidth, this.runningSprite.frameHeight);
            if(this.runningSprite.frameCount < this.runningSprite.frames - 1) { this.runningSprite.frameCount++; } else { this.runningSprite.frameCount = 0; }
        }
    }


texts: How to determine areas of pixels of different colors or luminosities?

texts:
I want to create a program that determines all the areas of a given picture that have a different color, or the same color with different luminosities.

Are there known algorithms that do this job ? I would love to study such algorithms and implement them.

Thank you in advance for any help.


texts: How can I make part of a JLabel visible under mouse movement?

texts:
The JLabel has an image of a room. I want the mouse to act as a flashlight, and only display around the mouse the part of the JLabel/image that the mouse is hovering over, in a large circumference.

How do I make a part of the JLabel, relative to the position of the mouse, visible only under the location of the mouse?


texts: Separate shader programs or branch in shader?

texts:
I have a bunch of point lights and directional lights. Instead of checking the light type in the fragment shader and then branch for either point light calculation or directional light calculation, is it more efficient to use two separate programs, one for point lights and one for directional lights?

(Using deferred shading in OpenGL 3.3)


texts: how to put elements around circle with equal distance?

texts:
I know circle formula and know how to draw it. but I want put 4 points on it with equal distance from each other. how can I do that?

I work with unity.


texts:
I'm not good with words so here's a picture to describe my problem:

In my game there is this big ball which the user can move on x-axis only. Now, if the ball is falling like the red one, it's blast away. But, with the angle/hit position of the green one it's just kinda sliding on the big ball and falling.

I'm using Box2d above AndEngine on an Android platform.

What is the reason for my green ball problem?


texts: In the GJK algorithm, when is a point ever closer to the origin than a line?

texts:
The GJK algorithm depends upon a function in its loop that updates the simplex and search direction for the next iteration (which is often called something like DoSimplex() or ProcessSimplex()). In order to find the next simplex, the algorithm divides the current simplex into regions, and determines which region contains the origin.

Here is an example of the regions for a 1-simplex (i.e. a line). In this example, the simplex previously only contained point B, and then point A was added in the direction of the origin.

(http://entropyinteractive.com/2011/04/gjk-algorithm/)

Now it makes sense to me why the origin can't be in region 4, since we just came from there. However, I can't think of any case where the origin would be in region 1 either. We just traveled from B to the origin, and if we didn't reach the origin, then we know there was no collision. So won't the origin always be in 2 or 3? Why does every algorithm always check whether the origin is in region 1?


texts: How can I determine the first visible tile in an isometric perspective?

texts:
I am trying to render the visible portion of a diamond-shaped isometric map.
The "world" coordinate system is a 2D Cartesian system, with the coordinates increasing diagonally (in terms of the view coordinate system) along the axes. The "view" coordinates are simply mouse offsets relative to the upper left corner of the view.

My rendering algorithm works by drawing diagonal spans, starting from the upper right corner of the view and moving diagonally to the right and down, advancing to the next row when it reaches the right view edge. When the rendering loop reaches the lower left corner, it stops.

There are functions to convert a point from view coordinates to world coordinates and then to map coordinates.

Everything works when rendering from tile 0,0, but as the view scrolls around the rendering needs to start from a different tile. I can't figure out how to determine which tile is closest to the upper right corner.

At the moment I am simply converting the coordinates of the upper right corner to map coordinates. This works as long as the view origin (upper right corner) is inside the world, but when approaching the edges of the map the starting tile coordinate obviously become invalid.

I guess this boils down to asking "how can I find the intersection between the world X axis and the view X axis?"


texts: In Unity, how can I get trigger enter/exit every frame when I change Time.timeScale?

texts:
In my game I have a power-up that slows everything down.  I keep the player at regular speed by dividing deltaTime by timeScale.  Everything works perfectly except for OnTriggerStay2D which appears to be affected by the timeScale.

I thought I could just use trigger enter and trigger exit, pushing everything up to the update function that IS running every frame, but those are also slowed down and I'd like to keep things accurate to the player perspective.

So, is there any way to force trigger stay, enter or exit to work in regular time after I've changed Time.timeScale?