texts: Using timestamp as a random seed returns identical results

texts:
And here is the random number generator again.

I work on a game, where a user can create and schedule some levels to player later. For simplicity, let's say I play chess.

I create a new game with AI or an opponent for specific datetime in the future.

The random number generator gets as seed the current timestamp when the user create the game and put the pawn in random positions.

If the user creates too many games at once, the results on pawns positions are identical.

So, I was wondering, what other strategies are out there on picking the right seed number instead of the timestamp.


texts:
I'm thinking about working on a game where I need to find all the objects matching certain properties.

For instances I might need to look up all the objects...

Producing gold.
Whose level is 5 or higher.
Within 10 meter from a point.
Currently fighting.
That have anything to do with metal (e.g. producing, consuming, made of, wearing, standing on etc).

And so on and so forth. I would also like to be able to add new objects with new properties without having to change everything else.

Ideally I would need to run multiple queries per frame (hundreds or thousands per second). I'll probably rely on some properties way more than others, but this kind of usage pattern is likely to change over time.

Is there any data structure, design pattern, method or idea to help me implement an efficient real-time query system?

I've been thinking about assigning to each object a dynamic set of tags with properties, then recursively partition the space storing in each partition a mapping from those tags to the objects. It might work, but I'd like to hear about existing solutions before wasting efforts.


texts: texture cordinate VBO not being updated OpenGL

texts:
I'm making a minecraft style game and I decided to add a VBO with the texture atkas coordinates of the vertices but it is appearing all white. However I'm following the same process as another VBO for the block positions which works

the one that works

glBindBuffer(GL_ARRAY_BUFFER,chunk->posOffsetVBO);
glBufferData(GL_ARRAY_BUFFER,sizeof(glm::vec3)*65536,NULL,GL_DYNAMIC_DRAW);

glVertexAttribPointer(2,3,GL_FLOAT,GL_FALSE,3*sizeof(GLfloat),(GLvoid*)0);
glEnableVertexAttribArray(2);
glVertexAttribDivisor(2,1);

then I fill it with glm::vec3s like this

glBindBuffer(GL_ARRAY_BUFFER,adjacentChunks[1][1]->posOffsetVBO);

glBufferSubData(GL_ARRAY_BUFFER,0,sizeof(posOffsets),&posOffsets[0]);

this is the one with the texture coordinates that doesn't work

glBindBuffer(GL_ARRAY_BUFFER,chunk->texCoordVBO);
glBufferData(GL_ARRAY_BUFFER,sizeof(glm::vec2)*36*1000,NULL,GL_DYNAMIC_DRAW);

glVertexAttribPointer(1,2,GL_FLOAT,GL_FALSE,2*sizeof(GLfloat),(GLvoid*)0);
glEnableVertexAttribArray(1);

then  fill It with 36 glm::vec2s for each block so one per vertex

glBindBuffer(GL_ARRAY_BUFFER,adjacentChunks[1][1]->texCoordVBO);

glBufferSubData(GL_ARRAY_BUFFER,0,sizeof(texCoords),&texCoords[0]);

Is there a reason why the texture one doesn't work?


texts: OpenGL web game: C++ with Java vs pure Java?

texts:
I'm going to write browser online game, not MMO, but something like a lot of Flash game. But with OpenGL rendering, because Flash is using CPU for rendering.

What are advantages of pure Java or c++ with Java that only create window.

My requirements are:

good performance - low overhead when calling OpenGL functions
short code( if possible ) - so, Java is fully object oriented language, which can require usage of object for each called OpenGL function
basic portability - Linux, Mac, Windows - multiple builds for each platform aren't problem
little communication with server for saves, top score,... not multiplayer - may be slow
game should be downloadable


texts: Why texture coordinate of flat surface reflection is calculated like this in fragment shader?

texts:
The whole project is here: https://developer.apple.com/library/mac/#samplecode/GLEssentials/Introduction/Intro.html

The rendering flow is like this:

Render the character upside down to a texture.
Render the character normally.
Render the flat reflection surface below the character using the texture from step 1.

I don't understand the texture coordinate calculation in the fragment shader, specifically the block marked with ??? below:

precision highp float;

// Color of tint to apply (blue)
const vec4 tintColor = vec4(0.0, 0.0, 1.0, 1.0);

// Amount of tint to apply
const float tintFactor = 0.2;

varying vec3  varNormal;
varying vec3  varEyeDir;

uniform sampler2D diffuseTexture;

void main (void)
{
    // Compute reflection vector
    vec3 reflectDir = reflect(varEyeDir, varNormal);

    // Compute altitude and azimuth angles
    vec2 texcoord;

    texcoord.t = normalize(reflectDir).y;
    // ???????????????????????????????????????????????
    reflectDir.y = 0.0; // Why clear reflectDir.y?
    texcoord.s = normalize(reflectDir).x * 0.5; // Why times 0.5?

    // Translate index values into proper range
    if (reflectDir.z >= 0.0) {
        texcoord = (texcoord + 1.0) * 0.5;
    } else {
        texcoord.t = (texcoord.t + 1.0) * 0.5;
        texcoord.s = (-texcoord.s) * 0.5 + 1.0; // Why translation of s is like this, different from t?
    }
    // ???????????????????????????????????????????????

    // Do a lookup into the environment map.
    vec4 texColor = texture2D(diffuseTexture, texcoord);

    // Add some blue tint to the image so it looks more like a mirror or glass
    gl_FragColor = mix(texColor, tintColor, tintFactor);
}

Thanks in advance to anyone who can demystify this for me!


texts: Is this specific server architecture okay for a multiplayer game?

texts:
So I am making a game in Node.js / HTML5.

And I am really struggling to determine what an effective server architecture looks like?

Right now I have a server for a multiplayer game ( I plan on making servers instanced, so up to 80 people per instance).

So everybody in the instances location and health are shared.

And when an attack happens, i.e. a meteor is dropped from the sky, the x-value is the only data passed to the rest in the instance ( they all do the computations on their own computer locally).

When you are hit, you tell the server you were hit. (can't tell the server to hit other people, only yourself, becuase otherwise it's exploitable).

That's the kind of architecture I was going for, you can only tell the server about events that damage yourself.  ( I don't believe these events are overridable but I will try to determine that).

--

Do I have the right idea about how to go ahead with this server?

Do you have any tips or resources?

NOTE: It's under MMO but servers will hopefully top off at about 80. MMO in the same sense as Realm of the Mad God. = )


texts:
I'm currently in the middle of writing a game where there is a maze. The maze itself is already drawn ok, and once I have the layout I randomly rotate all the pieces.

I have a 'start' cell that is a different colour to the others,when cells are rotated in such a way that they become 'linked' to this start cell, then all the cells that are linked back to this cell should change colour.The start cell itself can be rotated as well so just because a cell is back in it's initial rotation it doesn't mean it's connected. Also any random cell can be rotated regardless of whether it's neighbour is already connected. E.g if the start cell is at [8,8] in a grid, then all the other cells bar it's immediate neighbours could get connected and then finally the closest neighbours get rotated to form a completely connected grid in which case all cells should change colour like a flood fill.

Are there any good algorithms to solve an issue like this? I was thinking of a flood fill from the start cell every time a cell is rotated somewhere but I'm not sure if this is the optimum way to do this, especially as I have to check what each type of cell is (e.g is it a corner piece, a straight piece, a T Junction or a dead end with only one connecting side) and then check what it's current rotation is compared to it's neighbours rotation and type. Obviously this is fine if you can stop at immediate neighbour to the start piece, but when other sections of the maze might be 'complete' and then an interjoining piece is linked I would need to flood fill all of them. I had started writing this but I found myself just pretty much duplicating switch statements for all the different types of piece and then what type of piece their neighbour was and comparing the rotations of each piece. It felt very 'DRY' even though the comparisons were changing

I'm writing this in swift, but I guess an algorithm would be generic

thanks


texts: How make Unity wait before consuming next item in a list?

texts:
I have a class like so:

public class SomeObject : MonoBehaviour
{
    protected List<EdibleStuff> SomeItemsToConsume;

    private void StartConsuming()
    {
        this.SomeItemsToConsume
            .ForEach(item =>
            {
                StartCoroutine(Consume(item));
            });
    }

    private IEnumerator Consume(EdibleStuff edibleStuff)
    {
        yield return new WaitForSecondsRealtime(2);

        // Check whether edibleStuff is still fresh after 2 seconds
        // Figure out how to consume it -- e.g. by cooking, eating raw, whatever
    }
}

Before SomeObject consumes the next item in the SomeItemsToConsume list, I would like it to wait another short period of time, say, another 2 seconds.

I have tried these approches:

I added another yield return new WaitForSecondsRealtime(2); statement at the end of the Consume(EdibleStuff edibleStuff) method, but that did not work.
I added another co-routine, which simply contains the statement yield return new WaitForSecondsRealtime(2); in its definition, at the end of the ForEach loop, but that did not work either.

How can I achieve the effect I want?


texts: Where does the light come from, using Maya/Panda3D?

texts:
Total noob to Maya. Total noob to Panda3D. Planning on becoming really good at both as soon as I have free time to do so, but right now I have an assignment due in a few hours which requires this:

(The part which confuses me is bolded.)

  Model and texture a vehicle and two different obstacles
  Build a scene graph in Panda with a plane, the vehicle, several copies of each of the obstacles, and (at least) a direction light
  Program vehicle movement, constrained to a plane (no terrain)
  Working headlights
  Vehicle collides with obstacles

How do I attach a light source to a model? I'm assuming this is done in Panda3D but I'm sufficiently new to this that I wouldn't be astonished to hear it's part of the model.


texts: Normal map does not export into .dae file. Does Collada not support normal maps?

texts: Every time I try to use DAE FBX export in Autodesk Maya and export a .dae file the normal map doesn't export with it? Does Collada not support normal maps?


texts: How do I determine if one value is within a certain range of another in Python

texts:
I've been working on the attacking in my RPG.
The problem I have recently encountered is, I have to be in Exactly the same x coordinate as the Enemy. When I want to attack the enemy this is what happens:

 ...

    elif event.key == pygame.K_SPACE:
                    attack = True

if attack == True:
    if enx == x: #this is the line my qeustion is about
        endead = True

attack = False # I put this in so attack doesn't stay true forever

...

if endead == False:
            screen.blit(Enemy, [enx, eny])

How do I make it work if the enemy's position (enx) is equal to within a certain number of pixels to the player's position (x)?

So if I'm close but not Exactly the same place it works

(I know this only takes the x coords into account I'll add y later)


texts: Approaches for a clickable map of nations (such as a Risk game) with Spritekit

texts:
I would like to create a political map where each country is clickable by tapping but I'm not sure the best way to determine which nation was selected.  Imagine Risk where each country can be individually clicked to bring up additional information.

My current approach is to make a sprite for each nation where every image is the size of the screen   The images are mostly transparent except for the country, that way when all of the images are displayed the countries are in the correct place relative to one another.  To determine if a click occurs on an individual country I look to see if the tapped location is a non transparent pixel and check that the sprite's name is one of the countries.  Additionally the nation needs to glow or something when tapped as an indicator, however my current solution is yet another sprite that is displayed.

This seems like a terrible approach and I was wondering what other solutions might achieve the same results.  I'm pretty new to SpriteKit so I'm not entirely sure.

The other idea I had was creating a single texture where each country is a different shade of gray, then when I get the tap location I do a lookup on the color at that location and get the corresponding country.  However, I'm not sure how to create a hilight or glowing country effect with that method.


texts: How can I let new players effectively compete with long-time players?

texts:
When new players join my strategy game, they have 3 days of protection from other players attacking them, but that's not enough time to catch up to players who have been playing for longer.

How can I solve this?

I thought of extending the protection time, but if I do that, players will not be able to progress without attacking (gaining more resources for faster progress).

The game is browser-based with a PHP back-end.


texts: Most efficient way to draw large number of the same objects, but with different transforms

texts:
I'd like to draw a large number (multiple thousands) of simple meshes (each maybe... a maximum of 50 triangles, but even that is a very large upper bound), all of which are exactly the same.

As a simple brute force way, right now I'm just doing thousands of draw calls, where I just change the transformation matrices that the shaders need and then draw the same objects again.

Of course this is hideously slow, since (I'm guessing) there are too many draw calls for the driver and my PC to handle efficiently.

What can I do to make it faster?


texts: Where to put Tweening effect codes in HTML5 Canvas game?

texts: I am building a javascript HTML5 canvas game and I need to scale the map. However whenever I scale my map the screen stutters very obviously. To scale smoothly without player noticing I add Tween effect using Greensock TweenMax. I put the codes gsap.TweenMax.to(...) inside my animation update loop, right after requestAnimationFrame method. But I realize that the TweenMax may have its own ticker in animation and it handles animation internally. But the codes work very well. Does that implementation has any side effect? What is the correct place to put my tweening codes? Should I implement my own code inside the update loop?


texts: How many moves to think ahead for chess minimax AI?

texts:
I am thinking of making a chess game, and I read up on minimax trees. How many moves should the AI think ahead so that the player doesn't have to wait a long time?

If there are 25 possible moves (probably an underestimation):

2 moves = 625 boards
3 moves = 15625 boards (huge jump)

I'll be making the game in flash / actionscript 3 (not really a fast language), and I want to keep the turn times acceptable.

Thanks


texts: How to share Lua script between instances?

texts:
I'm doing an agent based framework with C++ and Lua. I want to use Lua to code the Agent behaviour having an AgentClass class that have the name and source code and an AgentInstance class that have the lua_State. I want to have a few AgentClass instances during execution but hundreds or thousands of AgentInstance objects.

Is there any way to share the same lua script with different lua_State? Or Is there a better way to get hundreds of agents without too much performance penalty?

¿Options?:

Having compiled Lua code in AgentClass.
Having lua_State only on AgentClass, setting a self variable in every AgentInstance update.
Other.


texts: Where is linked_portal_door in the Source SDK?

texts:
I just made a new mod in the Source SDK. I saw online that there is an entity that allows portals to be created (linked_portal_door). However, I cannot find or create this entity.

Is it included in the base SDK or do you have to have an add-on. If it is not included, is there an alternative?

I am using Source Engine 2007.


texts: Algorithm to draw particles in correct order?

texts:
For a game I'm making as a hobbyist project, I need to be able to draw smoke on the screen. I am doing this by setting up a particle system. The problem is I need all the particles drawn in order from farthest to nearest to the camera (because the particles do have a bit of transparency, and the entire texture transparency increases over time in the particles) and I cannot figure out a way to successfully do it. Here is the code that draws each of the particles, along with the code that that is supposed to determine what order to draw them in so that it draws them from furthest from the camera to nearest to it:

    void drawSmoke( Camera cam ) {

      int drawOrder [50];

    bool particleChecked [50] = {false};

    for ( int a = 0; a < 50; a++ ) {

    int furthest;
    float furthestDistance = 0;

        for( int check = 0; check < 50; check++){

                if ( !particleChecked [check] ) {

                float aSquared = ( cam.getPosition().x - smokeParticles[check].position.x ) * ( cam.getPosition().x - smokeParticles[check].position.x );
                float bSquared = ( cam.getPosition().z - smokeParticles[check].position.z ) * ( cam.getPosition().z - smokeParticles[check].position.z );
                float cSquared = aSquared + bSquared;

                float distanceFromCamera = sqrt ( cSquared );

                        if ( distanceFromCamera > furthestDistance ) {
                        furthest = check;
                        furthestDistance = distanceFromCamera;
                        }

                }

        }

        drawOrder [a] = furthest;

    }

GLuint transformLocation = glGetUniformLocation ( particleProgram, "transform" );
GLuint alphaLocation = glGetUniformLocation ( particleProgram, "alpha" );

for( int particle = 0; particle < 50; particle++ ) {
glm::mat4 model;
glm::mat4 view;
glm::mat4 projection;

int particleToDraw = drawOrder [particle];

model = glm::translate( model, glm::vec3 ( smokeParticles [particleToDraw].position.x, smokeParticles [particleToDraw].position.y + 10.0f, smokeParticles [particleToDraw].position.z ) );
model = glm::scale(model, glm::vec3 ( smokeParticles [particleToDraw].scaleFactor ) );
glm::vec3 diff = glm::normalize ( smokeParticles[particleToDraw].position - cam.getPosition() );
float angle = atan2 ( -diff.x, -diff.z );
model = glm::rotate ( model, smokeParticles[particleToDraw].rotation , glm::rotate ( glm::vec3(0.0f, 0.0f, 1.0f), angle, glm::vec3(0.0f, 1.0f, 0.0f) ) );

//rotating particle to face camera
model = glm::rotate(model, angle, glm::vec3(0.0f, 1.0f, 0.0f));

view = glm::lookAt(cam.getPosition(), cam.getTarget(), glm::vec3(0.0f, 1.0f, 0.0f));

projection = glm::perspective( 45.0f, (float)800/(float)600, 0.1f, 5000.0f );

glm::mat4 transform = projection * view * model;

glActiveTexture( GL_TEXTURE0 );
glBindTexture( GL_TEXTURE_2D, smokeTexture );
glUseProgram( particleProgram );
glUniformMatrix4fv( transformLocation, 1, false, glm::value_ptr(transform) );
glUniform1f( alphaLocation, smokeParticles[particleToDraw].alpha );
glBindVertexArray( smokeVAO );
glDrawArrays( GL_TRIANGLES, 0, 6 );
glBindVertexArray(0);
    }

What it looks like is on each frame every element of drawOrder is the same value. But I cannot figure out why. How can I fix this?


texts: How to make a 3D mesh invisible in Godot?

texts:
Just like the title says i'm trying to make the mesh disappear after a set value reaches zero. Current code is trying to simply turn the entity invisible so that later i can implement a resurrect function.

if Sname == get_node("Entity").get_name():
    print("punched number 1")
    selected.health = selected.health - 10
    if selected.health <= 0:
        selected.health = 0
        get_node("Control/Button").disabled = true
        $Entity.visable = false

Is it even possible to toggle that value or is there an easier way to do this?
I dont want to use free_queue() as that would interfere with other entitys.

Thanks for the help in advance, im new to Godot so sorry if this ends up being a no brainer.


texts: Need to know the origin and coordinates for 2d texture and 2d/3d vertices in webgl

texts:
Long story short, I know my coordinates are off and I believe my indices might be off.

I'm trying to render a simple 2d rectangle with a texture in webgl

here's the code I have for the vbo/ibo:

rectVertices.vertices = new Float32Array(
[
    -0.5, -0.5,  // Vertice 1, bottom /  left
     0.0,  0.0,  // UV 1

    -0.5,  0.5,  // Vertice 2,    top /  left
     0.0,  1.0,  // UV 2

     0.5,  0.5,  // Vertice 3,    top / right
     1.0,  1.0,  // UV 3

     0.5, -0.5,  // Vertice 4, bottom / right
     1.0,  0.0,  // UV 4
]);

rectVertices.indices = new Int16Array([
    0,1,2,2,0,3
]);

/* I'm assuming the vertices go like this

(-0.5, 0.5) ------ ( 0.5, 0.5)
            |    |
            |    |
(-0.5,-0.5) ------ ( 0.5,-0.5)

with the origin in the middle

and the texture coordinates go like this:

( 0.0, 1.0) ------ ( 1.0, 1.0)
            |    |
            |    |
( 0.0, 0.0) ------ ( 1.0, 0.0)

so as you can see I'm all messed up.

I'm also using:

gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);

*/

Here's the output of the program:

the texture I'm using is this:

So, I guess I need to know the origins, but the triangle strip looks way off.

I am doing this as well:

// create VBO and IBO
vbo = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
gl.bufferData(gl.ARRAY_BUFFER, triangleVertices.vertices, gl.STATIC_DRAW);

ibo = gl.createBuffer();
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ibo);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, triangleVertices.indices, gl.STATIC_DRAW);

and:

gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ibo);

gl.vertexAttribPointer(vertexAttribute ,2, gl.FLOAT, false,FLOAT*2,FLOAT*0); // position
gl.vertexAttribPointer(textureAttribute,2, gl.FLOAT ,false,FLOAT*2,FLOAT*2); // texture
gl.enableVertexAttribArray(vertexAttribute);
gl.enableVertexAttribArray(textureAttribute);

gl.drawElements(gl.TRIANGLE_STRIP, 6, gl.UNSIGNED_SHORT, 0);

It almost seems as though the Vertices and the UV coordinates are getting mixed up.


texts:
I've been looking around the forums for some answers to the question I have. I've found some answer that seem to help but nothing that answers my specific question. That question being how to rotate an object in world space around a non origin point.

I have a grappling hook that I am trying to implement inside of a game I am making for a final college project. This grappling hook collides with another object in world space and I then want the player to rotate around this point as if a rope were present.

I have the point at which the grapple collides the point at which the player is located and the origin. I tried the standard translate to the origin rotate and translate back and that did not work.

This is being done in DirectX 9 and it is a C++ game. Any  help you could offer would be greatly appreciated. If you need anymore info please ask.

Edit: I should also add that we are doing a vector based storage for this setup. So I store the matrices in vectors(i.e Forward,Direction,Right,Position) and build the matrices on the fly

void CSpatialFrame::RotateAbout(D3DXVECTOR3 _Point, float _fDegPitch, float _fDegYaw, float _fDegRoll)
{
    D3DXMATRIX RotationMatrix;
    D3DXMatrixRotationYawPitchRoll(&RotationMatrix, D3DXToRadian( _fDegYaw ), D3DXToRadian( _fDegPitch ), D3DXToRadian( _fDegRoll ));
    D3DXVECTOR3 playerPos = m_Position;
    m_Position = _Point;

    D3DXMATRIX PlayerMatrix;

    PlayerMatrix._11 = m_RightVector.x;
    PlayerMatrix._21 = m_RightVector.y;
    PlayerMatrix._31 = m_RightVector.z;

    PlayerMatrix._12 = m_UpVector.x;
    PlayerMatrix._22 = m_UpVector.y;
    PlayerMatrix._32 = m_UpVector.z;

    PlayerMatrix._13 = m_DirectionVector.x;
    PlayerMatrix._23 = m_DirectionVector.y;
    PlayerMatrix._33 = m_DirectionVector.z;

    PlayerMatrix._14 = m_Position.x;
    PlayerMatrix._24 = m_Position.y;
    PlayerMatrix._34 = m_Position.z;

    D3DXMatrixTranslation(&PlayerMatrix, _Point.x, _Point.y, _Point.z);

    //D3DXMatrixTranslation(&PlayerMatrix, m_Position.x, m_Position.y, m_Position.z);

    D3DXMatrixMultiply(&PlayerMatrix, &RotationMatrix, &PlayerMatrix);

    //D3DXMatrixTranslation(&PlayerMatrix, _Point.x, _Point.y, _Point.z);

    m_RightVector.x = PlayerMatrix._11;
    m_RightVector.y = PlayerMatrix._21;
    m_RightVector.z = PlayerMatrix._31;

    m_UpVector.x = PlayerMatrix._12;
    m_UpVector.y = PlayerMatrix._22;
    m_UpVector.z = PlayerMatrix._32;

    m_DirectionVector.x = PlayerMatrix._13;
    m_DirectionVector.y = PlayerMatrix._23;
    m_DirectionVector.z = PlayerMatrix._33;

    m_Position.x = PlayerMatrix._14;
    m_Position.x = PlayerMatrix._24;
    m_Position.x = PlayerMatrix._34;
}


texts: Multiple Kickstarter campaigns. Good? Bad? Ugly?

texts:
I've been toying with the idea of doing a Kickstarter for my game to help fund some good artists to replace the placeholder graphics I currently have. Just a small goal of $2k or so. Regardless of whether the campaign is successful this time, would it be considered a faux pas to do another, larger kickstarter once the game is looking better?

Would the rewards need to be the same, or could I offer better rewards at lower donation levels for the first one as an "early adopter" bonus?


texts:
So i have two coordinate planes. One is player and mouse click position relative to player. Other is the world map.

I need to find the point on the world map, where the mouse clicks.

The map is generated from a 64*64 heightmap, so for now i want to find the mouse click inside the 64*64 bounds.

Im having trouble determining the coordinates at the world map, where the mouse clicked.

The map has a multiplier of 10. Im not really sure how it is applied, but when it is 10, the world map is in bounds -10,-10 to 10, 10. When it is 20, it is in -20,-20 to 20, 20, when 50 then in -50,-50 to 50,50. Those are click coordinates in relation to player.

To get the world vertex i need to supply a coordinate (0-63, 0-63).

How do i transform the mouse click coordinates so that they are aproppriate to the world map?


texts: How to create skeletal animation data for a skirt?

texts:
Please think of this in an engine-agnostic way first, and then we can talk about specific engines.

In my game, I have a 3D character which is wearing a hakama (think of it as a long pleated skirt). This character will be doing a lot of dancing, which I'm getting a lot of motion capture data for. This is how my character is rigged right now (view from Unity):

This character has a standard 3D Studio Max humanoid rig, plus a bunch of bones for the "dangling" stuff such as the skirt, the sleeves, the long hair and other parts.

Unfortunately, motion capture can only give me data for the humanoid part, not for the additional parts, so I need a way to animate these. For now, let's focus on the hakama (skirt). I have a few ways of doing this:

Removing the additional bones, and rig the cloth directly to the leg bones: This is my last resort, but one that I'd like to avoid, as the hakama will move directly with the legs as if it were a tight fit, losing a lot of realism.
Keep the bones and animate them manually. There are just too many frames and too many characters for it to feasible to do this manually, so this is out of the question.
Simulate the leg and cloth interaction in some way. Fortunately, the dancing is static (just for cutscenes), so I can do this offline, export the resulting bone transforms for each frame, and apply this to the character during playback.

Since Unity has a pretty mature physics engine, I am trying to hack an offline physics simulation that exports the resulting bone transforms for each frame, which I can then playback in real time in the actual game (which by the way is not Unity-based). So far, the sleeves and hair have shown some pretty good results, but the hakama is much more difficult, and I haven't gotten it to work even close to decently.

I have tried:

Setting colliders in the legs and the skirt, so when the legs push the skirt, the skirt moves. I can set a bunch of joints to set some constraints, but setting a correct shape and position for the skirt colliders is not trivial, since the leg colliders eventually find a hole between the skirt colliders, which leads to the leg intersecting with the skirt.
Instead of colliders, set spring joints between the leg bones and the skirt bones. Unfortunately, springs don't have a concept of "pushing" vs "pulling", and I can visualize a lot of cases where the simulation will lead to the leg intersecting the skirt.

Notice that I can't use Unity's cloth simulator, since this acts on polygons directly, and I need to be able to export the results of the simulation in terms of bone matrices.

It's not mandatory to use Unity. I just need to find a way to simulate the leg-cloth interaction and export the results in a series of bone transforms.

Any ideas on how to solve this problem?


texts: Why not show progress towards achievements/badges?

texts:
Achievements are everywhere now — Xbox Live, iOS Game Center, many individual games, and even in social communities with gaming elements like Stack Overflow.

A common user request of Stack Overflow is to show progress toward badges.

This has been denied by SO, as seen in this uservoice request, where Jeff Atwood made the following statement:

  this is modelled on the xbox live achievements model, and that does not show progress, either.. by design

Jeff defers to the design of Xbox Live when denying the request to show progress.  Certainly, SO is technically nothing like Xbox Live, so it can be inferred that this is a design decision, not a technical one.

I am working on a game where we have achievements and right now the intention is to show progress.  So, I have two questions:

If it's known that Xbox Live achievements "by design" do not show progress, is there a source for this?
Why is this "by design"?  In other words, in terms of game design, what reason is there to intentionally not show achievement progress?


texts: Joining lines together into a single line

texts:
I’ve been working on a GDscript to draw isolines (contours).  I’m using the Meandering Triangles algorithm from https://blog.bruce-hill.com/meandering-triangles, and it works pretty well!  The problem is I don’t know how to do Step 4, which is where all the little individual lines that make up the contour lines are joined together, so that I have a set of points describing an entire isoline which I can then drop into a Line2D.points.
Bruce wrote his code in Python, which I’ve yet to learn, and I just don’t quite get how the joining works under the hood.  That is, I understand the principle—find a segment which touches the current segment, and join them together, then do it again and again—but I don’t understand how the code makes that happen.  And thus I haven’t been able figure out how to make it work in GDscript, let alone do so performantly.  I feel like I really should do this, as the current implementation, where all the lines are still their own Line2D nodes, creates 3,000-5,000 such nodes.  Turning those into, say, a couple dozen Line2Ds really feels like a good idea.
Below is the code the generates the several thousand tiny lines; apologies if I wrote awful code (looking at you, var offset) but I’m only two weeks into GDscript and, as I said, no weeks into Python.  cols and rows are defined earlier in the script, and are at present in the 50-100 range.
Any help will be greatly appreciated!
func contourDraw(isorange = Vector3(0,0,0), xmin = 0, xmax = cols, ymin = 0, ymax = rows):
    var triangles = []
    for x in range(xmin, xmax - 1):
        for y in range(ymin, ymax - 1):
            triangles.append([Vector2(x,y), Vector2(x+1,y), Vector2(x,y+1)])
            triangles.append([Vector2(x+1,y), Vector2(x,y+1), Vector2(x+1,y+1)])

    var contour_segments = []
    for triangle in triangles:
        for isocheck in range(isorange.x, floor(isorange.y /isorange.z)):
            var isoline = isocheck * isorange.z
            var below = []
            var above = []
            for vertex in triangle:
                if matrix[vertex.x][vertex.y].strength < isoline: below.append(vertex)
                if matrix[vertex.x][vertex.y].strength >= isoline: above.append(vertex)
            if below.size() == 0 or above.size() == 0:
                continue

            var minority = above if above.size() < below.size() else below
            var majority = above if above.size() > below.size() else below

            var contour_points = []
            var crossed_edges = [[minority[0], majority[0]], [minority[0], majority[1]]]

            for triangle_edge in crossed_edges:
                var offset = ( ( isoline - matrix[triangle_edge[1].x][triangle_edge[1].y].strength ) / ( matrix[triangle_edge[0].x][triangle_edge[0].y].strength - matrix[triangle_edge[1].x][triangle_edge[1].y].strength ) )
                var crossing_point = Vector2(
                    (offset * triangle_edge[0][0]) + ((1 - offset) * triangle_edge[1][0]),
                    (offset * triangle_edge[0][1]) + ((1 - offset) * triangle_edge[1][1])
                )
                contour_points.append(crossing_point * grid_space)
            contour_segments.append(contour_points)

    var counter = 0
    for segment in contour_segments:
        var line = Line2D.new()
        line.default_color = Color.from_hsv(0.58,0.5,0.5)
        line.width = 1
        line.antialiased = true
        line.points = segment
        $Contours.add_child(line)
        counter += 1
    print(counter)
    pass


texts: Complex mesh (created in Blender) is not overlapping when rendered in Monogame (XNA)

texts:
community. Just started playing with Monogame and stuck with a quite simple, but still unanswered issue, at least I couldn't find any answer.
The model rendered in Monogame (XNA) is not overlapping with its own parts:

Originally in Blender, it looks OK:

The same in Windows 3D Viewer:

I believe it depends on the order I'm rendering bones:
private void DrawModel(Model model, Matrix world, Matrix view, Matrix projection)
    {
        Matrix[] transforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo( transforms );
        var fixBlenderRotation = Matrix.CreateRotationZ(MathHelper.ToRadians(90));
        var scale = Matrix.CreateScale(0.1f);
        //for (int i = model.Meshes.Count; i > 0; i--) // -> this looks OK
        for (int i = 1; i <= model.Meshes.Count; i++)  // -> this looks BAD
        {
            ModelMesh mesh = model.Meshes[i - 1];
            foreach (var effect in mesh.Effects)
            {
                if (effect is BasicEffect basicEffect)
                {
                    basicEffect.EnableDefaultLighting();
                    basicEffect.Alpha = 1;
                    basicEffect.View = view;
                    basicEffect.Projection = projection;
                    var boneTransform = transforms[mesh.ParentBone.Index];
                    basicEffect.World = (world  * boneTransform * scale *  Matrix.CreateTranslation(_modelPosition)) * fixBlenderRotation;
                }
            }

            mesh.Draw();
        }
    }

Depth buffer is enabled:
protected override void Initialize()
    {
        _graphics.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
        _world = Matrix.CreateWorld(Vector3.Zero, Vector3.Forward, Vector3.Up);
        var cameraPosition = new Vector3(_radius, 0, 0);
        _camera = new FpsCamera(this, cameraPosition, Vector3.Zero, Vector3.Up);
        Components.Add(_camera);
        base.Initialize();
    }

So, cannot figure out how other tools render my model correctly while monogame is messing things up? The hierarchy of objects in Blender is correct:


texts:
This one is probably really simple but I didn't find a solution.

I'm trying to create a widget (speedometer) with libgdx.
For the arrows I'm using the setRotation() function.
But when the image is rotated, the quality drops.

The result looks like this:

How can I improve the quality of the arrows?


texts: Unity 4.6: why Image object doesn't stretch all sides of canvas

texts:
I insert a canvas, after that, I insert an image at center. Then, I want to stretch this image over this canvas, so I choose last option as below:

But the image doesn't stretch to fit the canvas, as you see: (in fact, image object doesn't change anything)

Please tell me how to make this image stretches over the canvas.

thanks :)


texts: does opengl automatically handle offscreen rendering?

texts:
I'm wondering if opengl can automatically manage offscreen rendering. I mean if it can detect and ignore sprites and textures if they are rendered out of screen.

if it makes any difference i'm targeting opengl-es 2.


texts:
Are there any existing interactive fiction text parsing engines that I can embed in another game or application?

I'm looking to use something as a library. I can pass it the available objects and verbs from my own side. It will parse the sentences from the user and give me back some sort of structure/AST describing what the user asked for. Then my own code can then act upon that request.

I don't need something SIRI level. The simple sentences and actions that current IF games support is fine. But I'm not looking to write a whole text/sentence parser myself.

This isn't an If game and I can't write it entirely in an interactive-fiction language like inform 7. Unfortunatly, I can't seem to find any examples of anyone using the text parsing capabilities of these engines without writing the entire game in that engine's language.


texts: How to panning camera on XZ axis with different angles

texts:
I have an Orthographic camera where the position is { x:0, y:100, z:0 } and is pointing/looking at { x:0, y:0, z:0 }. At this point, I'm able to capture the mouse movement and translate it to make the pan correctly. If the mouse goes 10 px down/y I just have to move Z in the 3D world.

The problem is that I don't know how to calculate if the camera position is in perspective, let's say:

position: { x:50, y:50, z:50 }
lookAt: { x:0, y:0, z:0 }

I guess I have to use some trigonometry, but I'm very lost, to be honest. Any guide would be very helpful.


texts: What do I do with a libgdx rectangle collision?

texts:
The edge of the rectangle is not detached

But if the rectangle is narrowed, it will affect the left and right collision detection


texts: Rendering a Sprite with an Effect.... how?

texts:
gettings tuck doing some 3d Rendering and I think you guys may have a lot more knowledge in it. I am tasked with basically rendering a texture onto a screen, preparing the way to apply graphical effects there (including some color space conversions later that shall move from the CPU to the graphics card.

My idea to do that is pushing the data into a texture, then render it as a sprite onto a surface or texture that then gets presented (it is going to be transformed by code from other people into some show of videos that are part of a larger scene).

Sadly, for technical reasons this means C#, DirectX9 and I decided to use SharpDx as DiretX wrapper.

I am slowly making my way into the whole thing. For the start, we have an A8R8G8B8 texture to render to, and a source in the same format (which will change later, including some foramats DirectX does not support - thus the idea to use PixelShader to transform for example color spaces).

Where I am stuck is:

I can not get an Effect to do ANYTHING. HI ahve the idea my setup is somewhere wrong. Sadly finding out how to apply an effect to a sprite is - very hard, given that most stuff on the internet deals with more recent versions of Direct x.

My code:

There is a SIMPLE effect that should just chane the colors of the pixel. This is a test, but the pixels get rendered normal, so something is wrong. The Effect code is:

float4x4 World;
float4x4 View;
float4x4 Projection;

float4 AmbientColor = float4(1, 1, 1, 1);
float AmbientIntensity = 0.1;

struct VertexShaderInput
{
    float4 Position : POSITION0;
};

struct VertexShaderOutput
{
    float4 Position : POSITION0;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;

    float4 worldPosition = mul(input.Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);

    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    float4 output;
    //output = AmbientColor * AmbientIntensity;
    output = float4(0,0,0,0);
    return output;
}

technique Render
{
    pass Pass1
    {
        VertexShader = compile vs_2_0 VertexShaderFunction();
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

The way I try to render it is:

I get the Effect like this:

Dx9.Effect effect = Dx9.Effect.FromFile(m_Device, "SpriteNopEffect.fx", Dx9.ShaderFlags.Debug);

I select the Technique:

effect.Technique = "Render";

That works -. if I change the name then it blows, so the effect file is loaded and the effect found.

The render code is:

        m_Device.BeginScene();
        Dx9.Sprite sprite = new Dx9.Sprite(m_Device);

        effect.Technique = "Render";
        int passcount = effect.Begin();
        for (int i = 0; i < passcount; i++)
        {
            effect.BeginPass(i);
            sprite.Begin();
            sprite.Draw(
                texture,
                new SharpDX.Rectangle(0, 0, m_Width, m_Height),
                new Dx.Vector3(0, 0, 0),
                new Dx.Vector3(0, 0, 0),
                new SharpDX.Color4(0xffffffff)
            );
            sprite.End();
            effect.EndPass();
        }
        effect.End();

        m_Device.EndScene();

And here the problem is - whether I have the effect in or not, the output is the same, so EITHER my effect is bullocks OR - the effect is simply not applied.

Any help appreciated.


texts:
Back in middle school I would play games like bowman, kitten cannon, sniper assassin, etc. On sites like addictinggames.com, or crazymonkeygames.com.

I know these games would have ads run on them, which I assume was profitable for the developer. Especially titles like those that probably have 8 figure play-stats across the internet.

I was wondering if anyone has any experience with this market, and could provide some insight as to how it is doing now, and what is used to make these games: Is it financially worth developing a browser game? Do I have to use flash to be accepted on these sites?

Back then they were all flash games, but there has been a large uprising of javascript game engines since then (which I am much more familiar with.) But I'm not sure if that's something these sites would accept.


texts: DX11 - Weird shader behavior with and without branching

texts:
I have found problem in my shader code, which I dont´t know how to solve.

I want to rewrite this code without "ifs"

tmp = evaluate and result is 0 or 1 (nothing else)
if (tmp == 1) val = X1;
if (tmp == 0) val = X2;

I rewite it this way, but this piece of code doesn ´t word correctly

tmp = evaluate and result is 0 or 1 (nothing else)
val = tmp * X1
val = !tmp * X2

However if I change it to:

tmp = evaluate and result is 0 or 1 (nothing else)
val = tmp * X1
if (!tmp) val = !tmp * X2

It works fine... but it is useless because of "if", which need to be eliminated

I honestly don´t understand it Posted Image . I tried compilation with NO and FULL optimalization, result is same


texts: How to get button component in Unity 2019.3

texts:
I have a simple class attached to a button in Unity Canvas:

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

public class AudioButtonPlay : MonoBehaviour
{
    public Button button;
    void Start()
    {
        button =  gameObject.GetComponent<Button>();
    }
}

But on the line button =  gameObject.GetComponent<Button>(); I get the following message:

GetComponent requires that the requested component 'Button' derives from MonoBehaviour or Component or is an interface

How can I access the "Button" component?


texts: How do I implement a racing clock that shows elapsed time?

texts:
I'm wanting to make a old school timer like the picture below. How would I go about doing this in VD? I have tried it doing it with code bellow. The problem with this is that it starts with just seconds only adds the minutes section when you reach 1 minute.

Dim StartTime As DateTime
Dim PlayTime As TimeSpan

 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    StartTime = Now()
    End Sub

  Private Sub tmrCountUp_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrCountUp.Tick

    PlayTime = Now() - StartTime

    lblTime.Text = PlayTime.Hours & PlayTime.Minutes & PlayTime.Seconds

    lblTime.Text = lblTime.Text + 1
End Sub


texts: Reducing disk space needed to use TextMeshPro in AssetBundles

texts:
My game uses AssetBundles, and quite often each of those bundles use TextMeshPro. The project is at a stage where it would be unwise to change to Addressables.

Anyway, I noticed that when a bundle has TextMeshPro involved, it easily adds roughly 2mb to the bundle - I assume it's a copy of all the dependencies to make it work.

Ideally all bundles should simply point to one copy which is guaranteed to always be present in the game, which I think Addressables sort of does, but as mentioned we cannot use it for this project for various reasons.

One way is to create/add the TextMeshPro components at runtime (e.g. have some kind of "placeholder/dummy" component that, upon Awake() will add TextMeshPro with various preset attributes).

That would work fine, and I'm willing to do that - but perhaps there are less tedious alternatives (other than Addressables) that I haven't thought of.

The goal is to be able to reduce the disk space required for each bundle just because it is using TextMeshPro components.


texts: How can I create a 3D model in Java without using modeling software?

texts:
I am a lightly experienced game developer and this is my first time trying 3D objects in Java for the first time. I have been recently creating and updating games using AWT, Swing, and Graphics, but I want to delve farther into Java.

I have looked into Java3D, but it's not what I want. I want to use Images and then crop the Image and place the respective textures in their respective places. I already know how to do the cropping and 2D Image editing, but how do I go 3D?


texts:
I've modeled an earth using an sphere. I can rotate it using glRotatef function around z axix by incrementing the angle. How do I simulate earth's movement which looks like 23.5Degree around Z axis? (see this image)

I guess I need to calculate the x,y,z verctors. Any Idea? I'm a complete newbie in computer graphics programming.


texts: Game logic implemented using TPL / async / await, and performance of it

texts:
I'm working on a game, and as a typical game (here using Monogame) it uses frame based approach, where all logic happens in Update() method called every frame.

As a consequence, any sequential logic of operation, like going from one level to another, moving some entity to a different place over time or having a bunch of entity movements happening one after another has to be implemented in some complicated way, using states and finite state machines to track what is where. I obviously can't do anything like this:

foreach (var level in Levels)
{
    while (!level.LevelCompleted)
    {
        level.ShowIntroduction();
        WaitForClick();

        level.ShowMapOverview();
        WaitForClick();

        level.Run();

        level.ShowResult();
        WaitForClick();
    }
}

(might be little dumb example, but you get what I mean)

This while and foreach would block everything. But the thing is, it is very often the best way to describe the algorithm behind, way better than state machines, and these algorithms do get complicated sometimes.

And I just learned a lot about TPL recently and WOOOOOWW, what a great thing it is. Now I can do this. I tested this already both for simple few second actions of moving things in a game, as well as for complete control of scenes and intermissions, where one async method takes minutes or even hours. It can look like this:

foreach (var level in Levels)
{
    while (!level.LevelCompleted)
    {
        level.ShowIntroduction();
        await WaitClickAsync();

        level.ShowMapOverview();
        await WaitClickAsync();

        await level.RunAsync();

        level.ShowResult();
        await WaitClickAsync();
    }
}

To make this work, I have some AsyncManager, which allows me to wait for next frame, like this:

private async Task WaitClickAsync()
{
    while (true)
    {
        await asyncManager.WaitNextFrameAsync();

        if (World.Keyboard.JustPressed.Contains(Keys.Space))
            return;
    }
}

This thing await asyncManager.WaitNextFrameAsync() is used to break the execution of a method and continue it at the next frame. This makes it very easy to make code like above, or to make movement of entities etc. All other stuff in Update() still works, things gets rendered, and all is done without using any additional threads.

Of course in reality it needs to be more complicated than this, to support cancellation of these async methods, but TPL seems to have good support for this.

So first of all I wanted to share it with. And then ask the following, before I start modifying all of my game logic to use TPL:

am I not going in trouble using it everywhere in my game? I'm not really sure if TPL designers really thought about using it for such scenarios, and have those methods run for hours. Any cons?
what could the price in terms of performance be, if anything significant? Am I going to get some problem here?


texts: How to rotate an object so that it is aligned with a vector?

texts:
I have the following Scenario:
Two moving objects (A and B in the picture) need to appear "connected" by a third one (C in the picture). I set the position of the connecting object C as "halfway" between A and B, but how do I rotate it in such a way that it is alined with the vector that connects them (i.e. the result of A - B)? I've tried with D3DXMatrixLookAtRH(&rotate, &eye, &look, &UP_VECTOR) where eye = (0,0,0),look = A's position - B's position and using the rotate matrix as a rotation matrix for C but the result doesn't look as what I expect.


texts: 3d immersive Virtual Conference meeting environment development on the web (3d website)-Help required

texts:
I want to develop 3d immersive virtual collaborative conference meeting environment on the web i.e an immersive virtual environment for our university Teachers to attend and address conference (meeting) Virtually in 3d

Each attendee have login with their customized avatar and can collaborate and discuss different issues(USING SPEECH IN REAL TIME) with each other by using their personalized avatar(other teachers present in meeting Virtually ) I want to implement these features + some other like text support , Multimedia Projector for presentation etc

I need help regarding platform selection preferably I want to Implement it as a webpage (3d website) with no installation or plugin support (plugin independent ) other wise I'll go for Plugin Solution I don't know WebGL and graphics programming I want to do it more by designing in 3d and integration with reusable components

I'm confused in choosing platform I've explored these names so far [ WebGL/Google O3d/web 3d's X3D ,VRML /X3doom/Sirikata Platform/yogurt3d/Unity3d/Jibe/OpenSim/Papervision3d/Flash/3dmlw/Java3d/Infinity3d/ Cube3/CloudMach] also please tell me if other are available and appropriate for me


texts: What are the security implications of this method of tracking countdowns?

texts:
Consider a multiplayer (client/server) game where you initiate the construction of some building. Let's assume construction will complete after 60 minutes.

My plan for dealing with this information is as follows, but I'm not sure if it is secure:

Client initiates construction of building (60 mins)
Server accepts request (resource requirements are met)
Server stores the building task for that player and a completion time-stamp (now + 60 mins)
Client begins a countdown (60 mins)
If client re-connects, the completion time-stamp is retrieved from the server and the remaining time is calculated by the client
When the client counter hits 0, it asks the server for an update
While retrieving the data to send for an update, the server notices that the time-stamp has expired and makes the necessary updates
Server response includes newly constructed building

I thinkit is secure since the completion time and resource calculations are all on the server side; however, is there a security problem that I haven't foreseen?


texts: How to rotate a rectangle body around a fixed point?

texts:
How to rotate a body around a point?
The body has x, y, speed and angle. Coordinates of the body relative to its center. Additional conditions: point position and distance from body to point.


texts: Mixing Objective-C and C++: Game Loop Parts

texts:
I'm trying to write all of my game in C++ except for drawing and game loop timing. Those parts are going to be in Objective-C for iOS.

Right now, I have ViewController handling the update cycle, but I want to create a GameModel class that ViewController could update. I want GameModel to be in C++. I know how to integrate these two classes. My problem is how to have these two parts interact with the drawing and image loading.

GameModel will keep track of a list of children of type GameObject. These GameObjects update every frame, and then need to pass position and visibility data to whatever class or method will handle drawing.

I feel like I'm answering my own question now (talking it out helps) but would it be a good idea to put all of the visible game objects into an array at the end of the update method, return it, and use that to update graphics inside ViewController?


texts: How do I add a prefab to another prefab?

texts:
I want to instantiate a prefab, and then instantiate another prefab and then set the second prefab to the first prefab.

However, this doesn't work.

This is my code:

    //instantiate a new weapon prefab
    Transform nNewInstantiatedPrefab = Instantiate(tPrefab, new Vector3(0, 0, 0), Quaternion.identity);
    if (nNewInstantiatedPrefab == null)
    {
        Debug.Break();
    }

    //instantiate a new amount info canvas
    GameObject nNewAmount = Instantiate(ItemInfoCanvasPrefab, new Vector3(0, 0, 0), Quaternion.identity);
    if (nNewAmount == null)
    {
        Debug.Break();
    }
    nNewAmount.transform.SetParent(nNewInstantiatedPrefab);

    //now test if the prefab has been attached to the other prefab:
    Transform nTest = Helpers.GoFromName(nNewInstantiatedPrefab, "AmountCanvas");
    if (nTest == null)
    {
        Debug.Break();//this line is called
    }

And this is the helper function. I haven't had any problems with it so far:

public static Transform GoFromName(Transform t, string uName)
{
    foreach (Transform g in t)
    {
        if (g.name == uName)
        {
            return g;
        }
    }
    Debug.Break();
    return null;
}

Am I doing something fundamentally wrong, and perhaps prefabs can't be added to other prefabs?

Thank you!


texts: libgdx continuous movement while touch and hold (even after jump)?

texts:
So, I have these buttons where I have implemented a method to handle 'touch and hold' (without polling). If the player touches and holds the walk button ..it will keep walking till the button is released. Problem is when I combine jump with it ...
In the update method,

if (activeTouch) {
        translateScreenToWorldCoordinates(touchCoords.x, touchCoords.y);
         if (touchPoint.x < 5) {
           // Code for walk left
        } else if (touchPoint.x > VIEWPORT_WIDTH - 5)
        {
            // Code for walk Right
        } else if ((touchPoint.x > 6 && touchPoint.x < VIEWPORT_WIDTH - 6) && player.isGrounded() && player.getState() != Player.State.Falling) {
           // Code for Jump
        }
    }

The touchdown and touchup events,

 public boolean touchDown(int screenX, int screenY, int pointer, int button) {
        touchCoords.set(screenX, screenY);
        activeTouch = true;

        return false;
    }

    @Override
    public boolean touchUp(int screenX, int screenY, int pointer, int button) {
        activeTouch = false;
        return false;
    }

So i can move right,left and also jump. But my problem is, while walking if I jump ... it will jump and then stop walking. How to continue walking after the jump if the player is still holding onto the walk button?


texts: 3D position to UV coordinates in fragment shader

texts:
I am interested in converting an arbitrary 3D position computed at run time in the fragment shader to its corresponding UV coordinates. Notice that the 3D position I am interested in is NOT a 3D vertex present in the VBO, but an arbitrary 3D location that may lay somewhere inside one of the triangles of the mesh.

What is the best way to perform this 3D to UV mapping? I am thinking of looking at the vertices of the face where the 3D point is, and interpolate its UV coordinates using the distance between the 3D point and the 3D vertices as a weights, but I have a feeling I may be overthinking this problem.

Ideally, I want to do it in a GLSL fragment shader. Does any body have any suggestion, example code, or better idea to solve this problem?


texts:
I want to rotate a form with three given angles fo each of the three axis. But the GLM rotation function takes only one angle and a vector as arguments.

How can I convert between both formats?


texts: Extracting gamefiles from a game, modify it, then use it commercially, would it be illegal?

texts:
I kinda get a chance to extract gamefiles from the game fortnite(assets, sounds, etc), and then I want to use them for my animation, would that be illegal.

If it is illegal, what if I alter the assets, like modifying it to a voxel, and use it commercially, is it still illegal?


texts: Is there a way to exclude original sprites in spritepacker that's in asset bundle?

texts:
I use spritepacker with assetbundle. It's working great. Its memory assumption is about just 8 MB. However, when I looked at the disk space that asset took on android phone, it took about 25MB. Which is 4 times from 8 MB. If I sum up all original sprites that have been used to create the atlas in spritepacker, they will be about 25MB as they are. Is there a way to exclude original sprites out of the bundle? It waste too much space in the device. I think only output atlas that generate from sprite would be enough to pack within the bundle.

I'm sure of it. I tested with 18 sprites and use the packer to generate 1024x2048 atlas. If I choose 2 sprites to make asset bundle, it used 5.76 MB disk space. If I choose 3 sprites to make asset bundle, it used 6.62MB. Its different is about 0.9MB which is the size of each sprite.


texts: How to know if one game idea is more worth pursuing than another?

texts:
Right now I'm stuck between multiple projects (I don't have shiny object syndrome) I have several game ideas and I'm trying to figure out how to pick between them. I was thinking maybe hearing someones else's idea on how to handle a situation like this would help me.

How can I pick between game project ideas?


texts:
I'm having a problem similar to this link: http://answers.unity3d.com/questions/1295955/character-on-a-moving-platform-slows-down.html

But...

My 2D character is on an elevator (which does not have any physics) and is being moved up and down through an animation (transform). But when my character is on the elevator, the colliders2D overlaps another, as my character's RigidBody2D stands still as I move the game object elevator (crossing each other).
My solution was to try to attach my character as the child of the elevator (SetParent), and this solved the problem of overcoming the colliders, but it gave me a new problem.

The new problem consists of a certain slowness in the movement of the character while it is on the elevator. I believe the problem is because the transform of my character is in motion while the elevator goes up and my rigidbody don't add any force.

Do I need move the elevator with physics to stay movent? Or am I thinking the wrong way?"
How to solve this problem?
See the player movement script:

 using UnityEngine;
 using System.Collections;

 public class Move : MonoBehaviour {

     public float speed;
     public float jump;
     public GameObject rayOrigin;
     public float rayCheckDistance;
     Rigidbody2D rb;

     void Start () {
         rb = GetComponent <Rigidbody2D> ();
     }

     void FixedUpdate () {
         float x = Input.GetAxis ("Horizontal");
         if (Input.GetAxis ("Jump") > 0) {
             RaycastHit2D hit = Physics2D.Raycast(rayOrigin.transform.position, Vector2.down, rayCheckDistance);
             if (hit.collider != null) {
                 rb.AddForce (Vector2.up * jump, ForceMode2D.Impulse);
             }
         }
         rb.velocity = new Vector3 (x * speed, rb.velocity.y, 0);

     }
 }


texts: Finite-state machine with more than one concurrent state

texts:
I am using a FSM for the player entity and it is working fine. Currently the entity has one state and only one (e.g. paralyzed). The entity's state process() method is called every turn.

It is necessary however, that each entity can have more than one state simultaneously (e.g. paralyzed and blinded). Each state affects the entity attributes e.g. paralyzed reduces the walking range to 10% and blindness reduces it to 50%. Vision range is not affected by paralyzed state, but by blindness (set to 0).

Now it is important in which order the states are processed. I either end up with a wrong walking range or a wrong vision range. I could do checks in every state's process() whether the entity has any other states and alter the code accordingly, but this gets very messy the more states I add.

Currently I think it's a better choice to attach only one state to the entity, but to create more states, some of them a combination of two states (e.g. a blindedAndParalyzed). This way I'll and up with a lot more states than I currently calculated with, because ever state has to be combined with other states. I'm wondering if that is the best solution?

A state is a Singleton with an enter, process and exit method. Process is called each turn.
Currently process() for paralyzed looks like this:

public void process(){
   walkRange = 10% * walkRangeBase;
   visionRange = visionRangeBase;
}

and process() for blinded looks like this

public void process(){
   walkRange = 50% * walkRangeBase;
   visionRange = 0;
}

At the moment the result is always fine becvause only the process() method of only one state is executed. If I switch to multiple states both get executed and the result is either walkRange = 50% and visionRange = 0 or walkRange = 10%. THe desired result would be a walkRange of 10% and a visionRange of 0, because the walkRange should be limited to the smallest one.
I could do something like that:

public void process(){
   if(state != paralyzed)
      walkRange = 50% * walkRangeBase;
   visionRange = 0;
}

But i have around 20 different states, so I have to create a lot of if cases. Choosing the smallest value for e.g. walkRange doesn't work either because there are some states with positive effect on walkRange.
So I am wondering if it is better to avoid a state machine with more than one concurrent state and live with a bigger amount of states (about 50), or if there si another solution to this problem.


texts:
I read and understand the basic of flocking algorithm. Basically, we need to have 3 behaviors:
1. Cohesion
2. Separation
3. Alignment

From my understanding, it's like a state machine. Every time we do an update (then draw), we check all the constraints on both three behaviors. And each behavior returns a Vector3 which is the "correct" orientation that an object should transform to. So my initial idea was

        /// <summary>
        /// Objects stick together
        /// </summary>
        /// <returns></returns>
        private Vector3 Cohesion() {
            Vector3 result = new Vector3(0.0f, 0.0f, 0.0f);
            return result;
        }

        /// <summary>
        /// Object align
        /// </summary>
        /// <returns></returns>
        private Vector3 Align() {
            Vector3 result = new Vector3(0.0f, 0.0f, 0.0f);
            return result;
        }

        /// <summary>
        /// Object separates from each others
        /// </summary>
        /// <returns></returns>
        private Vector3 Separate() {
            Vector3 result = new Vector3(0.0f, 0.0f, 0.0f);
            return result;
        }

Then I search online for pseudocode but many of them involve velocity and acceleration plus other stuffs. This part confused me. In my game, all objects move at constant speed, and they have one leader. So can anyone share me an idea how to start on implement this flocking algorithm? Also, did I understand it correctly? (I'm using XNA 4.0)


texts:
In phaser 2.6.2, is there a way to retrieve all tiles given their ID from a TilemapLayer? The method searchTileIndex on Tilemap works well to retrieve a tile. It has a skip parameter that allows to loop through the tiles, so I've come with the following code:

var walls = [];
var skip = 0;
do {
    var tile = map.searchTileIndex(Tiles.ID_WALL, skip, false, wallLayer);
    if (tile !== null) {
        walls.push(tile);
        skip++;
    }
} while (tile !== null);

but it looks very cumbersome to say the least. Am I missing a simpler method, kind of getAllTiles(id) or something?


texts: Game programming: common methods and design patterns

texts:
I begun writing a very simple game engine so that I can learn OpenGL 3.x better but since my inexperience and my sparse knowledge of how a 3D game should be designed, I usually get into problems where I realize that I should have designed my classes differently. Other problems I'm facing is how to keep track of time in a concise manner in the game and update movement as needed and how to tell the renderer that it needs to redraw. Also I keep needing to make Get and Set functions for passing various flags from one object to another, is that a bad practice?

So, as the title says, I'm interested in any books or articles/tutorials and source which could help me out and would explain some common design patterns in game design (i.e. game state handlers, fonts etc).

Btw, I'm still using freeglut, would you recommend I move to a better windowing system before progressing or after I get a better grasp of OpenGL?


texts: How to work out the height of a point on a tilted surface?

texts:
I have a plane which gets tilted on the X and Z axis (y+ is the normal).

Given an X and Z coordinate and the X and Z rotation of the plane, how do I find out the height (Y) at that point?

I assume this is a trigonometry question... I could use simple sin & cos to work it out if it was moving on just the X or Z axis, but what if it's at 3,8 (x,z)? Maybe an average of the sin/cos heights?!


texts: What 3D level development tools are available to indie developers?

texts:
People who build in Unity or UDK have immediate access to a 3D level editor. People who build their games in XNA or from scratch have no such thing. I'm looking for 3D level development tools available to these people.

It must be free, or affordable to an indie developer. I leave the term "affordable" open to interpretation.
It must not be restricted to a specific game engine. I should be able to build my game from scratch and use this level editor to construct my levels.
It should have a file format that comes with an interpreter, or sufficient documentation for me to be able to build my own interpreter.
Open source and/or modifiable/customisable is a plus, but not a requirement.

I know beggars can't always be choosers, but I'm hoping there's something high quality out there.

If there isn't, maybe someone would like to jump on that opportunity and fill the void.


texts: Optimizing models & improving performance

texts:
I've created a map editor for a game I've been developing. The maps (planets) are made using a form of meta ball editing. Basically, in the end the Marching Cubes algorithm is used to get my final model.

Here's an example:

In the game however, when planets are or a largish size, as you would expect, I start having quite a lot of lag. So what I was wondering, is are there any good libraries out there that could be used to remove clusters or triangles that are basically flat and turn them into a single triangle?

I'm not after simply reducing the count, I want the same amount of detail, but to merge triangles where their normal is practically the same.

Also curious, as to how you would go about having more/less detail as you approach/leave areas of a planet. Obviously chunks isn't the easiest method when the world's a sphere.

The project is in C#.


texts: How do I determine if I'm allowed to use an asset from the web in my game?

texts:
I need to incorporate other people's work into my game project. I must admit (with a little embarassment) that I am almost completely ignorant about copyright. I only have a vague idea of what it is, what it protects, or what it means when I see Ⓡ or © or ™. Since English is not my native language, reading all those Wikipedia pages full of legal jargon only gave me an headache.

I'm looking for images (sprites, backgrounds, UI elements mostly) and sound. I intend to publish the game (Google Play and Flash/HTML5 game websites, maybe the iPhone App Store). I don't plan to "sell" it directly, but I do intend to insert ads and/or in-app purchases.

I will most likely need to edit the content before including it in my game. Probably just scaling/rotating, but the greater degree of freedom I have, the better.

So, what should I look for, to be sure I have the rights to use the media I find the way I need to (like "royalty free" or "copyright free")? In which cases do I have to ask for "permission" to use that media, and how? Like, send the owner of the site an e-mail?


texts:
Im trying to implement smooth voxel grid meshing using marching cubes algorithm but I dont quite understand how to do the interpolating (I understand that this would solve the problem) to achieve the smooth transitions on the borders between the empty space and filled space.

In the picture above I have rendered my voxel grid cells as cubes.
Currently the voxel grid is just a 3d array which stores the values if the cell is empty (0.0) or filled(1.0) (not sure if this is ok, do I need to store each cell corners instead).

When processing marching cubes iteration I have to sample my data at floating point indices e.g. I need to look up if position (3.316, 0.16, 0.5) is empty space / on the surface of the data / inside the data.

Currently I just check the cell value where the position is e.g. (3, 0, 0) for the example above which results with cube mesh.

This shows what I want to do more or less:


texts: OpenGL: Display Memory, Offscreen Memory, and the Framebuffer?

texts:
From my understanding, display memory resides on the GPU  and is what's currently being displayed.

Offscreen memory resides on the GPU and is used for things that won't be displayed.

The framebuffer is graphics memory that is the result of OpenGL rendering.

So, how do these 3 correlate to one another? It seems that the framebuffer may reside in offscreen memory maybe? Is this true?

Any help in understanding all this would  be helpful.

Thanks.


texts: Android game crashes when attempting to start wifi hotspots

texts:
I have two methods that will try to start the WiFi hotspot on the android device so that others can connect and play the game.the problem is both method have problems and don't work.
the first method:

    public void ConnectWiFi()
    {
        try
        {

            using (AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic("currentActivity"))
            {
                using (var wifiManager = activity.Call("getSystemService", "wifi"))
                {
                    AndroidJavaObject wifiConfiguration = new AndroidJavaClass("android.net.wifi.WifiConfiguration");
                    wifiConfiguration.Set("SSID", meSSID); // string
                    wifiConfiguration.Set("preSharedKey", mePassword); // string
                    wifiManager.Call("setWifiApEnabled", wifiConfiguration, enabled);
                }
            }
        }
        catch (System.Exception E)
        {
            T.text += "\nE - " + E.Message;
            T.text += "\n\t" + E.StackTrace+"\n";
        }
    }

it crashes the game and I can't debug it.
the secont method:

    public void ConnectWiFiHardWay()
    {
        try
        {

            using (AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic("currentActivity"))
            {
                using (var wifiManager = activity.Call("getSystemService", "wifi"))
                {

                    using (AndroidJavaObject classObj = wifiManager.Call("getClass"))
                    {
                        using (AndroidJavaObject wifiConfiguration = new AndroidJavaObject("setWifiApEnabled"))
                        {
                            wifiConfiguration.Set("SSID", meSSID); // string
                            wifiConfiguration.Set("preSharedKey", mePassword);
                            using (AndroidJavaObject wifiCfgClass = wifiConfiguration.Call("getClass"))
                            {
                                using (AndroidJavaObject booleanObj = new AndroidJavaObject("java.lang.Boolean"))
                                {
                                    using (AndroidJavaObject booleanClass = booleanObj.Call("getClass"))
                                    using (AndroidJavaObject methodObj = classObj.Call("getMethod", "setWifiApEnabled", wifiCfgClass, booleanClass))
                                    {
                                        methodObj.Call("invoke", wifiManager, wifiConfiguration, enabled);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        catch (System.Exception E)
        {
            T.text += "\nH - " + E.Message;
            T.text += "\n\t" + E.StackTrace+"\n";
        }

this one throws an exception that says setWifiApEnabled Cannot be found
I can post the complete error text if that helps.
Also I followed this questions instructions.


texts: Calling method with enum parameters from buttons

texts:
I have the following enum:

public enum WeaponType { Sword, Spear, Blunt, Ranged }

And I have the following public methods on a component:

public void MyMethod1(int myparam) { ... }
public void MyMethod2(WeaponType myparam) { ... }

Why is it that when I try to call my methods from a Button component, I can not see the ones that use enumerations as parameters?


texts: How can I protect my save data from casual hacking?

texts:
What options are there for saving game data in a secure manner? I'm interested in solutions specifically tailored for C++.

I'm looking for something that is fast and easy to use. I'm only concerned about storing simple information such as

Which levels are and are not unlocked
The user's score for each level

I'm curious again to know what's out there to use, any good libraries to use that give me nice, secure game data files that the average player can't mess with.

I just found this here which looks very nice, but it would be great to get some opinions on potential other libraries/options out there.


texts: Missing texture coordinates for channel 0 Fbx and XNA 4.0

texts:
I'm getting this error while trying to load a model in XNA 4.0 :
Error   2   The mesh "transform1", using SkinnedEffect, contains geometry that is missing texture coordinates for channel 0.
The model was dxf format then I upload it to maya then I added some skeleton and some texture (viewed it on the UV) but I still get this error.

this is the load function.

    protected override void LoadContent()
    {
        // Load the model.
        currentModel = Content.Load<Model>("myModel");

        // Look up our custom skinning information.
        SkinningData skinningData = currentModel.Tag as SkinningData;

        if (skinningData == null)
            throw new InvalidOperationException
                ("This model does not contain a SkinningData tag.");

        // Create an animation player, and start decoding an animation clip.
        animationPlayer = new AnimationPlayer(skinningData);

        AnimationClip clip = skinningData.AnimationClips["Take 001"];

        animationPlayer.StartClip(clip);
    }

this is the draw function :

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice device = graphics.GraphicsDevice;

        device.Clear(Color.CornflowerBlue);

        Matrix[] bones = animationPlayer.GetSkinTransforms();

        // Compute camera matrices.
        Matrix view = Matrix.CreateTranslation(0, -40, 0) * // x, y, z
                      Matrix.CreateRotationY(MathHelper.ToRadians(cameraRotation)) * //rotate y
                      Matrix.CreateRotationX(MathHelper.ToRadians(cameraArc)) * //rotate x
                      Matrix.CreateLookAt(new Vector3(0, 0, -cameraDistance),
                                          new Vector3(0, 0, 0), Vector3.Up);

        Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4,
                                                                device.Viewport.AspectRatio,
                                                                1,
                                                                10000);

        // Render the skinned mesh.
        foreach (ModelMesh mesh in currentModel.Meshes)
        {
            foreach (SkinnedEffect effect in mesh.Effects)
            {
                effect.SetBoneTransforms(bones);

                effect.View = view;
                effect.Projection = projection;

                effect.EnableDefaultLighting();

                effect.SpecularColor = new Vector3(0.25f);
                effect.SpecularPower = 16;

            }

            mesh.Draw();
        }

        base.Draw(gameTime);
    }

PS : 1-My knowledge with Maya & XNA is very limited cause I used to use OpenGL/C++ for some time.

2-Also I change my Content Processor to SkinnedModelProcessor not Model - XNA Framework.
thanks in advance.


texts:
I receive an error in Visual Studio when I open CESharpFramework from my project folder. I had assumed I could use Visual Studio 2015; but the error tells me I need an older version of Visual Studio to open the MonoLauncher solution within CESharpFramework.

Is this a known issue and what should I do?


texts: RPG like hit points growth algorithms help

texts:
I am currently making an XNA game in C#. I want to increase health as the player level up. I am currently using this equation.

  MaxHealth = Convert.ToInt32(100 * Math.Pow(1.17, level - 1));

Its fine before the first 20 levels, but afterwards the health starts to increase extremely fast:

  Level 1: 100 Hp.

  Level 20: 1.975 Hp.

  Level 30: 9.493 Hp.

  Level 40: 45.630 Hp.

  Level 100: 658.546.089 Hp.

  Level 109: Crash: value too big for an integer.

How should i create these growth algorithms, so that the growth of hit points pr. level, will increase slowly. This is just an example, if you know a better growth rate, I will be happy to know that too.

  level 2: Hp = base health + 60 (Base health = 100)

  level 3: Hp = base helath + 60 + 120

  level 4: Hp = base helath + 60 + 120 + 180.

But the max health formular will run on every update/tick, so all this should happen in the same calculation.

Edit:

Thank you all for your input, I really appreciate it. But while away from the question, I found a solution myself. Thank you very much. The solution:

if (level < 35)
    this.baseMaxHealth = Convert.ToInt32((vitality * 10) + Math.Pow(level, 2) * 4);
else
    this.baseMaxHealth = Convert.ToInt32((vitality * (level - 25)) + Math.Pow(level, 2) * 4);

I added vitality as an upgrade you can spend skill points or something on

EDIT 2:

I improved the code a bit

        if (level < 35)
            this.baseMaxHealth = Convert.ToInt32((vitality * 10) + Math.Pow(level, 2) * 4);
        else if (level > 125)
            this.baseMaxHealth = Convert.ToInt32((vitality * 100) + Math.Pow(level, 2) * 4);
        else
            this.baseMaxHealth = Convert.ToInt32((vitality * (level - 25)) + Math.Pow(level, 2) * 4);


texts: Why am I getting a return value of zero from my position computation function?

texts:
Ok I have a Function int x(), which is used in

new Rectangle(x(),a,a,a);

in DrawMethod in XNA
but when I use it I get x() = 0 as as the answer.Here is my CODE:

int x()
        {
            int px = (128 * 5);
            int xx = 0;
            for (int i = 0; i < 6; i++)
            {

                if (Mouse.GetState().X > px)
                {
                    //xx = Mouse.GetState().X;
                    xx = px;
                    break;
                }
                else
                { px -= 128; }
            }

            return xx;
        }

Here is the DrawMethod Code:

if (set)
        {
            spriteBatch.Draw(texture, new Rectangle(x(), y(), texture.Width, texture.Height), Color.White);
            textpositionX = x();
            textpositionY = y();
            set = false;
            select = false;
            place = true;

        }
        else if(select)
        {
            spriteBatch.Draw(texture, new Rectangle(Mouse.GetState().X - texture.Width / 2, Mouse.GetState().Y-texture.Height / 2, texture.Width, texture.Height), Color.White);

        }
        else if (place)
        { spriteBatch.Draw(texture, new Rectangle(textpositionX, textpositionY, texture.Width, texture.Height), Color.White);
        select = false;
        set = false;
        }


texts: Do I need to ask Microsoft for permission to use their products logo?

texts: I am currently making a trailer of my game for my college project, I would like to note that my game is cross platform. Do I need to ask for permission to use those images in such situation? - When I want to say that their game will be on playable on Windows/Mac/Linux.


texts:
I want to understand how does Color.Lerp works in unity.
According to this page it is quite clear to understand how to use it but I'm interested in how it is implemented. Does it work on RGB channels? and how? In the docs it says that the t factor is clamped between 0 and 1 so i wonder to know on which values Lerp works with Color.


texts:
I need to make a button with texture. After button is pressed I want to change texture of button permanently.
For example on/of sound button.
I tried this but it changes image only while I hold button.

Thanks

mSoundButton  = new ButtonSprite(30, 30,
                    ResourceManager.getSoundButtonTR(),
 //tiled texture region with image for sound on and sound off
                    ResourceManager.getEngine().getVertexBufferObjectManager()) {
        @Override
        public boolean onAreaTouched(TouchEvent pTouchEvent,
                                     float pTouchAreaLocalX,
                                     float pTouchAreaLocalY) {
            if(pTouchEvent.isActionDown()) {
                SFXManager.toggleSoundEnabled();
                this.setCurrentTileIndex(1);
            }
            return super.onAreaTouched(pTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
        }
    };
    mScene.registerTouchArea(mSoundButton);
    mScene.attachChild(mSoundButton);


texts: Performance differences: one empty GameObject with multiple child objects vs. single GameObject formed by pre-merging the former child objects

texts:
Imagine a robot game where robots are made of pre-built blocks. Therefore, each block is a separate GameObject, with one mesh each.

I am trying to understand the conceptual differences behind the following. Is it better performance-wise and memory-wise to have one empty GameObject representing the robot that is the parent of multiple child GameObjects/meshes (i.e. the parts from which the robot is made of), or is it better to transform all into one single joint GameObject/mesh that will be the final robot?

When I mention "understand the concept", I mean understand why each of both options have their downsides in terms of memory allocation for the mesh geometry data and also processing (cpu -> drawcalls -> gpu).


texts: Deleting Objects Before Export from Maya Causes .PSK to Crash UDK on Import

texts:
I'm using Maya 2008 Complete and 03/11 build of UDK as well as 07/10 build (haven't got around to installing newer version on other computer). I am using ActorX to export.

I have a character that I have rigged and animated (I'm not using UDK rigs).

Here was my process:

Early on in the process, I had other objects skinned to the character's skeleton.
I hid those objects while weighting the character
I decided later that I wanted to delete them.
I tested my .psk in both UDK builds with those objects hidden and noticed that they still showed up (in UDK)
So, I went back into Maya, detached the skin on those objects and deleted history, then deleted them.
I then re-exported my .psk and now when I try and import, udk crashes.

Here are my input/output connections for one of the objects before detaching the skin.

http://i.stack.imgur.com/hoDdv.jpg

Here is my log:

0002.77] Log: >>>>>>>>>>>>>> Initial startup: 2.77s <<<<<<<<<<<<<<<
[0002.81] Cmd: MODE MAPEXT=udk
[0002.87] SourceControl: Source Control disabled in GAMEEditorUserSettings.ini.  [SourceControl] has Disabled=False
[0005.61] Log: TIMER ALL OF INIT : [5.028131]
[0070.42] Log: FactoryCreateBinary: SkeletalMesh with SkeletalMeshFactory (0 0 Z:\websterProject2\EXPORTTESTING\SK_snailMesh01.PSK)
[0070.42] Log:  * Skeletal skin VPoints            : 812
[0070.42] Log:  * Skeletal skin VVertices          : 1166
[0070.42] Log:  * Skeletal skin VTriangles         : 1596
[0070.42] Log:  * Skeletal skin VMaterials         : 1
[0070.42] Log:  * Skeletal skin VBones             : 73
[0070.42] Log:  * Skeletal skin VRawBoneInfluences : 1520
[0070.42] Log:  * Skeletal skin VertexColors          : 0
[0070.42] Log:  * Skeletal skin Num Tex Coords    : 1
[0070.42] Log:  Mesh material not found among currently loaded ones: lambert3SG
[0070.42] Log: Bones digested - 73  Depth of hierarchy - 15
[0070.49] Critical: appError called: Assertion failed: Wedges.Num() == WedgeInfluenceIndices.Num() [File:c:\depot\UnrealEngine3\Development\Src\Engine\Src\UnSkeletalTools.cpp] [Line: 301]
Stack: Address = 0x402228f9 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x40924bb1 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x412bfbc8 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x401a178d (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x412964a4 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x412823a4 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x983633   (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\wxmsw28u_vc_custom_64.dll]
Address = 0x983d73   (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\wxmsw28u_vc_custom_64.dll]
Address = 0x983e30   (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\wxmsw28u_vc_custom_64.dll]
Address = 0x800a34c6 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\wxmsw28u_core_vc_custom_64.dll]
Address = 0x800aec65 (filename not found) [in C

I would like to know why deleting these objects is causing the .psk to crash on import and how I can fix it.

Thanks very much for your time.


texts: How to get good movement synchronization in a networked game (action/shooter)

texts:
I've spent the last two days trying to get good movement interpolation with Photon in Unity but I can't get anything that I'm happy with. I've tried several methods but none satisfied me. My understanding is that I better use some kind of interpolation (as opposed to extrapolation/dead reckoning) because in my game the players can change direction fast.
I've tried lerping between the current position and the last received authorized position, I've tried lerping between the old and the new authorized position, but nothing gives me the right amount of responsiveness + smoothness. What can I do?
Sample code:
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
    if (stream.IsWriting) //do we have authority over this object?
    {
        stream.SendNext(transform.position);
        stream.SendNext(transform.rotation);
    }
    else
    {
        newNetworkTime = Time.time;
        oldPosition = transform.position;
        oldNetworkPosition = networkPosition;

        networkPosition = (Vector3)stream.ReceiveNext();
        networkRotation = (Quaternion)stream.ReceiveNext();
    }
}

void RemoteMovement()
{
    float t = 1.0f - ((newNetworkTime + interpolationPeriod - Time.time) / interpolationPeriod);

    transform.position = Vector3.Lerp(oldPosition, networkPosition, t);
    transform.rotation = Quaternion.Lerp(transform.rotation, networkRotation, Time.deltaTime * movementSpeed);
}


texts: Why do GPUs require game specific drivers?

texts: PC GPU driver updates often cite improvements made to performance of specific, recently released games. Why is this game-specific updating needed? How do the game-specific changes interact with the game code?


texts: I'm wondering how to design a database for the player's experience, whether to create a single table that will collect basic information such as. Class, race, number of experiences, number of occupied bases, etc. Or whether it would be more ideal to divide it into individual databases


texts: How can I convert a model's rigging from standard bones to a biped in 3DS Max?

texts:
I've purchased a rigged 3D model from Turbosquid. Unfortunately the model has been rigged using standard bones instead of a biped.

Is the a way I can automatically converting the skinning from bones to biped?


texts:
I was following the solution from this https://stackoverflow.com/questions/20180063/box2d-body-with-texture. I ended up getting this working for static bodies. But when trying to get the PolygonSprite to follow the body it is working but the textures scrolls as the body moves. I would like it to have a set texture and the UV's don't change.

As you can see by the top moving body the texture moves with the body but, the sprite is not staying constant. Every time draw is called the following is done. It recalculates the vertices and triangles.

    vertices = ActorUtil.calculateVertices(getShape(), body);
    short triangles[] = new EarClippingTriangulator().computeTriangles(vertices).toArray();

    region = new PolygonRegion(textureRegion, vertices, triangles);
    sprite = new PolygonSprite(region);

    polyBatch.begin();
    sprite.draw(polyBatch);
    polyBatch.end();

ActorUtil.calculateVertices

public static float[] calculateVertices(PolygonShape shape, Body body) {
    int vertexCount = shape.getVertexCount();
    Vector2 mTmp = new Vector2();
    float[] vertices = new float[vertexCount * 2];
    for (int k = 0; k < vertexCount; k++) {
        shape.getVertex(k, mTmp);
        mTmp.rotate(body.getAngle() * MathUtils.radiansToDegrees);
        mTmp.add(body.getPosition());
        vertices[k * 2] = mTmp.x * GameInfo.CONVERSION;
        vertices[k * 2 + 1] = mTmp.y * GameInfo.CONVERSION;
    }

    return vertices;
}

EDIT: So, I did some more testing trying to figure this out and still couldn't get it. I found out that I only needed to compute Triangles once since the shapes never changed though.


texts: Creating a path including loops and spirals

texts:
I have a paper airplane that I would like to take a "random" path towards its destination based on the game layouts size. I want it to include spirals and loops and gliding a little back and forth.

How would I go on about creating those random movements?


texts:
hey, I'm just using unity, I'm having a problem with the normal map, like the picture above, if I use blender I just need to change the sRGB to non-color data, but when I import it to unity using the fbx format, why is the result like the picture above?  I've been looking for tutorials on YouTube but can't find the results, thank you
https://drive.google.com/file/d/1taEKN33XByWa-eFgzsyOpS3JYOltuYe9/view?usp=sharing


texts: How can I use height patches to generate terrain such as what was used to create Abzu?

texts:
Last year's GDC was pretty inspirational for me and Matt's talk about GiantSquid's landscape creating workflow was the best of all. If you haven't seen it I highly recommend you to check it out.

I'm a Unity dev and I'm aware of the fact that Abzu was done with UE and the tools they used in this landscape creation and customizing was custom built.

Although I'd eventually like to create similar tools for terrain generation via mashing height patches and enabling different surfaces blending, terrain stamps, and such, the first thing I should ask should be about the level terrain bit.

How can I use height patches to generate a terrain (like sand) and then blending them together with something else without extra sculpting (like rock protruding from the sand surface)?


texts: Libgdx detect when player is outside of screen

texts:
Im trying to learn libGDX (coming from XNA/MonoDevelop), and I'm making a super simple test game to get to know it better. I was wondering how to detect if the player sprite is outside of the screen and make it so it is impossible to go outside of the screen edges.

In XNA you could do something like this:

// Prevent player from moving off the left edge of the screen
if (player.Position.X < 0)
    player.Position = new Vector2(0, player.Position.Y);

How is this achieved in libgdx? I think it's the Stage that handles the 2D viewport in libgdx?

This is my code so far:

private Texture texture;
private SpriteBatch batch;
private Sprite sprite;

@Override
public void create () {
    float w = Gdx.graphics.getWidth();
    float h = Gdx.graphics.getHeight();
    batch = new SpriteBatch();

    texture = new Texture(Gdx.files.internal("player.png"));
    sprite = new Sprite(texture);
    sprite.setPosition(w/2 -sprite.getWidth()/2, h/2 - sprite.getHeight()/2);
}

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

    if(Gdx.input.isKeyPressed(Input.Keys.LEFT)){
        if(Gdx.input.isKeyPressed(Input.Keys.CONTROL_LEFT))
            sprite.translateX(-1f);
        else
            sprite.translateX(-10.0f);
    }
    if(Gdx.input.isKeyPressed(Input.Keys.RIGHT)){
        if(Gdx.input.isKeyPressed(Input.Keys.CONTROL_LEFT))
            sprite.translateX(1f);
        else
            sprite.translateX(10f);
    }

    batch.begin();
    sprite.draw(batch);
    batch.end();
}


texts: Is there a way to add a like button which links to my page for my android game which I made in unity. Any help would be appreciated.


texts: Free animated character models for my first Unity game

texts:
I am creating my first game in Unity for my intra-college game development competition. A hack and slash type of game. It's about a warrior who is escaping from a prison. Setting is medieval times.
Thing is, I am looking for 3 free (low poly) animated character models which are appropriate for this game.
1. The hero (has a sword, with optional shield)
2. Basic enemy guard (with sword/ hammer/ other melee weapon, no shields)
3. Boss (with melee weapon)
I searched for the above over the last couple of days, but couldn't find them.

My modeling skills are not such that I can create my own character models. However I have managed to create the game levels.
Now I am looking for some help with the character models.

Can anyone please link me to the appropriate free models?

Last date of game submission is March 8. So I need the models urgently. Please help.

P.S.  The game is slightly inspired by Prince of Persia: Warrior Within