texts: Converting Euler rotation angles from Z up to Y up (Max to OpenGL)

texts:
I'm working on pulling geometry and it's transformation from a 3DS Max exported FBX (Z-up) to an OpenGL model format (Y-up). The main problem is I intend to keep the transformations as Translation and XYZ rotations.

Right now I pull all position transforms simply going from (x y z) to (x z -y) and everything looks good. However the geometry rotation comes in as Euler angle rotations ( X Y Z ). Rotating these has turned into a nightmare. I know I can get a matrix and just multiply it by the RotX-90 mat but pulling those Eulers back is not reliable.

What seems to almost work is this, and it's what seemed to give correct results most of the time. It jut seems bad for the case ( 92.83, -89.41, 53.53) for example when it looks like it's loosing a 90 deg rotation on X.

Matrix rot90 ( 1,  0, 0, 0,
               0,  0, 1, 0,
               0, -1, 0, 0,
               0,  0, 0, 1);

RotMat = RotX * RotY * RotZ
RotMat = Rot90X * RotMat
Quaternion = Convert from RotMat
NewX = Quaternion.Pitch
NewY = Quaternion.Yaw
NewZ = Quaternion.Roll

I know the god of bit shifting must have some civil way of doing this. Any tips/suggestions would be greatly appreciated.

ps. exporting the FBX with Y up won't work as it just seems to apply a transformation on the root node, not to actually swap vertices y-z positions.


texts: How do game servers / clients handle data?

texts:
How do servers handle data?
I understand the concept of the client sending the player pos and then the server sending back the area to display and also sending other player positions and such.

But how does a server save al the player positions? In its memory or how?

I was thinking about the client walks so it sends x: 100, y:100 to the server
The server validates if the client didn't cheat like walking to fast or through a wall or something and then the server responds with the correct data, other player positions, monster positions and such. Am I miss understanding something how servers work? and how should a server handle / save all the player data? I was thinking at writing everything to the data base once every x minutes?

For the landscape rendering, I was thinking about the server sending back an array with numbers like 1 dirt 2 grass and so on. The recieving client will then display those numbers into goodlooking tiles. Is this a good way to render landscape?

I was like thinking of 2D game like Realm of the mad god.


texts: Unity shader graph: Texturing optimized voxel terrain mesh

texts:
I'm new to shader programming, so I decided to use Unity's shader graph for that.

I have 256x256 texture atlas(like minecraft) with 4 16x16 block textures aligned on X axis

I can successfully assign texture depending on material ID (which is stored in UV.z) to the first block, but I've big issues with trying to make this work correctly for other blocks in the row(or in the 3 rows, cause 3 dimensions).

First block gets textured correctly, but other blocks(even if they are same material) get textures from other part of the atlas. For some reason texture won't repeat itself. (I assume reason is I need to do it myself somehow)

By current optimization, Vertices and UVs are shared between blocks only if they are of the same direction and same material ID.

My shader graph:

Atlas:

As seen in the result, even though all blocks are same material_ID, only the first one gets atlas aligned properly. Others don't.

How would I make this work with other blocks too using shader graph?

PS: How UVs are assigned:

  public static Vector2 ProjectPositionToUV(Vector3 position, Direction normal)
    {
        switch (normal)
        {
            case Direction.Up:
            case Direction.Down:
                return new Vector2(position.x, position.z);
            case Direction.East:
            case Direction.West:
                return new Vector2(position.z, position.y);
            case Direction.North:
            case Direction.South:
                return new Vector2(position.x, position.y);
        }

        // Fallback for an invalid input direction.
        return Vector2.zero;
    }

And

 uv.z = data.cubeType;


texts:
I have high experience In Java and Networking. Our team have built a effective server that can create thread-pools managing many players. But we have hit a brick-wall. The way our server works is that our clients directly all just connect to the server. The client sends information to the server. For example, Client 004 pressed W. And the server calculates and responds. But here's the problem. What exactly do we send over the data stream? Do we send strings and decode them on the client/server side, or serialize objects? Sadly that question is very opinion based. So let me re-phrase it. What data do we send over the stream? For example, you can use W,A,S,D To move around. Im guessing it should look like this.

User Pressed W > Client sends string saying w to server > Server calculates movement > Server sends string saying player position to player > User updates players position.

But then we have to render other players. So we thought about this

User MPressed W > Client sends string saying W to server > Server calculates movement > Server checks if any others players are in the area > Server saves data of all players and yourself into a string and adds positions and sends to client.

Fair enough. But imagine if the server had to send over information, like the other players clothing, their health, mana, position, current animated frame.

The string might look like this:

"Bob, 12, 321, 391.34, 2914.2, Left, 0, False, null, null, sword, null, null"

Just for one player! To be sent over. The string concept is becoming long and tedious.

I have re-wrote this several times. And I still do find it confusing to understand the question myself.

But to shorten it down. How do I create a system where its a mmo really.

We've created the server, client art. We've payed for a large server with ddos protection. But we don't know what to send over the sockets.


texts: C# Game Setting message Takes away first character

texts:
So If you set it to like

  abcdefg

it will come out like

  bcdefg

Here's changing the message

Here's the result

Here's the code

//Set Welcome msg
else if (Type == 6)
{
    if (Character.Network.Stall.isOpened) return;
    short length = Reader.Int16();
    Character.Network.Stall.WelcomeMsg = Reader.Text3();
    Character.Network.Stall.Send(Packet.StallWelcome(Character.Network.Stall.WelcomeMsg));
}

Any help?


texts: In XNA, how do I get forms to display in front of my full-screen game?

texts:
I'm trying to open a form in front of my game, which is full-screen.  However, the form seems to appear only behind the game window.

At the moment, I'm doing this:

protected override void Update(GameTime gameTime)
    {
        if(Keyboard.GetState().IsKeyDown(Keys.Q))
        {
            graphics.IsFullScreen = true;
            graphics.ApplyChanges();
            new Form1().Show();
            // The form is empty, just created.
        }
        base.Update(gameTime);
    }

I can reach the form with AltTab, but this is unfriendly to the user.

How can I do this correctly?


texts: How to model muscle contraction force acting on two bones connected by joint in Unity/PhysX?

texts:
I'm trying to understand what is a correct way to model a muscle contraction in a physics engine like PhysX (Unity3D). Muscle that I'm modelling is connected to a bones in 2 points A and B.

Having a total force for the muscle fTotal, I'm trying to apply two forces in points A and B on corresponding bones, where magnitude of each force is a half of the total force. And of course force vectors are lying on the same AB line and pointing to the opposite directions towards the center of the muscle.

fTotal = ||fA|| + ||fB||

One thing that bothers me is a situation when one bone is fixed in space. Intuitively, all contraction force should be applied only to a single attachment point, however, my model will apply only 1/2 of a force. Can you suggest a better way to implement this?


texts: What is the graphical effect occurring to non-mipmapped distant textures called?

texts:
We all know about mip-mapping. It reduces texture quality when a texture is further away.

Without mip-mapping, a texture appears to "flicker", like the top of the mountain here:

Is there any specific name for it?

I want to write a sentence like "I applied mip-mapping to solve the ___ effect", or "This is known as ___, and occurs when mip-mapping is not used".


texts: How can I transform a Point2f with a matrix on Android?

texts:
I'm developing for Android and I'm using the android.renderscript.Matrix3f class to do some calculations.

What I need to do now is to now is to do something like mat.tranform(pointIn, pointOut);

So I need to transform a matrix by a given Point class. In awt I would simply do this:

AffineTransform t = new AffineTransform();
Point2D.Float p = new Point2D.Float();
t.transform( p, p );

But in Android I now have this:

Matrix3f t = new Matrix3f();
PointF p = new PointF();
// Now I need to tranform it somehow..

But the Matrix3f class in Android doesn't have a Matrix.transform(Point2D ptSrc, Point2D ptDst) method.

So I guess I have to do the transformation manually. But I'm not really sure how that works. From what I've seen it's something like a translate and then a rotate?

Could anyone please tell me how to do this in code?


texts:
I have a script which has a Queue datastructure (code below). This queue holds more than 100 Actions. So currently my script does a yield return null after every Dequeue, which means that one Dequeue() call is executed every frame.

private static readonly Queue<Action> DataQueue = new Queue<Action>();
private bool _isHandlingQueue; // Helper bool to check if Coroutine is active

private IEnumerator HandleQueue()
{
    _isHandlingQueue = true;

    while (DataQueue.Count > 0)
    {
        DataQueue.Dequeue().Invoke();
        yield return null;
    }

    _isHandlingQueue = false;

    yield return null;
}

I'm trying to achieve that multiple Dequeue and Invoke actions take place in the same frame. One Dequeue and Invoke takes between x and y ms, this varies depending on the Action itself.

Example: Lets say the Queue has 100 entries and the game runs at 60 frames per second (minimum). One iteration (Dequeue + Invoke) in the while loop takes about 5 ms in this example. Here is the thing: In this case it is essentially waiting for 11.67 ms for the next frame (16.67 ms each frame at 60fps). I don't want the system to wait, but use the remaining 11.67 ms to Dequeue and Invoke 2 more Actions, so it only waits for 1.67ms each frame. In this ideal case the Queue get's cleared in 34 frames instead of 100 frames.

All help to point me in the right direction is appreciated!


texts:
So I'm running into a bit of a roadblock with the way I'm currently keeping track of game metrics. By "metrics", I mean little bits of information that I can compose together to get useful information about my game. My primary application for this being so that I can detect certain events in the game and disperse achievements.

The way my current system works, I have metrics represented as a long value, where each bit represents a certain metric... for example, there's a flag for enemies, a flag for the player, a flag for a kill, a flag for each weapon, a flag for when a wave starts, etc, etc. I can then compose these into a single value to tell me things like "an enemy of this type was just killed by this weapon". My achievements controller looks at each metric posted in the last update and I have state machines that transition to the next state based on what metrics are posted.

The problem with this method is... I'm quickly running out of bits to use for my long value. I have plenty more weapons I want to add, so this hard limitation on the number of bits I can use as flags means it's probably time to find a better way to keep track of these.

Does anyone have a recommendation? Preferably one that would require the least amount of effort to refactor my current metrics and achievement systems to integrate?

EDIT: Is there a better term than "metric" to use? I haven't been able to find articles on this topic of game engine design because whenever I use the word "metric", all I find are articles about revenue-related analytical metrics.


texts:
I'm creating a simple game in python that will follow the same logic of DDTank and Worms. The graph is formed by characters. The buildings that will be destroyed are formed by '*', players are '@' and the projectile I still did not think the character. For now I did the part that draws the buildings with a random height.

But I was thinking the logic of launching projectiles. I learned in physics classes some formulas for oblique launch. So wanted to know if these formulas would fit in a computer program or I would have to invent another logic?

Formulas:

vx = v0 . cos ?
x = vx * t
v0y = v0 * sen ?
y = v0y * t + g * t² / 2


texts: How do I put a game on miniclip or addinctinggames?

texts:
I finished making a java game recently, and I would like to put it on a website such as Miniclip.com or AddictingGames. How would I do this?

I have one more question. I know these sites could run Flash games, but what about Java games? If they can't, is there any other website analogous to those that would?

My reason for this is that I am planning on launching this game on Android, and I would like to get some feedback for this game and have some people be familiar with the game before it launches.


texts:
I have some SDL code that, before creating a Window and a Renderer, detects the display DPI using SDL_GetDisplayDPI, to properly scale textures late on for different types of monitors (for instance my MacBook Pro's monitor returns a DPI of 258, while my external Dell monitor returns 93).

When I use 2 monitors, SDL_GetNumVideoDisplays properly returns 2, but I couldn't find any function in SDL that would get me which monitor the window is running in, to call SDL_GetDisplayDPI with the correct index, nor any way to detect when the window is dragged from one monitor to the other.

Is there a way to do those things in SDL, or is there a tutorial somewhere that would explain how to do that (hopefully in a platform-independent way)?


texts:
I'm creating a logic game based on Fox and Hounds game. The player plays the fox and AI plays the hounds. (as far as I can see) I managed to make the AI perfect, so it never loses. Leaving it as such would not be much fun for human players.

Now, I have to dumb-down the AI so human can win, but I'm not sure how. The current AI logic is based on pattern-matching - if I introduce random moves which make the board go out of pattern space the AI would most probably play dumb until the end of the game.

Any ideas how to dumb down the AI in such way that is does not go from "genius" to "completely dumb" in a single move?


texts: How to rotate an image in pygame without losing quality or increasing size or moving position

texts: I am trying to make a game in which I place a spaceship (its an image I downloaded) in the center and then rotate it on its place. However, when I use pygame.transform.rotate(), it rotates the image and changes its location and keeps on increasing its size. I have tried pygame.transform.rotozoom but even when I used scale 1, it didn't show any difference. And also when it rotates and blits the image onto the screen the image severely loses its quality. Pleaseee helpp!!


texts:
I have made a game in Libgdx(eclipse).I changed the name of the app inside the
string.xml file.Now I have an error in AndroidManifest.xml. in this line:
  android:label="@string/app_name" (line 12).
its written:" No resource found that matches the given name (at 'label' with value '@string/app_name')."
what is the solution?


texts:
I am currently trying to find some alogorithm for agent avoidance in 3D (or for simplicity, 2.5D could be enough).

So far, I have been using variation of RVO - "Reciprocal Collision Avoidance" (C++ implementation from http://gamma.cs.unc.edu/RVO2/). They have 2D and 3D version. However, 3D is designed for planes, so agents are kind of "flowing" in the air during avoidance.

2D version is working correctly, but only in a plane. If I elevate agent to copy terrain (set its Z-position manually), the avoidance looks sometimes weird, because the actual distance is big, but the projected distance in XY plane is small and thus result in collision.

Other algorithm derivates from RVO are similar, designed only for 2D. Before I start to "editing" my current solution, is there something created directly for purposes of 2.5D (or 3D)?


texts: Can someone help me with my mario-inspired timer scoring system?

texts: I am new to GameMaker's coding language or GML. I have learned and done a lot so far, but now i am having a problem. I have a countdown timer starting at 5 minutes counting down and I want the player to receive points based on how much time is left kind of like in Super Mario Bros. along with the points accumulated for performing other tasks. How do I go about doing this with the coding language? Thanks in advance!


texts: I'm trying to get back into Unity and I've been playing around with lighting. I modelled a simple lightbulb in Maya and have been trying to create a hanging ceiling light but I'm struggling to get it to work. No matter where I place the point light, it appears to originate from the ceiling and the bulb remains dark. Ideally, I would like the light to originate from inside the bulb and spread across most of the room, while also making the bulb glow. I'm sure this is a simple task but I would really appreciate any tips in the right direction. Thanks


texts: How to keep two objects in the same zone when they collide?

texts:
I made a zone out of a cylinder with zero height. When one sphere moves to that zone it is fine but if another one moves to the same zone it only shows one sphere.

I tried to add a rigid body for each sphere but they collide inside the cylinder and both fly. I want both of them to collide but stay inside the cylinder zone with a distance between them like 2 units.


texts:
I have successfully implemented a simple pathfinding routine as described in this Wikipedia article:

https://en.wikipedia.org/wiki/Pathfinding#Sample_algorithm

I used the "sample algorithm", which starts at the endpoint, words across the grid by hopping to adjacent cells, counting the hops as it goes, and then using the number of hops to track the path back from the start to the end point. It works well, and is fairly fast.

The only problem I have is that the loop for calculating the path never breaks if there is no route to the destination (i.e. if the path is blocked).

I have considered limiting the number of rounds for the calculation; the maximum possible steps on the board will be (rows*columns)-1, so in a 10*10 grid, if a path hasn't been found within 99 rounds, there is no path. However, this could be very wasteful, for example if the start point is within a very confined space with only a few possible moves around it.

I'm writing in Cocoa + Objective-C, but I wouldn't have thought that makes a difference, as this seems to be a logical issue rather than one regarding the framework I'm developing in.


texts: My Single Pass Gaussian Blur Looks Awful

texts:
I've based my shader on this single pass shadertoy here:
https://www.shadertoy.com/view/XdfGDH

I applied the same shader and it looks like this:

Scaled up so you can see the faint tears in the texture. They look grid-like and not smooth at all.

When it should be looking like this:

Source image:

Here's my shader. Translated the shadertoy to GLSL 110

#version 110
uniform sampler2D texture;

float normpdf(float x, float sigma)
{
  return 0.39894*exp(-0.5*x*x / (sigma*sigma)) / sigma;
}

void main()
{
  vec3 c = texture2D(texture, gl_TexCoord[0].xy).rgb;

  const int mSize = 11;
  const int kSize = const int((float(mSize) - 1.0) / 2.0);
  float kernel[mSize];
  vec3 final_color = vec3(0.0);

  // Create the kernel
  float sigma = 7.0;
  float Z = 0.0;
  for (int j = 0; j <= kSize; ++j)
  {
    kernel[kSize + j] = kernel[kSize - j] = normpdf(float(j), sigma);
  }

  //get the normalization factor (as the gaussian has been clamped)
  for (int j = 0; j < mSize; ++j)
  {
    Z += kernel[j];
  }

  //read out the texels
  for (int i = -kSize; i <= kSize; ++i)
  {
    for (int j = -kSize; j <= kSize; ++j)
    {
      final_color += kernel[kSize + j] * kernel[kSize + i] * texture2D(texture, (gl_TexCoord[0].xy + vec2(float(i), float(j)))).rgb;
    }
  }

  gl_FragColor = vec4(final_color / (Z*Z), 1.0);
}


texts: How to make players be creative in a game, if the game cannot evaluate it?

texts:
I am working on a prototype game with several funny/visual effects that the player can trigger. The player can be quite creative in the way to use or combine these effects but it seems impossible to make detect/evaluate this creativity by the computer.

So, from a game design perspective, I wonder what could be the features to drive the players to be creative (experiment various combinations).

For the moment i think about "Draw something" where the result is evaluated by other players. I think about levels designed by "Little Big Planet" players but this aspect is out of the core game. I think also about "Minecraft" but I do not understand really how this game encourages the people to be creative (except of the open world).

Please tell me if you have any ideas, articles or references that could help me coping with this problem.


texts: Game networking topology - dealing with host leaving

texts: I am working on a P2P game in Flash and I'm wondering what network topology would be most robust for dealing with people randomly joining/leaving. I was thinking the first user to join could be the host, but if the host leaves the whole session would be killed. I am looking for a way to deal with this with no (or little) disruption.


texts: How to draw tile edges when you don't know where they're going.

texts:
This is more of an art question than a programing one but still game development.

I have a tile engine that makes a map randomly from tiles, each tile is a square 3x3 grid. The problem is that while the elements on each tile work well together such as having forests along the top three squares and grass on the other 6, the engine could put the forrests against anything such as rivers, grass, mountains or more forest.

how can i draw the edges of the tiles so the look good no matter what they are places against ?


texts: Why is my texture drawn in a different place when in fullscreen?

texts:
I'm trying to draw a texture (with a crescent moon) in the middle of the y-axis:

public void draw(SpriteBatch batch) {
    batch.draw(lune, 0, Gdx.graphics.getHeight() / 2);
}

It renders this when windowed:

And in full screen mode:

I don't understand why it doesn't work since I'm always drawing at the top of the middle in the y-axis.

I add a little update to what i do exactly :

        @Override
    public void resize(int width, int height) {
            this.levelDatas.screenWidth = width;
            this.levelDatas.screenHeight = height;
            this.levelDatas.lune.updateSize(width, height);
    }

My render method :

        @Override
    public void render(float delta) {
            Gdx.gl.glClearColor(0, 0, 0, 1);
            Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
            this.levelDatas.batch.begin();
            this.background.draw(this.levelDatas.batch);
            this.levelDatas.lune.draw(this.levelDatas.batch);
            this.levelDatas.batch.end();
            [...]

And this is the updateSize and draw method for the "Lune" object :

public void updateSize(int width, int height) {
    this.widthScreen = width;
    this.heightScreen = height;
}

public void draw(SpriteBatch batch) {
    batch.draw(new TextureRegion(lune), 0, this.heightScreen / 2, 0, 0, this.lune.getWidth(), this.lune.getHeight(), 1f, 1f, 0);
}

Still got the problem !


texts:
I have a java code (game) which runs at 3200 frames per second on my PC. On my laptop, it runs with 100 frames per second, despite the fact they have very similar hardware.

I think the issue might be related to the GPU, since on the laptop it never uses the dedicated GPU.

I know this is a complex question so I will try to give every information regarding this issue.

Originally, the laptop only had 30 FPS, which grow to 50 FPS after changing the preferred GPU in nvidia settings.

After fully disabling the integrated GPU, the FPS went from 50 to 100, still, is nowhere close to the PC.

The PC has around 30% GPU usage when running the game.

The laptop has 0% GPU usage when running the game.

Both machines have the same java version.

I tried it on a second laptop, with 1 integrated GPU and 1 dedicated GPU, it fully behaved like the first laptop. (no GPU usage, low FPS)

I do not understand.

Thank you.

EDIT:

The code below alone lags on the laptops.

int xStart = (int) Math.max(0, handler.getGameCamera().getxOffset() / Tile.TILEWIDTH);
    int xEnd = (int) Math.min(width, (handler.getGameCamera().getxOffset()
        + handler.getWidth()) / Tile.TILEWIDTH + 1);
    int yStart = (int) Math.max(0, handler.getGameCamera().getyOffset() / Tile.TILEHEIGHT);
    int yEnd = (int) Math.min(height, (handler.getGameCamera().getyOffset()
        + handler.getHeight()) / Tile.TILEHEIGHT + 1);

    for(int y = yStart; y < yEnd; y++) {
        for(int x = xStart; x < xEnd; x++) {
            getTile(x, y).render(g, (int) (x * Tile.TILEWIDTH
                - handler.getGameCamera().getxOffset()),
                (int) (y * Tile.TILEHEIGHT - handler.getGameCamera().getyOffset()));
        }
    }
```


texts:
I believe that there is a significant market of players who would enjoy the exploration and interaction aspects of MMORPGs, but simply don't have the time for the endless grinding marathons which are part of the average MMORPG.

MMORPGs are all about interaction between players. But when different players have different amounts of time to invest into a game, those with less time to spend will soon lack behind their power-leveling friends and won't be able to interact with them anymore.

One way to solve this would be to limit the progress a player can achieve per day, so that it simply doesn't make sense to play more than one or two hours a day. But even the busiest casual players sometimes like to spend a whole sunday afternoon playing a video game. Just stopping them after two hours would be really frustrating. It also creates a pressure to use the daily progress limit every day, because otherwise the player would feel like wasting something. This pressure would be detrimental for casual gamers.

What else could be done to level the playing field between those players who play 40+ hours a week and those who can't play more than 10?

Edit: Thanks for all of your answers. They all were very inspiring and gave me some interesting ideas. I decided that the first thing I will do will be a rest mechanic, so I accepted the answer by Orin MacGregor. But I upvoted a lot of other answers, too. When you are interested in my first draft for the rest mechanic, you can read about it on my development blog: http://ontraindevelopment.blogspot.com/2012/10/rest-system.html


texts:
I would like to start developing my own game. Basically, the game has a "world" that players can travel around and modify. Think of it as a much more realistic version of Minecraft or an open world MMO.

I have thought of two possible ways of designing the server, both with problems.

The first is a single threaded design where one thread handles all the game mechanics and player interactions. The problem with this is that it cannot fully utilize a processor, and if one player does actions that cause lag, all players will experience that lag.

My next idea was that there is a separate thread for each player that renders the terrain around the player, handles physics, NPC interaction, etc. With this approach the CPU could be fully utilized and one player causing lag wouldn't affect others. However, the problem is keeping the different threads in sync. The entire server must be on the same "clock," (same day/night cycle, certain things take a certain amount of time, etc.), i.e., the different threads must be synchronized. However, this raises the problem that if one player's thread is lagging behind, the only way to synchronize the other threads would be to also cause them to lag, and this would eliminate one of the big advantages of a multithreaded game server, not to mention that keeping everything in sync can become extremely complicated.

So my question is, what would be the best way to design the game server using a multithreaded design where the server is kept in sync and one player causing lag won't affect others? Or is this even possible without dropping a significant amount of game ticks?


texts:
I'm trying to stick some blocks together, but frankly I have no idea what I'm doing. I spawn 2 blocks during run time, and if they have an on hit event they're supposed to stick to each other.
It struck me that I'm not even sure if that's what attach does, and maybe it has some completely different meaning.
with the following blueprints, I'm getting all sorts of errors like "already attached" and "can't attach actor to actor, already attached"
https://imgur.com/a/16Zz2eS
Any help appreciated


texts: Prevent VS Code opening the Unity scripts twice

texts:
Is it possible to prevent VS Code opening the Unity scripts twice?

E.g. I opened Unity project, double clicked a script and got my project (Assets folder) opened in VS Code, now I go to Unity make a few changes and open another script file. The script file opens another instance of the VS Code. I would like to have the file opened in the currently opened instance instead of opening a new one. Is it possible?

Thank you.


texts: What causes the car in the Vehicle Advanced template to rotate in the air?

texts:
If you start a project with the Vehicle Advanced template, move the car high up, and press play, the car will rotate forwards as it falls. As far as I can tell, most things within Unreal Engine will maintain a given orientation as they fall. This is true for car in the regular Vehicle template, as well.

What causes Vehicle Advanced to behave this way? And is there a way to stop this behavior?


texts:
I found that A* is an algorithm for grid (or tiled) maps. I want to use it or some alternative of it to my game. The problem is that I have no grid. I have canvas and GameObjects could be at position { x: 23.91324512, y: 131.12334253461 }. How would you do this?

And another question, I have element with stepSize (concretely called movementSpeed), and getPosition().getX(), getPosition().getY() AND getRadius() which returns the radius of a circle.

How would you do A* algorithm with radius?

Btw I am implementing it in Java, so maybe some Java snippet would be helpful.

EDIT

As you may suggest me to create a virtual grid, how do I check if I can move to the next node when I have my getRadius() and all the obstacles getRadiuses


texts:
Lately, I've been learning some OpenGL for fun, and I've been thinking about hidden surface removal.

Say you have a high poly count static scene, with nothing that moves, no bones, physics, etc. Just static models to be drawn. I was thinking that you could put all the faces in the scene into a quad/octree. And with the camera position, and dimensions of the view frustum, you could traverse the tree to construct an index buffer of all the faces that are within the view frustum (facing towards you of course). You could then update the index buffer with glBufferSubData(), and draw with glDrawElements(), and you would do this every frame, and if my limited understanding is correct, this should theoretically draw only the faces you see, right?

So is this a good/valid way to do occulusion culling? If not, how else can you do it?


texts:
How would it be possible to create an inverse depth mask? In this case, I refer to a depth mask as a shader attached to a mesh that 'pokes a hole' through the current camera layer to let you see the camera render layer one depth down, usually by using ColorMask 0.

What I want is for, instead, the mesh to determine what ISN'T cut out, without everything that is NOT seen through the mesh being cut out.


texts: Creating Multiple Render System to Draw Different Entities in Entity-Component-System

texts:
When creating ECS based game engine, do you (or can I) create multiple rendering systems?

Let's say I have an Entity class which is the basic unit in my engine, all it can do is add, remove and get components attached to it.

I have a Component class which is just a class where other components can derive from and holds data that can be used to define an Entity.

And I have a RenderSystem with a Draw method that accepts the Entity to be drawn.

  My questions is, do I have to (or can I) create different derivations
  of RenderSystem to satisfy different rendering?

One example is when rendering sprites do I have to create a separate SpriteRenderSystem and with animations do I have to create AnimationRenderSystem? Also I have a World class which manages everything, with Entity & Component managers and Systems in it. That class has an Update and Draw method. So do I have to check if the Entity being processed is of a specific type SpriteEntity or AnimationEntity and use a specific renderer?

// World class
...
void Draw()
{
    // Loop through all entities
    for (...)
    {
        // Check for specific entities
        if (entities[i] is SpriteEntity)
        {
            // Call specific sprite renderer
            _spriteRendererSystem.Draw(entities[i]);
        }
        else if (entities[i] is AnimationEntity)
        {
            // Call specific animation renderer
            _animationRendererSystem.Draw(entities[i]);
        }
    }
}

Is this a good practice? Is this the right way? Is this fast?
Thanks for any answer.


texts: Initializing entities vs having a constructor parameter

texts:
I'm working on a turn-based tile-based puzzle game, and to create new entities, I use this code:

Field.CreateEntity(10, 5, Factory.Player());

This creates a new Player at [10; 5]. I'm using a factory-like class to create entities via composition.

This is what the CreateEntity method looks like:

public void CreateEntity(int mX, int mY, Entity mEntity)
{
    mEntity.Field = this;
    TileManager.AddEntity(mEntity, true);
    GetTile(mX, mY).AddEntity(mEntity);
    mEntity.Initialize();
    InvokeOnEntityCreated(mEntity);
}

Since many of the components (and also logic) of the entities require to know what the tile they're in is, or what the field they belong to is, I need to have mEntity.Initialize(); to know when the entity knows its own field and tile.

The Initialize(); method contains a call to an event handler, so that I can do stuff like this in the factory class:

 result.OnInitialize += () => result.AddTags(TDLibConstants.GroundWalkableTag, TDLibConstants.TrapdoorTag);
 result.OnInitialize += () => result.AddComponents(new RenderComponent(), new ElementComponent(), new DirectionComponent());

This works so far, but it is not elegant and it's very open to bugs. I'm also using the same idea with components: they have a parameterless constructor, and when you call the AddComponent(mComponent); method in an entity, it is the entity's job to set the component's entity to itself.

The alternative would be having a Field, int, int parameters in the factory class, to do stuff like:

new Entity(Field, 10, 5);

But I also don't like the fact that I have to create new entities like this.
I would prefer creating entities via the Field object itself.

How can I make entity/component creation more elegant and less prone to bugs?


texts:
I'm currently experimenting with movement in a isometric perspective world and i'm thinking about how the movement should work. The movement can be either by WASD or gamepad.
Since the player can rotate the camera, what do you feel make a more natural movement? Pressing up would always move the character to the world z like this:

Or is it more natural to move forward in the characters direction when pressing up like this:


texts: Do complementary shadows make sense for games?

texts:
According to color theory, shadows work better if they don't use pure blacks or grays, but instead use a color that's complementary to the color of the object casting that shadow.

That is, if you have a red apple, you should use a dark green shadow; for a yellow banana, a dark violet shadow.

But in many games, you cannot always predict what kind of background or environment the shadow will appear in, and you may not have the luxury of having dynamic shadow colors. In such cases, does it still make sense to use complementary shadows, or is a neutral black or gray acceptable?


texts: D3DXMatrixDecompose gives different quaternion than D3DXQuaternionRotationMatrix

texts:
In trying to solve this problem, I tracked down the problem to the conversion of the rotation matrix to quaternion. In particular, consider the following matrix:

-0.02099178 0.9997436  -0.008475631 0
 0.995325   0.02009799 -0.09446743  0
 0.09427284 0.01041905  0.9954919   0
 0          0           0           1

SlimDX.Quaternion.RotationMatrix (which calls D3DXQuaternionRotationMatrix gives a different answer than SlimDX.Matrix.Decompose (which uses D3DXMatrixDecompose). The answers they give (after being normalized) are:

                            X            Y             Z            W
Quaternion.RotationMatrix   -0.05244324  0.05137424    0.002209336   0.9972991
Matrix.Decompose             0.6989997   0.7135442    -0.03674842   -0.03006023

Which are totally different (note the signs of X, Z, and W are different). Note that these aren't q/-q (two quaternions that represent the same rotation); they face completely different directions.

I've noticed that with matrices for rotations very close to that one (successive frames in the animation) that the Matrix.Decompose version gives a solution that flips around wildly and occasionally goes into the desired position, while the Quaternion.RotationMatrix version gives solutions that are stable but go in the wrong direction. This is only for the right arm in my animation -- for the left arm, both functions give the correct solution, which is the same quaternion within error tolerances.

This makes me think that there's some sort of numeric instability or weird stuff with signs going on. I tried implementing this and then this, but both gave me a completely incorrect solution (even for the matricies where the SlimDX ones were working correctly) -- maybe the rows and columns are flipped?


texts: I was wondering whether I can use APNs in iOS to trigger an event in my game, like start a scene without user clicking the notification. Is it possible to use remote push notifications for events like this?


texts: "Invalid call. Nonexistent function 'travel' in base 'Nil'."?

texts:
I was perfect as I could possibly be with this code but for some reason every time I try to play the game it just breaks. It says "Invalid call. Nonexistent function 'travel' in base 'Nil'." So I'm pretty sure I gotta reinstall Godot because there's legit nothing wrong with the code. I triple checked and it should be working just fine. The issue is with the onready var animationState but that doesn't make sense because there's nothing wrong with that line of code. No typos, no anything. I just want the animations to play when they are moving and not moving. Can someone please tell me what the heck is wrong with this before I throw my computer out the window? Thanks.
extends KinematicBody2D

const ACCELERATION = 500
const MAX_SPEED = 80
const FRICTION = 500

var velocity = Vector2.ZERO

onready var animationPlayer = $AnimationPlayer
onready var animationTree = $AnimationTree
onready var animationState = animationTree.get("perameters/playback")

func _physics_process(delta):
    var input_vector = Vector2.ZERO
    input_vector.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
    input_vector.y = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up")
    input_vector = input_vector.normalized()

    if input_vector != Vector2.ZERO:
        animationTree.set("parameters/Idle/blend_position", input_vector)
        animationTree.set("parameters/Walk/blend_position", input_vector)
        animationState.travel("Walk")
        velocity = velocity.move_toward(input_vector * MAX_SPEED, ACCELERATION * delta)
    else:
        animationState.travel("Idle")
        velocity = velocity.move_toward(Vector2.ZERO, FRICTION * delta)

    velocity = move_and_slide(velocity)


texts:
I'm trying to build play with MonoGame and I'm trying basing this regarding the GameTime steps.
In my main Game class that is being run in the main entrypoint of my project, I'm doing something like that:

gameScreen.IsFixedTimeStep = true;
gameScreen.TargetElapsedTime = TimeSpan.FromMilliseconds(1000d / 120);

With a TargetElapsedTime at about 8ms, the "Draw" method of my current screen should display an ElapsedGameTime of 8ms but it's always displaying me 16ms.

Is it normal? Can't we go lower than 60fps in FixedTimeStep?
I've tried to make a custom loop on another running at 120 fps (without going through the MonoGame pre/post-draw) and it's running correctly.

Can you guys give me some hint?

[EDIT - Add more info]
I've fetched few answers before asking my question and some people were talking about the Vsync issue. So i've set up this:

_graphics.SynchronizeWithVerticalRetrace = false;

But the result is the same


texts: GMod Lua Scripting - Playing sounds only for specified player entities

texts: I'm making a game mode for Garry's Mod, and I'm trying to write a system in which I play sounds only for certain players. The problem I'm running across is that doing so from server-side would take a lot of bandwidth, but I'm not sure how I could reliably do it from the client side. None of the Garry's Mod sound functions seem to take player entity arguments, and surface.playsound would resort back to the method of server telling the client what sounds to play for every sound played.


texts: Looking for some insight on level mangment

texts:
So, i'm creating this little music game as and exerciseand want to do it as "Correct" as possible.

The game works like this:

The player gets a short melody played to them ("C4","D4","E4","C4")
Then the player has to play it back.
The notes in each level are at the movment stored in arrays as strings, and each level has a class(Level1, Level2 etc...).

I'm thinking this can be difficult to manage as a create more complex levels. And I really want to be able to add Levels via the internet without having to update the app.

Would it be better to have a "LevelMangager" that loads inn XML data on runtime?

I'm using the starling framework and i want it to be able to run on Mobile to.

As you probably can tell i'm fairly new to game dev. so all insight is appreciated


texts:
I'm making AI to tell a minion to chase and attack the player.

I played Magicka, and the minion follows the player in a nice curved manner (left image), rather than what I currently have (right image), where the minion just keeps reacting the the player's changes in X,Y.

The code I have makes the chasing minion appear to move in a blocky way as it keeps trying to have its coordinates == the player's coordinates:

    if (enemy.pos.x <= game.data.playerX) {
        enemy.body.vel.x += enemy.body.accel.x * me.timer.tick;
    }
    else {
        enemy.body.vel.x += -enemy.body.accel.x * me.timer.tick;
    }
    if (enemy.pos.y <= game.data.playerY) {
        enemy.body.vel.y += enemy.body.accel.y * me.timer.tick;
    }
    else {
        enemy.body.vel.y += -enemy.body.accel.y * me.timer.tick;
    }

How can I achieve a more smooth transition effect?


texts: Design Pattern for Social Game Mission Mechanics

texts:
When we want to design a mission sub-system like in the The Ville or Sims Social, what kind of design pattern / idea would fit the best? There may be relation between missions (first do this then this etc...) or not. What do you think sims social or the ville or any other social games is using for this?

I'm looking for a best-practise method to contruct a mission framework for tha game. How the well-known game firms do this stuff for their large scale social facebook games?

Giving missions to the players and wait players to complete them. when they finished the missions, providing a method to catch this mission complete events considering large user database by not using server-side not so much to prevent high-traffic / resource consumption.

how should i design the database and server-client communication to achive this design condidering this trade-off.


texts: Can you suggest a game development Institute? I am a newbie programmer and is really interested in developing my own game using C++ or other programming language. I would like to enroll my self in an institution who offers this kind of course?


texts: Program compiled with assimp will not start

texts:
I have recently updated my game engine source code to use the visual studio(2017) vc141 toolkit.

I am using Assimp 3.1.1 for model loading. The project compiles and links, and the appropriate dll's are in the debug folder for the solution.

To begin with I was getting a missing dll error "assimp-vc140-mt.dll", which disappeared, when I redownloaded the library, and replaced the dlls/libs/includes, in my solution.

But now, when I try to run the program I get:

"The application was unable to start correctly (0x000007b). Click OK to close the application."

I've never seen this error before. Could this be related to the new toolkit?


texts:
I'm not very familiar with animations but as far as I know, most of the animations are done frame by frame. For example animating a character walking etc. However, let's imagine this scene:

There's a man coming from the left towards the sign. It's easy to animate this. But when he comes to the sign, he picks it up and starts waving with it. Now this is something I don't know how to do. What is generally the recommended way to do this kind of animation (two separate objects)? Specifically we're talking about android live wallpaper here (probably made with libgdx but I can use anything if it's better for me).


texts:
What does it mean to bake lightmap ? I heard this in Unity3d, and again found this LightUp plugin for sketchup that bakes lightmap.

From what I observe, the lightmap baked gives the 3d object a much more realistic feel. Is the purpose of baking light on object to give that cg animation look you see on pre-rendered animations?


texts:
I am using libGDX and I have problems implementing the box2d fixed timestep with interpolation.

This is my code:

private void updateWorld() {

    accumulator += Gdx.graphics.getDeltaTime();

    while (accumulator>= step) { // The step is 1/10

        copyCurrentPosition();

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

    interpolate(accumulator / step);
}

private void copyCurrentPosition() {
    prevPosition = new Vector2(player.body.getPosition().x, player.body.getPosition().y);
}

private void interpolate(float alpha) {
    player.body.setTransform(player.body.getPosition().x * alpha + prevPosition.x * (1.0f - alpha), player.body.getPosition().y * alpha + prevPosition.y * (1.0f - alpha), 0);
}


texts: Sign APK of several games with same or different key?

texts:
When you choose a key for signing your APK for publishing in GooglePlay, you need to care of this key for the next 25 years if you want to do updates.

The key should not be shared with anyone.
The key should not be lost.

If you do several games, you face the question of having your key DeveloperName and sign all games with it, or have multiple keys like DeveloperName_GameOne for one game, DeveloperName_GameTwo for another, and so on.

Google says here http://developer.android.com/intl/es/tools/publishing/app-signing.html that if you sign several APPs with the same key, they may talk to each other. So it seems that having all with one key will allow future interoperability between games easier.

Instead, if at some point someone wants to buy you one of your games, but not the other, you don't want to give the keys to the non-sold games but still you don't want the buyer to break the update-flow. So it seems that having each game with a different key is better.

Question 1

What exact benefeits will one have if one signs 2 games with the same key? Is that necessary? Is that worth for future interop between games?

Question 2

What is the correct practice for an indie doing several games regarding the signature of them?


texts: XNA Texture.GetData "Size of the data passed in is too large or too small for this resource."

texts:
I am attempting to retrieve the color data for a given sprite located on a texture atlas by creating a new color and passing a source rectangle width and height for the given sprite. I am then passing this color variable into XNA's Texture.GetData method, as seen below. When this code is executed at runtime I receive the following message "Size of the data passed in is too large or too small for this resource."

Texture2D texture = level.Tiles[x, y].Texture;
Rectangle source = level.Tiles[x, y].Source;

Color[] colorData = new Color[source.Width * source.Height];
texture.GetData(colorData);

As far as I am aware this approach should work as it has worked previously with other spritesheets within the application. Could someone please explain why such a message would be thrown in the first place and how I may resolve it?


texts: How can I adjust steer angle based on speed in Unity?

texts:
I'm following this (https://www.youtube.com/watch?v=kAEpLX3rfms) video on how to make a car in Unity. But my car doesn't lower the steering angle based on the speed of the video. The idea was that you can steer the car at a max of 50 degrees at the slowest and then 10 degrees at the fastest. But it's having no effect on the car. Could someone show me how to fix this?

Code:

public WheelCollider wheelFL;
public WheelCollider wheelFR;
public WheelCollider wheelRL;
public WheelCollider wheelRR;

public Transform wheelFL_Trans;
public Transform wheelFR_Trans;
public Transform wheelRL_Trans;
public Transform wheelRR_Trans;

public float maxSpeed;
public float lowSpeedSteerAngle;
public float highSpeedSteerAngle;
public float Torque;
public float centerOfMassHeight;

private float currentSteerAngle;
private Vector3 com;
private Rigidbody rigidBody;

void Start () {
    rigidBody = GetComponent<Rigidbody>();
    com = rigidBody.centerOfMass;
    com.y = centerOfMassHeight;
    rigidBody.centerOfMass = com;
}

void FixedUpdate () {
    wheelRL.motorTorque = Torque * Input.GetAxis("Vertical");
    wheelRR.motorTorque = Torque * Input.GetAxis("Vertical");

    //Here is the part with the issues

    float speedFactor = GetComponent<Rigidbody>().velocity.magnitude / maxSpeed;
    currentSteerAngle = Mathf.Lerp(highSpeedSteerAngle, lowSpeedSteerAngle, speedFactor) * Input.GetAxis("Horizontal");
    wheelFL.steerAngle = currentSteerAngle;
    wheelFR.steerAngle = currentSteerAngle;
}

void Update () {
    wheelFL_Trans.Rotate(0, 0, wheelFL.rpm / 60 * 360 * Time.deltaTime);
    wheelFR_Trans.Rotate(0, 0, wheelFR.rpm / 60 * 360 * Time.deltaTime);
    wheelRL_Trans.Rotate(0, 0, wheelRL.rpm / 60 * 360 * Time.deltaTime);
    wheelRR_Trans.Rotate(0, 0, wheelRR.rpm / 60 * 360 * Time.deltaTime);

    Vector3 wheelSteerAngle = wheelFL_Trans.localEulerAngles;
    wheelSteerAngle.y = currentSteerAngle + 90;
    wheelFL_Trans.localEulerAngles = wheelSteerAngle;
    wheelFR_Trans.localEulerAngles = wheelSteerAngle;

    if(Input.GetKeyDown(KeyCode.P)){
        Vector3 resetPosition = new Vector3(transform.position.x, 1.5f, transform.position.z);
        Quaternion resetRotation = Quaternion.Euler(0f, 0f, 0f);

        //Reseting Velocity
        GetComponent<Rigidbody>().velocity = new Vector3(0f, 0f, 0f);

        //Reseting Rotation
        transform.rotation = resetRotation;

        //Reseting Position
        transform.position = resetPosition;

        //Reseting Motor Torque and Steering Angle
        wheelFL.motorTorque = 0f;
        wheelFR.motorTorque = 0f;
        wheelRL.motorTorque = 0f;
        wheelRR.motorTorque = 0f;

        wheelFL.steerAngle = 0f;
        wheelFR.steerAngle = 0f;
        wheelRL.steerAngle = 0f;
        wheelRR.steerAngle = 0f;
    }

}


texts:
I am trying to make the player die when it hits the rock or the time is up and the score is not reached, in this code at the first if statement it works when  Rockhit is true, the player jump and disappear at the bottom of screen and the music is work very well, but when the time is 0 and score is not reached , the player is jump and keeps going out of the top of screen and the sound is work but slow and not clear. (notice: that before I adding the Rockhit condition the player was going up out of screen and the voice wasn't clear)
this is the code:

  public State getState()
        {
            //Gdx.app.log(Float.toString(b2body.getLinearVelocity().x),"hi");
            if ((Hud.getTime()==0&& Hud.getScore()<(level*15)+50)|| Rockhit()) {
                Fruits.manager.get("music/Backmusic.ogg", Music.class).stop();
                collectoIsDead=true;
                Filter filter = new Filter();
                filter.maskBits = Fruits.NOTHING_BIT;
                for (Fixture fixture : b2body.getFixtureList())
                    fixture.setFilterData(filter);
                b2body.applyLinearImpulse(new Vector2(0, 5f), b2body.getWorldCenter(), true);
                //b2body.applyLinearImpulse(new Vector2(0,-2.5f), b2body.getWorldCenter(), true);
                Fruits.manager.get("music/fail.mp3", Sound.class).play();
                return State.DEAD;

            }

            if((Hud.getTime()==0&& Hud.getScore()>=(level*18)+50)|| (Hud.getScore()>=(level*15)+50)) {
                Fruits.manager.get("music/Backmusic.ogg", Music.class).stop();
                Fruits.manager.get("music/cheering.mp3", Sound.class).play();
                return State.SUCCESS;
            }
            if (b2body.getLinearVelocity().x!=0)
                return State.RUNNING;
            else
                return State.STANDING;

}


texts: Calcluate Mesh top, bottom, left and right position relative to mouse click position on the mesh

texts:
I have a mesh (suppose it can be circle, or rectangular,square or an arc). The geometry of the mesh can be anything. I can click on mesh at any position. From relative to the clicked position, I want to get its right, left top and bottom position of the mesh. Maybe the picture explain it better then my words

Update: I tried to apply a quick dirty solution. It is incomplete:

// Update is called once per frame
void Update()
{
    if (Input.GetMouseButtonDown(0))
    {
        //Ray r = Ray(Input.mousePosition);
        RaycastHit rayHit;
        Ray r = Camera.main.ScreenPointToRay(Input.mousePosition);

        if(Physics.Raycast(r,out rayHit,1000))
        {
            Debug.Log(rayHit.transform.name);
            Debug.Log(rayHit.point);
            Debug.Log(rayHit.normal);
            StartCoroutine(MoveToDirection(rayHit.point));
        }
    }

}

IEnumerator MoveToDirection(Vector3 startPosition)
{
    GameObject go = GameObject.CreatePrimitive(PrimitiveType.Cube);
    go.transform.position = startPosition;
    while (true)
    {
        go.transform.position=  go.transform.position + go.transform.up * Time.deltaTime* speed;
        yield return new WaitForEndOfFrame();
    }

}

On click i instantiated a gameobject and start moving in upward direction and when it leaves the mesh bounds i will get the position but it have differet problems, like:
1. It will not work with arc object or maybe with non rectangular geomerty.
2. I have to apply onTrigger and onExitEvent that can be skip when the cube move with fast pace.


texts: Serialize ScriptableObject without creating an asset out of it?

texts:
Is it possible to do something like this?

public class SomeScriptable : ScriptableObject
{
    public MyScriptable myScriptable;

    public void OnValidate()
    {
        if (myScriptable == null)
        {
             myScriptable = ScriptableObject.CreateInstance<MyScriptable>();
         }
    }
}

public class MyScriptable : ScriptableObject
{

    public int MyVar1;
    public string MyVar2;

}

I tried this but am getting a "Type Mismatch" error in Unity.


texts: Does inflating scores make players happier?

texts:
I realize that this will depend on a game-to-game, situation-to-situation basis and that this is not a very technical question, but I remember hearing in a tech podcast a few years ago that inflated numbers of points (e.g. 1000 points vs. 1 point) was preferable in games because it was either a standard or because it had been shown to produce better feedback/experience from users. Either case, it seemed to make users happier than lower numbers of points.

I have since been unable to find supportive evidence either way for the theory that inflating scores can keep the user engaged.

Is this inflated-point theory true? Where can I find more information and, particularly, some experimental data on different approaches and their effectiveness?


texts: Why do MMORPGs still use multiple servers?

texts:
MMORPGs, some MOBAs like League of Legends or even StarCraft 2 usually force you to pick a server. Usually they are US, EU and SEA, in MMORPGs many per location. I can see that that was necessary a few years ago, but now with the advent of AWS and similar offerings that allow you to seamlessly scale your "server-power", why are there still separate servers?

My train of thought is like this (using Star Wars: The Old Republic as an example): - You are always on one planet, an isolated "instance" from other planets. - If there are too many people on one planet, SW:TOR creates a new instance of the world and puts players in there. - If you leave the world / switch instances you have a loading-screen

So why can't the game create an instance for this planet. This instance (and only this one) has your current data in its database and manages x players. As soon as x-50 players are on this instance, a new server will fire up and new people will spawn on that instance. The 50 spots are reserved for switching to your group, etc.

There could be an instance for all three major regions to keep the latency low, but it would allow you to still play with other players from i.e. SEA if you can live with a 140ms delay (which is still nothing imho).

Whenever you switch an instance or travel to another world, your current server gives all your data to the next server, making sure you don't need one big centralized database. You could still have one that gets updates periodically for analysis purposes.

When you log off or the servers loses connection, the data could then be transferred into a massive database that is optimized for storing the data. The instance servers can then be optimized for high throughput.

Is there any particular reason this will not work? Are there other problems I am missing?


texts: Making a gameobject move back and forth in Unity

texts:
So i have this enemy gameobject and i want it to move in a certain pattern like a patrol. So i want him to move from A to B to C then Back to B to A.
The script I worked out makes him go from C to A directly but I dont want that. Can someone please help .
The Length of PatrolPoint Array in 3 `using UnityEngine;
using System.Collections;

public class EnemyPatrol : MonoBehaviour {

public Transform [] patrolPoints; // An Array of path points to be followed
private int currentPoint ;
public float enemySpeed ;

void Start()
{

    currentPoint = 0;
    transform.position = patrolPoints[ currentPoint].position; // Starting Point
}

void Update()
{

    if(transform.position == patrolPoints[currentPoint].position)
    {
        currentPoint ++ ;
    }

    if(currentPoint >= patrolPoints.Length)
    {
        currentPoint = 0 ;
    }

    transform.position = Vector3.MoveTowards(transform.position , patrolPoints[currentPoint].position , enemySpeed*Time.deltaTime);

    }

}
`


texts: How can I implement a global high score ladder?

texts: Are there any existing frameworks I can build on?  Should I build my own?  How can I prevent fake scores from being posted to it?


texts: Running an Existing Game Inside of Unreal Engine

texts:
Goal
Be able to add an overlay (a webcam feed with greenscreen processing) to an existing VR capable flight simulator so that the user can see their physical controls and the sim utilizing green screen tech.
Problem
I need a way to run a flight simulator (XPlane, MSFSX, etc) within Unreal Engine 4. Any advice/direction is greatly appreciated. Also a solution that doesn't involve using Unreal is also valid, but I prefer to stick with Unreal.
What I Have So Far
I currently have a way to display a webcam stream on a plane surface in Unreal with the green screen processing occurring in a blueprint.
Ideas/Examples That I Would Need Advice On
-Running the flight simulator directly
-Emulation
~Working Example in UE4
-Running the simulator on a monitor and using some form of screen cast software to send to Unreal
-Using an existing free flight simulator UE4 project (not prefered)


texts: Raycasting against my plane does not detect collisions in Unity

texts:
I'm trying to keep the camera above a plane which acts as the ground, so I wrote this bit of code:

RaycastHit hit;
if (!Physics.Raycast (transform.position, new Vector3 (0, -50, 0), out hit, 5)) {
    transform.position = new Vector3 (0, 20, 0);
    Debug.Log ("No ground found when raycasting down!");
    Debug.DrawRay (transform.position, new Vector3 (0, -50, 0), Color.red, 0, true);
} else {
    if (hit.distance <= 1) {
        transform.position = new Vector3 (transform.position.x, 1, transform.position.z);
    }
}

The camera is clearly over the plane on position 0, 20, 0 while the plane is at 1, 1, 1, with scale 50, 1, 50, but it never detects a hit. The ray drawn by DrawRay() does intersect the plane.

The plane is oriented upwards, but just to be sure I tried raycasting from below as well, without success.

I have also tried replacing the mesh collider with a box collider using size 10, 1, 10 (I'm not sure why, this seems to be the same size as my scaled plane) and 10, 10, 10. Neither worked.

What Am I missing?


texts: How can I implement UI in Unity using Chromium?

texts:
I'm looking for an alternative to UI Builder.
Ideally I'd like to have basically a Chromium instance atop Unity3D which would have its JS calls somehow land in the C# (maybe in the "Update" loop it listens to a constant stream of potential calls and the parameters will correspond to function names in my Unity code, I don't know)
here's what I found which doesn't quite live up to my expectations:

Unity WebView doesn't support Windows.

3D WebView for Windows and macOS (Web Browser) requires the UI to be served on an actual live URL and for Unity to access it via that URL and for all interaction to be handled via API, impractical or slow at best.

PowerUI - HTML/CSS is interesting, but was made in 2011. The documentation is all gone. the support for css feature is probably incredibly slim.

Embedded Browser looks pretty good, but I'm unsure that it could be bent into a UI system. I want it to frame my game, not to cover it.

Coherent Gameface looks probably the best,
although the CSS implementation seems a tad lackluster. Also this project was started in 2012, it's probably carrying very old, very slow code.

This Unity forum thread may be relevant.
Chromium Embedded Framework was a tool used by some assets on the asset store to create chromium UI but it has been removed.
If not using these assets, how can I implement my idea of using Chromium as my UI layer?


texts: Path Planning in a chaotic, ever-changing environment

texts:
I've implemented Path Planning a few times, using A* on nav meshes, and also Continuum Crowds but now I am trying to plan paths in very chaotic environments.

In this environment, new routes and new blockages are created constantly, and chaotically. This is because the environment is fully destructible, and the debris can create new obstacles.

In such an environment, nothing can be pre-computed. What would be a good way to sense the traversability in such a world? There is no concept of a grid in my world, b.t.w, but I wonder if I should introduce an artificial one for the purpose of planning.

But if navigation could be achieved without a grid, that would be much better of course.

Note that the navigation is not merely dynamic in the sense that certain transitions get opened/closed, but actually chaotic. This stops me from a simple approach of enabling/disabling certain edges on the navigation mesh. That approach would be usable if, e.g. a gate gets locked/unlocked. But in my case, in a blink of an eye, the routes could be drastically changed where simple mutations of a pre-computed mesh are not doable.


texts: How do I create a rocket projectile that is "dropped", then accelerates toward the enemy?

texts:
I'm making an Asteroids-like game.  I've successfully implemented linear bullets.

Now I want to add some rocket-styled bullets, with a certain flight path:
The rockets should be "dropped" back first, then accelerate towards the enemy.

I'm having difficulty making this work when the shooter is rotated.
To visualize what I mean:

Bullets have a lifeTime which increases every frame.


texts: FPS networking with server sending input instead of gamestate

texts:
Why do all fps games have the server send gamestate instead of input which is smaller?

One reason I can sort of see is that if the server sends input to the clients and a packet gets dropped then the client will not be able to gave an accurate simulation until a resend of that packet occurs which could be an entire timeout plus one way trip latency. Presumably this is considered unreasonable for a real time fps game.

But what if at time T the server sends the input processed at time T to the client and at time T+1 the server sends the input processed at time T and time T+1. This way if the packet containing the input processed at time T is dropped the client will get the next packet sent by the server which contains the input processed at time T and time T+1. Thus the client will not stall on the simulation because the server is redundantly sending previous input. The server stops sending a previous input when it gets an ack from the client.

This seems to avoid sending the entire game state. Can someone tell me why this idea is just bad and why no fps games use it?


texts:
So, I been following up the Space shooter tutorial on Unity, I had an issue where the project was acting up with an alpha version, so I was able to get a version that worked on a old release and applied all the new things I developed

But suddenly, my ship is acting up when getting closer to the boundary of its movement

This is the player movement code

public class playerMovement : MonoBehaviour
{
public float speed = 0.0f;
public float tilt;
public Boundary boundary;

void FixedUpdate ()
{
    float moveHorizontal = Input.GetAxis("Horizontal");
    float moveVertical = Input.GetAxis("Vertical");

    var movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
    var rigidBody = GetComponent<Rigidbody>();
    rigidBody.velocity = movement * speed;

    rigidBody.position = new Vector3
        (
            Mathf.Clamp(rigidBody.position.x, boundary.xMin, boundary.xMax),
            0.0f,
            Mathf.Clamp(rigidBody.position.z, boundary.zMin, boundary.zMax)
        );

    rigidBody.rotation = Quaternion.Euler(0.0f, 0.0f, rigidBody.velocity.x * -tilt);
}

}

[System.Serializable]
public class Boundary
{
    public float xMin, xMax, zMin, zMax;
}

And this is the player boundary properties

It used to work previously moving forward to the alpha, now I'm working on 2019.2.0f1, but since working on the alpha this is the behaviour I'm having

As you can see, getting closer to the player boundary, takes the player out of the play area, and I can't determine why this might be happening.

I already tried removing the Math.Clamp, as I though there migth be bug with the function in this version, but even without it, the problem is present.


texts: Setting the Box2D gravity for a pixel coordinate game?

texts:
I'm making a game with Box2D with a top left coordinate system. I multiply positions by an M_TO_PX_RATIO of 10.0f to convert from meters to pixels.

I noticed that when I set gravity to 9.8, the simulation is rather slow. When I set gravity to 9.8 * M_TO_PX_RATIO, the simulation runs at the correct speed, like normal gravity. However, the high gravity causes jittering.

Am I doing it properly? When using a top left, pixel coordinate system, must I do anything else to account for meters to pixels?

Thanks


texts: OpenGL error 0x0506 in -[CCSprite draw] 530 to run project on ios divice in cocos2d?

texts:
I am running my cocos2d program on simulator. It works fine but when I run it on device, it throws error OpenGL error 0x0506 in -[CCSprite draw] 530. In my program I want to push one scene to another scene.At that time it shows error. Sometime it works fine on device at first time, but sometimes it shows error.Please help me about it. I also tried to google it

My Code As below:

First Load LoadingLayer as below.

-(void) directorDidReshapeProjection:(CCDirector*)director
{

        if ([[director runningScene] isRunning])
        {

            [[CCDirector sharedDirector] resume]; //pause the director

            [[CCDirector sharedDirector] pushScene:[HelloWorldLayer scene]];
        }
        else
        {
            [[CCDirector sharedDirector] runWithScene:[LoadingLayer scene]];
        }

}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    // Create the main window
    window_ = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    [self.window setBackgroundColor:[UIColor whiteColor]];

    glView = [CCGLView viewWithFrame:[window_ bounds]
                                   pixelFormat:kEAGLColorFormatRGB565
                                   depthFormat:0
                            preserveBackbuffer:NO
                                    sharegroup:nil
                                 multiSampling:NO
                               numberOfSamples:0];

    director_ = (CCDirectorIOS*) [CCDirector sharedDirector];

    director_.wantsFullScreenLayout = YES;

    // Display FSP and SPF
    [director_ setDisplayStats:NO];

    // set FPS at 60
    [director_ setAnimationInterval:1.0/60];

    // attach the openglView to the director
    [director_ setView:glView];

    // 2D projection
    [director_ setProjection:kCCDirectorProjection2D];

    //  [director setProjection:kCCDirectorProjection3D];

    // Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
    if( ! [director_ enableRetinaDisplay:YES] )
        CCLOG(@"Retina Display Not supported");

    // Default texture format for PNG/BMP/TIFF/JPEG/GIF images
    // It can be RGBA8888, RGBA4444, RGB5_A1, RGB565
    // You can change this setting at any time.
    [CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];

        CCFileUtils *sharedFileUtils = [CCFileUtils sharedFileUtils];
    [sharedFileUtils setEnableFallbackSuffixes:NO];             // Default: NO. No fallback suffixes are going to be used
    [sharedFileUtils setiPhoneRetinaDisplaySuffix:@"-hd"];      // Default on iPhone RetinaDisplay is "-hd"
    [sharedFileUtils setiPadSuffix:@"-ipad"];                   // Default on iPad is "ipad"
    [sharedFileUtils setiPadRetinaDisplaySuffix:@"-ipadhd"];    // Default on iPad RetinaDisplay is "-ipadhd"

    // Assume that PVR images have premultiplied alpha
    [CCTexture2D PVRImagesHavePremultipliedAlpha:YES];

    // Create a Navigation Controller with the Director
    navController_ = [[MyNavigationController alloc]    initWithRootViewController:director_];
    navController_.navigationBarHidden = YES;

    // for rotation and other messages
    [director_ setDelegate:navController_];

    // set the Navigation Controller as the root view controller
    [window_ setRootViewController:navController_];

    // make main window visible
    [window_ makeKeyAndVisible];

    return YES;
}

After LoadingLayer It Push To ViewController.it has buuton click on it go to HelloWorldLayer.

-(void)Button
{
        director_ = (CCDirectorIOS*) [CCDirector sharedDirector];
        [director_ replaceScene:[HelloWorldLayer scene]];
        [self.navigationController pushViewController:director_ animated:YES];
}

Low as Scene to Viewcontroller to scene.

app is not crash but it got error


texts: Unity display my generic list in the editor

texts:
I have the following class:
[System.Serializable]
public abstract class BaseBehaviour<T> : MonoBehaviour
{
    [SerializeField]
    public List<BaseAction<T>> Actions;
    protected int currentIndex = 0;
    public bool OptOut = false;
    public Intelligence.Intelligence Intelligence;
    public T BaseAiContext;
    public List<BaseConsideration> Considerations;

    public Dictionary<string, object> CacheValues = new Dictionary<string, object>();

    public abstract void UpdateBehaviour();

    public bool IsDone()
    {
        if (currentIndex > Actions.Count || OptOut)
        {
            return true;
        }

        return false;
    }

    public abstract float GetScore();
}

Then i have an implementation of this class:
[System.Serializable]
public class AttackTargetBehaviour : BaseBehaviour<ExampleAI>
{
    public override void UpdateBehaviour()
    {
        Actions[0].Execute(this);
    }

    public override float GetScore()
    {
        float currentScore = 1;
        for (int i = 0; i < Actions.Count; i++)
        {
            float score = 0; // Actions[i].GetScore(this);
            if (score <= 0.0f)
            {
                return 0;
            }
            else
            {
                currentScore *= score;
            }
        }

        return currentScore;
    }
}

However here the list doesn't show in the inspector window which ultimately means i can't add my scriptableobject actions.
Can anyone tell me how i can display such as list in the Unity inspector?
For reference my action looks like this:
    [System.Serializable]
public abstract class BaseAction<TContext> : ScriptableObject, IAction
{

And the implementation of this class is:
    [CreateAssetMenu(fileName = "Move to Target", menuName = "AnAppGames/AI/Example/Actions/MoveToTargetAction")]

public class MoveToTargetAction : BaseAction<ExampleAI>
{
    public override void Execute(BaseBehaviour<ExampleAI> context)
    {
        throw new System.NotImplementedException();
    }

    protected override void OnUpdate(BaseBehaviour<ExampleAI> context)
    {
        throw new System.NotImplementedException();
    }

    protected override void OnStop(BaseBehaviour<ExampleAI> context)
    {
        throw new System.NotImplementedException();
    }
}


texts: Gravity not being applied to character, using character controller

texts:
So I just copy and pasted the unity example class to use with my character controller.

public float speed = 6.0F;
public float jumpSpeed = 8.0F;
public float gravity = 20.0F;
private Vector3 moveDirection = Vector3.zero;
void Update() {
    CharacterController controller = GetComponent<CharacterController>();
    if (controller.isGrounded) {
        moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
        moveDirection = transform.TransformDirection(moveDirection);
        moveDirection *= speed;
        if (Input.GetButton("Jump"))
            moveDirection.y = jumpSpeed;

    }
    moveDirection.y -= gravity * Time.deltaTime;
    controller.Move(moveDirection * Time.deltaTime);
}

The code seems to work okay if I comment out the isGrounded check statement (which means that gravity isn't being applied). So what could be the reason that the gravity is not being applied to my character controller?


texts: Do Octrees, Kd-Trees, BSP only make sense for static geometry?

texts:
I'm still implementing my scene graph (see this question). Now, I wonder if a spatial representation such as a Kd-Tree or Octree to do View Frustum Culling (VFC) only makes sense with static geometry. The reason for my doubt is that usually dynamic geometry is a small part of the scene, while static geometry can be very large, and dynamic geometry forces to handle updates in the spatial representation at each frame.

Your opinions?

Tunnuz


texts:
I'd like to visualize a BSP tree. To do this, I need to project an arbitrary euclidean plane onto a projection plane. I was thinking about calculating the intersections of the plane with the viewing frustum (in world space), then triangulating the resulting quadrangle and projecting the 2 triangles.

Is there a better way? For example, I thought about transforming the plane into the viewing space first, creating an ONB (from the transformed plane normal). Then I would simply stretch the quadrangle, until it is outside of the frustum and transform the quadrangle back into world space and send it into the rendering queue.

How should I got about shading the plane approximation (quadrangle)?


texts: How can I make RPC function calls in Unity?

texts:
I am making a multiplayer game. I am sending score via the server and client but I want to be sure that can I call an RPC function of a script from any other script.

For example, say Table_Manager as a script which contains a get_score function and I want to call it from a game_stat script like Table_Manager.networkview.rpc("Table_Manager", rpcmode.all, 25); The get_score method would look something like:

[RPC]
public void get_score(int new_score)
{
   // ...
}

How can I accomplish that?


texts: Is it possible to access vertex values of an object created using display lists?

texts:
I wanted to learn to develop games so started with tetris. I encountered a problem right in the beginning. My game is 20% ready. There are five types of shapes viz YELL, BOX, LINE, TEE, YEL which are shapes of different kinds. I created five display lists like this

#define YELL 1
#define BOX 2
#define LINE 3
#define TEE 4
#define YEL 5
int bs=20;
void defineshapes()
{
glNewList(YELL,GL_COMPILE);
    glPushMatrix();
    glTranslated(-bs,0,0);
    glColor3fv(color[color1]);
    glBegin(GL_POLYGON);
    glVertex2i(0,0);
    glVertex2i(bs,0);
    glVertex2i(bs,-bs);
    glVertex2i(0,-bs);
    glEnd();
    glTranslated(bs,0,0);
    glColor3fv(color[color2]);
    glBegin(GL_POLYGON);
    glVertex2i(0,0);
    glVertex2i(bs,0);
    glVertex2i(bs,-bs);
    glVertex2i(0,-bs);
    glEnd();
    glTranslated(bs,0,0);
    glColor3fv(color[color3]);
    glBegin(GL_POLYGON);
    glVertex2i(0,0);
    glVertex2i(bs,0);
    glVertex2i(bs,-bs);
    glVertex2i(0,-bs);
    glEnd();
    glTranslated(-2*bs,-bs,0);
    glColor3fv(color[color4]);
    glBegin(GL_POLYGON);
    glVertex2i(0,0);
    glVertex2i(bs,0);
    glVertex2i(bs,-bs);
    glVertex2i(0,-bs);
    glEnd();
    glPopMatrix();
glEndList();
glNewList(BOX,GL_COMPILE);
    glPushMatrix();
      .....

and randomly picking one like this

srand(time(NULL));
color1=rand()%6;
color2=rand()%6;
color3=rand()%6;
color4=rand()%6;
defineshapes();
randshape=rand()%5+1;

and drawing in display function like this

void display()
{
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    glPushMatrix();
    glTranslated(x2,y2,0);
    glCallList(randshape);
    glPopMatrix();
    glFlush();
}

I expected problem in the beginning itself when i used the display lists because i had to access the vertex values(x,y) of the shapes to check if they might overlap with another block below before moving them down. Is there a way of knowing the vertex values of objects drawn using display lists.

I encountered the same problem once before when i needed to create a tyre of a car. I wanted the tyre to be painted with colors so created a mesh by rotating a circle again using display lists. Then i needed to know the values of the intersection points of longitudes and latitudes which i didnt know how to get so i abandoned that task.

A YELL looks like this

What is the easiest method of getting around this problem. I am sure OpenGL has a way of getting this done but i am new to it.


texts: Switch character to play animation() in Unity3D using c#

texts:
I have two or more 2D character (Character A, B, n..).
I made an animation on the character using the Animator class "AnimCharacter.cs".
if i press the 'PgUp' character 'A' can call the function AnimCharacter.cs, when i press 'PgUp' again, character 'B' can call that function so the character A is in idle.
I've tried to make the class "aktifChar" but still error. Everybody can help me ? Thanks

"AnimCharacter.cs"

using UnityEngine;
using System.Collections;

public class AnimCharacter : MonoBehaviour {
    public float maxSpeed = 10f;
    bool facingRight = true;
    Animator anim;
    bool grounded = false;
    public Transform groundCheck;
    float groundRadius = 0.2f;
    public LayerMask whatisGround;
    public float jumpForce = 700f;
    bool doubleJump = false;

    void Start () {
        anim = GetComponent<Animator> ();
    }

    void FixedUpdate () {
        try{
            grounded = Physics2D.OverlapCircle (groundCheck.position, groundRadius, whatisGround);
            anim.SetBool ("Ground", grounded);

            if (grounded)
                doubleJump = false;

            anim.SetFloat ("vSpeed", rigidbody2D.velocity.y);

            //if(!grounded) return;

            float move = Input.GetAxis ("Horizontal");
            anim.SetFloat ("Speed", Mathf.Abs(move));
            rigidbody2D.velocity = new Vector2 (move * maxSpeed, rigidbody2D.velocity.y);
            if (move > 0 && !facingRight)
                Flip ();
            else if (move < 0 && facingRight)
                Flip ();
        }catch{

        }
    }

    void Update(){
        if ((grounded || !doubleJump) && Input.GetKeyDown (KeyCode.UpArrow)) {
            anim.SetBool ("Ground", false);
            rigidbody2D.AddForce(new Vector2(0,jumpForce));

            if (!doubleJump && !grounded)
                doubleJump = true;
        }
    }

    void Flip(){
        facingRight = !facingRight;
        Vector3 theScale = transform.localScale;
        theScale.x *= -1;
        transform.localScale = theScale;

    }
}

aktifChar .cs

using UnityEngine;
using System.Collections;

public class aktifChar : AnimCharacter {

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        if (Input.GetKeyDown (KeyCode.PageUp)) {
                 animation.Play("Running", PlayMode.StopAll);
        }
         }
}

there is a image of the Animator :

the error is saying :
MissingComponentException: There is no 'Animation' attached to the "CharacterLamp" game object, but a script is trying to access it.
You probably need to add a Animation to the game object "CharacterLamp". Or your script needs to check if the component is attached before using it.
aktifChar.Update () (at Assets/Script/aktifChar.cs:14)


texts: What is actually drawn when glDrawArrays and glDrawElements are called?

texts:
In my journey out of immediate mode I've come across a snag that I haven't been able to find a decent answer for in any tutorial or API, namely: Which data structures are actually invoked when I make a call to a glDraw* function in OpenGL3.3+?

For example, if I want to draw two 3D models and I've put their vertex data in two different VBO's, does invoking glDrawArrays draw everything set under the current VAO? Or does it only draw the currently bound VBO sampling from the currently bound texture?

I basically understand VAO's and VBO's conceptually but its down to implementation that I'm running into problems, it's a big jump to go from the "stability" of immediate mode to the a-synchronicity of modern OpenGL.


texts:
how to properly link an OrthographicCamera to a OrthogonalTiledMapRenderer

How do I properly link an OrthographicCamera to a OrthogonalTiledMapRenderer? I have tiled map i'd like render and two stages that have actors on them.. I call render.render() in my screens render method as well as stages.draw(); but every i put render.setView(camera) the screen displayed flashes or does other weird things. How do I properly attach a moveable camera to a tiled map renderer? I render the map first, do game logic and then call draw on the stages. when I call translate on the camera the tiled map zooms way out for some reason?

here is my render method

public void render(float delta) {

    Gdx.gl.glClearColor(1, 0, 0, 1);
        Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        camera.update();
        renderer.render();

        gameLogic();

        backStage.act(); // acts are called but do nothing

        frontStage.act();

        frontStage.draw();
        backStage.draw();

}

here is where  the camera and renderer get created

public void addMap(GameMap map){

this.map=map;
maps.add(map);
    renderer=new OrthogonalTiledMapRenderer(map.getTiledMap(), 1/20f);
    camera= new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    float aspect = Gdx.graphics.getWidth()/Gdx.graphics.getHeight();
    camera.setToOrtho(false, 20*aspect, 20*aspect);

    renderer.setView(camera);
    frontStage= new Stage();
    backStage=new Stage();

    xSize=map.getXSize();
    ySize=map.getYSize();
    Gdx.input.setInputProcessor(this);

}


texts: Unity UI: Dynamic button prefab font incorrect compared to other elements

texts:
I am having some issues when creating UI elements dynamically and the font size showing up incorrectly. The button is a prefab and font size set to 42 pixels. The elements next to it are not created dynamically and are set to the same font size and all settings are the same. It also is smaller or larger depending on the screen size but is NOT set to best fit

Using Unity 2017.x


texts: How to do multi-agent 2d pathfinding when agents can block each other?

texts:
I recently restarted on my long time game development project and had a few questions about how to improve my games AI.

I am a little stuck on the best way to implement my Enemy path finding when there are multiple enemies that can collide with each other.  Here is an example of the way my AI works at the moment.

The melee enemy has the following states:

Aggressive Attacking - Is in range of attacking player

Aggressive Stuck - Is trying to reach the player but blocked by a collision object

Aggressive Clear - Is trying to reach the player but is not blocked by a collision object

Passive - not currently looking for the player but if it moves in it's line of sight it will move to the aggressive state

Currently I am using a uniform tile system.  Here is the basics on how the pathing works.

FIND PATH FROM ENEMY TO PLAYER

    IF [BLOCKED BY A COLLISION TILE]

             CALL A STAR ALGORITHM

    ELSE IF [NO COLLISION ON PATH]

            MOVE TO PLAYER

I do this every frame.  This seems to work ok, but things have got more complicated when I bring in multiple enemies.  What would be the best way to achieve the following.

Find a path for the enemy to the player when there are multiple enemies that can all collide with each other?  If I just call A STAR it won't work correctly as the other enemies who are collision objects are also moving.

Sorry I hope this made sense, any help would be great.


texts:
I'm new to Unity and C# and have been struggling to figure out how to solve this.  What I'm looking for is a way to make text display whenever a button is selected. (ex. Player selects a difficulty option, and text pops up describing what mechanics the difficulty will affect)  I can get this to work with mouse input with no issue, with the following code attached to the button.
void Update()    {
        if (this.IsHighlighted() == true)
        {
            gameObject.transform.GetChild(1).gameObject.SetActive(true);
        }
        else
        {
            gameObject.transform.GetChild(1).gameObject.SetActive(false);
        }
}

The aforementioned description text is set up as a child to the button, and will appear/disappear depending on whether it's highlighted or not.  The problem is that isHighlighted only occurs when the mouse is hovered over the button, and does not take effect when selected via directional inputs from a keyboard/controller, which is what I'm looking for.  I've done some research and noticed there is an OnSelect method, but I can't figure out how to implement it.  Any advice would be greatly appreciated.


texts: So I have the encryption key. This is stressed so much to have it. Well, I have it. Where do I use it? Unrealpak does not seems to offer an option to supply the encryption key, if your pak is encypted - the unpackaging simply fails.


texts: How can I fix zig-zagging UV mapping artifacts on a generated mesh that tapers?

texts:
I am creating a procedural mesh based on a curve and the size of the mesh gets smaller throughout the curve as you see below.

And the problem is UV gets zig-zagged as the size changes (it works perfectly when the size of the mesh is same throughout the curve).

 Vertices.Add(R);
 Vertices.Add(L);
 UVs.Add(new Vector2(0f, (float)id / count));
 UVs.Add(new Vector2(1f, (float)id / count));
 start = Vertices.Count - 4;
          Triangles.Add(start + 0);
                 Triangles.Add(start + 2);
                 Triangles.Add(start + 1);
                 Triangles.Add(start + 1);
                 Triangles.Add(start + 2);
                 Triangles.Add(start + 3);

 mesh.vertices = Vertices.ToArray();
         //mesh.normals = normales;
         mesh.uv = UVs.ToArray();
         mesh.triangles = Triangles.ToArray();

How can I fix this?


texts: Naive Surface Nets - Translating from Javascript to C# Issues

texts:
I've been attempting to convert this Javascript code into a C# (Unity3d) script. It is an implementation of Naive Surface Nets explained here if that helps.

My translated C# script does compile without errors/warnings but the result is a broken (but recognizable) mesh:

I've also noticed that the vertices look reasonably correct:

If you can't already tell, the input voxels are just simplex noise.

I'd really like to get this working, but I am not well versed with Javascript.
If anyone would like the Unity project, here it is.
Can someone who knows both languages well tell me what I've missed? Thank you.


texts: I am making models in blender to export them then in unity, and unity can import .blend formats as well as .fbx, so which one is better, is there even any difference.


texts: Opengl ES 2.0: Is there a way to use less resources to draw in-game background texture

texts:
1.Should my in-game background be drawn with my game loop renderer, or if

2.I don't want to draw my background image every frame in my main renderer since it could possibly be a heavy job while the game loop is running. Do I need to use a separate thread or some other method to achieve this?

FYI, the background should be able to scale and translate with zooming function, it should be flexible.


texts:
I am trying to make a collider along the edges of my sprite, something like what an outline shader does. I tried adding a polygon collider 2D as you can see below but it doesn’t take the shape of the sprite. Any help is appreciated

https://imgur.com/a/LVsmNli


texts: How do I sample a Depth/Stencil Texture in HLSL?

texts:
I am shadow mapping in Direct3D 9. I'm trying to avoid rendering depth to a 32-bit render target. So, I've created a depth/stencil texture( a texture w/usage Depth/Stencil ). When I render I do this:

//device
IDirect3DDevice9 *pd3dDevice = GetDevice();

// set an rt the same size as the depth/stencil texture(needs attention...this render target will not be rendered to)
pd3dDevice->SetRenderTarget(0, GetShadowMapRT());

// set the shadow map depth/stencil texture surface
pd3dDevice->SetDepthStencilSurface(GetShadowMapDSSurface());

pd3dDevice.SetStreamSource(0, GDEOctree.Geometry,
                Constants.OctreeVertexSize * GDEOctree.StaticGeometryVertexCount, 12);

// set vertex format
pd3dDevice.VertexFormat = SlimDX.Direct3D9.VertexFormat.Position;

// set indices
pd3dDevice.Indices = GDEOctree.ShadowCasterIndices;

// set render states
DeviceManager.SetRenderState(RenderState.ZEnable, 1);
DeviceManager.SetRenderState(RenderState.ZWriteEnable, 1);
DeviceManager.SetRenderState(RenderState.ZFunc, (int)Compare.LessEqual);
DeviceManager.SetRenderState(RenderState.CullMode, (int)Cull.Counterclockwise);
DeviceManager.SetRenderState(RenderState.StencilEnable, 0);
DeviceManager.SetRenderState(RenderState.AlphaBlendEnable, 0);
DeviceManager.SetRenderState(RenderState.ColorWriteEnable, 0);

// draw shadow casting geometry
...

// get the effect
ID3DXEffect *pFX = GetFX();

// set the shadow map depth/stencil texture
pFX->SetTexture(GetShadowMapDSTexture());

// in pixel shader sample shadow map...
?

The problem is that the depth/stencil texture is a D24SX format...How do I sample from a texture of this format?

My original attempt which of course will not work:

tex2D(g_SamplerShadowMap, vShadowMapUV);

I read a post here that says:

  When reading from the texture, one extra component in texture
  coordinates will be the depth to compare with.

Or, how do I convert the color returned from the sampler code above to a single floating point value? The above code will return a 4-component vector but depth should be one value for comparison.

EDIT:

Below is the vertex shader for the shadow map pass...I do not compile a pixel shader for the shadow map pass because color is not written...only depth.

//--------------------------------------------------------------//
// ShadowMap Pass
//--------------------------------------------------------------//
void VS_ShadowMap( in float4 Position : POSITION0,
                    out float4 oPos : POSITION0 )
{
    // position of geometry in the shadow emitting light's clip space
    oPos = mul(mul(Position, mW), g_mShadowViewProjection);
}

technique DeferredShading
{
    pass ShadowMap
    {
        VertexShader = compile vs_3_0 VS_ShadowMap();
        PixelShader = NULL;
    }
}


texts: How does collapsable structures in a voxel based game like Ace of Spades/Build and Shoot work?

texts:
I know that once all the cubes that are connected are destroyed, the unconnected blocks collapse. How do you find out the unconnected blocks?

edit 1: How would you determine the collapsible object if it spans multiple chunks?


texts:
I'm programming a throw of 5 dices in Actionscript 3 + AwayPhysics (BulletPhysics port).

I had a lot of fun tweaking frictions, masses etc. and in the end I found best results with more physics ticks per frame. Currently I use 10 ticks per frame (1/60 s) and it's OK, though I see a difference in plus for 20 ticks.

Even though it's only 5 cubes (dices) in a box (or a floor with 3 walls really) I can't simulate 20 ticks in a frame and keep FPS at 60 on a medium-aged PC. That's why I decided to precompute frames for animation, finishing it in around 1700 ticks in 2 seconds. The flash player is freezed for these 2 seconds, and I'm afraid that this result will be more of a 5 seconds or even more, if I'll simulate multi-threading and compute frames in background of some other heavy processes and CPU drawing (dices is only a part of this game).

Because I want both players to see dices roll in same way, I can't compute physics when having free resources, and build a buffer for at least one throw of each type (where type is number of dices thrown). I'm afraid players will see a "preparing dices........." message too often and for too long.

I think the only solution to this problem is replacing PhysicsEngine with something simpler, or creating own physicsEngine. Do You have any formulas for cube-cube and cube-wall collision detection, and for calculating how their angular and linear velocities should change after a collision occurs?

Edit: I'm assuming the only way to solve my problem is to make a cube-cube and cube-wall collision engine, however maybe there's another solution for my problem.

As Arthur pointer out, there can be one animation - for me this is just a shortcut, I could as well show the final result without any dices rolling.
However, I thought about making 100 precomputed dice throws, though a user won't avoid repetition here as well. Sometimes a dice sits on it's edge (or corner) for a while, and that gives player some excitement (will it fall on 5 and give me a full house?), but with limited number of animations a player would already know how the animation will end.
Buffering solution would work, if players would see dices roll in different way (results would still be the same) - I'm considering this solution, however I'm still going to try to create a simple physics engine and see how it works.
less ticks is a solution I don't consider, because at as few ticks to be able to simulate physics in real-time, the dices behave not better than if I treated them as balls in my physics engine...