texts:
I have high-quality SVG card images, but they drastically lose their quality when I downsize them. I have tried two ways of rendering cards (using Inkscape and Imagemagics):

1) Render SVG to high-res PNG and resize it then:

inkscape -D --export-png=QS1024.png --export-width=1024 QS.svg
convert QS1024.png -filter Lanczos -sampling-factor 1x1 -resize 71x QS71.png

2) Render SVG to image of proper size at once:

inkscape -D --export-png=QS71.png --export-width=71 QS.svg

Both approaches generate blurry card images, which looks even worse than old Windows cards. What are the best way to generate smaller card images from SVG sources and not to loose their quality a lot?

UPDATE: I am using Inkscape to render SVG -> PNG and ImageMagick then to downsize PNG. I've tried using convert -resize with couple of filters (Lanczos/Mitchell/etc), but result was pretty much the same.

Original:

71x raster:


texts: How can I stress-test my sever for the game Rust?

texts:
I am looking to stress test my server for the game Rust and monitor CPU, RAM and FPS. I could not find much around.
I general I think I will need a good amount of compute power, bunch of cloud based VM which generate the load through UDP using some headless client.
Monitoring CPU and RAM should be fairly easy, but how about the in game FPS?
Also I could not find much about Rust clients that could simulate a player.


texts: Farseer Physics Samples and Krypton how to reference game

texts:
I'm sure this is totally simple and yes I am new at this.

I am trying to set up Krypton inside farseer.
1.  create a new Krypton engine in my sub screen aka AdvancedDemo1 : PhysicsGameScreen, IDemoScreen
Via  this.krypton = new KryptonEngine(this, "KryptonEffect");
The problem is the KryptonEngine(this wants reference to Game game, I cant seem to reference it from FarseerPhysicsGame : Game
So how would I do that?

or
2.  I can put it directly in FarsserPhysicsGame but again I cant seem to figure out how to reference FarseerPhysicsGame in AdvancedDemo1.

or
3.  I can put it inside the public FarseerPhysicsGame() and do Componenets.Add(krypton) [which works] HOWEVER I cant figure out how to reference the compoenet once it is added.

You should be able to stop reading here , but for more detail
I simply took the Farseer XNA Samples went into FarseerPhysicsGame.cs and deleted all the screens and menus except AdvancedDemo1 so there is one option and I just click that to load into the advancedDemo1 and thats where I want to put the lights from krypton.

Thanks.

Edit: Figured out 1 solution though I am still curious about others.
Solution 1 I was able to use ScreenManager.Game(not sure why it was there but Ill try to figure it out later)


texts:
I have an arcball set up to follow my model in XNA. It rotates around the target correctly when holding in the left mouse button and moving the mouse. It zooms in and our correctly with the mouse wheel. It turns  so it's orientation is always the same as the character turns left and right.
The one part that's missing: I want the player direction to snap to the camera direction if I press the right mouse button, so I can then steer the player with the mouse. This refuses to work, I just can't seem to get the player facing in the correct direction.

The camera update class:

      public Matrix UpdateCamera(GameTime gameTime, HeightMapInfo heightMapInfo, float playerFacingDirection, Vector3 playerPosition)
    {
        float time = (float)gameTime.ElapsedGameTime.TotalMilliseconds;

        Matrix cameraFacingMatrix = Matrix.CreateRotationY(playerFacingDirection);

        Vector3 targetOffset = Vector3.Transform(cameraTargetOffset,
            cameraFacingMatrix);

        Vector3 cameraTarget = playerPosition + targetOffset;

        Matrix orientation = Matrix.CreateFromYawPitchRoll(MathHelper.ToRadians(cameraRotation),
                MathHelper.ToRadians(cameraArc), MathHelper.ToRadians(cameraDistance));

        view = Matrix.CreateLookAt(cameraTarget + (orientation.Backward * cameraPositionOffset.Z), cameraTarget, Vector3.Up);

        return view;
    }

And a snippet of the player class (based upon the XNA heightmap collision demo off MSDN):

        Matrix playerFacingMatrix = Matrix.CreateRotationY(playerFacingDirection);
            Vector3 velocity = Vector3.Transform(movement, playerFacingMatrix);
        velocity *= playerVelocity;

        Vector3 newplayerPosition = GetPlayerPosition() + velocity;
        if (heightMapInfo.IsOnHeightmap(newplayerPosition))
        {
            newplayerPosition.Y = heightMapInfo.GetHeight(newplayerPosition) +
                SphereRadius;
        }
        else
        {
            newplayerPosition = playerPosition;
        }
        float distanceMoved = Vector3.Distance(playerPosition, newplayerPosition);

        int rollDirection = movement.Z > 0 ? 1 : -1;

        sphereRollingMatrix *= Matrix.CreateFromAxisAngle(playerFacingMatrix.Right,
            theta * rollDirection);

        playerPosition = newplayerPosition;

and then the Draw for the player model

            DrawModel(sphere, camera.ReturnSphereRollingMatrix() *
            Matrix.CreateTranslation(camera.GetPlayerPosition()));

Basically, from what's above, what do I need to set as what to make the player direction point in the same direction as the camera direction? (not vice versa)


texts: XNA 4.0 - Purple/Pink Tint Over All Sprites After Viewing in FullScreen

texts:
I'm a noob to the game dev world and recently finished the 2D XNA tutorial from http://www.pluralsight.com.

Everything was perfect until I decided to try the game in Fullscreen mode.  The following code was added to the Game1 constructor.

        graphics.PreferredBackBufferWidth = 800;
        graphics.PreferredBackBufferHeight = 480;
        graphics.IsFullScreen = true;

As soon as it launched in Fullscreen, I noticed that the entire game was tinted.  None of the colours were appearing as they should.  That code was removed, the game then launched in the 800x480 window, however the tint remained.

I commented out all my Draw code so that all that was left was

        GraphicsDevice.Clear(Color.CornflowerBlue);

        //spriteBatch.Begin();
        //gameState.Draw(spriteBatch, false);
        //spriteBatch.End();

        //spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive);
        //gameState.Draw(spriteBatch, true);
        //spriteBatch.End();

        base.Draw(gameTime);

The result was an empty window that was tinted Purple, not Blue.  I changed the GraphicsDevice.Clear colour to Color.White and the window was tinted Pink.  Color.Transparent gave a Black window.

Even tried rebooting my PC but the 'tint' still remains.  I'm at a loss here.


texts: Drawing a graph in Java JPEG/PNG for a simple map

texts:
For my game i need to create a map based on a graph starting from the coordinates of the nodes, using "roads" instead of simple lines (for the edges) and circles instead of points (for nodes), but i don't now exactly which library to use.

As far as I now the standard graph visualization libraries wouldn't make me create this kind of graph.

Here is a quick example of what i mean:

If possible for the points i would like to use a custom textures

I only need to learn how to create the picture, because i know how to handle it in my game


texts:
I am trying to make a 2D isometric RPG and I kind of hit a wall when it comes to lighting.
I was thinking of using shaders, if I manage to understand them.The problem I am anticipating is the presence of light sources outside the screen.In order to calculate shadows and so on I'd still need to have those objects rendered even if they're offscreen or else light would pop in and out if I move the view around the map. I was thinking of drawing the entire level, not just what is seen,  but that would mean drawing at negative and outside the view coordinates.Does that work or I should seek a better, more efficient alternative?


texts: When to use Euler vs Axis angles vs Quaternions?

texts:
I understand the theory behind each but I was wondering if people could share their experiences in when one would use one over the other

For instance, if you were implementing a chase camera, a FPS-style mouse look or writing some kinematic routine, what would be the factors you consider to go with one type over the other and when might you need to convert from one form of representation to the other?

Are there certain things that only one system can do that the others can't? (eg smooth interpolation with quaternions)


texts:
I'm building an RPG style game, but i have some trouble with storing data from entities. These entities can carry data including but not limited to their location, their graphics, whether they are solid, and so on.

I have thought about just storing it as a list of numbers, but this means that a single change (adding a variable for example) will break the entire saving system.

Is there an easier and more versatile way to store this information?

EDIT: Ok i did a bit of searching and i found a bunch of questions basically the same as this one. Feel free to ignore this question ;)


texts: How can I avoid a delay with continues touch detection in swift?

texts:
I want control a character on my screen with a continuous swipe gesture. As soon as I do a swipe +x or -x my character moves left or right. And as long as I hold my finger it continuous to move to the direction in that I swiped. When I swipe into the opposite direction of my last swipe without leaving my finger from the touch ground, my character should move into this direction. When I release my finger from the touch screen, my character should stops instantly.

My problem is that there is often a small delay within the change of direction. And this delay makes it less precise.

override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
    /* Called when a touch begins */
    var player = self.childNodeWithName("man")

    for touch in (touches as! Set<UITouch>) {
        let location = touch.locationInNode(self)
        let touchedNode = self.nodeAtPoint(location)

        lastFingerPosition = location

    }
}

override func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent){
    var player = self.childNodeWithName("man")

    for touch in (touches as! Set<UITouch>) {
        let location = touch.locationInNode(self)
        let touchedNode = self.nodeAtPoint(location)

        if(location.x > lastFingerPosition?.x && lastMoveDirection != "right"){
            movePlayer("right")
        } else if(location.x < lastFingerPosition?.x && lastMoveDirection != "left"){
            movePlayer("left")
        }
    }
}

//@Todo: Wenn man touchMoved und nicht über dem Button hoch geht, wird die Action nicht aufgehoben
override func touchesEnded(touches: Set<NSObject>, withEvent event: UIEvent) {
    var player = self.childNodeWithName("man")

    for touch in (touches as! Set<UITouch>) {
        let location = touch.locationInNode(self)
        let touchedNode = self.nodeAtPoint(location)

        player?.removeAllActions()
        lastMoveDirection = ""
    }
}

func movePlayer(direction: String) {
    var player = self.childNodeWithName("man")

    if(lastMoveDirection != direction){
        player?.removeAllActions()
        lastMoveDirection = direction

        var duration:CGFloat? = 0
        var x = player?.position.x
        duration = x!

        if(direction == "left"){
            var xDestination:CGFloat = 10
            var run = SKAction.moveToX(10, duration: NSTimeInterval(Double(duration! / runSpeed)))
            player?.runAction(run, withKey: "moveLeft")
        } else if(direction == "right") {
            duration = self.frame.width - x!
            var xDestination = frame.size.width - 1
            var run = SKAction.moveToX(xDestination, duration: NSTimeInterval(Double(duration! / runSpeed)))
            player?.runAction(run, withKey: "moveRight")
        }
    }
}


texts:
I'm currently working on my 2D survival game, where the world is infinite and generated by perlin noise. I wanted to also include biomes and this article interested me - http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/ .

I downloaded the source ported to C# and edited it to 2D, but there's the problem. I generated simple map 100x100 but then, I dont know how to convert those polygons into the tiles. I tried a simple technique:

for (int x = 0; x < map.GetLength(0); x++)
        {
            for (int y = 0; y < map.GetLength(1); y++)
            {
                float rozdilP = 100000f; Biome b = BiomeTypes.Snow;

                foreach (Center center in EnvironmentService.MapGenService.Centers.Values)
                {
                   float rozdil = Vector2.Distance(new Vector2(x, y), new Vector2(center.Point.X, center.Point.Z));
                    if (rozdil < rozdilP)
                    {
                        rozdilP = rozdil;
                        b = center.Biome;
                    }

                }
                map[x, y] = b;
            }
        }

it works, but it's really, really slow. Isn't there any better solution or algorhytm for this or is the polygon method of generation supposed to be used only in 3D?

Ty for your time and answer :)


texts:
Is there a way one could bend an object, like a cylinder or a plane using OpenGL?

I'm an OpenGL beginner (I'm using OpenGL ES 2.0, if that matters, although I suspect, math matters most in this case, so it's somehow version independent), I understand the basics: translate, rotate, matrix transformations, etc. I was wondering if there is a technique which allows you to actually change the geometry of your objects (in this case by bending them)?

Any links, tutorials or other references are welcomed!


texts: Why does adding LIBGDX "fadeIn" action to a table in a group make the whole stage fade in?

texts:
I'm trying to "fadeIn" a store "screen" which is really just an invisible group. I set the group to visible=true, set the alpha to 0 and then do a "fadeIn" on the group. The problem is that the whole stage goes black (my clear screen color) and then fades back in.

storeGroup.addAction(Actions.sequence(Actions.alpha(0), Actions.fadeIn(1)));

I even went as far as to make the Table within my StoreGroup accessible and adding the action to that, but the result is the same.

storeGroup.getTable().addAction(Actions.sequence(Actions.alpha(0), Actions.fadeIn(1)));

Essentially I just want my store group to fade in over whatever is currently displaying, but the fade in seems to apply to every other actor in my Stage, not JUST the one I'm adding it to.

Any help would be greatly appreciated, I've been working on this all morning and can't figure out why the "fadeIn" is applying to everything.


texts: I'm using pygame to make a top down shooter I've placed my tiles and object layers using Tiled Map Editor. My player and mobs collide with their spawn locations (object layer) is anyone able to help? It's as if the object layers for items, player and enemies are physical so they can't pass through and just walk around.


texts:
I want to move an object towards the destination elastically. Currently I am using Vector3.Lerp it working to move the object, start with high speed and reached at destination with low speed but missing elastic effects.

float i = 50, t = 0;
        while (t < 1)
        {
            t += Time.deltaTime / i;
            transform.position = Vector3.Lerp(transform.position, newPostionAtDistance, t);
            transform.LookAt(targetFollow.transform);
            if (transform.position.ToString() == newPostionAtDistance.ToString())
            {
                //StartCoroutine(CamElasticMoveBackEffetcts());
                Debug.LogWarning("Object reached to the point.");
                yield break;
            }

            smoothTime += Time.deltaTime;
            yield return 0;
            i++;
        }


texts: How does this example make efficeint voxel engines using "chunks"?

texts:
I'm currently looking in to how voxel engines works, with a view to possibly making one, myself. I see a lot of material, like "Let's Make a Voxel Engine", which talks about how to go about reducing the draw calls. What I can't seem to understand is how it actually saves draw call counts, on the basis of the logic being something like the following:

// Without chunks:

foreach voxel in myvoxels
  DrawIfVisible()

// With chunks:

foreach chunk in mychunks
    DrawIfVisible()

    // which then does ...
foreach voxel in myvoxels
    DrawIfVisible()

Surely, you save nothing by doing this; you still make a draw call for each visible voxel, and a visible voxel needs a draw call in either scenario. The only real saving I can see is that the logic that evaluates a chunk will be able to determine if a large number of voxels are visible or not, effectively, saving a bit of "is this chunk visible" CPU time. It's the draw calls that interest me; the fewer of those, the faster the application.

In case it makes any difference, I will probably be using XNA with DirectX for my engine, so don't consider my choice of example in the link above as my choice of technology. However, this question is such that I doubt it would matter.


texts: Video recording and editing for game promo video

texts:
I would like to screen record a beta of an RPG I've created. The format will be narration over video with the ability to edit. It's an indie game I'm marketing, so the video quality and narration need to be semi-professional.

I'm curious as to which video production packages are of good enough quality to accomplish this without breaking the bank (free is the best!). If there are no good packages, then separate software recommendations for screen recording, editing, and narration would be helpful!

Notes:

I have a Mac
I would rather do video recording first, then narration later with an overlay
I've used Quicktime in the past, not sure if there was something better
This video is for my Kickstarter campaign


texts: Pure functional programming and game state

texts:
Is there a common technique to handle state (in general) in a functional programming language? There are solutions in every (functional) programming language to handle global state, but I want to avoid this as far as I could.

All state in a pure functional manner are function parameters. So I need to put the whole game state (a gigantic hashmap with the world, players, positions, score, assets, enemies, ...)) as a parameter to all functions which wants to manipulate the world on a given input or trigger. The function itself picks the relevant information from the gamestate blob, do something with it, manipulate the gamestate and return the gamestate. But this looks like a poor mans solution for the problem. If I put the whole gamestate into all functions, there is no benefit for me in contrast to global variables or the imperative approach.

I could put just the relevant information into the functions and return the actions which will be taken for the given input. And one single function apply all the actions to the gamestate. But most functions need a lot of "relevant" information. move() need the object position, the velocity, the map for collision, position of all enemys, current health, ... So this approach does not seem to work either.

So my question is how do I handle the massive amount of state in a functional programming language -- especially for game development?

EDIT: There are some game frameworks for building games in Clojure. There approach to solve this problem partially is to thread all objects in the game as "entities" and put it in a huge bag. A gigant main function is holding the screen and the entities and handle events (:on-key-down, :on-init, ...) for this entities and run the main display loop. But this is not the clean solution I am searching for.


texts: Best format for model with double UV sets

texts: I'd like to use first UV set as wrapping (or when some faces cover another on UV) diffuse color map and second UV set as baked ambient occlusion (packed to islands) map. It is possibly to use FBX or Collada .dae or other (what?) in this case? I read scene by Assimp library.


texts: Trigger an event when a game object touches a non-solid game object

texts: For a 2d game, I are currently making an AI and I want it to jump when it touches a invisible cube, which isn't solid, how do I do this?


texts: Collisions with complex assets from Blender in SceneKit

texts:
I have a very basic workflow question: I'm prototyping a game with Apple's SceneKit framework. It can automatically create a mesh for collision detection, but it will always be a convex hull. This works okay for simple meshes, but now I want my character wo walk into a house.
The options I could come up with:

Use the same mesh for the physicsShape (could be too complex and a performance bottleneck)
Build the level in SceneKit and only create atomic building blocks in Blender
Create a second low-poly version of the model and use that for collisions (basically twice the work?

As you can see I have zero experience with game development and best practices. What is the typical way to do this?


texts: What are some tried-and-true combat models?

texts:
I'm thinking about starting a text-based RPG game using Javascript (Similar to a text adventure, but with a much more refined item/fighting system). I've had some experience with playing RPG games, but before I begin, I want to find out what some good "combat models" are. When I say combat model, I mean a tried-and-true system of how a player's strength and weapons affects his attack, defense, etc. There are a few points I'd like to hear some more about:

How would I create a good attack for a player including weapons and traits?
What about defense?

Thanks, Elliot Bonneville


texts:
In my game I have a line that simulates the trajectory of a gun shot, fired by the main character.
The line starts at the character and ends at the mouse position at the moment of the click.
What happens is that sometimes the click is before the target. So the line does not extend to the target. I wish I could extend the line, at least to the end of the room.
What happens:

What I would like to happen:

Line:
(x1,y1,x2,y2)

(obj.x,obj.y,mouse_x,mouse_y)

Attempt based on liggiorgio's answer:


texts: Server-client communication: Quick and verbose or involved and compact?

texts:
TL;DR: Does the short development time required for HTTP/XML offset its size issues compared to developing a custom protocol?

As some of you might have divined; I'm currently working on a turn-based strategy game of the massively multiplayeriffic variety. The target turn-length is anywhere from 6 hours and up, so synchronization will be, on the whole, a bit easier than, say, an FPS or an MMORPG.

The issue then, is how the clients connect to the server. As I see it, I have basically two options: HTTP using some manner of XML exchange, or direct socket communication using some arcane protocol.

Because casual gaming is the "big thing" nowadays; the idea is that the game will be the sort of game where you can pick it up, play for 5 or 10 minutes, and then put it down and come back the day after; an approach that would greatly benefit from having the communication be stateless (as in HTTP).

On the other hand, target devices include the iPad and (perhaps) other mobile devices down the road; any protocol used would probably benefit greatly from being compact, if not so much for the speed (see above), but more in order to not cost the user everything he has if he plays on the road using cellular data networks.

On the gripping hand; using HTTP as the basic communication protocol greatly facilitates the creation of a web-based client.

All of this leaves me, as far as I can see, anyway, with 3 options:

XML over HTTP: A bit of bloat, but easy to implement in all cases.
Custom protocol: Allows for a very streamlined protocol, but trickier to implement.
All of the above: Small protocol for application clients; big protocol for web clients, increases implementation complexity and maintenance time required geometrically.

Does the short development time required for HTTP/XML offset its size issues compared to developing a custom protocol?


texts:
How do i draw a texture2D in a specific area (rectangle) where the texture is bigger than the rectangle, and i dont want to draw outside the rectangle. So that means i want to cut the texture so it fits the rectangle area (if its too big).

For example if the rectangle area is 200 x 100 and my texture (the smiley) is 200 x 150
then i want to cut the last 50 off so it only draws 200 x 100


texts: Recalculating normals on a tesselated cubed sphere with heightmap applied

texts:
I'm learning about the graphics pipeline using C++, HLSL and DirectX 11 for my course. I'm currently tesselating a cubed sphere with an applied height map.

My issue is figuring out how to recalculate the normals after the tesselated height map is applied. I'm trying to recalculate them in the domain shader like so:

// Tessellation domain shader
// After tessellation the domain shader processes the all the vertices
Texture2D HightMapTexture : register(t0);
SamplerState Sampler  : register(s0);

cbuffer MatrixBuffer : register(b0)
{
    matrix worldMatrix;
    matrix viewMatrix;
    matrix projectionMatrix;
};

cbuffer TessellationBuffer : register(b1)
{
    float4 TessellationFactor;
    float4 CameraPosition;
    float4 padding;

};

struct ConstantOutputType
{
    float edges[4] : SV_TessFactor;
    float inside[2] : SV_InsideTessFactor;
};

struct InputType
{
    float3 position : POSITION;
    float4 colour : COLOUR;
    float3 normal : NORMAL;
    float2 tex : TEXCOORD0;
};

struct OutputType
{
    float4 position : SV_POSITION;
    float4 colour : COLOUR;
    float3 normal : NORMAL;
    float2 tex : TEXCOORD0;
};

[domain("quad")]
OutputType main(ConstantOutputType input, float2 uvwCoord : SV_DomainLocation, const OutputPatch<InputType, 4> patch)
{
    float3 vertexPosition;
    float3 normalPosition;
    float2 UV;
    OutputType output;

    float3 v1 = lerp(patch[0].position, patch[1].position, uvwCoord.y);
    float3 v2 = lerp(patch[3].position, patch[2].position, uvwCoord.y);
    vertexPosition = lerp(v1, v2, uvwCoord.x);

    float3 np1 = lerp(patch[0].normal, patch[1].normal, uvwCoord.y);
    float3 np2 = lerp(patch[3].normal, patch[2].normal, uvwCoord.y);
    normalPosition = lerp(np1, np2, uvwCoord.x);
     // Send the input normalPosition into the pixel shader.
    output.normal = normalPosition;

    float2 uv1 = lerp(patch[0].tex, patch[1].tex, uvwCoord.y);
    float2 uv2 = lerp(patch[3].tex, patch[2].tex, uvwCoord.y);
    UV = lerp(uv1, uv2, uvwCoord.x);
    output.tex = UV;

    float hightColour = HightMapTexture.SampleLevel(Sampler, output.tex, 0).r;
    vertexPosition += (2 * hightColour) * float4(output.normal, 0);

    //vertexPosition.z =    sin((vertexPosition.y *2) + (padding.x * 2) *2);
    //vertexPosition.z += cos((vertexPosition.x *2) + (padding.x * 2)*2);

    // Calculate the position of the new vertex against the world, view, and projection matrices.
    output.position = mul(float4(vertexPosition, 1.0f), worldMatrix);
    output.position = mul(output.position, viewMatrix);
    output.position = mul(output.position, projectionMatrix);

    //output.worldPosition = float4(vertexPosition, 1.0f);

    // Send the input color into the pixel shader.
    output.colour = patch[0].colour;
    output.normal = mul(output.normal, (float3x3)worldMatrix);
    output.normal = normalize(output.normal);

    return output;
}


texts: Trigger the button's onclick after checking that the cursor has been on it for some time

texts:
I would like to have the mouse hover/click the button for a fixed amount of time (5 seconds) before triggering the onclick method, it can click only after they have hovered for a certain amount of time on one button. I'm using it with the leap motion UI and EventSystem to prevent clicking a button by accident when passing the hand over it.
I tried using the highlight animation and then triggering the event after it but i can't check if the hand has passed through another button and then got back to the previous one.


texts: online game, NPC monster death and hit detection to gain experience points

texts:
I'm doing a simple idle game, HTML5 client and Node.js server, but I'm making it online, where the client talks to the server (websockets) and all the logic is in the server (I want to prevent cheating as much as possible, because I want to have leaderboards).

My idea is, when the player X attacks the mob Y and it hits for 10 (should gain 10xp), so I send that via websocket, "playerX|10". How do I validate the input, so that a cheater can't just send "playerX|100000000".

Also how do I handle mob deaths? Do I send a "playerX,mobY" and the server replies with a drop?

Am I worrying too much about security? The golden rule is never trust the client, but how?

I'm thinking maybe all the client does is send actions?

message: attack|mobY, and the server calculates everything, xp gains, hit values, but I still don't know how to handle mob death, without having to keep state for the current "fight" with that mobY.

Sorry if I'm not clear enough. If you can share some thoughts or articles about this stuff, I'll be very glad!


texts: OpenGL concatenate vertex data into one big VBO

texts:
I successfully can render two triangles (with a texture) that looks like the side of a crate and also "walk" around it.
Also, a small .obj file parser is available which gives me a float array of the vertices, texture coords and an unsigned int array of the indices (of a simple cube).

The vertices and texture coords look like the following:

float vertices[] =
{
     // positions         // texture coords
     0.5f,  0.5f, 0.0f,   1.0f, 1.0f,
     0.5f, -0.5f, 0.0f,   1.0f, 0.0f,
    -0.5f, -0.5f, 0.0f,   0.0f, 0.0f,
    -0.5f,  0.5f, 0.0f,   0.0f, 1.0f
};

And the indices:

unsigned int indices[] =
{
    0, 1, 3, // first triangle
    1, 2, 3  // second triangle
};

To assign the vertices and tex coords I use the following:

unsigned int VBO;
glGenBuffers( 1, &VBO );
glBindBuffer( GL_ARRAY_BUFFER, VBO );
glBufferData( GL_ARRAY_BUFFER, 5 * 4 * sizeof( float ), vertices, GL_STATIC_DRAW );

Creating an IBO

call glEnableVertexAttribArray()
glVertexAttribPointer()

Creating a shader, a texture etc.. and draw it with glDrawElements().

This works all very well, I just can't wrap my head around how to use just a single VBO with the "split" data that my .obj parser gives back.
I now (when using the .obj parser) have the vertices and texture coords separated; how do I put that two arrays into one VBO?

The picture I have in mind is to have fewer draw calls and also prevent redundant code if I, for example, use the same model for 100 times.


texts: How do I make my indices anti-clockwise, so I can cull triangles in OpenGL? (immediate mode)

texts:
At the moment, I'm attempting a basic game engine in OpenGL using immediate mode. I'm trying to render a cube. Cube is a class with the vertices, normals, and indices. Here is part of the Cube class:

// Note: I'm actually coding this in C# using a light OpenGL wrapper called OpenTK.
// But I'm giving my instructions in C++ for this post, for simplicity's sake:
// Please don't be confused if I switch between the two :-)

// C#:

Vertices = new Vector3[]
        {
            new Vector3(-1.0f, -1.0f,  1.0f),
            new Vector3( 1.0f, -1.0f,  1.0f),
            new Vector3( 1.0f,  1.0f,  1.0f),
            new Vector3(-1.0f,  1.0f,  1.0f),
            new Vector3(-1.0f, -1.0f, -1.0f),
            new Vector3( 1.0f, -1.0f, -1.0f),
            new Vector3( 1.0f,  1.0f, -1.0f),
            new Vector3(-1.0f,  1.0f, -1.0f)
        };

Indices = new int[]
        {
            // front face
            0, 1, 2, 2, 3, 0,
            // top face
            3, 2, 6, 6, 7, 3,
            // back face
            7, 6, 5, 5, 4, 7,
            // left face
            4, 0, 3, 3, 7, 4,
            // bottom face
            0, 1, 5, 5, 4, 0,
            // right face
            1, 5, 6, 6, 2, 1
        };

Normals = new Vector3[]
        {
            new Vector3(-1.0f, -1.0f,  1.0f),
            new Vector3( 1.0f, -1.0f,  1.0f),
            new Vector3( 1.0f,  1.0f,  1.0f),
            new Vector3(-1.0f,  1.0f,  1.0f),
            new Vector3(-1.0f, -1.0f, -1.0f),
            new Vector3( 1.0f, -1.0f, -1.0f),
            new Vector3( 1.0f,  1.0f, -1.0f),
            new Vector3(-1.0f,  1.0f, -1.0f),
        };

This all worked out fine. The sides of the cube are shadowed nicely, and all seems well. The inside looks like this (note, the lighting is actually coming from the top):

When I cull the 'non-visible' triangles with glEnable(GL_CULL_FACE); it looks okay normally, but the bottom looks like this:

And if you move the camera to the 'inside' of the cube, you can see the missing bottom face by looking down! This seems to me like I'm confusing OpenGL by declaring my vertices in the clockwise direction, instead of anticlockwise.

This seems to be causing two problems. Firstly, my culling is all messed up. Secondly, remember how the light is actually coming from the top of the cube? Well, from the inside of the cube, it looks like the light is coming from the bottom. Weird.

I'm rendering my cube by doing the following:

GL.Begin(PrimitiveType.Triangles); // Translation: glBegin
foreach (Shape shape in shapes) {
    foreach (int index in shape.Indices) {
        GL.Normal3(shape.Normals[index]); // Translation: glNormal3f
        GL.Vertex3(shape.Vertices[index]); // Translation: glVertex3f
    }
}
GL.End();

How do I fix this culling problem? Do I need to be worried that the lighting is messed up from the inside? I think I might just need to swap my indices around, but I don't know how I do this. The rendering works by passing the vertices in the array 0-7, in the order shown by the indices array. Hopefully, getting my indices in the right order will fix the issue.

If my logic upto here is correct, what are the correct (anti-clockwise) indices for my cube class? How did you work this out?

Thanks a lot for any help in advance. I sure appreciate it.


texts:
What I'd like to do is create a sheet where I can track character XP/level progression.

I created this by hand:

It's sloppy, but in the realm of what I'd like to generate on a computer. Each bar represents XP needed to level up, with each square on the grid representing a set number of XP.

Any ideas how I could go about doing this in a more standardized/repeatable/printable?


texts: What is the Default Pawn class and what is used for in Unreal Engine?

texts:
I'm newbie in Unreal Engine and also in games development.

I have developed my own version of Pong game (sources here) and I'm confuse with the behaviour of DefaultPawnClass: Its creating another Paddle in game (I posted a question about it here).

I have to questions:

What is Default Pawn class?
And, what is it used for?


texts: 2d mmo open world connection and reconnection

texts:
I am trying to create an 2d html5  open word (the sprite does not have any fancy flare, just shapes around) with only maximum of 10 player at once.
My question is how to create a seamless join for new player join when 5 others have already started roaming in the world? in the other words, how to maintain synchronization for a new player for all updates that is happenning in new world.

I know pub sub can do the trick but it is very wasteful to catch up from start of the queue. How can a new player get a refresh of the current state and continue to stream from movement from other exisitng player?
Thanks.


texts: Accessing motor object of a surface motor

texts: I would like to make a door closer for a door. The door should open normally, but when the person passes through close slowly. I've made an standard door on hinges, but then made one of them a motor and thought to control it when the person passes the door. However, I can't find the motor object on that part which owns the motor-surface. How can I do this properly?


texts: How can I test if the mouse draw on the active tiles?

texts:
I want to draw some sprites in a tiledmap where the tiles are active.
I want to draw with the mouse, so how could I compare the position of the mouse, the sprite position and the position of active tiles?
I tried to compare:
sprite.getX, screenX and cell.getTile (). getProperties (). containsKey ("active")
but I can not get the position of the active tiles.


texts:
I've recently gotten into XNA and must say I love it. As sort of a hello world game I decided to create the classic game "Snake". The 90 degree version was very simple and easy to implement. But as I try to make a version of it that allows 360 degree rotation using left and right arrows, I've come into sort of a problem.

What i'm doing now stems from the 90 degree version: Iterating through each snake body part beginning at the tail, and ending right before the head. This works great when moving every 100 milliseconds. The problem with this is that it makes for a choppy style of gameplay as technically the game progresses at only 6 fps rather than it's potential 60.

I would like to move the snake every game loop. But unfortunately because the snake moves at the rate of it's head's size it goes way too fast. This would mean that the head would need to move at a much smaller increment such as (2, 2) in it's direction rather than what I have now (32, 32). Because I've been working on this game off and on for a couple of weeks while managing school I think that I've been thinking too hard on how to accomplish this. It's probably a simple solution, i'm just not catching it.

Here's some pseudo code for what I've tried based off of what makes sense to me. I can't really think of another way to do it.

for(int i = SnakeLength - 1; i > 0; i--){
    current = SnakePart[i], next = SnakePart[i - 1];

    current.x = next.x - (current.width * cos(next.angle));
    current.y = next.y - (current.height * sin(next.angle));

    current.angle = next.angle;
}

SnakeHead.x += cos(SnakeAngle) * SnakeSpeed;
SnakeHead.y += sin(SnakeAngle) * SnakeSpeed;

This produces something like this: Code in Action. As you can see each part always stays behind the head and doesn't make a "Trail" effect.

A perfect example of what i'm going for can be found here: Data Worm. Not the viewport rotation but the trailing effect of the triangles.

Thanks for any help!


texts: How can I manipulate a static 2D sprite so that it looks alive?

texts:
I've got a stick figure in the corner of my UI, but I don't like the way he's just standing there, without moving. I'm stuck without additional frames of animation, so my only recourse is the manually move the sprite up and down, left to right, rotation, or whatever else you can think of. Basically I can do everything besides drawing another sprite of animation.

I've tried things like have it subtly bounce or rotate a bit to give it a little bit of dynamism, but I don't believe its the best approach.

I've got a static sprite of a stick figure, how do I give it a bit of life?


texts:
In my endless game i need to generate random enemies for each "level".

For each level i need to generate the total number of enemies that have to be spawn, and spawn them a few at a time. When they are finished, go to next level and repeat calculation.

So, from the current level (that i know, it's a number, 1,2,3..), i need to generate:

1) A random number indicating the TOTAL number of enemies for this level

2) A random number indicating how many enemies "in this very moment" i have to spawn (extract from the total list) from the total

3) Since i need spawn enemies a little at a time, i need to generate a random number indicating this time

All of these values should increase the difficulty according to the current level.

This is my approach, but if you have other solutions it's ok.

Actually i don't know which formulas i could use.

This is my code (not random):

// if there are no enemies to be spawn...
    if(enemiesToSpawn.size == 0) {
        gameManager.incrementLevel();
        // generate the enemies according to the current level --> put them into enemiesToSpawn
        generateEnemies();
        // reset timeAccumulator
        timeAccumulator = 0f;
        // initialize target time
        targetTime = 2;
    }
    // there are enemies to be spawn...
    else if(enemiesToSpawn.size != 0){
        // increment accumulator
        timeAccumulator += delta;

        // extract enemies and add them to the stage
        if(timeAccumulator >= targetTime) {
            int amount = 1; // should be random
            Array<BaseEnemy> enemies = extractEnemies(amount); // extract enemies from enemiesToSpawn
            for(BaseEnemy enemy: enemies) {
                EntityManager.addEnemy(enemy, gameTable); // add enemies to the stage
            }

            // reset accumulator
            timeAccumulator = 0f;
            // reset target time (should be random)
            targetTime = 10;
        }
    }


texts:
I am using the flash flixel engine, and have a sprite sheet of a spaceship from top-down view. The sprite sheet includes a bunch of different states and animation frames. Problem is that I have drawn them all facing upwards (north), and my maths is all done assuming the sprites face to the right (east).

In flixel v2.5 is there a way to rotate the sprite graphics without affecting the "angle" property of the FlxSprite that is using the graphics? I was thinking along the lines of a pre-process, as I initialise everything. I don't really want to fix all the graphics, or hack into my maths at this point. This also might come in handy later.


texts: Unity: Failed to build APK. See console for details

texts:
i am getting this error whenever i am trying to build a project. i looked at so many solutions but this one just doesn't go away.

This is the error:

CommandInvokationFailure: Failed to build apk.
C:\Program Files\Java\jdk-9\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/Mohit/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

stderr[
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at SDKMain.main(SDKMain.java:130)
Caused by: java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder
    at com.android.sdklib.internal.build.SignedJarBuilder.<init>(SignedJarBuilder.java:177)
    at com.android.sdklib.build.ApkBuilder.init(ApkBuilder.java:446)
    at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:422)
    at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:362)
    at UnityApkBuilder.<init>(UnityApkBuilder.java:214)
    at UnityApkBuilder.main(UnityApkBuilder.java:34)
    ... 5 more
Caused by: java.lang.ClassNotFoundException: sun.misc.BASE64Encoder
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
    ... 11 more
]
stdout[

]
exit code: 1
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.HostView:OnGUI()

what i have tried so far:

1) downgrading android sdk
2) moving zipalign file from build-tools to tools folder
3) setting up keystore


texts: How can I prevent the knob from resizing when I use the Slider?

texts: I am using the Unity Slider component.  I have a custom background and custom knob.  But whenever I move the slider, my knob's size becomes distorted.  It is 100x100 pixels, and when I set it to its native size, it does so.  But I soon as I move the slider, it cuts its height in half.  How can I prevent this from happening?


texts: Can you have an embedded browser in Gamemaker:Studio

texts: I am trying to make a sort of browser in gamemaker and I wanted to know how to embed a browser within a game. Are there any extensions I need to download?


texts:
I am a newbie in OpenGLES, so pardon me if I cannot state the question properly.

Is it possible to create a 3D box with the following imports only:
OpenGLES, QuartzCore, GLKit
I have created a 2D object, (squares, triangles, polygons) but I want to make them into 3D without using cocos3D or blender or other frameworks or api (if its possibe). But how?


texts:
I'm trying to generate random terrain for my game (In Unity3D, C#). All I need is water and grass. No height to it (no mountains or hills.) I'd preferably like to do it by placing individual cubes. On top of that the terrain needs to be infinite.

I've searched every where for even a hint on how to do it, but everything I found had either height to it, didn't use individual cubes (edited the terrain as a whole), or wasn't infinite.

Any help would be much appreciated! :)

EDIT: I'm looking for something somewhat similar to a game called Factorio. Here's a screenshot: http://i.ytimg.com/vi/Uns15OfPWbo/maxresdefault.jpg As you can see there is a big body of water, and a ton of land. I want to create something that randomly does that every time (random bodies of water and random land shapes). Something like Minecraft without all the height.

I've heard about something called Perlin noise, but because of a lack of tutorials and documentation, I can't figure out for the life of me on how to use it to generate random terrain.


texts: (Unity) Physics based movement vs Straight position change

texts:
Unity provides a cool physics engine for game development and I want to utilize it in my game.

Shorter version

I want to use physics engine for everything else other than character movement because trying to use physics engine for player movement doesn't yield the perfectmovement speed that I want; move x units per second.

If I use physics engine for character movement, it gets complicated. I would rather just add "moved distance" to the position to have things done simple. Is doing something like this wrong? All the learning sources I read recommend to use physics engine for movement if the game incorporates physics engine. I am nervous; am I wrong?

Longer version

The following description is where I use "physics", why I need physics engine.

In my game a player fires a bullet. When enemies collide with bullet, they get pushed back slightly. A strong blast can push enemies far back so that they even bounce back from hitting wall.

A recommend, a proper way, I was told, to utilize this physics engine for character movement is to add force to the direction I want to move.

But doing so(adding force to the direction I want to move) will result in truck-like; slowly warming up by adding velocity. To avoid "truck like movement" I was told to apply greater force at the beginning. Doing so result in change in velocity like the below picture.

However problem is not over yet, you must consider a situation where you change direction of movement while the character is running.

If you started to move backward, all of the sudden while running forward, you will need to slow down forward movement burn velocity by adding backward force. Thus rotation burns velocity.

So a solution is to find out perpendicular velocity to your desired direction, then find out needed amount of force to "burn off" the undesired velocity.

This seems way too complicated for a character to simply move around. I would rather just move character to desired direction by simply adding "constant X distance" to the character's position.

But I can't find a source of example where it utilizes both "simple movement by directly adding moved distance to the position" and "using physics engine for the game". All the sources of learning(using Unity physics) I find say use this complicated way of having character to move around. I wonder is there a reason why people don't just add moved distance to the position?


texts:
I'm testing some vector reflection and I want to check what happens when
a ball collides with a paddle.

So if I have:

Vector2 velocity = new Vector2(-5, 2);
position_ball += velocity;

if (position_ball.X < 10)
{
    Vector2 v = new Vector2(1,0); // or Vector2.UnitX
    velocity = Vector2.Reflect(velocity, v);
}

then, correctly, velocity is (5,2) after Reflect,
but if I do:

if (position_ball.X < 10)
{
  Vector2 v = new Vector2(1,1);
  velocity = Vector2.Reflect(velocity, v);
}

then velocity is (1,8) and not (5, -2) that is
the solution of reflection equation R = V - 2 * (V . N)

Why is that?


texts: What basic non-games related computer knowledge should a games programmer possess?

texts:
So the question will very likely need re-phrasing. I thought about asking this for a while, but held off because it's a tad vague.

To explain - I have been a programmer for 4 years and only begun doing it when I took a university course. Now that I'm working as a programmer, I find that often people assume you know a number of things that I feel people who have been messing around with computers know by default, and I don't.

Things like shell commands, how to use subversion, stuff about how websites work at their base level, how to use databases and so on.

What I would like to know is some of the basic stuff, the nitty gritty that people in a programming job are expected to have encountered and know how to do.

Also, I'm sorry if people feel this question is not a perfect match for the Q and A format - please let me know how I can improve it - or just edit it heavily.

Thank you in advance.


texts:
I have a self contained physics simulation (eg fragments of a building crumbling) which is known to be the same, excepting floating point precision errors, every time it is run.

Is there a way to improve performance by pre-calculating/recording the simulation?

It would seem that the build in physics engine does not support this, but are there other engines that do?

Or alternatively, would recording the transformation of each Rigidbody in the simulation, and then playing back those transforms, be a sensible approach to increase performance?  It would remove a lot of Rigidbodies, joints and enable flattening the hierarchy.


texts: How to handle physics of moving platforms in a platformer?

texts:
So after a few hours of searching on the internet, I have yet to find a pleasing answer on how to handle moving platforms in a 2d platform game. So I decided to make a simple prototype where you interact with 2 different platforms, one that moves vertically and one horizontally. I would love some help to dissect and see what isn't working, and how to fix them. I have submitted the .fla file + .as file below, accompanied with a link to the playable .swf.

The goal is to make the Hero interact with the platforms as if they were solid objects that he can stand on, pushed alongside with, jump on/under etc etc.

The problems with my prototype are these:

When you stand on the horizontally moving platform, without moving (not touching any keys), the Hero moves along with platform, but with a slight delay causing hero to slide back a little.
When you stand on the horizontally moving platform, and jump, you move along with the platform midair (some games prefer having it like this, but it doesn't feel natural and is not wanted here). Which might be caused by the Hero retaining the velocity on the X-axis from the platform.
When you jump up to the bottom side on the vertically moving platform, whilst the platform is moving downwards, you sink inside it for a brief second. Hero penetrates through as if the collision was non existent for a moment.
When you jump on vertically moving platform, the veloctiy on Y-axis is retained, so when you walk off the platform, you fall down at a higher speed. With the speed of the retained velocity, + gravity that is added (this is mostly because I cant figure out a way to reset velocity on Y-axis to 0 when you land on the platform, without the player freezing midair).

I'm a novice programmer so I am sure there are BETTER ways to do this, and I would love to hear them all. Any ideas on how to improve the code or other methods in which you can implement moving platforms into a Tilebased game are welcome. In the end, I am trying to find a solid way to handle moving platforms in 2d platformers.

Playable SWF:  http://dl.dropbox.com/u/28271061/PlatformerhowtoFLA.html (Move with arrow keys, Jump with X key, Run with Z key)

Sourcecode AS-file: http://dl.dropbox.com/u/28271061/Platformerhowto.as

SourcefileFLA:  http://dl.dropbox.com/u/28271061/PlatformerhowtoFLA.fla

If you prefer just to read the code through Pastie online: http://pastie.org/2266764


texts:
I'im thinking of building a text-based browser game.
A racing game.like F1 or rally.
 users can set-up a car.
thinks like tyres, fuel, driver,brakes.
every attribute gets a value.

the part where i am stuck is the race.

i think a race exist out of corners, straight parts, hills,...

i have no idea how i can come to a solution who wins the race and what the lap times would be.

idea i have:
a race has for all attributes of a car the best value. the car with the best values of that race, normally wins.

anyone with some idea's?


texts: How to animate large and complex sprites with modular parts

texts:
I am trying to animate sprites like metal slug bosses.
But they can't be animated as regular and squared sprites because the have multiple moving parts at same time.
Considering i am talking about arcade games, frameworks like spine and mecanim did not exist in that time.
I am seeking for techiques to do that, but only found examples animating simple sprite sheets.
Does somebody know how was it done ?
Link to slug flyer sprite sheet
Link to big shiee boss sprite sheet


texts: Game loosely based on a copyrighted story

texts:
I want to make a game based on a copyrighted book. It's not about recreating it strictly with all details, but rather about building something new around the general idea (possibly incorporating some concepts from other books by the same author).

I don't want any copyright infrigement or plagiarism problems. How far can I move with "borrowing" concepts from the original story? Will it be fine to:

set the action in the same universe? (possibly changing character names etc)
use the same general concept (rather unique one), but with my own plot?
let the player choose one of many story threads, one of which will be the original one?


texts:
I have a flat 10x10 surface (floor) made out of cubes of 1x1x1.

I am spawning objects from the "sky" and I want them to fall on random points of the surface without exceeding the surface limits.

Is there anything similar to Random.onUnitSphere to handle this case?


texts: Calculate initial velocity for trajectory given duration, launch angle, and distance

texts:
I need my entity to go from point A to point B with a given launch angle over a given time.

I've been able to figure out the initial velocity without the constraint of the launch angle, but I can't figure out how to incorporate that into the equation.

After launch the entity is only affected by gravity, and point A and B are not necessarily at the same height.

Thanks!


texts: Calculating a child object's Position, Rotation and Scale values?

texts:
I am making my own game editor, but have encountered the following problem:

I have two objects, A and B.

A's initial values:

Position: (3,3,3), Rotation: (45,10,0), Scale(1,2,2.5)

B's initial values:

Position: (1,1,1), Rotation: (10,34,18), Scale(1.5,2,1)

If I now make B a child of A, I need to re-calculate the B's Position, Rotation and Scale relative to A such that it maintains its current position, rotation and scale in world coordinates. So B's position would now be (-2, -2, -2) since now A is its center and (-2, -2, -2) will keep B in the same position.

I think I got the Position and scale figured out, but not rotation.

So I opened Unity and ran the same example and I noticed that when making a child object, the child object did not move at all. but had its Position, Rotation and Scale values changed relative to the parent.

For example:

Unity (Parent Object "A"):

Position: (0,0,0)
Rotation: (45,10,0)
Scale: (1,1,1)

Unity (Child Object "B"):

Position: (0,0,0)
Rotation: (0,0,0)
Scale: (1,1,1)

When B becomes a child of A, it's rotation values become:

X: -44.13605
Y: -14.00195
Z: 9.851074

If I plug the same rotation values into the B object in my editor, the object does not move at all.

How did Unity arrive at those rotation values for the child? What are the calculations?

If you can put all the equations for the Position, Rotation or Scale then I can double check I am doing it correctly but the Rotation is what I really need.


texts: Manually writing a dx11 tessellation shader

texts:
I am looking for resources on what are the steps of manually implementing tessellation (I happen to be using Unity CG, but any help is appreciated).

Today it seems that it is all the rage to hide most of the gpu code far away and use rather rigid simplifications such as unity's SURFace shaders. And it seems useless unless you're doing supeficial stuff.

A little background: I have procedurally generated meshes (using marching cubes) which have quality normals but no UVs and no Tangents. I have successfully written a custom vertex and fragment shader to do triplanar texture and bumpmap projection as well as some custom stuff (custom lighting, procedurally warping the texture for variation etc).

I am using the GPU Gems book as reference. Now I need to implement tessellation, but It seems I must calculate the tangents at runtime by swizzling normals (ctrl+f this in gems: <normal.z, normal.y, -normal.x>) before the tessellator gets them (during some sort of per-triangle geometry pass, which comes before vert and frag).

And I also need to keep my custom vert+frag setup (with my custom parameters/textures being passed between them) - so apparently I cannot use surface shaders.

Can anyone provide some guidence?


texts: How can I write data to a file that users can't easily edit?

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

While working on game saving and loading I figured I could just write all the variable values to a file and then load that file from it's default location anytime.

However from the very beginning it sounded like an odd job. I know about serialization and boost, but that seems so complicated, I figured I'd keep it simple, but I've ran across this huge issue: No matter what file I can write with C++, the user can get their hands on it, they can edit their position, they can remove a boss, or add new weapons for themselves.

My question here is: How can I create a file in C++ which cannot be editted or openned with a text editor such as Notepad (I'm not trying to make a file which is impossible to open, but a file which will give the user a headache if he tries to edit it through usual methods.)


texts:
I am making a Java game and I want my game to run the same on any FPS so I'm using time delta between each update. This is the update method of the Player:

    public void update(long timeDelta) {

        //speed is the movement speed of a player on X axis
        //timeDelta is expressed in nano seconds so I'm dividing it with 1000000000 to express it in seconds

        if (Input.keyDown(37))
            this.velocityX -= speed * (timeDelta / 1000000000.0);

        if (Input.keyDown(39))
            this.velocityX += speed * (timeDelta / 1000000000.0);

        if(Input.keyPressed(38)) {
            this.velocityY -= 6;
        }

        velocityY += g * (timeDelta/1000000000.0); //applying gravity
        move(velocityX, velocityY); /*this is method which moves a player
                                        according to velocityX and velocityY,
                                        and checking the collision
                                    */

        this.velocityX = 0.0;
    }

The strange thing is that when I have unlimited FPS (and update number) my player is jumping about 10 blocks. It jumps even higher when the FPS is increasing. If I limit FPS it is jumping 4 blocks. (BLOCK: 32x32) I have just realized that the problem is this:

if(Input.keyPressed(38)) {
    this.velocityY -= 6;
}

I add -6 to velocityY which increases player's Y proportionally to the update number and not to the time.

But I don't know how to fix this.


texts:
I am using Android studio (libGDX), and I can't figure out why alternative paths doesn't work. I've tried it as it said in the book, but it doesn't do anything, it shows a black window and than the program exterminates.
If the .png file would be in the .../android/assets/ folder, it wouldn't work either.

Book: Java Game Development with LibGDX 2nd edition

This is what the book wants me to do it:

public Spaceship(float x, float y, Stage s){

    super(x,y,s);
    loadTexture( "assets/spaceship.png" );
    setBoundaryPolygon(8);

    setAcceleration(200);
    setMaxSpeed(100);
    setDeceleration(10);
}

This is the shortest form that works for me:

public Spaceship(float x, float y, Stage stage) {

    super(x, y, stage);

    loadTexture("core/src/com/dusi/game/ch04/assets/spaceship.png");
    setBoundaryPolygon(8);

    setAcceleration(400);
    setMaxSpeed(200);
    setDeceleration(20);
}

This is what my path looks like:


texts: Camera Matrix Transform to scroll through level - Monogame, XNA

texts:
I am trying to change the way I scroll through a level. Currently I have a static camera class which stores a direction enum and a vector 2 position. This class then has a method to move the position of the camera (vecotr2) based on the direction value. This is called in the update method. Then when drawing my tile grid I loop through the number of visible tiles in the viewport and add the position of the camera to the counters to get the texture of the tile in question to draw. (note the main game class calls the level draw class passing it the sprite batch after starting it)

This seems like a pretty bad approach. I have seen in a few place that I should be using a matrix transformation to move the camera and then pass this as part of the draw method. However, I have absolutely no idea how to achieve this, I am literally lost.

I have attached my code below, and would greatly appreciate any advice you could provide.

Camera:

// Stores the position and scroll direction of the camera.
 static class Camera {

static public Vector2 Position;

static public ScrollDirection Direction;

public static void MoveCamera(Level level) {
    Vector2 scrollSpeed = new Vector2(20, 18);
    if (Camera.Direction == ScrollDirection.Up)
    {
        Camera.Position.Y = MathHelper.Clamp(Camera.Position.Y - scrollSpeed.Y, 0, (level.Height * 50 - level.mViewport.Height));
    }
    else if (Camera.Direction == ScrollDirection.Down)
    {
        Camera.Position.Y = MathHelper.Clamp(Camera.Position.Y + scrollSpeed.Y, 0, (level.Height * 50 - level.mViewport.Height));
    }
    else if (Camera.Direction == ScrollDirection.Right)
    {
        Camera.Position.X = MathHelper.Clamp(Camera.Position.X + scrollSpeed.X, 0, (level.Width * 50 - level.mViewport.Width));
    }
    else if (Camera.Direction == ScrollDirection.Left)
    {
        Camera.Position.X = MathHelper.Clamp(Camera.Position.X - scrollSpeed.X, 0, (level.Width * 50 - level.mViewport.Width));
    }
}

}

Level:

public void DrawTiles(SpriteBatch spriteBatch) {
    // Calculate the position of the camera in terms of tiles.
    Vector2 cameraPosition = new Vector2(Camera.Position.X / Tile.Width, Camera.Position.Y / Tile.Height);
    // Calculate the offset of the camera position for when it is part way through a tile.
    Vector2 cameraOffset = new Vector2(Camera.Position.X % Tile.Width, Camera.Position.Y % Tile.Height);

    // Loop through the number of visible tiles.
    for (int y = 0; y <= mViewportTiles.Y; y++) {
        for (int x = 0; x <= mViewportTiles.X; x++) {
            // Check that we have not exceeded the dimensions of the level.
            if (x + cameraPosition.X < Width && y + cameraPosition.Y < Height) {
                // If the tile is not an empty space.
                if (tiles[x + (int)cameraPosition.X, y + (int)cameraPosition.Y].Texture != null) {
                    // Get the position of the visible tile within the viewport by multiplying the counters by the tile dimensions
                    // and subtracting the camera offset values incase the position of the camera means only part of a tile is visible.
                    Vector2 tilePosition = new Vector2(x * Tile.Width - cameraOffset.X, y * Tile.Height - cameraOffset.Y);
                    // Draw the correct tile based on the position of the camera in the appropriate position within the viewport.
                    spriteBatch.Draw(tiles[x + (int)cameraPosition.X, y + (int)cameraPosition.Y].Texture, tilePosition, Color.White);
                }
            }
        }
    }
}

public void Update(GameTime gameTime) {
   Camera.MoveCamera(this);
}

Thanks in advance


texts:
Ok, so my little dungeon runner game has its functioning adventurer characters as objects, but unfortunately I'm having trouble figuring how to let the player assemble a party of four of them like I originally intended. I suspect I will need to have a room/menu before the "dungeon" room proper where the player selects which four adventurers will be assigned to an object array that will be used in the subsequent dungeon, but I'm having difficulty finding specifics on how to properly do that in Game Maker Studio 2. Does anyone else have any experience doing this or similar they'd like to share?

EDIT: Teammates don't need to have any AI beyond following behind the "leader"; in fact, the player only controls the head of the party, which they will be able to cycle out with another member in party order during the dungeon run with the press of a single key. I might have only the character the player is controlling take damage as well, but either way each party member has their own individual HP tracks that renders them unusable when it goes below '0'.


texts: How to import Cocos2d-x in codeblocks ide?

texts:
Is it possible to import cocos2d-x in codeblocks just as in xcode ?? How can I do that ?

I use ubuntu. It is not possible to use xcode in ubuntu. Cocos2dx is in c++. How can I use codeblocks for game development with cocos2dx??

Thanks


texts:
What I need is apparently very simple, a lookup table in a fragment shader. It seems that the natural way would be an array float lut[], but in some implementations of OpenGL ES I am getting an error

  "profile requires index expression to be compile-time constant".

Next approach would be a 1D texture filled with the values, but again OpenGL ES doesn't like that :)

What would be the simplest way to have a lookup table of 256 float elements in the fragment shader? (I guess it will be a 2d texture but it looks like it is some overhead and I am not sure if it's possible to handle two textures on a shader)

P.S. I am a very beginner in OpenGL but what I need is simple handling of images in textures.


texts: Unity FPS - Joining players always take over the camera

texts:
I created a "network manager" and a "network manager hud" for the whole scene. My character is a simple capsule and has a camera, a weapon spawner and 3 weapons as children. I gave him a "network identity" and a "network transform", rewrote the "capsule controler" (attached to the capsule) and also the "mouse controller" (attached to the camera) and saved it as a prefab. I configured the network manager to take the prefab as spawn object and use the default settings of the network manager: localhost:7777.

Now my problem.

I have build an instance of the game, run the inline game as host (localhost:7777) and everything works. Then i run the external build (tried localhost and even local ip)

As soon as i join the game using the 2. instance, the second player take over the camera of the first player! And in the first instance it seems like both cameras are rendered in paralell.

If i dont attach cameras to the player, i can control them as expected :#

Now, finally my question: What am i doing wrong or do i miss?

Thank you


texts: openGL - Updating instanced model transform in vbo every frame

texts:
I am using OpenGL to render a large number of models by instanced rendering (using LWJGL wrapper).
As far as I can tell I have implemented the instancing correctly, although, after profiling, I've come upon an issue.
The program is able to render a million cubes at 60fps when their model (world) transformations are not changing. Once I make them all spin though, the performance drops significantly. I deduced from the profiler that this is due to the way I write the matrix data to the VBO.
My current approach is to give each unique mesh a new VAO (so all instances of cubes come under 1 VAO), have 1 VBO for vertex positions, textures, and normals and 1 instance array (VBO) for storing instance model matrices. All VBOs are interwoven.
In order to make the cubes spin, I need to update the instance VBO every frame. I do that by iterating through every instance and copying the matrix values into the VBO.
The code is something like this:
float[] matrices = new float[models_by_mesh.get(mesh).size() * 16];

for (int i = 0; i < models.size(); i++){
    Model cube = models.get(i);
    float[] matrix = new float[16];
    cube.getModelMatrix(matrix);    //store model matrix into array
    System.arraycopy(matrix, 0, matrices, i * 16, 16);
}

glBindBuffer(GL_ARRAY_BUFFER, instance_buffers_by_mesh.get(mesh);
glBufferData(GL_ARRAY_BUFFER, matrices, GL_STATIC_DRAW);

//render

I realise that I create new buffer storage and float array every frame by calling glBufferData instead of glBufferSubData but when I write:
//outside loop soon after VBO creation
glBufferData(GL_ARRAY_BUFFER, null, GL_DYNAMIC_DRAW); //or stream

//when updating models
glBufferSubData(GL_ARRAY_BUFFER, 0, matrices)

nothing is displaying; I'm not sure why, perhaps I'm misusing subData but that's another issue.
I have been looking at examples of particle simulators (in OpenGL) and most of them update the instance VBO the same way as me.
I'm not sure what the problem could be and I can't think of a more efficient way of updating the VBO. I'm asking for suggestions / potential improvements with my code.


texts: Java Distance between two Vector positions never 0

texts:
I have a Player moving, but when the player reaching the destination it should stop. But problem is that distance never return 0.

It starts printing this:
0.9672514210000003

End by this and then start to raise back again:
0.0015875672000023044

// My position is 5.0 and toPosition is either +1 or -1
if (getDistance(getPosition(), toPosition) <= 0) {
    allowMovement = false;
}

public double getDistance (PositionVector pos1, PositionVector pos2) {
    double dx = pos1.x - pos2.x;
    double dy = pos1.y - pos2.y;
    return Math.sqrt(dx * dx + dy * dy);
}

Cheers.


texts: Can a partially completed game be sold to a game development company for completion?

texts:
I'm a lone programmer with an idea for a game.  I believe I can code the mechanics of the game by myself.  I do not think I have the expertise, time, or creativity to create the graphics and audio of a marketable game.  I have a very good understanding of how to design applications that are loosely coupled to their front ends and I feel I could create the game with an ugly UI.

I was wondering if I were to create a game, would I then be able to sell or license my game to a game development company that has the resources to replace my UI with quality work?  If this can work, are there any examples of other people doing it?

I imagine the scale of the game would be a consideration for this approach.  A large scale game would probably be more attractive, but there is no way a lone programmer could create it to begin with.  A small scale game may not be worth the time for a game development company.


texts: Unity Get corners of camera in world space

texts: I'm making a 2D game and i need to get the corners of the camera in world cordinates. Is this possible in unity?


texts: Where to find animated matrix transformations in an fbx file?

texts:
Where can I find matrix transformation animation data in an fbx file?

I have an fbx file with animations. I have successfully read the indices, matrix, and weight from it.

How can I get the frame-by-frame changes in the matrix? Unfortunately, I haven't been able to find the answer in the Autodesk documentation.


texts:
I am making a game where i have items or blocks stacked on top of each other.

What i would like to do is, when the first item(or the item at the bottom of the stack) is removed, i would like to shift all the blocks above, down into the next position below it and add another block to the top of the stack.

Sort of like in a match 3 game.

Could someone provide instructions for doing this? or some type of psuedocode?

Thanks guys


texts: Unity: How to get a GameObject programmatically?

texts:
I have created a prefab.
In Unity Scene editor, I dragged the prefab into the scene and named it PrefabA (this is a GameObject instance of the Prefab).

Now, I need to update the PrefabA position.
How can I access the GameObject "PrefabA" during runtime via script?

GameObject prefab =  GameObject.Find("Canvas/PrefabA").GetComponent<GameObject>();

The code above throws Object reference not set to an instance of an object.


texts: AS3/Flash Develop - Radial Gravity (character on planet simulation)

texts:
I am trying to create a program where a character shape will be constantly drawn towards the centre of a planet shape. I have taken on previous advice into using physics equations to generate the desired effect yet I think I am missing some and therefore it does not work (I am only using v^2=u^2+2as). Am I over complicating things? All I need is for the player object to be constantly drawn towards the centre of the planet object; there will be no need for other planet objects to come into play and affect the player's gravity.

edit: To clarify, my question should have been "where did I go wrong?". I have now since solved the problem with the answers posted below, which were present because I wasn't going about trying to achieve what I wanted the right way. I didn't calculate the actual direction to move in as expected, and so the character could not move in the expected direction.

Here is my Main.as:

package
{
import flash.display.InteractiveObject;
import flash.display.Sprite;
import flash.events.Event;
import Math
import flash.display.Bitmap;
import flash.display.DisplayObject;
import flash.events.KeyboardEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.utils.*;

/**
 * ...
 * @author Me
 */
public class Main extends Sprite
{
    public var planet1:Planet;
    public var character1:Character;
    public var initialXVelocity:Number = 0;
    public var initialYVelocity:Number = 0;
    public var finalXVelocity:Number;
    public var finalYVelocity:Number;
    public const gravitationalAcceleration:Number = 3;
    public var xDistance:Number;
    public var yDistance:Number;

    public function Main()
    {
        if (stage) init();
        else addEventListener(Event.ADDED_TO_STAGE, init);
    }

    private function init(e:Event = null):void
    {
        removeEventListener(Event.ADDED_TO_STAGE, init);
        // entry point
        planet1 = new Planet;
        character1 = new Character;

        //place entites in position to test note: planet 1 is 100*100 pixels, character 1 is 10*10 pixels
        planet1.x = 350;
        planet1.y = 250;
        character1.y = 100; //295
        character1.x = 396; //395
        addChild(planet1);
        addChild(character1);

        //Make sure character has gravity applied constantly
        setInterval(playerMove, 1000);

    }

    public function playerMove():void
    {
        //Calculate the distance between the character and the planet in terms of x and y coordinate
        xDistance = (character1.x + 5) - (planet1.x + 50);
        yDistance = (character1.y + 5) - (planet1.y + 50);

        //Make sure this distance is a positive value
        if (xDistance < 0) {
            xDistance = -xDistance;
        }

        if (yDistance < 0) {
            yDistance = -yDistance;
        }

        //Calculate velocity using physics equation v^2=(u^2)+2as
        finalXVelocity = Math.sqrt((initialXVelocity * initialXVelocity) + (2 * gravitationalAcceleration) * xDistance);
        finalYVelocity = Math.sqrt((initialYVelocity * initialYVelocity) + (2 * gravitationalAcceleration) * yDistance);
        /*trace(initialXVelocity);
        trace(gravitationalAcceleration);
        trace(xDistance);
        trace(finalXVelocity);
        trace(initialYVelocity);
        trace(gravitationalAcceleration);
        trace(yDistance);
        trace(finalYVelocity);*/

        //Make sure the character is moving towards the centre of the planet at all times by reversing the appropriate velocity once it passes the axis of the centre of the planet
        if (planet1.x < character1.x) {
            finalXVelocity = -finalXVelocity;
        }

        if (planet1.y < character1.y) {
            finalYVelocity = -finalYVelocity;
        }

        //Update the current velocity before new velocity is calculated
        initialXVelocity = finalXVelocity;
        initialYVelocity = finalYVelocity;

        //Send the character into the correct direction
        character1.x += finalXVelocity;
        character1.y += finalYVelocity;
    }

}

}


texts:
No collision detected with 2D rigidbody
0
I have a ZombieBoy with a circle collider2D and a box collider2D and a RigidBody2D . The player shots energy balls which has a Circle Collider2D and a Rigidbody2D. It is set to trigger. But i have also tried without it set to trigger.

The ZombieBoy has this on its script

        void OnTriggerEnter (Collider other)
       {
          Debug.Log ("Im hit! " + other.name);
       }

       void OnCollisionEnter (Collision collision)
       {

          Debug.Log ("Im hit! " + collision.gameObject.name);
       }

But i get nothing in the console, and no breakpoints react.


texts:
I want players to be able to use a controller to navigate our game's menus. We use Unity's new UI, and in the EventSystem have specified a controller axis for our vertical axis. However the selection from the controller is extremely sticky. The joystick must be held down for a second in order for it to move its selected item down.

I've tried fooling around with the Gravity, Dead and Sensitivty levels but haven't found anything suitable. Could someone recommend some standard settings so the input is not stick7?

I've been using a Xbox controller with a wireless adapter for PC as my controller.


texts: What technique would I use to animate a 2D curling tentacle?

texts:
I have played around in Cocos2D-X and I think I understand the limitations of sprite-based animation fairly well.

I want to have a game with some characters curling and extending a tentacle which varies in length and amount of curl depending on the terrain.

Maybe imagine a sloth swinging from a tree but with arms that stretch at times (Gumby character?).

Is there a name for such a technique?

Would this be a variant on Animating Bezier Curves as seen in Jason Davies's example or discussed in this blog on tweening control points?

I'm a very experienced polyglot programmer but relatively naive in games and graphics.


texts: For a 2D XNA game, should I use the built in Vector2 or Vector3 or port my own class from ActionScript?

texts: I use a lot of 2D vectors in my Flash games - basically all velocities, positions etc I store in this way. My Vector2D class has lots of built in functions for rotation, dotproduct, projectOnto etc. The native Vector2 class doesn't seem to have half of this stuff, but it is used in a lot of places. The Vector3 has all this stuff, but has an extra dimension I don't need. So should I use either of the built in ones or port my AS3 class? Or should I try to extend Vector2 and add the extra functionality I need. Could that cause any problems?


texts:
I've made a simple game with a steering model that manage a crowd of agents. I use an genetic algorithm to find the best parameters to use in my system but I need to determine a fitness for each simulation.
I know it's something like that:

number of collisions * time to reach goal * effort

But I don't know how to calculate the effort, is there a special way to do that ?

Here is what I've done so far:

// Evaluate the distance from agents to goal
Real totalDistance(0.0);
for (unsigned i=0; i<_agents.size(); i++)
{
    totalDistance += _agents[i]->position().distance(_agents[i]->_goal->position());
}

Real totalWallsCollision(0.0);
for (unsigned i=0; i<_agents.size(); i++)
{
    for (unsigned j=0; j<walls.size(); j++)
    {
        if ( walls[j]->inside(_agents[i]->position()) )
        {
            totalCollision += 1.0;
        }
    }
}

return totalDistance + totalWallsCollision;

Thanks for your help.


texts: I've heard about this term distributed leaderboard for p2p games and I've searched it online but couldn't find much of a thing about it.I was curious what does it really mean and didn't really knew where to ask.Do you guys know what does it mean to have a distributed leaderboard? it's something like a global leaderboard but for p2p players?


texts: Whats the point of all these Surface Formats

texts: I am relevantly new to Graphics Programming. I have written some basic games in xna in the past but I am trying to understand what the point of all these surface formats is. For instance Xna and DDS support the standard RGBA (8bpp). Why does one need 32 bpp or even stranger combinations of bits per channel like Rg32. Isn't it enough to have the standard DXn, RGBA, and HDR formats?


texts: How can I obtain information about the GPU in Cocos2d-x?

texts:
I'm trying to obtain information about the GPU that is running the game in order to use the correct texture compression for that GPU:

std::string GPUInfo::getTC()
{
    std::string TC;
    cocos2d::Configuration::getInstance()->gatherGPUInfo();
    if(cocos2d::Configuration::getInstance()->supportsPVRTC())
        TC = ".pvr.ccz";
    else if(cocos2d::Configuration::getInstance()->supportsATITC())
        TC = ".dds";
    else
        TC = ".png";
    CCLOG("Texture compression format -> %s", TC.c_str());
    return TC;
}

But this keeps causing this error:

call to OpenGL ES API with no current context (logged once per thread)

Is there another way to obtain details about supporting GPU features on the current device?


texts:
Following is my code for my platformer. However, in the //Run with left shift// section when I made the image speed change, the speed is still the same and doesn't change so is there any piece of code that is preventing this task?

///Get player's input
key_right = keyboard_check(vk_right);
key_left = -keyboard_check(vk_left);
key_jump = keyboard_check_pressed(vk_space);
key_jump_held = keyboard_check(vk_space);
key_shoot = keyboard_check(ord("D"));

//React to inputs
move = key_left + key_right;
hsp = move * movespeed;
if (vsp < 10) vsp += grav;

if (place_meeting(x, y+1, Obj_Floor))
{
 vsp = key_jump * -jumpspeed;
}

if (vsp < 0) && (!key_jump_held) vsp = max(vsp,0)

//Run with left shift
if (keyboard_check(vk_lshift))
{
 movespeed = 5;
 image_speed = 0.14;
}

if (keyboard_check_released(vk_lshift))
{
 movespeed = 3;
 image_speed = 0.025;
}

//Shooting direction
if (keyboard_check(vk_right))
{
 mpfacing = 0;
}

if (keyboard_check(vk_left))
{
 mpfacing = 180;
}

//Shooting
if (keyboard_check(ord("D"))) && (canshoot = true)
{
 instance_create(x+13, y-0.5, Obj_MP_Laser);
 canshoot = false;
 alarm[1] = 30;
}

//Horizontal Collision
if (place_meeting(x+hsp, y, Obj_Floor))
{
 while(!place_meeting(x+sign(hsp), y, Obj_Floor))
 {
  x += sign(hsp);
 }
 hsp = 0;
}
x += hsp;

//Vertical Collision
if (place_meeting(x, y+vsp, Obj_Floor))
{
 while(!place_meeting(x, y+sign(vsp), Obj_Floor))
 {
  y += sign(vsp);
 }
 vsp = 0;
}
y += vsp;

//Animate
if (move != 0)
{
 image_xscale = move;
}

if (place_meeting(x, y+1, Obj_Floor))
{

 if (move != 0)
 {
  sprite_index = CalvinWalking;
  image_speed = 0.05;
 }

 else
 {
  sprite_index = CalvinStanding;
  image_speed = 0.025;
 }
}

else
{
 if (vsp < 0) sprite_index = CalvinJumping
 else sprite_index = CalvinJumping
}


texts: GameObject in hierarchy needs to know who it belongs to

texts:
I have two objects from the same prefab. They have bodies and swords. What good options do i have to check if a sword belongs to player2 or player1?

For example when body registers that it has been hit by a sword i need to see if its the sword belonging to the enemy or the same body.


texts: How to set up OpenGL for CLion on Windows

texts: Can someone give me a simple step-by-step on how to set up and compile a simple "Hello World!" program on CLion using OpenGl/SDL/Freeglut . I see a lot of tutorials on Visual Studio, but CLion uses CMake so it's a lot different.


texts: How can I change the name of my game in Google Play?

texts:
I have just released my first app game called 'paperplane', now the problem is that there are hunderds of paperplane apps so I dediced the change the name to 'neonplane'. I was not able to change the package name, however i could change the title name which is what I did. I updated the game and waited for google to publish it.

Now it is published it is called neonplane, but here is my problem:

If I look for neonplane I can't find nothing.
If I look for paperplane I find somewhere down the list neonplane with the name neonplane.

Is it somehow possible to fix this.


texts: it tells me "the identifier "input" isnt declared in the current slope"

texts:
this is where the problem is it tells me "the identifier "input" isn't declared in the current slope".
if input.is_action_pressed("move_forward"):
        direction -= head_basis.z


texts: How to generate "Password" to transfer data?

texts:
Old Handheld games like The Legend of Zelda: Oracle of Ages/Seasons, Golden Sun and Golden Sun : The Lost Age have the possibility to share data between games in the form of passwords.
I was wondering how such a password is constructed and checked.


texts:
I want to implement a wavy laser beam similar to the Proton Backpack in Enter the Gungeon.

https://youtu.be/wl-o6gbMqFM?t=58

It's easy enough to draw a line from one point to another, but how to get the undulating curviness and the lighting effects?

I am working in Godot, but I could easily adapt techniques from Unity, if you know them, since Godot has similar resources.

I asked a version of this question in a Godot forum, but am also asking it here


texts: Offset Forward vector of object based on Rotation

texts:
I'm using the Bullet 3D physics engine in a iOS application running openGL ES 1.1

Currently I'm accepting info from the gyroscope to allow the user to "look around" a 3d world that follows a bouncing ball (note: it only takes in the yaw to look around 360 degrees). Im also accepting information from the accelerometer based on the tilt to push the ball. As of right now, to move forward, the user tilts the devise forward (using the accelerometer); to move to the right, the user tilts the devise to the right and so on. The forward vector is currently along it's local Z-axis.

The problem is that I want to change the ball bounce based on where the user has changed the view.  If I change the view, the ball bounces in the fixed direction.

I want to change the forward facing direction so that when a user changes the view (say to the look at the right of the world, the user rotates the device), tilting the devise forward will result in a forward force in that direction.

Basically, I want the forward vector to take the rotation into consideration.

Sorry if I didn't explain the issue well enough, its kind of confusing to write down.


texts: Change material emission for a second then go back to default

texts:
I'm looking for a way to change the emission of a material for a second then get it back to where is was by default

Here's what I have for now

float emission_lvl = 5.0F;
float emission_lvl_start = 0.5F;

public Update(){
    mat.SetFloat("_Emission",emission_lvl);
    Invoke ("SetEmissionBack", 1.0f);
}

public void SetEmissionBack(){
    mat.SetFloat("_Emission",emission_lvl_start);
}


texts:
Watching a Unreal Course, and the instructor is creating a default pawn c++ class.  He is adding all the components with code, but this seems really inefficient to me.  Why can't you add components in the engine like you can with blueprint classes?  Also, I know you can convert c++ classes to Blueprint classes and still code using attached c++ components, is there a downside to doing this?
my main questions are these:
What is better about adding components in code?
What is the difference between creating a blueprint class and creating a c++ class but converting it into a blueprint?
What are the benefits of each?  thnx.


texts: When dealing with a static game board, what are some methods to make it more interesting?

texts:
Let's say you have a game board that you look at. It does not move but there is some action going on. For example Chess, Checkers, Solitaire. The game I'm working on is not one of these but it's a good reference.

What are some methods you can apply to the game or the design that increases the appeal of the game to the user?

Of course you can make it prettier but what are some other methods you can use?

For example: Visual cues, game design changes, user interface arrangement, etc.


texts: Actually utilizing relational databases for entity systems

texts:
Recently I was researching several entity systems and obviously I came across T=Machine's fantastic articles on the subject. In Part 5 of the series the author uses a relational schema to explain how an entity system is built and works. Since reading this, I have been wondering whether or not actually using a compact SQL library would be fast enough for real-time usage in video games.

Performance seems to be the main issue with a full blown SQL database for management of all entities and components. However, as mentioned in T=Machine's post, basically all access to data inside the SQLDB is done sequentlially by each system over each component. Additionally, using a library like SQLite, one could easily improve performance by storing the entity data exclusively in RAM to increase access speeds.

Disregarding possible performance issues, using a SQL database, in my opinion, would allow for a very intuitive implementation of entity systems and bring a long certain other benefits like easy de/serialization of game states and consistency checks like the uniqueness of entity IDs.

Edit for clarification:

The main question was whether using a SQL database for the actual entity management (not just storing the game state on the disk) in a real-time game would still yield a framerate appropriate for a game or even if someone is aware of projects that demonstrate SQL in a video game.


texts:
I'm trying to make a Sudoku puzzle generator. It's a lot harder than I expected and the more I get into it, the harder it gets!

My current approach is to split the problem into 2 steps:

Generate a complete (solved) Sudoku puzzle.
Remove numbers until it's solveable and has only 1 solution.

In step 1, since I'm using a brute force methods, I'm facing some run time issues. Is there an optimal way of filling in a complete Sudoku puzzle?

In step 2, what kind of algorithm should I use to "puzzlize" a solved sudoku?


texts: Should I use GL_GENERATE_MIPMAP_SGIS or GL_GENERATE_MIPMAP?

texts:
I'm using Windows 7 and most people in the group of this specific OpenGL project is too, there's only one member on Windows XP. We are all using Visual Studio 2010 though. I don't know if the OpenGL headers come with VS or with Windows but I would assume it's VS. And since we are all using the same VS version, albeit not the same SKU, I'm also assuming we all have the same OpenGL headers and version running on our systems.

That said, the version installed on my system (note that I haven't installed anything OpenGL related) is 2.1 and it does support GL_GENERATE_MIPMAP, I don't need to resort ot the SGIS extension.

However, the Windows headers only support version 1.1. To work around that, I'm using GLEW. I also noticed that both GL_GENERATE_MIPMAP_SGIS and GL_GENERATE_MIPMAP have the same exact values defined.

So my question is, should I do the following on my texture loading routine:

if(GLEW_SGIS_generate_mipmap) {
    glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
    glTexImage2D(GL_TEXTURE_2D, 0, glFormat, texWidth, texHeight, 0, glFormat,
        GL_UNSIGNED_BYTE, texPixels);
} else {
    gluBuild2DMipmaps(GL_TEXTURE_2D, glFormat, texWidth, texHeight, glFormat,
        GL_UNSIGNED_BYTE, texPixels);
}

...or can I just assume everything will work and just do this:

glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
glTexImage2D(GL_TEXTURE_2D, 0, glFormat, texWidth, texHeight, 0, glFormat,
    GL_UNSIGNED_BYTE, texPixels);

?

I would think that this code would fail (and the game wouldn't probably run) if the OpenGL version doesn't support mipmapping generation like that, but nowadays, most people probably have OpenGL 2.1 on their systems right, probably in Windows XP too (without any development tools installed)?

Also, another small question...

My laptop has 2 graphics card, one integrated (Intel) and the other dedicated (NVIDIA), with NVIDIA Optimus technology. Mipmapping using the dedicated GPU seems to have better quality. I mean, the integrated card mipmapping seems more pixelized in near planes (I'm talking about a plane terrain texture) than the dedicated one. And when I move the camera, the near pixels "blink" a little (with the integrated card) and it's distracting, while the far pixels look nicely linear. Yes, I'm using GL_LINEAR_MIPMAP_LINEAR for the minifying filter. Anyway to fix this?


texts: How to represent a game character in code?

texts:
In a previous game I wrote I  had a game character class. This class tracked the location, velocity, and a set of states. Except the states were tied very close to the animation. Each state would have a list of buttons that can transition it other states, and an animation that would go with that state (you could also do per-frame animation state changes, if you wanted to do something like have a very specifically timed punch or something). All of the collision data for the character was done on a per animation-frame basis. This was done for a fighting game, so it seemed necessary at the time to have the animation and collision tied so closely to the character state.

But the programmer in me feels like this is mixing responsibilities. And now I'm making a game engine that I want to be a little bit more generic than that. How do you typically organize the structures relating to the characters, how they're drawn, how they interact with each other and the world, etc?

I realize this is sort of a vague question that depends on the type of game I want to make, but I think seeing how other people handle this would be useful.

(and if it matters, this is all for a 2D game.)


texts: OnInspectorGUI Custom properties are not displayed in the right order

texts:
I basically made a lot of research and wasn´t able to find any solution.
So my problem: I´ve made some variables disappear/appear depending on an enum with a custom editor script. But if they appear they do not appear at the position where the normal editor variables would appear

override public void OnInspectorGUI()
{
    base.OnInspectorGUI();
    GunCard myScript = target as GunCard;

    EditorGUI.indentLevel++;

    switch (myScript.aimingControlType)
    {
        case AimingControlType.Manual:
            myScript.hasAimAssistance = EditorGUILayout.Toggle("Has aim assistance", myScript.hasAimAssistance);
            break;
        case AimingControlType.AutoTargeting:
            myScript.targetPreference = (TargetTypes)EditorGUILayout.EnumPopup("Target preference", myScript.targetPreference);
            myScript.requiresLineOfSight = EditorGUILayout.Toggle("Requires line of sight", myScript.requiresLineOfSight);
            myScript.requiresPossibleTargetOnScreen = EditorGUILayout.Toggle("requires possible target on screen", myScript.requiresPossibleTargetOnScreen);
            break;
    }
    EditorGUI.indentLevel--;
}

Here is where they appear:

That are the raw variables in the scriptable object

[Header("Aiming Controls")]
public AimingControlType aimingControlType;

[HideInInspector] public bool hasAimAssistance;
[HideInInspector] public bool requiresLineOfSight;                //TODO: implement -> requires 180
[HideInInspector] public bool requiresPossibleTargetOnScreen;     //TODO: implement -> requires 180
[HideInInspector] public TargetTypes targetPreference;
[HideInInspector] public bool isAutoShootWhenAimOnTarget;

I know I´m basically adding new variables to the inspector in my editor Script but it would be really useful to order them. Is there a way to do that?

P.S sorry for the funny typo in the picture :)


texts: Copy unaligned XMVECTOR and use the copy?

texts:
I know XMVECTOR has to be 16-byte-aligned and therefore shouldn't be a member of a class (unless I ensure the alignment). However, can I do sth like this?

class A
{
    public:
    XMVECTOR vect;
};

void fun(void)
{
    A a;
    XMVECTOR localVect = a.vect;
    // can I now use localVect correctly?
}

Edit:
My question isn't "Can I use XMVECTOR as a member variable?". It's "Can I copy an XMVECTOR instance that's not guaranteed to be 16-byte aligned into one that is and then use the latter one without any problems?".