texts:
Im making a game and Im working on the collision.
First Ill tell you what I want (Ill put in pictures), then Ill leave the code.

What I want: I want the player to stop exactly before its collision box (a rectangle) intersects with a wall collision box. Right now this only happens sometimes, sometimes it doesnt go all the way to the wall, that is probably because the velocity is too big I guess. Here are the pictures:

Left: it works good, it goes all the way to the wall (btw the red square is the collision box).

Right: The player only goes down that much and leaves a gap inbetween it and the wall (the circle shows the gap) and you can not go down to go all the way to the wall.

The movment code:

if(canMove){
    move(xVol, yVol);
    xVol = yVol = 0f; // resets the velotcity
}

public void move(float xv, float yv){
    if(!collisionv(yv)){
        y += yv; // moves the player on its y
        for(Entity e : PlayState.e){
            if(e.getID() == ID.Player){
                e.getCollisionRect().setY(y); // moves the collision box
            }
        }
    }

    if(!collisionh(xv)){
        x += xv; // moves the player on its x
        for(Entity e : PlayState.e){
            if(e.getID() == ID.Player){
                e.getCollisionRect().setX(x); // moves the collision box
            }
        }
    }

}

public boolean collisionv(float yv){
// Vertical collision checking
    boolean ret = false;
// makes a rectangle that represends the players collision rect after it moved to check if it will be colliding with anything
    Rectangle p = new Rectangle(x, y + yv, getCollisionRect().getWidth(), getCollisionRect().getHeight());

    for(Entity e:PlayState.e){

        if(e.getID() != ID.Player && c.trueCollision(p, e.getCollisionRect())){
    // This true collision method just returns if the rectangles are intersecting
            ret = true;
        }
    }
    return ret;
}

public boolean collisionh(float xv){
// Horizontal collision checking
    boolean ret = false;
    // makes a rectangle that represends the players collision rect after it moved to check if it will be colliding with anything
    Rectangle p = new Rectangle(x + xv, y, getCollisionRect().getWidth(), getCollisionRect().getHeight());

    for(Entity e:PlayState.e){
        if(e.getID() != ID.Player && c.trueCollision(p, e.getCollisionRect())){
            ret = true;
        }
    }
    return ret;
}

My question: How do I make it move all the way to the wall, never leaving a gap inbetween the player and the wall?


texts: How should one handle positions in a tile-based world?

texts:
I have a simple Tower Defense game using a tiled world.  Creep and towers are on a tile at all times.

How should I represent the position of creeps in code? (Do creeps know their current tile and position on said tile or are they aware of their absolute world position?)

I'm basically looking for best practices, design pattern-type tips or general insight about how one manages positioning in a tile-based world.

Thank you.


texts: How can I detect and compensate for system related lag?

texts: The best example I can think of is Doom 3. It seemed to me that if there was any kind if lag the game would pause and then resume without "fast forwarding" to catch up. I'm trying to figure out a good practice to use for lag detection in JavaScript.


texts: How do you construct a node map for pathfinding in a non-tiled 2D environment?

texts:
A* and Dijkstra's pathfinding algorithms work by navigating a node map. In a tile-based 2D environment, these nodes could easily be inferred to be the literal x,y positions of the map.

For example, the agent is at (0,0), an obstacle is at (0,1), and the agent wants to go to (0,2).

However, in a 2D environment where locations are represented using floating point variables float x, float y, agents and obstacles can exist between the traditional style nodes (0,0) and (0,1).

How do you create a node map from such an environment?


texts: What kind of issues should I watch out for or avoid when using JOGL(OpenGL Java bindings)?

texts: I am completely new to OpenGL, but have a very good basic foundation in Java. I've set up Eclipse with the most recent version of JOGL recently, having found it to be, of what I as a beginner programmer, feel as very easily adaptable from the original OpenGL code. By simply using a replace all command to change the C++ native library commands from gl to gl.gl, and GL_ETC to glu.GL2_ETC, and so on and using a website with OpenGL tutorials on nehe.gamedev.net that I recently found, I was wondering if there are any huge problems or things I should avoid for instance using awt or swing as a frame or window for a viewport program. Maybe I'm trying to ask a more specific question before I even try it on my own, and that is, "Do I use windows from both languages consecutively or would it just create two windows, whilst trying to only open one window?", as they both have similar methods and objects aside from OpenGL being much more centered on 3D graphics. The reason I ask is that the 3D graphics of OpenGL usually must be built on a frame as far as I know, or linked to the main method of course like anything.


texts: Slicing irregular spritesheet (automatically?)

texts:
If found a cool sprite sheet on the internet but its irregular.

Is there any way besides manually cutting sprites to extract the separate pngs?
I need to pack them then again into the Texture Atlas under proper names.

Maybe theres some smart online tool that uses deep learning or something like that?


texts: How can I respawn enemies in Gamemaker Studio 2?

texts:
I know this may have been asked before but I would like an updated answer. So how do I respawn enemies in Gamemaker Studio 2?

Say I have an object called objBullet and an enemy objenemy; when they collide with each other I want the bullet to destroy the enemy, and the enemy to respawn after a few seconds. As a bonus, if you could tell me how to respawn the enemy in a new random spot that'd be awesome.


texts: How do I calculate how an object will move from one point to another?

texts:
Here's the problem: A player starts the game in the 0 coordinate (x=0,y=0).
When the user clicks on the screen, it returns the coordinates of the destination.
Now the player has to move from its current position A(0.0) to B(x,y).
Take into account that B is in the first Quadrant so x>0 and y>0.

How will the player move?
I know that I will have to use this:
atan2(positionY-destinationY, positionX-destinationX)
to get the angle.

Now what? How will the player move with a fixed velocity (which by the way will be a variable, so a player may move faster while using some "items")?

Whose answer is better? What is more accurate? Trigonometry or Linear Algebra?


texts: How to manage state in a component-based game engine?

texts:
I'm working on a small, data-driven game engine with some friends.

We use GameObjects (a.k.a. Entities, Actors, or whatever it is called in your favorite engine) to represent every entity in the game. These GameObjects owns Components, who communicates via message passing. This is a very well-known pattern, and although implementations differ greatly, it seems to be what every commercial, modern game engine is doing.

Now we have one problem: managing state. Let's say we are creating some kind of platform game. The hero of this game should be able to stand still, jump, attack...

We created some Finite State Machines to hold the player's state. Now the state should, in turn, be consumed by the other components. Running should trigger an animation and modify the player's velocity, attacking should stop the player and spawn a bullet...

But this creates a lot of dependencies. The Sprite component now has to be aware of the State component, and listen to state changes. The Movable component should listen to state changes too, to be able to change the player's speed. Nearly every component depends on the State component. This sounds like a dependency hell.

I think it's a very common problem, but I can't find a good solution for it. Are there some design patterns for situations like this?


texts: GLSL "varying" interpolation: component-wise? Reference in the spec?

texts:
Probably a dumb question, but I can't find (or am not understanding) a conclusive answer in the spec or in other questions (e.g., this one).

For smoothly-interpolated varying vec and mat vertex shader outputs / fragment shader inputs, is each element of the vector or matrix interpolated individually?

GL spec sec. 13.5.1 (clipping) describes linear clip-space interpolation of the "output values associated with a vertex."  It also says that those are componentwise for vectors, but doesn't mention matrices.

Similarly, sec. 14.5.1 (rasterizing lines) and sec 14.6 (rasterizing polygons) describe interpolation of an "associated datum f for the fragment".  Is each element of a vector or matrix considered an individual "associated datum" and interpolated independently from the other elements of the vector or matrix?

Secs. 11.1.3.10 (shader outputs) and 15.1 (fragment shader variables) mention interpolation but refer elsewhere for the details.

Similarly, in the GLSL spec, sec. 4.5 (interpolation qualifiers) says that interpolation happens but does not distinguish scalars from multi-component variables.

I am looking for a definitive statement about how vecs and mats are interpolated, if there is one.  Or let me know if there isn't!  Thank you!

(Note: answers can be for any OpenGL version.)


texts: MiniMax function throws null pointer exception

texts:
I'm working on a school project, I have to build a tic tac toe game with the AI based on the MiniMax algorithm. The two player mode works like it should.

I followed the code example on http://ethangunderson.com/blog/minimax-algorithm-in-c/. The only thing is that I get a NullPointer Exception when I run the code. And I can't wrap my finger around it.

I placed a comment in the code where the exception is thrown. The recursive call is returning a null pointer, what is very strange because it can't.. When I place a breakpoint on the null return with the help of a if statement, then I see that there ARE still 2 to 3 empty places.. I probably overlooking something.

Hope someone can tell me what I'm doing wrong.

Here is the MiniMax code (the tic tac toe code is not important):

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package MiniMax;

import Game.Block;
import Game.Board;
import java.util.ArrayList;

public class MiniMax {
public static Place getBestMove(Board gameBoard, Block.TYPE player) {
    Place bestPlace = null;
    ArrayList<Place> emptyPlaces = gameBoard.getEmptyPlaces();
    Board newBoard;

    //loop trough all the empty places
    for(Place emptyPlace : emptyPlaces) {
        newBoard = gameBoard.clone();
        newBoard.setBlock(emptyPlace.getRow(), emptyPlace.getCell(), player);

        //no game won and still room to move
        if(newBoard.getWinner() == Block.TYPE.NONE && newBoard.getEmptyPlaces().size() > 0) {
            //is an node (has children)
            Place tempPlace = getBestMove(newBoard, invertPlayer(player));

            //ERROR is thrown here! tempPlace is null.
            emptyPlace.setScore(tempPlace.getScore());
        } else {
            //is an leaf
            if(newBoard.getWinner() == Block.TYPE.NONE) {
                emptyPlace.setScore(0);
            } else if(newBoard.getWinner() == Block.TYPE.X) {
                emptyPlace.setScore(-1);
            } else if(newBoard.getWinner() == Block.TYPE.O) {
                emptyPlace.setScore(1);
            }

            //if this move is better then our prev move, take it!
            if((bestPlace == null)
                    || (player == Block.TYPE.X && emptyPlace.getScore() < bestPlace.getScore())
                    || (player == Block.TYPE.O && emptyPlace.getScore() > bestPlace.getScore())) {
                bestPlace = emptyPlace;
            }
        }
    }

    //This should never be null, but it does..
    return bestPlace;
}

private static Block.TYPE invertPlayer(Block.TYPE player) {
    if(player == Block.TYPE.X) {
        return Block.TYPE.O;
    }

    return Block.TYPE.X;
}
}


texts: My script isn't deleting or destroying my prefab game object in Unity2D

texts:
My script isn't deleting this game object once it reaches a certain position in my game. This is my script:

public float left;

public GameObject enemyLeft;

void Start ()
{
    enemyLeft= GameObject.Find("Enemy Left");
}

void Update()
{
    if (transform.position.x < left)
    {
        Destroy (enemyLeft);
    }
}

enemyLeft is a prefab gameObject that is being spawned in by my spawner.

This is the script where I intend to Destroy the game object:

    public float left;

    public GameObject[] enemiesLeft;

    void Update()
    {
        for (int i = 0; i < enemiesLeft.Length; i++) {

            if (enemiesLeft[i].transform.position.x < left) {
                Destroy (enemiesLeft[i]);
            }
        }
    }

Why isn't it deleting the game object?


texts: How should I store edge weights for my A* graph?

texts:
I am working on A* pathfinding in Unity, using C#. I am implementing Dijkstra's shortest path algorithm. I have a Dictionary with nodes as keys and corresponding lists of adjacent neighbors as values, which I use for A*.

My pathfinding graph is a 2D grid of nodes, with 4 connected edges each. I want to give edges representing unobstructed paths a cost of 1, and increase it for obstacles.

Where should I store each edge's weight?

Currently I'm representing my grid of nodes as plain gameobjects in a 2D array. I thought of storing the weights in a dictionary with node-pairs as keys and weights as values. Would that work, and be efficient enough?


texts: How to describe the performance requirements for a PC game?

texts:
System requirements describe the minimum specifications of the hardware and software required to play a game, in terms of performance and compatibility. Some requirements are clear-cut, like the operating system(s), 32 or 64 bit, minimum RAM and disk space, minimum DirectX versions, but for CPU and GPU performance, it's complicated:

The megahertz/gigahertz myth applies, so it's inaccurate to say "1.6GHz or faster"
CPU and GPU vary by generation ("Is my Core 2 Duo too old for this?") and segment ("Do I need a high-end rig or a budget rig is enough?"), so "1.2 GHz Pentium" won't cut it

Many minimum system requirements mention Athlon, Core 2 Duo, Pentium, ATI and GeForce 8800 GT which sound irrelevant in the age of i3/i5/i7 and A6/A8/A10/FX, AMD-branded (not ATI) GPU and three-digit GeForce GPU numbers (like 760).

Benchmark scores like 3DMark are accurate, but not everyone are aware of benchmarks or bother to run them.
Screen resolution and graphic settings are variables not mentioned in most system requirements.
"Playable frame rate" is subjective: It can be 12, 24, 30, 40, 60

My question is, is there a way to communicate the performance requirements of a game to a buyer that address the issues above. Or, should we ditch performance requirement descriptions and let the buyers do their own research on forums, benchmark sites and review sites? Are there any unusual ways of communicate system performance requirements?


texts: synchronizing view state between nodes in a rendering cluster

texts:
I'm building a display wall demo application.

The environment:

N machines, each driving up to six displays
Wired gigabit switch
OpenTK application to draw the pretty pictures, running 1 copy on each node

Each node runs an identical copy of the demo executable. Each node also has some config data containing the resolution of the entire wall and the relative position of that node's displays within that space. When rendering, a scale/translation transform is applied after the projection matrix (effectively zooming in on the part of the view that the node is responsible for rendering).

The nodes have a "mode" switch set in a startup script that puts them in "send" or "receive" mode. All but one node is in "receive." (Switching a node to "send" causes all others to switch to "receive").

The demo app is a basic FPS-type fly through of some primitive geometry (grid, icosahedron, etc). On each update, the sender node broadcasts a UDP datagram containing some state information (camera translation/rotation, transforms for moving objects).

Listeners asynchronously receive these datagrams, deserialize the state and update their local copies.

The net effect is that I run the app on my laptop and fly around, and the wall nicely follows along. This all works pretty well.

However, I'm concerned that as the system scales (from 10 displays to, say, 500), that network latency will be an issue. I've also thought that, rather than spamming state across the network this way, it would be nice to stuff it into a database and have each node just pull from there, but I doubt any off the shelf databases are going to be up to a 60FPS * 500 nodes cycle.

Suggestions? What's the best way to share state between a lot of nodes really, really fast?


texts: Why not just create very high resolution graphics and use them on all screens?

texts: I'm creating a game with pretty basic graphics (numbers, blocks, words, and a few nice design elements for the logo and such). My question is: can I create everything in a very high resolution- say 2048x2048- and just let libGDX scale these depending on the screen size? The reason I ask is because I've seen questions that ask about creating a copy of the assets in various resolutions. What's wrong with just using one asset set that's a very high resolution on all devices?


texts:
I've been reading Real-Time Collision Detection and for loose octrees it recommends expanding each node's AABB length by a factor of 2, making its expanded volume 8 times as large.  I am surprised that it needs to be this large, and there must be quite a lot of overlap and unnecessary child node traversals due to this large size.  Within the top few levels of the octree, triangles are generally very small compared to the node's volume so I don't see any problem with making their scaling factor much less than 2, perhaps even 1.1 (And then ramping it back up to 2 after a certain depth.)

This is for an octree holding static background geometry so I'm not concerned with how long building it takes.

Is there a mathematical reason for the radius ratio being two?


texts: Clicking on clues and other objects in a 2D cluedo like game

texts:
I'm a java/android programmer, but I don't have any experience in game programming, I'm already reading proper books, like "Pro Android Games", but my concerns are more about the ideas behind game programming than the techniques themselves.

I'm working on a 2D game, something like Cluedo to let you understand the genre. I would like to know how should I act with the "scenes", for example, a room with a desk, TV, windows and a lamp. I need to make some items tappable and others not. Is it common  to use one image (invisible to the user) with every different item a different color, then call the getColor() method on the image? Or use one image as background, and separate images for all the items? If the latter, how can I set the positioning? and should I use imageView or imageButton?

I'm sorry if those are really low quality questions, but as "outsider" ( I'm 23 and still finishing my university ) it's pretty hard learn alone.


texts: Memory clean up in scene management (AndEngine)

texts:
I have developed and launched a game called Bicycle Doodle GLD.

In this game, I load all the game resources at the initial loading scene. The game contains 24 levels, so only the resources that change for each level I don't load initially, but instead load at the level-select scene.  Each level needs 5 to 15 terrain images that load during level selection time.  There are the following scenes in the game: menu scene, level select scene, game play scene, and game over scene.

On each set of scene I call System.gc(), so memory clean up occur. My problem is that after playing a long time and changing scenes, the game suddenly closes without firing any message in debug.

I think memory becoming full is the reason.  How do I fix this?


texts:
When writing a game, you can do many things in many ways. But not all the machines the code will be ran on support all the ways of doing it.

How can you query for the capabilities of the machine hardware programmatically?

For example, there are ways in openGL to detect if certain openGL methods are supported by the GPU, you can also see if certain extensions are supported, query the openGL version, ect, but that still doesn't give you all the data (I'm pretty sure you cannot query the amount of VRAM the machine has).

Can you do a hardware query system-wide?
To ask for the number of cores, CPU frequencies, L2  cache size, amount of ram/vram, sound card capabilities and any other system specifics so you could instruct your code how to behave (for example, to not try to play sound on 64 channels if sound card supports only 32, if vram is limited use smaller textures, etc)?

It would be nice to query for such data on startup to see if machine supports minimum requirements and then have the data globally available to the code so certain feature can be turned on or off or substituted by maybe less efficient but supported code for that machine.

I remember GTA IV had a gfx menu where it showed the amount of VRAM available and the amount required for the selected setup.

Anyway, is there a way to do what I ask?


texts: Monogame pipeline tool: "Build failed: 1 is not a supported code page."

texts:
I've previously done some coding with Monogame 3.6 in VS 2015 on Windows 10 without any problems, including using the pipeline tool. Last week I was forced to reinstall my whole system and now have VS 2017 + Monogame 3.6. Suddenly the pipeline tool does not do anything anymore, instead of a report on the build success of the various items i only get the following output (which only shows up when I disable the "filter output" setting):

  Build failed:  1 is not a supported code page.
  Parameter name: codepage

I'm rather lost with this one and google did not return anything useful. Since I reinstalled the whole system I guess it could also be something missing which is not directly installed by VS or Monogame and got on my old system some other way.

Any ideas what is going wrong here?


texts: How can I play and stop a Visual Effect Graph effect through script?

texts: Can anyone please give an example lines of code one could use to play/stop a VFX through C# script.


texts:
I want to render text on an 3d object. I'm trying to simulate a digital signage LED panel.

My lcd Panel has a material and a texture.

How can I do ?

Using 3d Text ?

Thanks


texts: Mission system for a FPS game to force the player into following the storyline

texts:
Lately I've been working on a FPS game with a storyline in unity and I've encountered something that has been making my head explode for days. My objective is to be able to force the player to do a certain objective before being able to continue the game and to also give the new missions straight after the player has completed the past ones.
To help the player out I've created a panel with the description of the mission so that the player can check it out whenever he wants to. I've already created some code of my own for one mission but it seems to be a mess, I'm sure I should have different scripts for different things so that I didn't need to repeat code so much when I'm about to create a new mission script.
My problem is that I don't have the skills yet to do and I would like some suggestions: how could reduce my code and how I could create a universal script that would be able to recognize which missions are done and which are not, instead of doing it over and over again in every single mission script?
I'm kinda of new to unity and I've never posted to stack overflow so if I made any mistakes I'm sorry.
Extra information: the storyline is a linear, what I mean by that is that it doesn't give the player a choice to change it, it will always be the same and the quests/missions are here to force the player into following it. For example, the first mission is for the player to go down stairs and turn on two batteries. The second mission is for the player to kill a certain amount of enemies that appear right after.


texts: How do I account for the velocity difference between a ship and it's fired projectile?

texts:
In my project, I have a ship that moves and increases it's movement speed with respect to time and how long the acceleration button is being pushed(just like the way a real life car works), now as expected, the ship fires projectiles when I press the fire button.

The problem here, is that at a point in the game, the ship reaches it's highest speed/terminal velocity, and now it's faster than the projectile it fired which is not what I want, so, how do I create a realistic projectile movement based on the ship's velocity?
This is so that if the projectile is fired when the ship is moving slowly through the game scene, it doesn't move so fast that we can't see it travelling in the forward direction, and at the same time if it is fired when the ship is moving at top speeds, the ship is not seen to be faster than or as fast as the projectile's speed.

I want to keep the code as optimized as possible, so I am using this line for the projectile's movement:

public float velocity = 100f;
void Update() {
transform.position += transform.forward * Time.deltaTime * velocity;

}


texts:
I'm making a game with target (orbit camera). I want to limit camera movements when in room. So that camera don't go through walls when moving around target and along the ground.
What are common approaches? Any good links with tutorials? I use Unity3D, nevertheless I'm good with a general solution to the problem


texts: How to create a depth-recording shader for shadow mapping?

texts:
I am attempting to implement shadow maps.

I am first going to implement spotlights over directional lights (I am aware this is harder).

Since I was already rendering the geometry, my attempt was to recycle my old shaders and modify them to make shaders to create the depth maps.

This created the following vertex shader:

#version 450

layout(location = 0) in vec3 position; //(x,y,z) coordinates of a vertex

layout(std430, binding = 3) buffer data_buffer
{
    vec4 cubes_info[];//first 3 values are position of object
};

uniform mat4 view = mat4(1); //Camera orientation and position
uniform mat4 proj = mat4(1); //The projection parameters (FOV, viewport dimensions)

void main()
{
    gl_Position = proj*view*(vec4(position, 1.0) + vec4(vec3(cubes_info[gl_InstanceID]),0));
}

And fragment shader:

#version 450

layout(location = 0) out float fragmentdepth;

void main()
{
    fragmentdepth = gl_FragCoord.z;
}

As you can see, both shaders are pretty basic, they are a little more complex than they would otherwise be since they are using instancing, but overall they are simple.

However the output of these shaders is:

Where the original image is:

As you can see, the depth is being lost.

I think this is because my perspective, projection and model matrices are identical for both shaders.

In other words, I think that the camera I use for rendering the second image does not store the depth information. I wanted to know how can you generate a similar projection matrix to store the depth?


texts: Changing multisample count or disable/enable multisampling while the program runs?

texts:
How can I disable or enable multi-sampling live while the program is rendering?

I tried this.

    public override void Draw(GameTime gameTime)
    {

        GraphicsDevice.PresentationParameters.MultiSampleCount = 0;

        ... draw stuff ...

    }

But it doesn't disable the multisampling while drawing, because setting "PreferMultiSampling" to true under the presentation parameters when starting the program apparently overwrites this. Or am I wrong?

How can I do this?


texts: Objective-C SpriteKit – How to make a circle of buttons

texts:
I have some code in a project already, but I'd like to change it up a bit. Currently, my code creates an empty node called _buttonLayer and then create some buttons to add to it. My buttons start from the top-left corner of the _buttonLayer and then get added all the way to the bottom-right corner.

// Set up button layer.
_buttonLayer = [SKNode node];
_buttonLayer.position = CGPointMake(_centerOfScreen.x - (_buttonSize.width * 1.5) - 5.0,
                                    self.size.height - ((self.size.height * 0.375) + (_buttonSize.height) - 50.0) + 5.0);
[self addChild:_buttonLayer];

// Set up button array.
_buttonArray = [NSMutableArray array];

// Add some buttons.
for (char row = 0; row < 4; row++) {
    for (char col = 0; col < 4; col++) {

        // Buttons.
        SKSpriteNode *button = [SKSpriteNode spriteNodeWithImageNamed:@"LightGreyButton"];
        button.name = @"LightGreyButton"; // Initially set it to grey, because they all start off that way.
        button.size = _buttonSize;
        button.position = CGPointMake(2.0 + ((button.size.width + 3.0) * col),
                                      -(2.0 + ((button.size.height + 3.0) * row)));
        [_buttonLayer addChild:button];
        [_buttonArray addObject:button];

    }
}

So what I need to do now is create the buttons in a circle – instead of in a square. I'd like to somehow add the buttons into an outline of a circle, and then take the whole _buttonLayer and rotate it. Of course, the way I have it right now, it rotates on the top-left corner of the square. I want the middle of the circle to rotate.

How would I go about doing this?


texts: How do I get a HingeJoint2D to be rigid instead of elastic?

texts:
I made a chain of 40 segment using a HingeJoint2D. I followed the instructions directly off this Unity tutorial video

But when I start the game the chain bounces and stretches and then slowly over about 20 seconds it slowly pulls it self back up

How do I get the chain to actually be rigid instead of elastic?

If that's impossible, how do I get them to start in a rest state instead of starting with a bounce?

I uploaded the scene here if you want to play with it in Unity yourself.


texts:
I am converting two 2D images (A Voronoi graph and a Diamond Square noise map) into a 3D object.

However when finding the corner points of the Voronoi I am left with gaps, so I thought to drop these by calculating adjacency to existing nodes before creating the vertex. However no matter which algorithm for the weld I use, or the tolerance level of the distance I can't seem to get it to work.

This has led me to believe I am doing something wrong.

Image of the issue:

These gaps do not appear if I run without the weld, they are created by the weld jumping to spots, but then later welds not finding that spot.

I have even tried to increment the weld distance to a maximum of 10, if a suitable node wasn't found. But this is far to aggressive and has the effect of simplifying the mesh instead and creating more gaps.

My Repo for the full code is here: https://github.com/HughAJWood/TerrainGenerator

private void CalculatePolys()
{
    var nodesForEdges = new List<VNode>();
    foreach (var region in _regions)
    {
        foreach (var point in region)
        {
            if (point == null)
            {
                continue;
            }
            // We calculate where the voronoi node corners are, and pass them into the region
            var diff = ColoursDifferent(point);
            if (diff > 1)
            {
                RenderNodePointsOnImage(point);

                // Points are 2D, so to translate to 3D they are set to the Z property of the 3D node
                var node = new VNode
                {
                    X = point.X,
                    Z = point.Y
                };
                // Weld points within 1 unit from each other by determining if we already have one that exists
                // then using the existing node instead
                // A weld is calculated by determining the X,Z distance to see if we have a node stored already
                // that is within 2 units of the node we are creating
                VNode existingNode = Nodes.FirstOrDefault(n => n.Adjacent(node));
                if (existingNode == null)
                {
                    // Optimise node creation by skipping perlin lookup and ID iteration for only when needed
                    node.ID = VNodeId;
                    node.Y = _perlin.GetPixel(point.X, point.Y).R;
                    Nodes.Add(node);
                    Mesh.ControlPoints.Add(new Vector4(node.X, node.Y, node.Z, 1));
                }
                else
                {
                    node = existingNode;
                }
                nodesForEdges.Add(node);
            }
        }
        //if (i++ > 20) return;
        AddNodesToMeshAsPolys(nodesForEdges);
        nodesForEdges.Clear();
    }
}

The adjacency method is currently simplified to the fact I want to ignore the height of the node.

internal static bool Adjacent(this VNode a, VNode b, int tolerance = 3)
{
    var distance = Math.Abs(a.X - b.X) + Math.Abs(a.Z - b.Z);
    return distance < tolerance;
}

[UPDATE]

I have tried sorting the points by distance and fuzzy distance, both sort in the correct order. Then I tried taking the first point and using that as the welding point. Same effect.

I tried to average the points at the intersections at the image level and pass that back as the point every time, then weld. Same effect.

Clearly there are many approaches I can take for this, the problem arises when there are 2 points close to each other on the edge of a voronoi region. Sometimes they weld and create a gap. Sometimes however in some variances of the algorithm that the points don't weld even though their X,Z coordinates are very close to each. I'm still stumped as how to approach this.


texts: How to programmatically create an animation that linearly interpolate between two rotations?

texts:
I would like to programmatically create an animation that linearly interpolate between two angles (using the shortest path).
I wrote the following code :

Animation anim = gameObject.GetComponent<Animation>();

Quaternion a = Quaternion.Euler( 35.0f, 0.0f, 0.0f);
Quaternion b = Quaternion.Euler(330.0f, 0.0f, 0.0f);

AnimationClip clip = new AnimationClip();
clip.SetCurve("", typeof(Transform), "localRotation.x", AnimationCurve.Linear(0.0f, a.x, 1.0f, b.x));
clip.SetCurve("", typeof(Transform), "localRotation.y", AnimationCurve.Linear(0.0f, a.y, 1.0f, b.y));
clip.SetCurve("", typeof(Transform), "localRotation.z", AnimationCurve.Linear(0.0f, a.z, 1.0f, b.z));
clip.SetCurve("", typeof(Transform), "localRotation.w", AnimationCurve.Linear(0.0f, a.w, 1.0f, b.w));

clip.legacy = true;
anim.AddClip(clip, "test");

What happen is this : the angle goes 35 => 100 => 200 => 330

Instead, I would like it to go35 => 0 => -30

Also (another issue) the interpolation seems not linear (left : what I got, right: after setting the curve linear using the editor) :

As an example, the following code does what I want, it is linear and take shortest path (but without using curves) :

Quaternion a = Quaternion.Euler( 35.0f, 0.0f, 0.0f);
Quaternion b = Quaternion.Euler(331.0f, 0.0f, 0.0f);
transform.rotation = Quaternion.Lerp(a, b, Time.time % 1.0f);


texts: A* Pathfinding issues, player node is always off

texts:
so I am using Sebastian Lague's second video on A* pathfinding (https://www.youtube.com/watch?v=nhiFx28e7JY&list=PLFt_AvWsXl0cq5Umv3pMC9SPnKjfp9eGW&index=2), and since he is using a 3d model, and I am using a 2d model, I need to convert some of the values to 2d. It is working fine, but the problem I ran into is that the node that detects the player is always off.

Like in here, the cyan node is the node where my player is supposed to be, and the my cursor is where my player actually is. You can see that it is completely off. I am pretty sure this is because some error is produced while I tried to turn 3d into 2d, but I don't know how. Here is my grid script:

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

public class Grid : MonoBehaviour
{
    public Transform player;
    public LayerMask unwalkableMask;
    public Vector2 gridWorldSize;
    public float nodeRadius;
    Node[,] grid;

    float nodeDiameter;
    int gridSizeX, gridSizeY;

    void Start() {
        nodeDiameter = nodeRadius*2;
        gridSizeX = Mathf.RoundToInt(gridWorldSize.x/nodeDiameter);
        gridSizeY = Mathf.RoundToInt(gridWorldSize.y/nodeDiameter);
        CreateGrid();
    }

    void CreateGrid() {
        grid = new Node[gridSizeX,gridSizeY];
        Vector3 worldBottomLeft = transform.position - Vector3.right * gridWorldSize.x/2 - Vector3.up * gridWorldSize.y/2;

        for (int x = 0; x < gridSizeX; x ++) {
            for (int y = 0; y < gridSizeY; y ++) {
                Vector3 worldPoint = worldBottomLeft + Vector3.right * (x * nodeDiameter + nodeRadius) + Vector3.up * (y * nodeDiameter + nodeRadius);
                bool walkable = !(Physics2D.OverlapCircle(worldPoint,nodeRadius,unwalkableMask));
                grid[x,y] = new Node(walkable,worldPoint);
            }
        }
    }

    public Node NodeFromWorldPoint(Vector3 worldPosition) {
        float percentX = (worldPosition.x + gridWorldSize.x/2) / gridWorldSize.x;
        float percentY = (worldPosition.y + gridWorldSize.y/2) / gridWorldSize.y;
        percentX = Mathf.Clamp01(percentX);
        percentY = Mathf.Clamp01(percentY);

        int x = Mathf.RoundToInt((gridSizeX-1) * percentX);
        int y = Mathf.RoundToInt((gridSizeY-1) * percentY);
        return grid[x,y];
    }

    void OnDrawGizmos()
    {
        Gizmos.DrawWireCube(transform.position, new Vector3(gridWorldSize.x, gridWorldSize.y, 1));

        if (grid != null)
        {
            Node playerNode = NodeFromWorldPoint(player.position);

            foreach (Node n in grid) {
                Gizmos.color = (n.walkable)?Color.white:Color.red;
                if (playerNode == n)
                {
                    Gizmos.color = Color.cyan;
                }
                Gizmos.DrawCube(n.worldPosition, Vector3.one * (nodeDiameter-.1f));
            }
        }
    }
}

And here is my node script:

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

public class Node
{
    public bool walkable;
    public Vector3 worldPosition;

    public Node(bool _walkable, Vector3 _worldPos) {
        walkable = _walkable;
        worldPosition = _worldPos;
    }
}
```


texts: Unity) What should i do if i want to change sprite animation in same action?

texts:
My character has Idle-Walk-Jump-Attack state in animator.
and it can change its appearance when it gets an item.
for example, it can equip sword or armor. and i need to change whole sprite. the sword and armor are not separate with body.

which is best way to handle it?

before get item) Idle-Walk-Jump-Attack with sprite set 1.

after get item) Idle-Walk-Jump-Attack with sprite set 2.

how can i change animation state after get item? do i make every animation state in Base Layer?


texts:
I am trying to learn Unity for a simple board game. The question is, is it possible to use grid layout group (or any layout component) with sprites? The goal is to fit a board into my view regardless of the aspect ratio of the device.

The following grid should contain 7 by 7 sprites and it should scale up and down (no more then lets say 100 px) and have an aspect ratio of 1. I've tried adding a canvas and a panel that has a grid layout group component but it seems like sprites are not affected when added to the panel.

Also it seems like when I try to work with a panel or a canvas they have a fixed sizes in units. Having fix sizes feels a little bit off.

Is there a way to use layout components so sprites can have relative distances between them.

So far I am stuck and lost in tutorials and feeling like the answer should not be this complicated.

Any push to the right direction is welcome.


texts: How do I spawn enemies with a delay using threads?

texts:
Right now I have this:

Thread enemySpawner = new Thread(new Runnable() {
    public void run() {
        if(world.getCurrentState() == gameState.GAME) {
            world.spawnEnemy(x, y);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
});
enemySpawner.start();

It is called in the constructor of my game. For some reason, only one enemy spawns. How do I fix this?


texts: What's a way to implement a flexible buff/debuff system?

texts:
Overview:

Lots of games with RPG-like statistics allow for character "buffs", ranging from simple "Deal 25% extra damage" to more complicated things like "Deal 15 damage back to attackers when hit."

The specifics of each type of buff aren't really relevant.  I'm looking for a (presumably object-oriented) way to handle arbitrary buffs.

Details:

In my particular case, I have multiple characters in a turn-based battle environment, so I envisioned buffs being tied to events like "OnTurnStart", "OnReceiveDamage", etc.  Perhaps each buff is a subclass of a main Buff abstract class, where only the relevant events are overloaded.  Then each character could have a vector of buffs currently applied.

Does this solution make sense?  I can certainly see dozens of event types being necessary, it feels like making a new subclass for each buff is overkill, and it doesn't seem to allow for any buff "interactions".  That is, if I wanted to implement a cap on damage boosts so that even if you had 10 different buffs which all give 25% extra damage, you only do 100% extra instead of 250% extra.

And there's more complicated situations that ideally I could control.  I'm sure everyone can come up with examples of how more sophisticated buffs can potentially interact with each other in a way that as a game developer I may not want.

As a relatively inexperienced C++ programmer (I generally have used C in embedded systems), I feel like my solution is simplistic and probably doesn't take full advantage of the object-oriented language.

Thoughts?  Has anyone here designed a fairly robust buff system before?

Edit: Regarding Answer(s):

I selected an answer primarily based on good detail and a solid answer to the question I asked, but reading the responses gave me some more insight.

Perhaps unsurprisingly, the different systems or tweaked systems seem to apply better to certain situations.  What system works best for my game will depend on the types, variance, and number of buffs I intend to be able to apply.

For a game like Diablo 3 (mentioned below), where nearly any bit of equipment can change a buff's strength, the buffs are just character stats system seems like a good idea whenever possible.

For the turn-based situation I'm in, the event-based approach may be more suitable.

In any case, I'm still hoping someone comes along with a fancy "OO" magic bullet which will allow for me to apply a +2 move distance per turn buff, a deal 50% of damage taken back to the attacker buff, and a automatically teleport to a nearby tile when attacked from 3 or more tiles away buff in a single system without turning a +5 strength buff into its own subclass.

I think the closest thing is the answer I marked, but the floor is still open.  Thanks to everyone for the input.


texts: I am having issues creating a third-person camera for my Rogue Squadron (N64) like game. First I have posted my issue on the official Unity Answers site here. So far my ship is behaving as I want and the camera follows position correctly (XYZ), however, it doesn't rotate how I would like. My first attempt was to set the rotation of the camera to the rotation of the ship and realized that is not what I am looking for either. I have found some information on rotating around a (pivot) point but I am having trouble understanding them. For example, I have found this and this but Im not sure how they work. The end result would be something like the camera found here. Thank you for any help, I would greatly appreciate a description of what you are doing/how it works. Lastly this is done in C# in Unity. I can provide my code if needed.


texts: How can I determine the pixels covered by a transformed triangle (without drawing it)?

texts:
I have three points that form a triangle in a 3D scene. I want to apply an arbitrary rotation/translation transformation to this polygon and later check in which pixels of an image they would be rendered (if any), taking occlusion into account. I want to do this without having any window, so that no actual drawing is done (I know the camera parameters and the "virtual" rendering image size).

How can I accomplish this? I thought about OpenGL and the glReadPixels function, but I am not sure that I can query for a 3D point to get its rendered 2D pixel.

For reference, I am working on a computer vision application where I have an image taken by a camera and a 3D model of a virtual object. The virtual object is a mesh of a lot of triangles. What I actually want is to project the virtual object on the image and get the positions in the image of the non-occluded triangles, so that I can manipulate the image in those positions. As I said, I don't really need to draw, just the calculations. Now, I am doing it manually and I can get rid of those points that are occluded by other points, but I do not know how to take occlusion into account when instead of single points, they are planar triangles.


texts: Why do some videogame sequels become bigger?

texts:
Sometimes I'm wondering why sequels in games usually strive to have new features, making them more complex, taking much longer to finish and also sounds much harder to keep motivated into it.

I understand that it's needed because gamers don't want to buy the same game with just a different story. but occasionally these features seem to make the original intention of the game more complex than I think it should be.

If a developer is always with the thought to make his next game bigger than the previous, then that means that they'll become overly cluttered with tons of features that a gamer may or may never use. That sounds like a waste of effort to me.

Maybe it's just that I prefer a simple style from indie games,
but when I look at the larger companies, then sometimes I've a feeling
they're trying out a lot (if not too much) to sell well.

Just take a look at Mario Kart 8, Breath of the Wild and Super Mario Odyssey as example.
They're all so complex compared with what the series used to be.
Now imagine how large their next game has to be in order to top that, if that's even possible.

So my question is: what leads game developers to focus on making the next game even bigger? And are there viable ways to avoid this trend?

I'm used to the phrase 'less is more', but I wonder if that also fits in this situation.


texts:
I was doing some reading for college and I searched for

"Main characteristics of games"
"Main characteristics of video games"

and other similar ones, the result were a bunch of psychological studies and some non totally related links. The bottom line there was no real definition.
I can see why, however I m suprised there are no attempts

I m going to think I m looking for the wrong thing, so can you help?

My purpose is to try to understand what is a video game and what isnt. ie: bad games are still games, so fun and immersion are not characteristics of a game ( before I started thinking about this I thought that was the case)

Cheers


texts: How can I monetize with AdMobs a libGDX game made with AIDE?

texts:
I have created a libGDX game with the AIDE IDE Android app. The game is working fine so I will be uploading it to the Play Store to make money.

I'd like to use AdMob ads, how would I integrate it?


texts: How to use ROAM algorithm to adapt terrain's mesh?

texts:
I have a hard time understanding the idea behind ROAM algorithm

"Real-time, continuous level of detail rendering of height fields" Peter Lindstrom, David Koller, William Ribarsky, Larry F. Hodges, Nick Faust, Gregory A. Turner SAIC http://dl.acm.org/citation.cfm?id=237217
"ROAMing terrain: real-time optimally adapting meshes" Mark Duchaineau, Murray Wolinsky, David E. Sigeti, Mark C. Miller, Charles Aldrich, Mark B. Mineev-Weinstein http://dl.acm.org/citation.cfm?id=267028

The problem that I cannot grasp is that the whole idea behind the algorithm is that the terrain mesh is at all times divided to isosceles right angled triangles but when we arrange the terrain in a non flat mesh then the triangles that we divided the mesh into are supposed to be extended(?) to meet the height field requirements?

From what perspective is the terrain divided into those triangles and should they be isosceles right angled triangles generally or only when looked upon in up-down projection?


texts: How to handle the different frame rate on different devices?

texts:
I am not quite sure how frame per second works on a web page. I have a Canvas game that involves in moving an image from point A to B, and measuring the time elapsed.
The code can be as simple as:

var timeStamp = Date.now();
function update(){
  obj.y += obj.speed;
  text = "Time: "+ (Date.now() - timeStamp) + "ms";
}

The function update() is called every frame.
The problem is that the time elapsed is different from device to device. It is pretty short on my PC, but get longer on my iPad, and is much longer on my cell phone. I thought it is because the FPS is smaller on mobile devices, so instead of calling update() every frame, I call it every 1ms by using a setInterval. But this does not solve the problem.

In my understanding, the function for setInterval is invoked based on the increment in system time, other than frame rate, so it should fix the problem. Am I missing anything here? If the setInterval function is called based on FPS, is there any way to get around with the FPS difference across devices?

On a side note, I have sort of a "water simulator" on the same canvas. It involves in redrawing about 60 objects which can be 600x600 pixels for every frame, so it could be a frame rate killer. I am using Phaser.js but not really using much of its functionalities, if that helps.


texts: Ray Sphere Interesection Distances WRONG

texts:
The discriminant is not working. This code produces incorrect distances from ray to sphere, but it can tell whether or not the ray does strike the sphere.

HOW HARD IS THIS I'VE BEEN TRYING TO DO THIS FOR 2 DAYS

float raySphereIntersect2(glm::vec3 ray, glm::vec3 origin, glm::vec3 sphere_origin, float sphere_radius, float drawdistance){
    //A sphere is given by its center
    float cx = sphere_origin.x;
    float cy = sphere_origin.y;
    float cz = sphere_origin.z;
    //its radius R
    float R = sphere_radius;
    //and its color
        //Ignored
    //A line segment (ray) is given by its endpoints:
    //P0
    float x0 = origin.x;
    float y0 = origin.y;
    float z0 = origin.z;
    //and P1
    float x1 = origin.x+(ray * drawdistance).x;
    float y1 = origin.y+(ray * drawdistance).y;
    float z1 = origin.z+(ray * drawdistance).z;
    //set
        float dx = x1 - x0;
        float dy = y1 - y0;
        float dz = z1 - z0;

        float a = dx*dx + dy*dy + dz*dz;
        float b = 2*dx*(x0-cx) + 2*dy*(y0-cy) + 2*dz*(z0-cz);
        float c = cx*cx + cy*cy + cz*cz + x0*x0 + y0*y0 + z0*z0 + -2*(cx*x0 + cy*y0 + cz*z0) - R*R;

        float discriminant = (b * b) - (4 * a * c);
        if (discriminant < 0)
            return -1;
        // OK so there is a solution, compute the distance
        float t = (-b - sqrtf(discriminant))/(2*a);
        return t;
}


texts: Phone complains that identical GLSL struct definition differs in vert/frag programs

texts:
When I provide the following struct definition in linked frag and vert shaders, my phone (Samsung Vibrant / Android 2.2) complains that the definition differs.

struct Light {
    mediump vec3 _position;
    lowp vec4 _ambient;
    lowp vec4 _diffuse;
    lowp vec4 _specular;
    bool _isDirectional;
    mediump vec3 _attenuation; // constant, linear, and quadratic components
};

uniform Light u_light;

I know the struct is identical because its included from another file. These shaders work on a linux implementation and on my Android 3.0 tablet. Both shaders declare "precision mediump float;"

The exact error is:

Uniform variable u_light type/precision does not match in vertex and fragment shader

Am I doing anything wrong here, or is my phone's implementation broken? Any advice (other than file a bug report?)


texts: Resize rigidbody in runtime, Box collider OnTriggerEnter not work

texts:
Scene setting:

Object A:
Rigidbody, kinmeatic
Box collider, is trigger true.

Object B:
Box collider, is trigger true.

Script is on Object A:

void FixedUpdate()
{
    if(increaseScale)
    {
        transform.localScale += transform.forward* speed;

        // when to stop
        if ((AEForward * transform.localScale.z).sqrMagnitude >= range * range)
            increaseScale = false;
    }
}

void OnTriggerEnter(Collider other)
{
    Debug.Log(other.transform);
}

No log message when part of object A is inside B.

And the funny part is if I use it on a sphere collider, it works. (use                       transform.localScale += new vector3(1,1,1)* speed; instead )


texts:
I've realized this gear using primitive.

My object is:

Main cylinder with
with a Rigidbody and a script who rotate Y axis

All Prism as child who has MeshCollider

I've got also a pivot for each gear.

The problem is that the right gear not rotate when "prism" collide with others.
The collision not happen.

Any ideas ?

Thanks


texts: Android - Using opengles through java vs c++

texts:
Ive been reteaching myself opengl so I can make a game on android. However Ive been struggling with how to build objects and scenes in opengl using c/c++ and passing them through the jni to the virtual machine where android can use them. Can some one point me towards some tutorials that actually show the use of natively built objects being created and passed through to the jni. Im fine using c++ or java I just dont have much experience using the jni.  Ive built some sample projects where I pass primitives like floats and perform operations on them on the native side and then passed them back but I cant figure out how to create a scene in opengl in c++ and then pass it to java.  Ive been looking at writing everything using java but Im not sure if the java bindings make for some performance loss.

Any help would be much appreciated


texts: mobile: Is every position in percentages when you support multiple screen sizes (different aspect ratios)?

texts: Is every position in percentages when you support different aspect ratios? Or do you do if-else statements for each aspect ratio and put absolute positions? What are the pros and cons of each?


texts: Displaying scores in tutorial projects - GUI and UI

texts:
I've just started learning to use unity by working through the tutorial projects but in both roll-a-ball and space shooter I've hit dead ends in the text lessons. The lessons tell you to simply add a GUI text object but they don't seen to exist anymore. From what I've gathered they have been replaced with UI text, but I can't find any documentation that explains how to use them in the way the tutorial describes.

Essentially my question is "how do I complete lesson 15 of the space shooter tutorial project now that unity doesn't let me create GUI text objects in the hierarchy?" Any help would be greatly appreciated.


texts:
I am working on a small simulator. There is a 3D character on the screen and it randomly plays an animation (I used animation.PlayQueued(...) command inside a for loop).
Now I have added a slider ( GUI.VerticalSlider ) on screen. I want to change the speed of all playing animations of 3D character when change the value of slider.

I know to use animation["animationNane"].speed=xx; but my problem is I have to pass the parameter of animation name that I want to change the speed . but actually I don't want to change the speed of specific animation clip. I want to change the speed of whatever the animation running in my 3d character. How can I change the speed of whatever animation is playing?


texts: How to figure out a vector based on 2 points that add up to a certain value

texts:
I am writing a game in which I am representing a velocity with a vector. I have a starting point and a point that I want the object to move towards at a certain speed. (I need the resulting vector's x and y values to add up to 800). I'm not sure what kind of formula I can use to accomplish this.

SO! I have a starting point. An "ending point". And need a vector whose x and y values add up to 800.

Here is the code I came up with:

dx = size.width / 2 - ball.position.x
dy = 800 - size.height / 2 - ball.position.y
ball.physicsBody?.velocity = CGVectorMake(dx, dy)

Although this appears to work, |dx| + |dy| != 800 and therefore the balls move at slightly different speeds. I'm sure I'm doing this wrong, but I'm not sure how to go about fixing it.


texts: Limit rotation to certain angles for transform.rotate

texts:
I'm working on a small project to learn Blender and Unity, and one issue I recently came across is that while I can have the turret of my tank rotate on the z-axis based on mouse movements, I can't for the life of me figure out how to lock it to certain angles.

My current approach was to use Mathf.Clamp to limit the range of values that I could pass to the rotate function, but that doesn't seem to have done anything at all, even though when outputting the value Clamp produces, I can tell it doesn't go over my specification.

The code I have:

enum RotationAxes {MouseX, MouseY, MouseXandY};
var axes : RotationAxes;
private var MouseX = RotationAxes.MouseX;
var sensitivityX : float = 15F;
var minimumZ : float= -35;
var maximumZ : float = 35;
function Update ()
{

    if (axes == MouseX)
    {
        //yRotation += Input.GetAxis("Mouse X");
        //transform.eulerAngles = Vector3(0, 0, yRotation);
        transform.Rotate(0, 0, Mathf.Clamp (Input.GetAxis("Mouse X")*sensitivityX, -30, 30));

    }

}

function Start ()
{

}


texts: Trying to find a game development competition

texts:
About a month or two ago one of my friends participaded in a game development competition. The theme was "infinity". I think he had either a week or a month to finish the game. The problem is I cannot for the life of me find or remeber the name of the site. (Its not Ludum Dare)

I am hoping someone here might know what I am talking about.


texts: How do I prevent players from flying too low in an infinite sky?

texts:
Let's say I have a game that allows the player completely free, open world flight, and the world itself is a bunch of floating islands. This creates some problems with flying too low, such as reaching the fake cloud "floor", being stuck without being able to get back up, and so on. How can I prevent this without introducing some jarring invisible "floor" that repels the player if he slams into it?

I thought about having some sort of in-universe wind near the "bottom" that might decelerate the player and then push him/her back up, but I'd like to hear some more ideas that might be less artificial.


texts: Data structure for objects in a galaxy of star systems

texts:
I'm having some difficulty coming up with the appropriate data structure to use for a game.
I'm aiming for a galaxy view with tens of thousands of visitable star systems.

Structure
Hierarchically, each star system can contain one or more of the following:

Planets [and their moons]
Asteroid Belts
Megastructures [and their moons/sub-structures]

All of the above can have "points of interest" [POI] eg a station in low orbit, a surface resource node, a docking bay.
Usage
I don't particularly care about physical location within a system beyond knowing its order in the hierarchy (I'll be showing a list of locations, rather than trying to render them in 3D space). So I can treat all objects within a system as located at the star for the pursposes of calculation.
I do, however, need a way to specify routes from any Planet/AsteroidBelt/Moon/Megastructure/POI to any other. I also need to be able to search for other locations meeting certain criteria [both to offer as destinations in the UI and to handle rendering].
Each type of location will have some unique properties (Asteroid belts have resource distributions, for example whereas planets ave atmospheres) but they also have lots of common properties (inventory, owner, comms network node id, etc).
Ideas so far
Obviously, with the numbers I'm considering I need to take a sparse/lazy generated approach. Currently the galaxy is built entirely in the GPU and stars are only presented to the CPU when the user first clicks on them.
That lends itself nicely to a hierarchical data structure with a load-on-first-access approach. Click on a star and it's added to the list, so the name is saved. Scan/visit it and I'll generate the system contents.
Unfortunately, I also need to be able to search across all generated locations efficiently (given an ID, find the star system coordinates, find planets with an atmosphere like X, find any location with X in its inventory) in a potentially huge search space.
That doesn't align with recursively walking up/down trees.
I considered using a heirarchy and manually maintaining a number of separate indices to speed up searching. It's doable but a pain and error-prone. It also feels like one of those solutions where I'm going to keep finding one more type of query I need to support and before long I'm trying to implement a minimal database.
Speaking of which I also need to persist this data at some point. Currently I'm serializing to a densely packed binary blob.
So... I took a step back and wondered whether I should actually use a database. I can see the benefits of using something like SQLite which I could bundle with the game and would handle persistence, indices, and the rest.
Db?
After spending a couple of days implementing the basics, I can see this is going to be quite a long and involved process.
None of the friendly tooling works well in Unity, so I can't take advantage of entity framework w/ code first, nor nice Linq-To-Sqlite predicate handling. Even worse, most of the libraries to work with EF are tightly coupled to windows. EF Core seems like an option but I haven't been able to get it working in Unity (I need to do some assembly version mapping but as Unity overwrites the project file regularly and doesn't seem to support this itself, I think it's a losing battle).
So I've headed down the route of implementing a data layer that generates SQL as needed.
I can do that, but it opens up a huge can of worms in terms of manually maintaining the DB schema. I'm going to have to start tracking a DB version and bundling migration scripts with any update/patch. It's a whole new maintenance burden.
Question
So... What am I missing? What's the elegant way to store a sparse hierarchy of data whilst still supporting flexible search across disparate object types that just happen to have a lot of common properties?


texts:
I want to create a button for a game's UI. The background uses a gradient and then I blit a surface on top of the gradient and use SDL_SetColorKey to delete the unwanted pixels. The surfaces are not the same size: the clipping mask is 200 x 50 and the gradient 1 x 50, so I need to stretch the gradient to the same width of the cliping mask, I can't use a wider image because the purpose of doing this is to save memory and storage and using the same gradient image on multiple clipping_masks of different widths.

I found I can use SDL_BlitScaled but I need to blit the surface to itself and it appears to be useless because the surface remains the same size, am I doing something wrong?
Is there a way to do it without blitting the surface to itself?

SDL_Rect final_size;
final_size.w = 200;
final_size.h = 50;
final_size.x = 0;
final_size.y = 0;
SDL_BlitScaled(gradient_surface, NULL, gradient_surface, &final_size);
//do some stuff with those textures
SDL_CreateTextureFromSurface(renderer, final_button_surface);


texts: How to determine lowest PC requirenments for my game to run

texts:
so I've created my first game in UE4 (4.9.2 version) and want to publish it. But i really don't know how to determine lowest possible environment my game runs on.Also I am unsure what other files apart from actuall build I should redistribute. I am building game via file->package project->window.

1) How to determine minimum required DirectX version?

2) How to check what other dll's I need to include into installer (apart from actuall build)? For example will I need to install VC redistributable packages? If so then which ones? The same goes with directx.

3) How to determine minimal windows version? This is limited by directx compatibility right? If my game runs on DirectX10 or higher then all OS versions with at least direct10 will be OK?

4) This may seem as stupid question but in which version 64 or 32 bit I should distribute my game? 32 is always better because anybody can run it right?

thanks for Your answers ;)


texts: I want my button to activate an inactive ui image in the hierarchy through c# called "Responded_A" when the "Response_A" button is clicked. I assume this will use setActive in someway, but I'm just starting out and a little lost. I think some guidance here could really set me in motion. Thanks!


texts: What use does the unary & operator have in this piece of C++ code?

texts:
In an example for a little game framework (that does work), there are the lines:

ID3D10Device* device;
ID3D10Buffer* pBuffer;

followed by the line

 device()->CreateBuffer(&bd, NULL, &pBuffer());

The third argument requires a pointer, so why do you need to put an ampersand before pBuffer? an ampersand gets a memory address right? But pBuffer is already a pointer so what does the ampersand do to it?


texts: How do you get player to interact with level?

texts:
I suffer from this problem where I have say a class called Player and a class called Level. Now the only way I can figure out how to say make the player interact with the level is if I do something like

player.input();

level.update(player);

I would have to do something like that, but then it gets even more complicated if I have monsters and I need to add them to the level e.t.c., so how do I get the monsters to interact with the player.

So I'm struggling with this basic concept. If I use C it gets rid of this problem as I use extern and I can get the data I want so all I think about is the flow. So in C I can do something like this

switch (terrain[u.y + dy][u.x + dx])
{
case WALL:
print_msg("You cannot go there.\n");
return 0;
case FLOOR:
case DOOR:
case STAIRS:
reloc_player(u.y + dy, u.x + dx);
return 1;
}

So in here we have Player u and your moving that player around only if it doesn't hit a wall. But, I can do this because I use extern on terrain[][].

I'm really struggling. I don't really want to use C as C++ is easier with SFML and I like classes. I suppose the answer is how do I manage interaction between level, mobs and players?

If I was going to do it now I would do this

Game::Game()
{
   level.init();
   player.init();
}

void Game::input()
{
  player.input(level.getLevel()); // so yucky
}

void Game::update()
{
  player.update();
  level.update(player); /// yuck
}

void Game::render()
{
 player.render();
 level.render();
}

I could do something like this, but it gets really complicated and everything becomes a mess of passing stuff around. In particularly I need to pass the player method to the level.update() so the level knows the player has moved. Everything gets messy and I feel I can't add into the game. Plus I would need to make the level static or something.


texts: android game performance regarding timers

texts:
Im new to the game-dev world and I have a tendancy to over-simplify my code, and sometimes this costs me alot fo memory.

Im using a custom TimerTask that looks like this:

    public class Task extends TimerTask {

    private MainGamePanel panel;
    public Task(MainGamePanel panel) {
    this.panel=panel;
    }

    /**
    * When the timer executes, this code is run.
    */
    public void run() {
    panel.createEnemies();
    }
    }

this task calls this method from my view:

    public void createEnemies() {
    Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.female);
    if(enemyCounter < 24){
        enemies.add(new Enemy(bmp, this));
    }
    enemyCounter++;
      }

Since I call this in the onCreate-method instead of in my views contructor (because My enemies need to get width and height of view). Im wondering if this will work when I have multiple levels in game (start a new intent). And if this kind of timer really is the best way to add a delay between the spawning-time of my enemies performance-wise.

adding code for my timer if any1 came here cus they dont understand timers:

    private Timer timer1 = new Timer();
    private long delay1 = 5*1000; // 5 sec delay

    public void surfaceCreated(SurfaceHolder holder) {
    timer1.schedule(new Task(this), 0, delay1); //I call my timer and add the delay
    thread.setRunning(true);
    thread.start();
}


texts: Why is addressing an array of vectors more efficient than addressing an array of matrices in Cg?

texts:
According to Nvidia's Cg tutorial (in the note section right under 6.5.2), addressing an array of vectors seems to be more efficient than addressing an array of matrices. The reason it mentions is because the index is floating point value instead of integer.

Could anyone explain this a little bit?

Here is the quote:

  For performance reasons, the program treats boneMatrix as an array of float4 vectors rather than an array of float3x4 matrices. ThematrixIndex` array contains floating-point values instead of integers, and so the addressing of a single array of vectors is more efficient than accessing an array of matrices. The implication of this is that the indices in the matrixIndex vector should be three times the actual matrix index. So, the program assumes 0 is the first matrix in the array, 3 is the second matrix, and so on. The indices are fixed for each vertex, so you improve performance by moving this "multiply by 3" outside the vertex program.

And here is the Cg program it's referring to:

// Example 6-5. The C6E5v_skin4m Vertex Program
void C6E5v_skin4m(float3   position    : POSITION,
                  float3   normal      : NORMAL,
                  float2   texCoord    : TEXCOORD0,
                  float4   weight      : TEXCOORD1,
                  float4   matrixIndex : TEXCOORD2,
              out float4   oPosition   : POSITION,
              out float2   oTexCoord   : TEXCOORD0,
              out float4   color       : COLOR,
          uniform Light    light,
          uniform float4   boneMatrix[72], // 24 matrices
          uniform float4x4 modelViewProj)
{
  float3 netPosition = 0, netNormal = 0;

  for (int i = 0; i < 4; i++) {
    float index = matrixIndex[i];
    float3x4 model = float3x4(boneMatrix[index + 0],
                              boneMatrix[index + 1],
                              boneMatrix[index + 2]);

    float3 bonePosition = mul(model, float4(position, 1));
    // Assume no scaling in matrix, just rotate & translate
    float3x3 rotate = float3x3(model[0].xyz,
                               model[1].xyz,
                               model[2].xyz);

    float3 boneNormal = mul(rotate, normal);
    netPosition += weight[i] * bonePosition;
    netNormal   += weight[i] * boneNormal;
  }

  netNormal = normalize(netNormal);
  oPosition = mul(modelViewProj, float4(netPosition, 1));
  oTexCoord = texCoord;
  color = computeLighting(light, netPosition, netNormal);
}


texts: Whats the best way to publish and promote an app by myself?

texts:
My first little casual-action android game is nearly finished. Its my first one and i dont expect any sucess. But nevertheless i want to try to publish and market it by myself.

But what can i do without any bugdet? How do i attract and reach people ? Are there any tricks ? How did you published and promoted your first app/game ? And what is your experience with self publishing/marketing ?


texts:
I am developing an TBS (turn based strategy) game. I have created a simple canvas renderer to render hexagonial map. I already implemented scrolling on the map. My current problem is that I want to make it like in the civilizations games that you can scroll around the world. But I am kind of stuck on how to implement that. I had the idea of checking if a tile was rendered and if there is still space to the left render next sibling and so on, but this would turn out into long loops. My map array (2d) holds all the tiles and every tile has a member which holds all the siblings. How would you solve this?

This is a screenshot from the example. You can check it out on http://civ.minerjs.com. The code is also available to browse on the site using developer tools. Thanks for reading!


texts: Cocos2D: Upgrading from OpenGL ES 1.1 to 2.0

texts:
I have recently starting upgrading my ios game to the latest Cocos2D (2.0 rc), and I am having some difficulties upgrading my texture generation code to OpenGL 2.0.

In the old version I generated images with this code:

CCRenderTexture *rt =
[CCRenderTexture renderTextureWithWidth:WIDTH height:HEIGHT];

[rt beginWithClear:bgColor.r g:bgColor.g b:bgColor.b a:bgColor.a];

glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);

glVertexPointer(2, GL_FLOAT, 0, verts);
glColorPointer(4, GL_FLOAT, 0, colors);
glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)nVerts);

glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_TEXTURE_2D);

[rt end];

But since OpenGL 2.0 works differently this code won't work. What is the best way to use the new OpenGL?


texts:
I have four sources of a character's stats changing (in order of calculation):

Due to leveling up (base stats)
Equipment changing (calculated after base stats)
A passive skill being toggled on or off (calculated after equipment stats)
Being afflicted by a buff/debuff (calculated after passive skill stats)

My question is, if any of these sources causes a change, should I recalculate everything from base stats, or store "sets" of the stats after each change (i.e. save a copy of the stats after passive skill changes, so if the player is hit by a "defense down" status effect, I only have to recalculate from skill stats). Unless there's a better way to deal with this problem, I don't know which of these two options is better.


texts:
As you can see on the top corner it says COL: False/True. This is if the player bounds and the tiles which are solids. The rectangles for the tiles and players are checked if they intercept each-other. Looks like its working right? Well nope. Look more closely.

The BOTTOM RIGHT corner needs to be inside the tiles for it to count.

Now let's get to the code I used now that hopefully you understand the problem.

Player Bounds (Rectangle)

playerBounds.Width = 32;
playerBounds.Height = 64;
playerBounds.X = (int)this.position.X;
playerBounds.Y = (int)this.position.Y;

Tile Bounds (Rectangle)

newTile.bounds = new Rectangle(x * TILE_SIZE, y * TILE_SIZE, TILE_SIZE, TILE_SIZE);

Now onto how it detects it:

for (int x = 0; x < Tilemap.MAP_WIDTH; x++)
        {
            for (int y = 0; y < Tilemap.MAP_HEIGHT; y++)
            {

                if (tm.tile[x, y].bounds.Intersects(playerBounds))
                {
                    if (tm.tile[x, y].getSolid())
                    {
                        Colliding = true;
                    } else
                    {
                        Colliding = false;
                    }
                }
            }

        }

Move

    public void Move(Vector2 pos)
    {
        for (int i = 0; i < speed; i++)
        {

            position += pos;
        }

    }

I have used breakpoints at the collision detection loop. And the rectangle fully covers the character and the tiles.


texts: Best way make static GameObject clickable 2D

texts:
I've built a turn based battle combat game (like pokemon) but i'm stuck between a rock and a hard place.

Asfar as i understod UI elements should be inside Canvas, while Players, Enemies, Items and etc... Should not be inside a canvas. Correct me if i'm wrong.

I've tried different ways how to handle this situation. Such as make Enemy as a button, but seems not to fire. Since i think it has to be inside a canvas. Also make enemy which have animations as button, may not be a good idea?

Update event, to check if the mouse is down and mouse position is converted with screentoworldpoint and see if the positions matches with the enemy position.

Update event, to check if the mouse is down and rayCast see if we colide with something. But i dont feel like this is neccesary since the enemy does not move. So the position is always the same.

Also if it's possible to take into consideration that every enemy is different size. But this is a minor detail, i would like firstly tackle the best way handle onClick event without the extra overhead.

I would appericate any feedback on my dilemma.


texts:
I'm designing a game where players are able to form alliances with each other.

The game has two winning conditions: When all other players are eliminated, the remaining player wins; or if all the teams work together to solve the problem that was set them against each other in the first place, then they all win.

I'd like to encourage the single player victory, as it's more fun, but I don't want to flat-out remove the cooperative victory.

How would I go about discouraging players from attempting to cooperate with each other?

One idea I had was to make alliances a vector for mistrust - alliances might be able to steal items from each other, for example.

For some small amount of context: the game involves capturing territory and destroying territory belonging to other players. When a player runs out of territory they are eliminated.

Cheers for any suggestions!


texts:
I'm trying to create a game where i have two abjects A and B

1 :I know the shape of the two objects(Rectangles) .

2 :The speed and position of each object.

And i'm trying to figure out if the two object will eventually collide .

I  calcuted the point where   the object's paths intersect
using this formula

The same for y

But i still don't know if the two object will actually collide or will miss each other .


texts: Unity find position within range of object

texts:
Say you have a gameobject that is at a certain position(this could be your player).

Now say that you have a melee NPC that has to be within a certain range to hit the Player.

Now you would do something like this to find out where the player is:

var targetPosition = target.transform.position;

Say that the range of the NPC is 4 meaning he can be 4 units away from the player before he can start attacking him.

My question is how would you subtract that to get a position that is within range?

And am i doing this type of thing correctly? or is there a better way of doing it?  :)

Any help would be appriciated a lot!


texts: is it possible to use Ui button to work continous on unity

texts: i want to use Ui buttons as joyStick arrows to move character. but as i know buttons just work once. not continous. so is it possible to make button work continous?


texts: Math / game design for non-linear armor degradation?

texts:
I have a game that is about starships shooting each other.
Starships have a values that represent initial Health, Armour and Damage degradation

Example
1000, 800, 80% // 1000 HP, 800 Armour, 80 % mitigation
300, 250, 60% // 300 HP, 250 Armour, 60 % mitigation

Note Armour and mitigation are in relation to each other and armour will be lowered on damage, lowering the associated mitigation in the process.

Resolving damage start with a pure damage value, something like 50.
I then check the targeted ship for existing damage entries.
Depending on that, i reduce the "armour", translate it to a modified mitigation value and mitigate the damage by x%, reducing the armour in the process, so the next hit will encounter less armour, hence less mitigation etc.

example

A virgin ship has 1000/800/60% - hp/armour/% and is hit for an initial 50 damage.

Check the ship, see it has no damage received yet.

Take the damage (50), apply the armour modifier (800 of 800 remains, so 60% mitigation applies).

Split the damage into 40%/60% (hp, armour damage), so 20 of the 50 damage damage the hull, while 30 damage are eaten up by armour - lowering armour, and effective mitigation, for the next hits.

Next hit, 50 damage

Ship has 980/1000 Health, 770/800 armour.

With 800 armour giving 60% mitigation, 760 armour will give 57 % mitigation

50 damage are split into 43%/57% Hull/Armour damage -> 21/29 points.

this continues until a ship has no hull left.

How can i modify this so it becomes more of progressive curve, i.e. initial hits take bigger chunks of armour/mitigation relative to later hits (currently the the first few hits obviously eat more mitigation than later hits, but i want it to be more even more effective at the beginning.

How do i modify my math ? Do i need to add a square/root somewhere ?


texts: How do I show a camera's field of view area through another camera?

texts: I have a side camera that can be set on run-time with changeable field of view with GUI. I am searching for a way to show the field of view of the side camera using my main camera. I am thinking about custom mesh creation through code so that it can be generated alongside the camera rectangle, but it seems too complex. Should I proceed with this method or are there any other solutions?[!


texts: 2D active ragdoll/physics-based procedural animation

texts:
I'm trying to make a 2D quadraped robot stand and walk via physics.

My robot looks like this. (art is not mine. Source is vapgames)

It's rigged via Unity's 2D animation package and each joint/bone has it's own collider + rigidbody with the legs also having hingejoints connecting the lower part to the upper part and the upper part to the main body of the robot. I've also set up IK for both legs using the 2D IK package with the IK target being attached to their respective leg via fixedjoint and can be moved programmatically to move the legs with respect to IK.

I want it to stand up, as at the moment is just falls and acts as a generic limp ragdoll. I've tried these methods:

Adding downward force to the legs via the IK targets
Adding upward force to the torso
Animating the IK targets to try and get the bot to stand up with animatePhysics enabled.

All of these failed (downard force to legs did pretty much nothing, upward force to torso just made it float if there was no ground, animating the IK targets was too glitchy).

I'm out of ideas on how to actually do this now. I've looked around for guides but there seems to be nothing good (I keep getting this suggested to me but it doesn't help. It's in 3D and the only thing that could help, spider legs, isn't finished and probably never will be)

There's very little information on how to do this sort of stuff and even when I find people who know about active ragdolls they just say add force to the head (for a 3D active ragdoll), which I've already tried (see 2. on the list of what I've already tried) and don't explain anyt further.

If anyone could help, that'd be great!


texts: Can't use the hardware scissor any more, should I use the stencil buffer or manually clip sprites?

texts:
I wrote a simple UI system for my game. There is a clip flag on my widgets that you can use to tell a widget to clip any children that try to draw outside their parent's box (for scrollboxes for example). The clip flag uses glScissor, which is fed an axis aligned rectangle. I just added arbitrary rotation and transformations to my widgets, so I can rotate or scale them however I want. Unfortunately, this breaks the scissor that I was using as now my clip rectangle might not be axis aligned.

There are two ways I can think of to fix this: either by using the stencil buffer to define the drawable area, or by having a wrapper function around my sprite drawing function that will adjust the vertices and texture coords of the sprites being drawn based on the clipper on the top of a clipper stack. Of course, there may also be other options I can't think of (something fancy with shaders possibly?). I'm not sure which way to go at the moment.

Changing the implementation of my scissor functions to use the stencil buffer probably requires the smallest change, but I'm not sure how much overhead that has compared to the coordinate adjusting or if the performance difference is even worth considering.


texts: How to calculate Camera “correct” position and distance to Frame all my Scene?

texts:
Consider I have N dynamic points on my Scene, I would like to "frame" all them, with my Camera.

How can i calculate (at runtime) Vector3 Position to correctly frame all my scene ?

This is my idea:

Calculate Avarage for all my points
Move my Camera "up" / Zoom out to correctly "frame" all my points (i don't know how to calculate )
Use Unity LookAt(myAvaragePoint)

I think i've to use some trigonometryc function to calculate the Y Camera position (to zoom in, zoom out), but i don't know which!

Thanks


texts: Unity Client and Multiplayer Networking/Architecture

texts:
My background is in Enterprise and SaaS web infrastructure.  Zero information about games and how their networking works.  I only know about the world of browsers and RESTful APIs.

I'm planning on using Unity for the client FYI.

Authentication and Authorization

I'm planning to use Unity and Firebase.  Seems like this is fairly standard HTTP connections during the auth faze.  Nothing surprising here unless there is something I missed.

The client authenticates against a service, Firebase in this case.  And then all future calls after authentication are made using the returned credentials.

Gameplay and Player State

This part confuses me.  I assume shooters use a UDP type protocol or some proprietary protocol on top of UDP. But can a game use a REST API and HTTP or TCP connections to send client updates?

Clients would then poll the game server or have a long running connection open to request updates.  For example the Auction House in WoW.  Is there a long lived TCP connection open between the client and the server updating the auction house data every X seconds?

Then when a player submits a purchase order that same long lived TCP connection is used to update the game server state?

Or is it all literally a REST API like a SaaS app would use?  Is my experience with browsers and Single Page Apps in an Enterprise environment applicable to a WoW auction house type situation?

Thank you,
Any tips or feedback is helpful at this point.


texts: How can I randomly generate arbitrary "rules" for a creative card game

texts:
My friends and I in school play this interesting card game, which we call 'the game without rules' (ironically, of course). The game is like this: in the beginning of a school year, we start with one rule: you have to lay a card that is higher. Everything else is not allowed and the one who is the first to have no more cards, wins.

When only one person remains with cards, the game ends. At that point, the winner can define a new rule, such as "on a seven, you have to play a lower card instead of a higher card". This makes the game harder and harder as we play on. Every time a person breaks a rule, he/she is given an extra card.

Now my idea was to make a computer program out of this and let them create new rules, so that would be pretty funny to see what combinations they come up with. Every time a 'computer' defines a new rule, they don't tell the others, so they have to figure out by trial and error.

Well at this point I am stuck. How can I let the computer define new rules and can someone write an example for me? And in what language should I do it?


texts: Are Textures cached by GPU or buffered from memory for every frame?

texts:
Are the textures buffered from memory(RAM) for each Draw Call/Frame or are cached in VRAM.

As per my research, I believe in the former case, if it is, then isn't the second approach a better option?

For example, in First Person Shooter games, the weapon is going to be rendered 98% of the time, so are those weapon textures cached by the GPU locally?

I am not sure about this, so I hope someone could explain this.


texts: Issues with character controller (unity 4 project in unity 5)

texts:
I'm having the weirdest issues with a game me and a mate have been working on. They came up immediately after moving from the last version of Unity 4 to Unity 5.

The two objects (player and enemy) return an error "Character Controller Settings are invalid" both on starting and stopping the game.

The enemy settings are:

Slope Limit:        50
Step Offset:        60
Skin Width:         0.003
Min Move Distance:  0
Center:            (0, 0, 0)
Radius:             0.01
Height:             0.01

some of the values have had to be scaled down to accommodate for the scale of the actual model.

Then, whenever the "Move" function calls (which use to have the enemy move towards the player), I get

CharacterController.Move called on inactive controller

which I have located to come from this code:

_controller.Move(moveDirection * Time.deltaTime);

where moveDirection is just a Vector3 co-ordinate of where to move too.

as I said, this was all working before I converted to the new version of Unity. I have checked and confirmed that the Character Controller is both correctly linked and enabled. I have not found anything useful looking up problems others have had with a similar error, and it's pretty much got me stumped.


texts: How do I run code for a period of time and then return to normal behavior?

texts:
i wanna run a code for my special power for five seconds only and then return to my normal working. when that power activates i am changing my player's material and i wanna return to my old material after those five secs are over. this is the code i tried:

void Start () {

        transform.GetComponent<Renderer> ().material.mainTexture = texts [0];
    }

    void Update () {

        if (condition) {
            for (int t1 = 0; t1 < 5; t1 += (int)Time.deltaTime) {
                transform.GetComponent<Renderer> ().material = mats [0];
            }
            transform.GetComponent<Renderer> ().material.mainTexture = texts [0];
        }
    }

this code breaks the game i think because unity is freezing when the condition is being met.


texts:
I bought an old second-hand Nintendo DS game from a used game shop and my 3DS wouldn't play it. I exchanged it and the shop said it was probably a forged cartridge.

I did a bit of research and apparently the 3DS has better forgery detection than the older models - so the fake cartridge probably worked in an old DS but not in my newer model.

Here's what I already understand about 3DS copy protection:

Modern cartridges have a cryptographic signature to prove they're genuine.
Older cartridges have no signature, but the 3DS has a whitelist of checksums for every legitimate old cartridge.
Cartridges that don't have a signature OR appear on the whitelist are blocked.

I can see how this would stop me releasing my own unlicensed game. But I don't understand why it blocks a copy of an existing, legitimate game.

My question is: why can't the game pirates make a perfect copy of an existing game, including the signature (or with a matching checksum), so the 3DS can't distinguish it from the real thing?

(Aside - I've got no interest in playing pirated games (I write software for a living myself), I'm just curious about the technology).


texts: What do the components of gl_TexCoord[0] mean?

texts:
What are the differences between gl_TexCoord[0].s, gl_TexCoord[0].t gl_TexCoord[0].p and gl_TexCoord[0].x, gl_TexCoord[0].y gl_TexCoord[0].z ?

I understand that gl_TexCoord[0].x, gl_TexCoord[0].y gl_TexCoord[0].z are pixel coordinates?

But what do gl_TexCoord[0].s, gl_TexCoord[0].t gl_TexCoord[0].p mean and where must I use them?


texts: How can I create a spritesheet animation with big images?

texts: If I have a 200x200 pixel sprite, and I want to create an animation for it with 30 different frames, how can I accomplish that? I can't put them on one texture/spritesheet.


texts: Turning a simple HTML5/JS single-player game into a multi-player one

texts:
CONTEXT:
I am currently developing the front-end/ client of a simple browser game using HTML5 Canvas/JavaScript. In the future, I would like to add a multi-player dimension to it, most likely using node.js/mongoDB. At this point, however, I have no experience whatsoever with the required back-end technologies.

DESIRED OUTCOME:
The game involves some simple interactions (e.g. collect a key; once you've collected it, you can open the door, etc.). In the multi-player mode, the outcomes of said interactions carried out by any player are supposed to affect the game state for all players (e.g. if any player has opened the door, it stays open for all players). This will likely require setting up a database.

QUESTION:
At what point do I need to start writing the code in a way which involves referencing a database?
Does it make any sense at all to first develop the "game logic" in JavaScript only (as if it was only meant to be played as a single player) and only afterwards proceed to rewriting the code referencing a database?

Apologies if my question sounds idiotic. Newbie here!


texts:
i have a problem with serialization (saving and loading game variabiles), when i save evreything seems to be saving correctly but when i try to load it only detects first 3 objects i saved and the rest are null. Am i using serialization wrong or am i saving it wrong.

Saving objects with this:

FileOutputStream f_out = new
                FileOutputStream("c:\\save.data");

            // Write object with ObjectOutputStream
            ObjectOutputStream obj_out = new
                ObjectOutputStream (f_out);

            // Write object out to disk

                obj_out.writeObject ( player.currentPerson );
                obj_out.writeObject ( player.gold );
                obj_out.writeObject ( Global.currentJob );
                obj_out.writeObject ( Global.currentWifeJob );
                obj_out.writeObject ( Global.currentWife );
                obj_out.writeObject ( Global.currentFood );
                obj_out.writeObject ( Global.currentCity );
                obj_out.writeObject ( Global.childList );
                obj_out.writeObject ( Global.generationList );
                obj_out.writeObject ( Global.currentPortrait );
                obj_out.writeObject ( Global.maxGeneration );
                obj_out.writeObject ( Global.currentGeneration );
                obj_out.writeObject ( Global.bloodlineRanking );
                obj_out.writeObject ( year );

Loading objects:

  // Read from disk using FileInputStream
                    FileInputStream f_in = new
                        FileInputStream("c:\\save.data");

                    // Read object using ObjectInputStream
                    ObjectInputStream obj_in =
                        new ObjectInputStream (f_in);

                    Object obj = (Object) obj_in.readObject();

                        do{
                            if(obj == null){
                                System.out.println("Skipped" + i);
                                i++;
                                continue;
                            }
                            else{
                                    if(i==0)
                            player.currentPerson  =  (Person) obj;
                        else if(i==1)
                            player.gold = (int) obj;
                        else if(i==2)
                            Global.currentJob = (Job) obj;
                        else if(i==3)
                            Global.currentWifeJob = (Job) obj;
                        else if(i==4)
                            Global.currentWife = (Wife) obj;
                        else if(i==5)
                            Global.currentFood = (Food) obj;
                        else if(i==6)
                            Global.currentCity = (String) obj;
                        else if(i==7)
                            Global.childList = (ArrayList<Child>) obj;
                        else if(i==8)
                            Global.generationList = (ArrayList<Generation>) obj;
                        else if(i==9)
                            Global.currentPortrait = (Portrait) obj;
                        else if(i==10)
                            Global.maxGeneration  = (Integer) obj;
                        else if(i==11)
                            Global.currentGeneration  = (Integer) obj;
                        else if(i==12)
                             Global.bloodlineRanking = (Integer) obj;
                        else if(i==13)
                            world.year = (Integer) obj;

                            }
                            System.out.println(obj.getClass());
                            System.out.println(i);

                            i++;
                            obj = obj_in.readObject();
                        }
                        while(i < 20);

Here is the print output

class javagame.Father
0
class java.lang.Integer
1
class javagame.Job
2
Skipped3
Skipped4
Skipped5
Skipped6
Skipped7
Skipped8
Skipped9
Skipped10
Skipped11
Skipped12
Skipped13