texts: Persisting save data on uninstall without sign in

texts:
I am looking for ways to keep a unique link between a user's device and their account without requiring users to sign into an account.
The kind of system I am looking for is one like the game AFK Arena. It seems even if I sign out of everything, uninstall the game, and even reset unique identifiers (such as ADID), after reinstalling the game it puts me at exactly where I was before uninstalling.
Are there any identifiers on iOS and Android devices that I can use to 100% link a device to a save, so that even if the user uninstalls I can easily restore that save file from my server using that same identifier with no input from the user?


texts: Rotating a 3d vector around an axis using sines and cosines

texts:
I am trying to represent a 3d cone light's direction using only 2 variables. Right now I represent it with two points (6 variables) but I know that the direction in 3d space can be represented by two angles, rotating an arbitrary vector (e. g. pointing upwards) around two fixed axes step-by-step.

These calculations would be done in a shader, so I need a formula similar to the one in this question, that would allow me to perform such rotations. Could anyone suggest it?

UPDATE:

Following the Babis' answer I made a simple console project that computes phi and theta from two 3d points and then recomputes the normalized direction vector using the angles. However, the algorithm seem to always give me the wrong dir.Y value for some reason:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Microsoft.Xna.Framework;

namespace DirectionIn2Angles
{
    class Program
    {
        static void Main(string[] args)
        {
            Vector3 first = new Vector3(1000, 1200, 85.245f);
            Vector3 second = new Vector3(1150, 85, 750);

            Vector3 distance = second - first;
            float length = distance.LengthSquared();
            distance.Normalize();
            Console.WriteLine(distance.ToString());

            float cosFSinY = distance.X;
            float sinFSinY = distance.Y;
            float cosF = distance.Z;
            float F = (float)Math.Acos(distance.Z);
            float Y = (float)Math.Asin(distance.X / distance.Z);

            float SinY = (float)Math.Sin(Y);
            float CosF = (float)Math.Cos(F);
            distance.X = CosF * SinY;
            distance.Y = (float)Math.Sin(F) * SinY;
            distance.Z = CosF;

            Console.WriteLine(distance.ToString());
            Console.ReadKey();
        }
    }
}

The values written in the console are:

x: 0,1147876; y:-0,8532547; z: 0,5087044

x: 0,1147876; y:0,1942689; z: 0,5087044

UPDATE:

This really is very wierd, I tried computing phi and theta using formulas from this article, but it now gives me the wrong dist.X! What could I be doing wrong?

UPDATE:

OK, that was just me being blind, I misread the formula. Here is the solution:

SOLUTION:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Microsoft.Xna.Framework;

namespace DirectionIn2Angles
{
    class Program
    {
        static void Main(string[] args)
        {
            Vector3 first = new Vector3(1000, 1200, 85.245f);
            Vector3 second = new Vector3(1150, 85, 750);

            Vector3 direction = second - first;
            direction.Normalize();
            Console.WriteLine(direction.ToString());

            float CosYSinF = direction.X;
            float SinFSinY = direction.Y;
            float CosF = direction.Z;

            float F = (float)Math.Acos(direction.Z);
            float Y = (float)Math.Atan2(direction.Y, direction.X);

            float SinF = (float)Math.Sin(F);
            direction.X = (float)Math.Cos(Y) * SinF;
            direction.Y = SinF * (float)Math.Sin(Y);
            direction.Z = (float)Math.Cos(F);

            Console.WriteLine(direction.ToString());
            Console.ReadKey();
        }
    }
}


texts:
Using the Texture2D.Sample function, how does the pixel shader infer the mipmap level to use? Or does it use mipmap level 0? I am using the ps_4_0 shader model. And replacing Sample, with SampleLevel(state, pos, 0.0), does that give same results? In what cases does it give same results?

struct PS_INPUT
{
    float4 pos                   : SV_POSITION;
    float3 tex : TEXCOORD0;   // texture coordinate
};

struct PS_OUTPUT
{
    float4 color                   : SV_Target0;
};

Texture2D tex;

SamplerState state {
    Filter      = MIN_MAG_LINEAR_MIP_POINT;
    AddressU    = CLAMP;
    AddressV    = CLAMP;
};

PS_OUTPUT main(PS_INPUT input) : SV_Target
{
    PS_OUTPUT output;

    output.color = tex.Sample(state, input.pos);

    return output;
}


texts: Verify if a circle is completely inside a rectangle or not?

texts:
I am a beginner in game development. I am using the libGDX library.

I'd like to know the best algorithm to verify if a circle is completely inside a rectangle. I tried using the the static method overlaps() of the Intersector class like this:

if(!Intersect.overlaps(ball.getBoundingCirle(), wall.getBoundingRectangle())) { // ball is a circle and wall is a rectangle
            ball.reset(midPointX, midPointY);
        }

but I won't be accurate. I have read a lot of algos for circle and rectangle collision what I want is to detect when the circle touches any of the side of the rectangle (while inside). I read this answer but it didn't help me.


texts: What is a good way to load more than a million images for a collectible card game?

texts:
I'm using C# with MonoGame and I'm wondering what would be an efficient way to load more than a million card images for a collectible card game. More cards would be continuously added in future updates and what not. I'm sure there are some genius ways to go about this which are both elegant and efficient. I'm hoping to obtain some insight on how others would solve this problem.

Added more details:

The cards will all be on a client side application the user downloads. The server will make sure the players are not cheating. I'm trying to figure out what are efficient ways to manage a large amount of card images on the client side regarding the loading and unloading of the cards.

I understand the cards should loaded and shown only when necessary. However, there are points in the game where the user can look through their entire collection. I was thinking with a scrollbar or something along those lines. They can filter their cards based on certain properties of the cards. In this scenario, how would I manage the loading/unloading of the cards in real time to make it seamless and efficient.

Thank you for any help!


texts: Why does the Modelview Matrix in OpenGL not have accurately signed vector values for look vectors?

texts: When I do a GluLookAt(0.0, 500.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0) so that I'm 500 units up on the positive Y axis looking down at the origin with the top vector of the camera pointing toward the negative Z axis, that means my unit vector, mathematically speaking, should be (0.0, -1.0, 0.0) correct?  If I'm looking down toward the negative Y axis now and want to move closer to the origin, I'm supposed to subtract the number of units from my camera's current position of 500 so that the Y value gets smaller which means I'm moving the camera forward in the direction I'm pointing.  How come when I do a glGetFloatv(GL_MODELVIEW_MATRIX, mycopy) to get the current matrix right after the GluLookAt command is executed, I end up getting a Look Vector of (0.0, 1.0, 0.0) so that it's a positive Y value?  mycopy[2], mycopy[6] and mycopy[10] are the look vector values.  I know I can negate it to get the negative Y value but it seems like a cheap move.  Why does OpenGL do this in the modelview matrix when REAL mathematics states that it should be a negative Y value for the look vector?  If anyone can help me understand this, I would greatly appreciate it.  :)


texts: Making various shapes equally difficult to tap

texts:
I'm developing a game where the player quickly has to tap/click on various shapes such as squares, circles, triangles, stars and so on. I'm now struggling with the following task: I'm searching for a normalized size for each shape, so that every shape is equally difficult to hit. E.g. given a circle with a radius r, how do I find the length l of the corresponding square?

At first glance I thought: Easy. Just make all shapes share the same area A. So, in the example above, l = sqrt(pi). http://en.wikipedia.org/wiki/Squaring_the_circle

But on second thought, this does not seem to be the best metric. Imagine a star with many long, thin, pointy arms or a very long but thin line. Even if they have the same area as a circle or square, they are still more difficult to hit.

So, what might be a better approach? Maybe something involving the "form factor" (circumference squared divided by area C²/A)?


texts: What's the best practice to have NPC enemies taking cover in an FPS game?

texts:
My question is about the data structure (and logical way to use this structure) behind this type of comportment of NPC enemy : How does he computes the place where he can take cover when the player is shooting at him ?

It can be in a FPS-like, or a "board game" view game...


texts: What's the term for this illustration style common in MMOs/RPGs?

texts:
Often I was asked for the "style", but I am not sure how to describe it. I just say "mix of anime and realism". But what is it actually called, a style like this example:

It's popular and you see it in most of all mmo/rpgs. I know that it's called "stylized" in 3D-Texturing. But how would you call that typical style like in the link above (not meaning the clothes or what it expresses do be, its about the illustration and character style. Like anime, Fortnite (as it has very unique style) and so on)


texts: Why BlackBoardValue Says Invalid And False? UnrealEngine4

texts: Think my ai do not move towards the sound because of the blackboard keys , one says invalid and another says false , i think that is the reason.... Enemy Ai should move to the location where sound is heared , here is the photo of BehaviourTree. Look at those 2 keys named "InvestigatePosistion" and "HasHearNoise" its says False and Invalid. so how make them work?


texts: At what point of the game should I request users leave a review?

texts:
I'm planning on displaying a dialog requesting users review my Android game, but I'm wondering at what point I should display the dialog. I wont show the dialog until the user has completed several levels, but I can't decide where in the game flow to place it.

I have several options.

On game launch - my concern with this is that they're looking to play a game at this moment in time, not review the game.
On game exit - this seems a fairly classic time to do it, but many users wont quit by pressing back, often they'll just use the home button, or just turn the phone off. Also, if a user is stopping playing then they'll often be doing so because they've got something else to do.
On level completion - I will only request the review on successful level completion as I assume a player will be feeling good about the game at that point in time. My concern with this is that it interrupts game flow.

I'd be interested in hearing the thoughts of others on this.


texts: How do I get a Light's Range value in Shader?

texts:
I'm trying to write a simple frag/vert shader that, depending on whether it is in the range of a light, will paint the appropriate colour from either the 'lit' texture or from the 'unlit' texture.

Therefore, I need to compare the distance between the light to the range of the light.
I've been googling all kinds of things, but I can't seem to find a way of accessing the range value of the light. Is there a way to do so? If not, is there some kind of derived data I could use as an alternative?

I was able to find this method here, which seems to be the most promising so far, however after playing around for a bit, I still can't seem to get what I need. There's some talk about _LightMatrix0 not being populated. Can anyone confirm?

I've also had it suggested to use SetFloat() and pass in the range like that...however, that provides no easy way of telling one light apart from another short of using the light's position as a key. As several key lights in the game will be moving this is just ugly and inefficient.

Update

I found the variable unity_LightAtten in the Unity Shader Variables documentation. However, this is only used for Vertex Lit shading, which isn't exactly ideal, especially considering the lack of console support.
Could there be a way to pipe this variable to Forward Rendering?

Update 2
For clarification, shading should otherwise be 'flat' (ie no need for diffuse etc):

Also, what I've currently got (albeit, not currently working as desired and currently using a workaround):

Shader "Lantern/Flat Pullup" {
Properties {
    _LitTex ("Lit (RGB)", 2D) = "white" {}
    _UnlitTex ("Unlit (RGB)", 2D) = "white" {}
    //_Falloff ("Falloff", 2D) = "white" {}
    _Pullup ("Pull up Point", Range(0,1)) = 0.7
}
SubShader {
    Pass{
        Tags { "LightMode"="ForwardBase" }
        LOD 200

        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        #include "UnityCG.cginc"

        uniform sampler2D _UnlitTex;
        uniform float4 _UnlitTex_ST;
        uniform sampler2D _LitTex;
        uniform float4 _LitTex_ST;
        uniform float _Pullup;

        uniform float4 _LightColor0;

        struct VI {
            float4 vertex : POSITION;
            float4 tex : TEXCOORD0;
        };

        struct V2F {
            float4 pos : SV_POSITION;
            float4 tex : TEXCOORD0;
            float4 posWorld : TEXCOORD1;
        };

        V2F vert(VI v){
            V2F o;
            o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
            o.tex = v.tex;
            o.posWorld = mul(_Object2World, v.vertex);
            return o;
        }

        float4 frag(V2F i) : COLOR {
            float3 flatReflection = _LightColor0.xyz *
                (1 / length(_WorldSpaceLightPos0.xyz - i.posWorld.xyz));
            float4 color;
            //Improve for light color etc
            if(length(flatReflection) > _Pullup){
                color = tex2D(_LitTex, i.tex.xy * _LitTex_ST.xy + _LitTex_ST.zw);
            }else{
                color = tex2D(_UnlitTex, i.tex.xy * _UnlitTex_ST.xy + _UnlitTex_ST.zw);
            }
            return color;
        }

        ENDCG
    }
}
FallBack "Diffuse"
}


texts: How to make goalKeeper move within post but not move towards to the player?

texts:
Hello so basically I make a 2d top-down soccer game but I have to trouble with GK AI, I want to GK is followed the ball but not move toward on it
let say (Enemy = GK)

so when the player moves to the left or right the enemy will follow to the right or left not The Yaxis but in X-axis with guarding the post or Y=0
my default enemy movement is like this :
if (gameObject.CompareTag("GK"))
        {

            anim.SetBool("GKRun", false);
            gkballInRange = Physics2D.OverlapCircle(transform.position, gkballRange, playerMask);
            float distancePlayer = Vector2.Distance(target.position, transform.position);

            if (gkballInRange)
            {
                if (distancePlayer <= gkballRange)
                {
                    //Animation
                    anim.SetBool("GKRun", true);
                    transform.Translate(0, -speed * Time.deltaTime, 0);
                }
            }

        }

in that scrip, when the ball is on the range the GK is moving to the ball just that. maybe anyone can explain to me how to do it?


texts: Should I use octree or quadtree for my spacial data structures?

texts: I would like to know the advantages and disadvantages of using octree or quadtree for spacial data structures? In a 3d gaming setting would you ever need more than 4 children nodes? Does it take longer to traverse through oct tree than quad tree? Is one of the two by all means faster than the other or is it a trade off sort of thing?


texts:
I have downloaded the latest Unity 5.2.0f3 so I wondered if it is just me or others are having a similar problem: When I double-click on an animator controller to launch it, the animator tab/window appears, but when I run the editor, I don't get the usual flow, operations, etc... I only get a static view of the states and transition arrows between them. My parameters do not show the changes they go through either.

I have multiple animations and can switch between them when certain game conditions occur, but nothing really shows when I do so, to see the flow of control, what happens, what goes wrong, the switching, the progress bar, etc...


texts: Odd behavior in Unity 5.1 2d project prefabs

texts:
I am very worried something is corrupt in my project. I am making a 2d top-down rogue-like and am currently using prefabs to generate enemies from. I have started running into an issue where I get a null reference error when trying to iterate a collection of enemies after doing anything on the prefabs, even just selecting one in the editor. If I drag any of the enemy prefabs into the scene then immediately delete it I am fine until I touch a prefab in the inspector again. at one point I was getting "iHasError" 6 times with no info but the unity reinstall fixed that so far

I have tried:

•Deleting the library folder
•Doing a Reimport All
•Uninstalling and reinstalling Unity
•Reloading the project from a few days ago
•Removed a bunch of animations added this weekend
•Commenting out everything I had done recently in the Enemy script
•Googled for a couple hours and looking for things that seem similar

My prefab is structured:

•Gameobject
•Sprite Renderer
•Enemy (Script) About 500 lines
•Animator (simple 2-sprite swap animation)

Does anyone have any ideas?

Mike B


texts: Efficient acceleration structure for moving 3D objects in scene

texts:
I am implementing a 3D FPS game in C++. The game has large outdoors areas with both static and dynamic objects in the scene, with the following implicit assumptions:

Static objects:

Do not move after initialization
Only added to scene during load time, all in one go
Examples: buildings, plants, obstacles, etc.

Dynamic objects:

Can be expected to move at any time
Can be added to or removed from the scene at any time
Examples: players, vehicles, moveable physics objects, etc.

I want to implement acceleration structures that can efficiently handle collision detection on the objects in the scene (e.g raycasts, frustum culling, etc.) NOTE: I am only doing these tests on the bounding volume level, i.e no polygon-ray/box/etc. tests. The goal here is to have an efficient method for early-outs before testing on the polygon level. In other words, let's assume all the static/dynamic objects are simple 3D boxes of various sizes.
For static objects, I found that I can just create a Bounding Volume Hierarchy using their AABBs, which I've already tested and found to be quite efficient. I want to do something similar with the dynamic objects, i.e use their bounding volumes to create and update an acceleration structure at runtime.
So far, the only candidates I found are Spatial Hashing and Dynamic Octrees, but I could not find a lot of material for this specific use case, nor is it clear which of the two is more efficient. Also, I am not sure how to efficiently update the scene whenever the objects change. I can think of two approaches, which are indicated in the following pseudocode:
struct RayResult;
struct RayCast;
class RenderObject;

class DynamicScene
{
public:
    void addObj(RenderObject* obj) { /* Add object, update structure... */ }
    void removeObj(RenderObject* obj) { /* Remove object, update structure... */ }
    void updateObj(RenderObject* obj)
    {
        /* Update the acceleration structure based on the changes in the object */
        updateAccelerationStructure(obj);
    }

    void perFrameUpdate(float dt)
    {
        // Update all the objects in the scene
        for(RenderObject& obj : m_sceneObjects)
        {
            obj.update(dt);
        }

        /* OPTION 1: update the scene here, after all objects have been updated? */
        updateAccelerationStructure();
    }

    RayResult rayTest(const RayCast& ray)
    {
        RayResult result;

        // Test all the dynamic objects using the accelerator structure
        // Add objects where we hit the OBB to the result struct
        // ...

        return result;
    }
};

class RenderObject
{
public:
    // Assume it has a 3D matrix for position/orientation, and an OBB that is updated whenever the transform changes
    // ...
    void update(float dt)
    {
        // ...
        /* OPTION 2: update the scene here, based on the changes to this one object? */
        if(transformChanged())
        {
            m_scene->updateObj(this);
        }
    }
private:
    DynamicScene* m_scene;
};

Option 1 would result in a single update to the entire acceleration structure, but would require constantly inspecting all the objects for changes. Option 2 would only update if an object actually changed, but it also means N objects changing in a frame will result in N updates to the acceleration structure.
Thus, my questions are:

For the above use-case, which 3D acceleration structure is optimal, or at least most frequently used in game dev?
What is the ideal per-frame update procedure for said acceleration structure?


texts: Rendering transparent textures in directX

texts:
I am working with a directX application with WPF, I am facing a problem with videos and images that contains transparent pixels, I have to draw a color in background an then a video/image over it. What I expect is background color should be visible while playing video only non transparent pixels should be visible but what I get is a black background behind the video.
I am using following settings on device to achieve alpha blending :

device.RenderState.SourceBlend = Blend.SourceAlpha;
device.RenderState.DestinationBlend = Blend.InvSourceAlpha;
device.RenderState.AlphaBlendEnable = true;

What am I missing here? What is the best approach to handle transparent videos?
Any help will be of great value to me.


texts: In Unity how do I make a button call everything suscribed to the "onEndEdit" event of an InputField?

texts:
How do I make a method (that is going to be called every time that a button is pressed) to call everything subscribed to the "onEndEdit" event of an InputField?

I expected something like this:

public class DoneButtonInputField : MonoBehaviour
{
    [SerializeField] private InputField inputField;

    public void ClickDoneButton()
    {
        inputField.onEndEdit();
    }
}

But it does not work and I do not know how to search for the answer (probably by vocabulary lack).


texts: Traversing an acyclic binary tree to construct paths from a given starting node, but the paths come out wrong

texts:
The tree is an acyclic binary tree. It's composed of node objects that have a list of connections to link objects (at most 3), and link objects that have a list of connections to node objects (always 2). I am trying to construct a list of possible paths to other nodes that can be reached given a fuel budget and a fuel cost on each link. What it is supposed to do is go through each non-backtracking connection of a node, and spawn a new route and thread to investigate that, leaving the current one to end at that node and thus create a list of routes to every node in the reachable area. When executed, the list of end destinations are valid but many of the paths that are constructed to get to them are wrong, going down other branches in the tree that are extraneous or entirely outside of the reachable area bounded by the fuel budget as well as jumping between nodes that aren't directly connected. There seems to be some pattern in the errors, when going down from the root of some branches of the tree the path goes down every offshoot in order first instead of going in a straight line, and when going up the tree the path tends to go further out and make triangle shapes, often landing somewhere other than the listed destination. I have already checked the link and node connections themselves to see if they are assigned properly, and they are. What am I getting wrong?
Route class definition
var origin:Node
var destination:Node
var totaldV:float
var totalt:float
var dVBudget:float
var tBudget:float
var tdVRatio:float
var links:Array
var nodes:Array

func duplicate_values(originator:Route):
    origin = originator.origin
    destination = originator.destination
    totaldV = originator.totaldV
    totalt = originator.totalt
    dVBudget = originator.dVBudget
    tBudget = originator.tBudget
    tdVRatio = originator.tdVRatio
    nodes = originator.nodes
    links = originator.links

func _init(originator_route):
    if originator_route != null:
        duplicate_values(originator_route)

Tree traversal algorithm
var routes:Array
onready var root = get_node("..")

func traverse(current_node:Node, previous_route:Route):
    if previous_route == null:                             # Starts off the recursion by providing an initial node
        previous_route = Route.new(null)
        previous_route.origin = current_node
        previous_route.nodes.append(previous_route.origin)
        previous_route.dVBudget = 2000
        previous_route.totaldV = 0
    for link in current_node.connections:
        if (previous_route.totaldV + link.dV < previous_route.dVBudget &&
        !IsBacktracking(previous_route, LinkDestination(link, current_node))):   # If there is enough fuel and the link isn't backtracking, go through it.
            var working_route:Route = Route.new(previous_route)    # Copy the previous route to make the new route
            routes.append(working_route)
            working_route.destination = LinkDestination(link, current_node)
            working_route.totaldV += link.dV
            working_route.totalt += link.t
            working_route.links.append(link)
            working_route.nodes.append(working_route.destination)
            traverse(working_route.destination, working_route)
    DisplayRoutes()
    root.get_parent().pathSelectionFlag = true   # UI control boolean

func IsBacktracking(route:Route, destinationNode:Node) -> bool:
    for nodeI in route.nodes:
        if (destinationNode == nodeI):
            return true
    return false

func LinkDestination(link:Node, originNode:Node) -> Node:    # Finds the node on the other side of a link
    for nodeI in link.connections:
        if (nodeI != originNode):
            return nodeI
    return originNode


texts: Is there a good comprehensive walk-through of deriving the math for 3D model rendering that starts from scratch?

texts:
I'd like to fully understand the math of rendering a 3D model in a 2D perspective.

I always find tutorials that are in terms of the APIs used to do the math for you, and not the math itself.

I'd like to understand it from the standpoint of geometry as opposed to linear algebra if possible.  What I mean is, I'd like to be able to visualize what the matricies stand for in the 3D model and/or 2D image which is the result of rendering.

Is there a definitive source or sources I can consult for this?


texts: How can I detect and hide faces inside an object when combining two or more meshes?

texts:
I am trying to make a game where the player can make vehicles out of parts. To apply proper physics to the vehicles, like drag and buoyancy, I would like to get the outer hull of the various parts placed in arbitrary positions, scalings, and rotations. The hull will most likely be concave, not convex.
How can I detect which faces (or parts of faces) would be on the interior of the vehicle so I can ignore them? Or alternatively, which faces are not on the interior of the vehicle and therefore make up the outer hull?
Some use cases that I am trying to handle are:

Two cubes placed right next to each other, like in a grid.

Two cubes placed next to each other, but of different sizes

A cube and a sphere (or other shape) overlapping each other.

One method that I have tried but not yet got to work is to voxelize the parts using raycasting or SDFs and then using marching cubes or dual contouring to make the hull mesh. That has issues when there are sharp angles and it can create a lot of triangles, a lot more than the original mesh. Are there other methods that I should try?
Can binary space partitioning (BSP) or a k-d tree be used for this or is that the wrong approach?
I am working in Unity / C#, but can translate from other languages.


texts:
As the title state, I have a large tilemap 400 x 400 x 26. Which currently just about fairs when using it. Saving takes a couple of seconds and it saves to a .ser file which is okay at the moment however when re-loading the map it takes a couple of minutes and is painful.

I'm wondering how I can improve my saving/loading and also if possible improve the way the maps are used eg: using a 2D array instead of a 3D array but still with the z-level.


texts: Relation between TFLOPS and Threads in a GPU?

texts:
What's the relation between Teraflops and Threads in a GPU like GTX Titan X has 7 TFOPS of Compute Performance but how many threads it has ? And Like Xbox and PS4 have 1.32 and 1.84 TFLOPS of compute performance but how many threads they have? Like what’s the relation between teraflops and threads?

If they are different concepts. Can you please explain both of them?


texts: Monogame/XNA Making animations play once per click

texts:
I'm currently making a #gbjam entry and everything has been going smoothly up to this point.

My issue being that I've implemented a shooting mechanic and along with it an animation to play as a shot is fired, however I'm struggling to make it so that the animation plays properly each click of the mouse. I only ever see sporadic flickers with no real pattern to them. I'm using an animation class and for anything else it's been working fine.

Here's my animation's Draw() method:

public void Draw(SpriteBatch sB, GameTime gT, Vector2 pos)
    {
        time += (float)gT.ElapsedGameTime.TotalSeconds;

        while (time > frameTime)
        {
            frameIndex++;
            time = 0f;
        }

        if (frameIndex >= totalFrames)
        {
            frameIndex = 0;
        }

        Rectangle source = new Rectangle(frameIndex * frameWidth, 0, frameWidth, frameHeight);

        sB.Draw(spriteSheet, pos, source, Color.White, 0.0f, origin, 1.0f, SpriteEffects.None, 0.0f);
    }

For reference the animation spritesheet is 20 frames long, each 128px by 128px.

Here is the Update() and Draw() calls that are use in handling shooting and the shooting animation:

        #region Shooting
        if (mS.LeftButton == ButtonState.Pressed && mSP.LeftButton == ButtonState.Released)
        {
            if (bCount > 0)
            {
                shooting = true;
                bCount--;
                Debug.WriteLine("Bang!" + " Rounds Left: " + bCount);
            }
            else
            {
                shooting = false;
                Debug.WriteLine("OUT OF AMMO");
            }
        }
        else
        {
            shooting = false;
        }

        if (mS.RightButton == ButtonState.Pressed && bCount == 0)
        {
            shooting = false;
            bCount = 6;
            Debug.WriteLine("RELOAD");
        }
        #endregion
        mSP = mS; //mSP being the previous mouse state and mS being the current
    }

    public void Draw(SpriteBatch sB, GameTime gT, Camera cam)
    {
        if (shooting)
        {
           revolverShoot.Draw(sB, gT, fpsPos);
        }
        else
        {
            revolverIdle.Draw(sB, gT, fpsPos);
        }
    }

If anyone could offer any ideas as to 'force' the game to complete the animation first before continuing I would be really greatful.


texts:
I'm working on a game where some in-game events need to happen once in a while. A nice example would be a tutorial.
You start the game, and at several points in the game an event occurs:

You encounter your first enemy, the game pauses and you receive an explanation on how to kill it.
You killed the first enemy, you receive a "good job" message.
You gain a new item, a menu with the items stats popup.
etc etc.

The game I'm working on is a puzzle game where the rules in the game are pretty much all the same, so it seems inefficient to hardcode all these events in separate levels.

Should I somehow define these events in an external source, like XML? Then write an interpreter that reads out the XML and sets the events requirements for the level?
I'm not sure how I could define an event that should occur when you killed two enemies for example.

Just to be clear, I'm not looking for the best programming language or scripting language to do this, but more at the best method to handle this.

Thanks!

Edit:
A second example since my question was pretty hard to understand:

The problem I'm having is to put some extra actions in the game in a procedure that is always pretty much the same. Like an RPG battle, everyone has a turn, picks a skill etc - it's always the same. But what if there was a case where I would like to display a cutscene somewhere in between. Modyfing the entire game structure to pass in an altered battle class with the cutscene included seems very inefficient. I'm wondering how is this usually done.


texts: How to prevent creation of game object clones

texts:
Within the script of one game object I am initializing another game object with a prefab. To make development easier (so I don't have to run the game for every change) I call the function in OnValidate(). Anytime I select the hasWindow bool a Window clone is created. So in situations that I select then deselect (doesn't go away) and reselect, two clones are created. I don't even have a window game object in my hierarchy, so I don't get why any clone is created. I want the window to appear when I select hasWindow and disappear (not hide) when I deselect within the inspector. How can I do this? The relevant code follows:

public bool hasWindow;

void OnValidate ()  {
    prepareWindow();
}

void prepareWindow  ()  {
    if (hasWindow) {
        window = (GameObject)Instantiate(Resources.Load("Prefabs/OtherPrefabs/Window"));
    }

}


texts: Game Design - Challenging a player in an RPG-like game without removing easy cards

texts:
I'm designing a card game that I'm implementing on the computer that mirrors some gameplay aspects of dungeon crawlers and RPGs. The player's object is to survive as long as possible from the onslaught of monsters, etc. in the dungeon, while getting stronger and more powerful. The way the dungeon is generated is by drawing one card from the "dungeon" stack per turn, this card represents a monster, animal, item, etc. found in the dungeon. As the player progresses through the game, he gains better abilities to fight the monsters and animals with. The issue becomes that the player then becomes too powerful to have any challenge (e.g. after progresses through the game for a while, the rats in the dungeon won't be a challenge). My question is, how can the player be challenged, assuming that any cards in the "dungeon" stack cannot be removed, and that the player must become stronger (e.g. not progressing is not an option)?

One solution I thought of would be a leveling system, where the player's progress is measured through levels, and upon attaining another level, certain, more challenging cards are mixed into the "dungeon" stack. This however would involve different card backs (theoretically not an issue in the digital implementation) which would give away the difficulty of the card the player is about to draw.


texts: Optimal solution to render sprites with transparent edges in Unity

texts:
Since I'm currently developing a 2D game for mobiles, overdraw and drawcall count is my first priority in the design of the application
I've thought initially to split each sprite in two parts: one where each pixel is fully opaque (to render with cutout shaders in front-to-back order) and the other part with semi transparent edges (which will be ordered back to front)

Since I need to support ES2.0 devices, I can't use texture-arrays and I need to fit as many sprites as possible in a single 2048x2048 texture atlas to reduce drawcalls and ensure mobile compatibility, but as you can see from this picture:

Splitting sprites in opaque and non-opaque parts will certainly double the space occupied in the atlas, thus decreasing by half the potential amount of consecutive sprites I can draw in a single drawcall

This way, I'm paying drawcalls to reduce overdraw.
By rendering the entire sprite with transparent shaders I'd pay overdraw to reduce drawcalls.

Am I missing something? Is there a better approach?


texts:
You can style EditorGUILayout field with following code:

EditorGUILayout.BeginVertical(GUI.skin.box);

EditorGUILayout.PropertyField(serializedProperty, true);

EditorGUILayout.EndVertical();

But when you use it this way:

EditorGUILayout.BeginVertical(GUI.skin.box);

EditorGUI.PropertyField(rect, serializedProperty, true);

EditorGUILayout.EndVertical();

This happens:

With fixed height:


texts: Is there a way to draw an array of vertices/traingles directly from code, above 65k verts? I looked at Graphics class but it can only render a Mesh object.


texts:
I'm currently having a problem that has stopped my productivity for quite a while. I need to check if all tiles of a color is touching each other for each color like this:

I have all my code for moving the tiles around and switching levels, but i can't seem to work out a proper algorithm that checks if the level is complete(see image above).

The base of my code is the Tile[] that holds information about all these tiles.

The Tile class looks like this:

public class Tile {
int x = 0;
int y = 0;
int type = 0;
boolean checked = false;

//SETTERS AND GETTERS FOR ALL VALUES
public void setX(int v){
    x = v;
}
public int getX(){
    return x;
}
public void setY(int v){
    y = v;
}
public int getY(){
    return y;
}
public void setType(int v){
    type = v;
}
public int getType(){
    return type;
}
public void setChecked(boolean v){
    checked = v;
}
public boolean getChecked(){
    return checked;
}
}

The "type" is the color of the tile.
Should mention that the Tile[]'s length is 25 and that each tile has got a X & Y from 0-4.
I need something that can return me a boolean[] finishedColors so i can check if it's done.

All kinds of help is surely welcome!


texts: How to manage server "view" of game board when it is shared by clients?

texts:
I'm currently creating a simultaneous turn based card game in which two players play cards in three lanes to determine who wins points in these lanes.

I've been struggling this past week trying to think of a good way to handle my game board on the nodejs server. The problem I'm having is that the game board consists of 3 lanes and 5 rows in a 2D array (I.E. indexs 0,0 to 2,4). When Player A plays a card to 0,0 on their screen it goes to 0,0 on the server, the problem then comes Player B plays a card in 0,0 locally but it translates to 2,4 on the server.

My question is, is there a better server game board pattern that enables a cleaner structure than to specifically make a playerA and B on my server and have a playerId tied to every call to know whether or not to invert the co-ordinates? If there is no better way, is it better to do the conversion on the client or server side? I.E. after matchmaking will the server tell each client if they are playerA or B or will the server just keep track of it?

Also, less important, but if in the future I wanted to add new gamemodes that support x number more players how will this pattern scale upwards?


texts: NullReferenceException when accessing variables in a 2D array in Unity

texts:
I have made a class including variables in Monodevelop which is:

public class GridInfo : MonoBehaviour {

    public float initPosX;
    public float initPosY;
    public bool inUse;
    public int f;
    public int g;
    public int h;
    public GridInfo parent;
    public int  y,x;
}

Now I am using its class variable in another class, Map.cs which is:

public class Map : MonoBehaviour {

    public static GridInfo[,] Tile = new GridInfo[17, 23];

    void Start() {

        Tile[0,0].initPosX = initPosX;  //Line 49
    }
}

I am not getting any error on runtime, but when I play in unity it is giving me error

NullReferenceException: Object reference not set to an instance of an object
Map.Start () (at Assets/Scripts/Map.cs:49)

I am not inserting this script in any gameobject, as Map.cs will make a GridInfo type array, I have also tried using variables using GetComponent, where is the problem ?


texts: Managing animations for object state transitions

texts:
I'm looking for an optimized way to handle simple state transitions on my game objects. By "simple" I mean not more than 1-2 actions per object, and most algorithms are linear.

For example, I have an UI element that implements a switch (like a light switch) and it has two states - "up" (lights turned on) and "down" (lights turned off). Let's say I want to make it so that I can switch the switch from one state to another, and update its presentation in a smooth way using linear interpolation (move the foreground sprite up or down).

The question is if I should always check if the object should update its state (every frame), or should I add/remove this object from the update loop on demand, or is there any other (better) way of handling this situation?

Currently I have it implemented the following way: my object has a boolean variable called animated and in my onframe loop I have the following code:

if (this.animated)
    /* calculate new positions for the sprite */
else
    /* do nothing */`

And it would appear to me that this kind of code is not very well optimized. How to handle this kind of things better?


texts: Checking if a click happened "off" an object

texts:
Having made the first game in Game Maker, Catch the Clown, I realised there was no way to win or lose.

Winning is easy enough, set a maximum score and a test that fires whenever a score increments, but losing has proved challenging. I had an idea; if the player attempts to click on the clown but misses he/she loses a life. I have tested every check, read the manual and looked through forums but I can't find a way to do this.

I also can't figure out where to put the event. I tried on the clown; tests like checking to if there would be a collision between where the click occurred and where the clown is... nothing works. I am at a complete loss so any help would be greatly appreciated.


texts: How can I implement a third-person camera in an SC2 map?

texts:
I want to try creating a custom Starcraft 2 map with a third-person camera following a unit. A few custom maps with this feature exist already, so I know it's possible.

How do I do this? Do I need a custom mods file, or can everything be done in the map file?


texts:
Answer :

  Turns out the for loop did work.

  Lesson Learned :

  You might want to
  try putting something in it to see if the code inside actually
  executes....

As the title says I would like to loop trough a std::map filled with sf::Sprite*'s.

However when I try it like this :

(in .h file)

std::map<std::string, sf::Texture*> textures;

(in .cpp file)

for (auto const &ent1 : textures)
{

}

It tells me that the Debug Assertion Failed!.

With this error "log" :

  Program: C:\WINDOWS\SYSTEM32\MSVCP140D.dll
  File: c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtree
  Line: 237

  Expression: map/set iterator not dereferencable

At this point I've tried reading some on how it works, and I don't understand what I'm doing wrong.

I've been playing around with it, removing some parts and adding new ones.

I'be been removing const, removing the & and combining those two.


texts: is it possible to use dynamic types in c# generic methods?

texts:
for example i need something like this:

 SQLITE._instance.ds.GetItems<armour>();

armour is a class. but i need to get type of object to send to it in order to avoid rewriting this function.

for example it need:

SQLITE._instance.ds.GetItems<"classType">();

or

 SQLITE._instance.ds.GetItems<obj.getType()>();

to send the type to generic function. but i always receive that you send a variable not a type to generic function.

what should i really do?


texts:
I was thinking about developing a sidescrolling platformer very similar to an old Mario and Luigi game for NES. To start out I was thinking about taking the images from a site like this:

http://www.mariouniverse.com/sprites/nes/smb3

Which clearly states a copyright.  I was wondering how far I am allowed to take these images.  I figure I'm probably allowed to use it for personal development, but what if I publish the game as an exe file and send it to some friends?  I figured a definite no-no would be selling the game with the copyrighted images included.

A secondary question would be whether or not I would be allowed to modify them slightly and then call them my own.


texts:
I've started with Libgdx and am currently stumbling about trying to understand how to set up the interface.  I have generated the base projects in Eclipse ( < proj-name >,< proj-name >-android, < proj-name >-desktop, < proj-name >-html), and can get the program to display a simple background, play a looping sound file, and draw a tank.  I have been having some problems implementing the UI though.

I want to make a collapsible interface bar at the bottom of the screen that would contain buttons for movement, and selecting weapons.  I'm confused since there appears to be several ways of doing this and the documentation (or tutorials explaining it) tend to be obsolete.  How would one go about this?  Use a stage for the bar and actors for the widgets?  I'm a little lost on this.


texts:
To build my tank for a Unity game, I am using Blender. Currently, I am making a turret consisting of an isosphere with half of the faces removed (I needed the bottom to be "flat") with some minor visual edits, two cylinders (one is the hatch, the other the antenna), and a cube to act as a hinge:

The inside is hollow. When I imported it to Unity (drag and drop from File Explorer straight to Unity Assets folder), the entire isosphere was missing as you can see from the preview:

I have tried to correct the normals with CTRL-N as mentioned in other Blender forum pages but it still doesn't work. How exactly do I make my isosphere appear in Unity?

NOTE: This works if imported as a .fbx file but I would much prefer the file to be a .blend file instead (which is default).


texts: How can I add a batch of sprites to a list in Unity's inspector?

texts:
I have a C# script with a public property:

List<Sprite> someSprites;

I would like to add 20 sprites to it, from the inspector window. However, it seems like the only way to do so is to drag one by one. Is there a simpler way to batch fill lists in Unity?


texts:
I wonder if it is possible to export Unity features to my game.

For example if I want user to be able to modify scale or rotation of object, do I have to scritp it myself or can i somehow export it ?
Same question about some simple texturing, adding lights, etc.


texts: Implementing a Turn-Based Game with Windows API Window Messages

texts:
I'm trying to make a 2-player Connect 4 game, but I'm having trouble wrapping my head around some of the concepts related to incorporating event handlers while progressing with the game.

On the one hand, I have my windows:
One is a control window used for entering player information, and has an exit button.
One is the actual game window used for drawing on and interaction with the player.
One is a popup that asks the player a question that they must answer correctly in order to take that turn.

On the other hand, I have my actual game logic. A player's turn could progress as follows:

//create question window with question and await an answer (game state != WAITING_FOR_ANSWER)
//question window is destroyed after the question
//if not correct, move onto the next player's turn
//if correct, await their move (by clicking on the board, state != WAITING_FOR_MOVE)
//then check for win/tie
//then perform end-of-game function / change state if needed
//move onto next player's turn (same function)

//all this time, game window redraws when game has started and needs to change

Meanwhile, my game window draws and responds to clicks depending on the game state. My general method is:

//change state to something like WAITING_FOR_MOVE
//window sees state is now this, and responds to clicks
//window changes state back when move is made
//function continues

The problems arise when trying to get all of this running concurrently. If I try as is, the question window for the first player's turn comes up after clicking the "Start Game: button, but then all windows freeze up. I would imagine this is due to the logic not actually ending, as it requires the window to give it a reason to stop.

I tried wrapping the very first nextTurn() call (in the "Start Game" button handler) in a new thread, but it causes the same thing to happen, except the control window responds when clicking the exit button.

How should I be dealing with program logic and window event handlers at the same time?

I'm also pretty sure I should be accessing the state differently than just checking it until it's the desired result. Would I need a mutex for this?


texts: Rendering performance in FlasCC + UDK when compared to Stage3d and UDK on Windows?

texts:
Adobe recently released the Flash C++ Compiler, which UDK uses to target Flash Player.

Developers can now access UDK for browser applications. Does this mean greater performance than using a Stage3D engine (Away3D 4) and how much of a noticeable difference in performance would it make in rendering speeds?

Is there any benchmark you could propose that would allow to compare them fairly?
I am asking this to help myself understand the consequences in performance for deciding to use UDK in a browser based game. I would also like to know how it compares with UDK running natively in Windows?

I am not asking which technology to use or which is better. Only interested in optimizing rendering speed in a 3d browser game with flash.


texts: What is the primary use of Vertex Buffer Objects?

texts:
From what I've read, it seems VBOs are purely for performance.

I'm working on a very rudimentary learning project in lwjgl and I'm just trying to figure out what more advanced features of the library I should be delving into, and what their use is.

My understanding is that VBOs allow a person to keep vertexes in VRAM while they aren't currently being drawn in a scene. In my case, I'm just drawing quads and performance probably isn't a concern at all, but I'm trying to piece together what's happening under the hood. If I'm drawing quads directly, I'm drawing from the CPU memory, correct? Also, if I'm not doing any checks for visibility, does that mean I'm rendering absolutely everything in the "scene", regardless of whether its in view? Are VBOs a way to store objects and only render what's needed?


texts: How do I ADD gravitation to a rotation matrix?

texts:
I have ported the Matlab script from https://instruct1.cit.cornell.edu/courses/bionb441/LSystem/ to POV-Ray and everything works fine (although I'm not quite sure why). To navigate a "turtle" through space, it utilizes a 3D rotation matrix (roll/pitch/yaw).

Now I would like to add a "tropism" command to simulate gravity pulling on the elements of an L-System, similar to how Laurens Laprés LParser does, and this is where I'm stuck.

This sounds trivial maybe, but I've been hitting walls for the past week, google and dissecting Lparser source code didn't help a bit:

What operation must be performed to "add" a gravity vector to the rotation matrix, iow: how do I easily rotate x degrees towards (0, -1, 0)?

---If it is of any help, this is a simplified example of how my script performs a YAW of dA radians. The columns of the matrix are stored in three vectors hT, lT, uT. For each, macro Rup(Vector, Angle) is called and returns the new vector (column of the matrix).

Corresponding macros Rlp & Rhp for pitch and roll exist, of course. vdot(A, B) is a POV Ray function and returns the dot product of A and B.

#if (cmdT = "+")
            #declare hT=Rup(hT, dA);
            #declare lT=Rup(lT, dA);
            #declare uT=Rup(uT, dA);

#macro Rup(RotVec, Angle)
    #local RotX=vdot(RotVec, < cos(Angle),  sin(Angle),      0>);
    #local RotY=vdot(RotVec, <-sin(Angle),  cos(Angle),      0>);
    #local RotZ=vdot(RotVec, < 0,           0,               1>);
    <RotX, RotY, RotZ>
#end

It works perfectly, but I don't know why so I don't know what to do to add gravitation. Thanks in advance!


texts:
and apologies in advance for this fairly random question.

I'm using Love2D 0.9.1 and Box2D to create two bodies joined by a revolute joint. A simplified representation of the two bodies is a Sphere and a rectangle:

hero.heroPhysics = {}
hero.heroPhysics.body = love.physics.newBody(theWorld, hero.x,hero.y,"dynamic")
hero.heroPhysics.shape = love.physics.newCircleShape(CONSTANT_heroRadius)

hero.extraPhysics = {}
hero.extraPhysics.body = love.physics.newBody(theWorld, hero.x,hero.y,"dynamic")
hero.extraPhysics.shape = love.physics.newRectangleShape(CONSTANT_heroRadius * 3, 8)

hero.jointPhysics = {}
local hx,hy = hero.heroPhysics.body:getWorldCenter()
hero.jointPhysics.joint = love.physics.newRevoluteJoint(hero.heroPhysics.body, hero.extraPhysics.body, hx, hy, false)

Everything seems to be ok, except that the anchor points of the joint are the centers of mass of the two bodies, and I'd like to manually adjust the anchor point of the rectangle to be closer to one end of the rectangle. However, I can't find a way in Love2D to set the joint anchor points? I can get the anchor points via Joint:getAnchors(), but not set them? Or maybe I'm missing something.

In pictures, I'm only able to get something resembling the bottom picture, whereas I really want something like the top picture (please excuse crude drawing):

I've tried changing the rectangle body's center of mass using body:setMassData(), but that doesn't seem to make a difference (unless I try to offset it too much, at which point Box2D dies).


texts:
If I poll keyboard events with SDL2 all I get is the pressed key and the modifiers. But I am using Neo and have some keys like Esc and arrow keys on a different layer which means that e.g. Mod4+i is the same as the left arrow key.

How can I get the modified key from SDL2?

The same problem occurs to me when I want to handle special chars which are located on different keys on different keyboard layouts (/ for example has a dedicated key on US layout while on German layout it is located at Shift+7).

I already found the text input mode, but this seams rather unfitting as one gets a string instead of a single key.

Edit: formatting

Edit 2: I just found another problem .. SDL doesn't recognize Mod4 so when pressing Mod4 plus another key, the mod field is still 0. Other modifiers like Shift work.


texts:
I am developing multiplayer game in unity. For multiplayer i am using photon networking library. I created room and join client successfully.

But Problem is I am doing gameobject movent by this code:

public GameObject player;
IEnumerator Moving (String temp)
{

    for (int i = 0; i < 3; i++) {

        player.transform.DOMove (CurrentPositionHolder, 0.5f).SetEase
           (Ease.Linear);
        yield return new WaitForSeconds (0.5f);
    }
}

DoMoveis library here.

Problem is player movement is not synchronized.

For Synchronization I add photonview component to player gameobject.

And i call coroutine though RPC like this.

player.GetComponent<PhotonView>().RPC ("Moving", PhotonTargets.All, "temp");

Accordingly i changed coroutine like this:

[PunRPC]
IEnumerator Moving (String temp)
{

    for (int i = 0; i < 3; i++) {

        player.transform.DOMove (CurrentPositionHolder, 0.5f).SetEase
           (Ease.Linear);
        yield return new WaitForSeconds (0.5f);
    }
}

I got this error

Illegal view ID:0 method: Moving GO:player
UnityEngine.Debug:LogError(Object)


texts: Spritesheet filesize gets huge after compiling

texts:
I have a 14x2 spritesheet which has 125 Kb in raw .png.
But as soon as I compile that to .xnb, it mutates to 4 MB.

So my question is: Why is that? And how can I fix that?


texts:
I've implemented shadow maps in my simple block engine as an exercise. I'm using one directional light and using the view volume to create the shadow matrices. I'm experiencing some problems with the shadows shimmering when the camera moves and I'd like to know if it's an issue with my implementation or just an issue  with basic/naive shadow mapping itself.

Here's a video:

http://www.youtube.com/watch?v=vyprATt5BBg&feature=youtu.be

Here's the code I use to create the shadow matrices. The commented out code is my original attempt to perfectly fit the view frustum. You can also see my attempt to try clamping movement to texels in the shadow map which didn't seem to make any difference. Then I tried using a bounding sphere instead, also to no apparent effect.

    public void CreateViewProjectionTransformsToFit(Camera camera, out Matrix viewTransform, out Matrix projectionTransform, out Vector3 position)
    {
        BoundingSphere cameraViewFrustumBoundingSphere = BoundingSphere.CreateFromFrustum(camera.ViewFrustum);

        float lightNearPlaneDistance = 1.0f;

        Vector3 lookAt = cameraViewFrustumBoundingSphere.Center;

        float distanceFromLookAt = cameraViewFrustumBoundingSphere.Radius + lightNearPlaneDistance;
        Vector3 directionFromLookAt = -Direction * distanceFromLookAt;
        position = lookAt + directionFromLookAt;
        viewTransform = Matrix.CreateLookAt(position, lookAt, Vector3.Up);

        float lightFarPlaneDistance = distanceFromLookAt + cameraViewFrustumBoundingSphere.Radius;

        float diameter = cameraViewFrustumBoundingSphere.Radius * 2.0f;

        Matrix.CreateOrthographic(diameter, diameter, lightNearPlaneDistance, lightFarPlaneDistance, out projectionTransform);

        //Vector3 cameraViewFrustumCentroid = camera.ViewFrustum.GetCentroid();

        //position = cameraViewFrustumCentroid - (Direction * (camera.FarPlaneDistance - camera.NearPlaneDistance));
        //viewTransform = Matrix.CreateLookAt(position, cameraViewFrustumCentroid, Up);

        //Vector3[] cameraViewFrustumCornersWS = camera.ViewFrustum.GetCorners();
        //Vector3[] cameraViewFrustumCornersLS = new Vector3[8];
        //Vector3.Transform(cameraViewFrustumCornersWS, ref viewTransform, cameraViewFrustumCornersLS);

        //Vector3 min = cameraViewFrustumCornersLS[0];
        //Vector3 max = cameraViewFrustumCornersLS[0];
        //for (int i = 1; i < 8; i++)
        //{
        //    min = Vector3.Min(min, cameraViewFrustumCornersLS[i]);
        //    max = Vector3.Max(max, cameraViewFrustumCornersLS[i]);
        //}

        //// Clamp to nearest texel
        //float texelSize = 1.0f / Renderer.ShadowMapSize;
        //min.X -= min.X % texelSize;
        //min.Y -= min.Y % texelSize;
        //min.Z -= min.Z % texelSize;
        //max.X -= max.X % texelSize;
        //max.Y -= max.Y % texelSize;
        //max.Z -= max.Z % texelSize;

        //// We just use an orthographic projection matrix. The sun is so far away that it's rays are essentially parallel.
        //Matrix.CreateOrthographicOffCenter(min.X, max.X, min.Y, max.Y, -max.Z, -min.Z, out projectionTransform);
    }

And here's the relevant part of the shader:

if (CastShadows)
{
    float4 positionLightCS = mul(float4(position, 1.0f), LightViewProj);

    float2 texCoord = clipSpaceToScreen(positionLightCS) + 0.5f / ShadowMapSize;

    float shadowMapDepth = tex2D(ShadowMapSampler, texCoord).r;

    float distanceToLight = length(LightPosition - position);

    float bias = 0.2f;

    if (shadowMapDepth < (distanceToLight - bias))
    {
        return float4(0.0f, 0.0f, 0.0f, 0.0f);
    }
}

The shimmer is slightly better if I drastically reduce the view volume but I think that's mostly just because the texels become smaller and it's harder to notice them flickering back and forth.

I'd appreciate any insight, I'd very much like to understand what's going on before I try other techniques.


texts: How to move an object uniformly from one point to another at a fixed angle?

texts:
In my 2d java game, I need to move Point objects (as projectiles) from Enemy object to Player object in a straight line. I did some research and found out that I can use atan2(x, y) method of Math class to get the angle, but then how am i supposed to move the projectile in that particular angle(direction)? I checked this question: How do I calculate how an object will move from one point to another? , but did not quite understand. Also there is no vector math in java.
 Any ideas would be very helpful.


texts: How to line up rigidbody velocity with speed of moving floor

texts:
So,  I have a player who remains in the same X position. the floor moves from right to left underneath the player, and I am using tiles of 1 unit.

Here's my jumping stuff:

if (RB.velocity.y < 0)
{
    RB.velocity += Vector2.up * Physics2D.gravity.y * (FallMultiplier - 1) * Time.deltaTime;
}
else if (RB.velocity.y > 0)
{
    RB.velocity += -Vector2.up * -Physics2D.gravity.y * (JumpMultiplier - 1) * Time.deltaTime;
}
if (/*Input.GetKey(KeyCode.Space) &&*/ IsGrounded && JumpDelay < 0)
{
    RB.velocity = Vector2.up * JumpVelocity;
    JumpDelay = 0.1f;
    Debug.Log("Jumping");
}

And here is what moves the floor:

Vector2 NewPosition = TF.position;
NewPosition.x -= Time.deltaTime * Speed;

TF.position = NewPosition;

So, what I want to happen, is I have a movement speed for the floor, and I want to make it line up such that if I jump where the player is directly in the middle of one floor tile, they will land (say 4 tiles later) directly in the middle of another tile.

I can get close by tweaking the velocities... but this feels the wrong way. I want to know what values I might be able to use, and how to calculate what velocities they should be.

Speed of floor right now is at 5, Jump Multiplier at 1.75 and Fall Multiplier at 7. There of course do not line up as I hope, but it gives example values in case that helps. How would I solve this to say, for example, with the given multipliers, what should the floor speed be to line up perfectly?


texts:
I am practising programming games with the Godot Engine and I've been having some issues with RigidBody2Ds.

In this case I have a RigidBody2D as a child of a Node2D. The Node2D is rotating and the RigidBody2D with it. However, as soon as I use apply_impulse() it just returns to it's initial rotation point, which is zero.

Does anyone know what's going on here?


texts: independent lighting per mesh in blender

texts:
In Blender, is it possible to assign lighting objects/effects exclusively to a single mesh? For instance, if I place two meshes next to each other, and two lights (one shining on each mesh), I would want each mesh to not cast a cast any shadow on the other.

For example, in the following rendered image from a "test" star system view:

The rings are casting shadows on the right-most planets. I want the rings to only cast shadows on their own planet.

Is this possible?


texts: Problem Rendering TTF_Font Textures to one Texture with SDL2

texts:
I'm trying to render multiple lines of text to one texture so I only have to render one texture to the screen. However, when I use a dstrect argument in SDL_RenderCopy the text doesn't show up and when I use NULL for the dstrect argument it does work, but it is stretch to the entire texture which I don't want. I've checked the values of the dstrect (x,y,w,h) and they all seem to be at the right values when I try to render.

Here is the creation of the "Font Texture"

void Font::setMessage(std::string textureMessage, SDL_Color textColour){

if(text != NULL){
    SDL_DestroyTexture( text );
    text = NULL;
}

//contents is a string
contents = textureMessage;

//Render text surface
SDL_Surface* loadedSurface = TTF_RenderText_Blended( fontType, contents.c_str(), textColour );

if( loadedSurface == NULL ){
    std::cout << TTF_GetError() << std::endl;
}

if( loadedSurface == NULL ){
    //Error Check
    std::cout << "COULDN'T RENDER TEXT." << std::endl;
}
else
{

    //Create texture from surface pixels
    //text is of type SDL_Texture
    text = SDL_CreateTextureFromSurface( rendererPtr, loadedSurface );
    if( text == NULL ){
        //Error Check
        std::cout << "COULDN'T LOAD FONT TO TEXTURE." << SDL_GetError() << std::endl;
    }
    else{
        //w and h are int pointers to the SDL_Rect "textBox" offsets
        w = &textBox.w;
        h = &textBox.h;
        if( TTF_SizeText(fontType, contents.c_str(), w, h) != 0){
            std::cout << "COULDN'T SIZE FONT." << SDL_GetError() << std::endl;
        }
    }

}

//Get rid of old loaded surface
SDL_FreeSurface( loadedSurface );
loadedSurface = NULL;

}

And here is where I'm trying to render it to another texture:

    dstRect->x = xTemp;
    dstRect->y = yTemp;
    dstRect->w = messageLog.at(placeCount)->getW();
    dstRect->h = messageLog.at(placeCount)->getH();

    std::cout << dstRect->x << " " << dstRect->y << " " << dstRect->w << " " << dstRect->h << std::endl;

    if (messageLog.at(placeCount)->getSelf() != NULL){
        if ( SDL_RenderCopy(rendererPtr, messageLog.at(placeCount)->getSelf(), NULL, dstRect) != 0){
            std::cout << SDL_GetError() << std::endl;
        }
    }

Any ideas why giving an argument would make it not work but using NULL would?


texts: Creating a custom collider shape in unity, and performance concerns

texts:
I want to create a custom chaped collider in unity to create point-defense triggers for objects. I have a spherical collider that triggers for attacking objects that enter it already. However I want cone-shaped colliders for point defense to detect and shoot down enemy projectiles in certain areas.

I can do this by creating a custom mesh and importing that for the collider. How much of a performance hit can this cause? If you have 1,000 of these colliders active in a scene with objects flying in and out of them, will I see significant performance reduction compared to just using a spherical collider and dropping the cone idea?


texts: How to activate Xbox controller vibrations in Unity?

texts: Is there any way to toggle the XBOX controller vibrations in Unity ? I came across Handheld.Vibrate() but it seems like it's not meant for controllers.


texts:
So I have a velocity vector b in world space and I have a "pointing" vector a in world space. I need to know how to make the velocity vector to be relative to the "pointing" vector. Better explanation in image below:

So on the left you can see the vectors in world space, but on the right - vectors in a space. I need to get the vector b in the _a_space from the worldspace.


texts: Can I load a SpriteFont without a content project?

texts:
I'm developing a game in XNA, however, I do not want to use a content project. I'm loading all my textures through different means, and I'd also like to load my fonts without a content project.

Is there any quick way to maybe include the SpriteFont in the main game project?


texts: Exchanging data between custom-built hardware and games

texts:
I have a built my own steering wheel and motion platform that I would like to connect to popular car racing games (e.g. iRacing, Dirt Rally). I need to read data such as the car's acceleration (to send to the motion platform) from these games and send information such as steering wheel's angle to the game. I have written an SDK in C++ to communicate with my steering will and motion platform. Now I need to interface different games with to that SDK.

I searched quite a bit but could not find much information about how this is generally done. Do game developers provide some sort of extension which allows third party hardware developers to communicate with their game?

Any guidance from the community is much appreciated.

Kam


texts: How do I implement melee hit boxes for a top-down game?

texts:
For a 3D top-down game, how should I handle collision in melee combat? My game has no targeting system, so I can't use a simple distance check between attacker and target.

What I am thinking is have the character swing, generate a hit box, run the damage script for any characters in that hit box, and then delete the hit box. How should I handle this?

Also, I would like to use the same attack script for all players and NPCs in melee, even with different attack animations and hit boxes. However, really I can't figure out how to reliably assign who the attacker and who the target are within that script, or how to handle multiple simultaneous attacks.


texts: Are there any cases where I should not use object pools but instead rely on Instantiate and Destroy? (Or more generally, outside of Unity, creating objects on a per-instance basis instead of with a pool)?


texts:
Im developing a flash game and I'd like to know how much info can I store in a browser cookie.

The game is simple, but it needs to store several variables in order to save all the details of your current progress.

The game is only one swf file, no server, no nothing.

I need to know how should I use the cookies to achieve this, and if they have the posibility of doing it, of course.

(several = 200 variables i.e)


texts: Strange I'm getting exception but the scripts in the exception message are not exist on my pc. What should I do?

texts:
I'm using unity version : 2019.2.5f1 personal

I searched on my hard disks the entire pc and none of the scripts in the exception message are exist. And the exception is happens only sometimes. When I stop the game in the editor by pressing the play button the exception is show sometimes and sometimes not.  I tried to close and open over agai the unity editor and the project. Still strange.

  MissingReferenceException: The object of type 'ReflectionProbe' has been destroyed but you are still trying to access it.
  Your script should either check if it is null or you should not destroy the object.
  UnityEditor.ReflectionProbeEditor.OnPreSceneGUICallback (UnityEditor.SceneView sceneView) (at C:/buildslave/unity/build/Editor/Mono/Inspector/ReflectionProbeEditor.cs:651)
  UnityEditor.SceneView.CallOnPreSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:3359)
  UnityEditor.SceneView.DoOnPreSceneGUICallbacks (UnityEngine.Rect cameraRect) (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1935)
  UnityEditor.SceneView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2320)
  System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
  Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
  UnityEngine.UIElements.UIR.RenderChain.Render (UnityEngine.Rect topRect, UnityEngine.Matrix4x4 projection) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRChainBuilder.cs:238)
  UnityEngine.UIElements.UIRRepaintUpdater.DrawChain (UnityEngine.Rect topRect, UnityEngine.Matrix4x4 projection) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:66)
  UnityEngine.UIElements.UIRRepaintUpdater.Update () (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:54)
  UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTree () (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeUpdater.cs:72)
  UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:637)
  UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:240)
  UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:78)
  UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)


texts:
i want to animation the transition between game screens , in my game loop i have a function called getCurrentScreen() which returns a Screen object this Screen Class
has a function called present() this function draw on the framebuffer , when i want to change to another screen i call setCurrentScreen(Screen) , so it will draw the screen i set ,  What i want is to animation the transition between these screens  any suggestion , is the a book or an article that discusses this


texts: Random looking item placement that's deterministic?

texts:
I'm working on a sidescrolling game and I want to generate a forest for the background.  I want the background to be the same for every one to make sure the quality is the same.  I don't have access to a seeded random number generator either, so I can't find a good seed and go from there.

Ideas?


texts: How do I change the relative origins of a Box2D World and a TiledMap in Libgdx?

texts:
I'm playing around with Box2D and TiledMaps and I've come across this minor annoyance.

As you can see, both Box2D and TiledMap render at the center of the screen. This forces me to compensate by adding .5 to every item I spawn in the Box2D world, giving me some problems down the road.

How do I change the origin of these two things? Maybe it has something to do with the camera?


texts: Why is it that the Z-buffer algorithm does not require polygons to be depth sorted to function correctly?


texts:
I currently have a camera class set up and have my model/player loaded but I can't get my camera in the correct position by changing the x,y,z coordinates.

I have set up my "game" with a separate class for the model/player and a class for the camera. I am fairly new to XNA and most of what I have already got is from a tutorial from my lecturer.

Here is my player/model class:

public class Player
{
    public Model model;
    public Matrix world = Matrix.Identity;
    public Vector3 position;
    public Vector3 direction;
    public Quaternion rotation = Quaternion.Identity;
    public BoundingSphere collision;
    public float speed = 2f;
    public float moveForwards;
    public float moveLeft;
    public float forward;
    Matrix[] transform;

    public Player(Model m, Vector3 iPos)
    {
        model = m;
        position = iPos;
        direction = new Vector3(0, 0, 1);
        transform = new Matrix[m.Bones.Count];
        m.CopyAbsoluteBoneTransformsTo(transform);

        foreach (ModelMesh mesh in m.Meshes)
        {
            collision = BoundingSphere.CreateMerged(collision, mesh.BoundingSphere);
        }
    }

    public Player()
    {

    }

    public BoundingSphere getSphere()
    {
        return collision.Transform(world);
    }

    public void sampleInputMovement(GamePadState player)
    {
        moveForwards = (player.ThumbSticks.Left.Y / 5);
        moveLeft = (player.ThumbSticks.Left.X / 32) * -1;
    }

    public void update()
    {
        rotation *= Quaternion.CreateFromAxisAngle(new Vector3(0, 0, -1), moveLeft) * Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), moveForwards);

        Vector3 motion = Vector3.Transform(direction, rotation);
        position += motion * forward;
        world = Matrix.CreateFromQuaternion(rotation) * Matrix.CreateTranslation(position);
    }

    public void Draw(Matrix projection, Matrix view)
    {
        Matrix[] transforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo(transforms);

        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.Projection = projection;
                effect.View = view;
                effect.World = transforms[mesh.ParentBone.Index] * world;
            }
            mesh.Draw();
        }
    }
}

And here is my camera class:

 public class Camera
{
    Vector3 position;
    Vector3 newposition;
    Quaternion cameraRotation;
    Vector3 targetOffset = new Vector3(0, 1f, -6f);

    public Matrix view = Matrix.Identity;
    public Matrix projection = Matrix.Identity;

    public Camera(Game game, Vector3 xPostion)
    {
        position = xPostion;

        projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, game.GraphicsDevice.Viewport.AspectRatio, 1.0f, 1000000f);
    }

    public void update(Matrix targetWorld)
    {
        Quaternion rotation;
        Vector3 target;
        Vector3 scale;

        targetWorld.Decompose(out scale, out rotation, out target);
        cameraRotation = Quaternion.Lerp(cameraRotation, rotation, 0.15f);
        newposition = Vector3.Transform(targetOffset, targetWorld);
        position = Vector3.SmoothStep(position, newposition, 0.8f);

        Vector3 cameraup = Vector3.Transform(new Vector3(0, 1, 0), Matrix.CreateFromQuaternion(cameraRotation));
        view = Matrix.CreateLookAt(position, target, cameraup);
    }
}

Could someone help me get my camera in the correct position?


texts: Any good pattern for managing user input in XNA

texts:
I'm doing some experimentation on XNA, and unlike past experiences with XNA, I wanna do stuff right.

Are there any good patterns for managing user input?

Like... how do I manage what components get the input?

Is there anything like that? I feel like doing the normal - checking for state of a button and if-ing for every thing you need... It can't be that there isn't something more clever and well designed to do that.

I feel that the wheel has already been invented here, I just can't find it.


texts: rotate sphere horizontally around another sphere

texts:
I currently have an earth and a moon. What I'm trying to achieve is to have the moon physically rotate around the earth horizontally along the equator along a circular path.

    moonAngle = (moonAngle + 0.5f) % 360f;
    xPath = (float) Math.sin(Math.toRadians(moonAngle)) * distance;
    yPath = (float) Math.cos(Math.toRadians(moonAngle)) * distance;

    gl.glTranslatef(xPath, yPath, -30f);

The above works fine, except the moon is rotating around the earth vertically around the Prime Meridian like a wall clock. How do I adjust the angle of rotation? I've tried modifying the glTranslatef, but with no success.


texts: How much does it cost to produce a major video game?

texts:
I asked this same question here, but was closed and told to ask it on this site instead.

How much would it cost to develop a video game. I mean like a major PS3/360 video game. I know there really is no set price; but there has to be a pall bark, 100 grand, 10 mil, etc.

I am asking how much the games cost to make, (studio cost, developer salaries, etc.)

Examples would be nice.


texts: My background stopped looping and is mushy and weird looking

texts:
My looping bacground texture looped perfectly, but maybe after building the project as an android project broke it? How can I fix it?

using UnityEngine;
using System.Collections;

public class ScrollScript : MonoBehaviour {

public float speed = 0.01f;

void Start () {

}

void Update () {
    Vector2 offset = new Vector2 (Time.time * speed, 0);

    GetComponent<Renderer>().material.mainTextureOffset = offset;
}
}


texts:
I'm trying to render isometric terrain in javascript. Currently, my tiles are being drawn with small gaps between them:

I want the tiles to line up with no pixel gaps in between:

My rendering function is like this:

var screenX = (x * 60 / 2) + (y * 60 / 2);
var screenY = (y * 30 / 2) - (x * 30 / 2);
console.log(screenX, screenY);
context.drawImage(img, screenX, screenY, 60, 30);

Btw, my image is 30x15.

Can you help me with this problem?

EDIT:

var screenX = (x * 56 / 2) + (y * 56 / 2);
var screenY = (y * 28 / 2) - (x * 28 / 2);
console.log(screenX, screenY);
context.drawImage(img, screenX, screenY, 60, 30);

It works, but I want to find a general solution


texts: How do you maintain content size vs. content quality in a mobile application?

texts:
I am developing my first Cocos2d iPhone/iPad game that includes quite a few sprites, I would need approximately 80 different. As this is for both normal and HD displays I have 2x of each sprite. I am using TexturePacker to optimize the thing.

I would like to ask if there are any rules-of-thumb, tricks, ideas etc. to adjust to in regards to size of content, quality and how you maintain high-quality HD-based graphics due to its size vs. the device memory sizes?

Also, is it a good idea to only have one copy of the sprites and scale it using code?


texts: How should I make realistic electricity?

texts:
I am currently designing electricity for my game. If you've ever played or seen Factorio, this is pretty much the exact way I want it to be.

Okay, on to theory:
What I came up with is some sort of power source produces a certain amount of Watts per frame. Most power sources cannot store any energy, so at the end of the frame, it is all lost.

Machines connected by wires to energy sources will perform a Dijkstra-style flood-fill from themselves through all connected wires, ignoring wires that have already been processed. The Watt cost will slightly increase for each wire it passes through (to simulate energy loss) and when it reaches a battery or power source, it will drain as much as it needs. If the source doesn't have enough, it continues to search for more power. If, by the end of the frame, it doesn't have enough Watts, it simply works slower or stops working entirely.

After all machines have done this, all batteries will perform a similar flood-fill, but ignoring other batteries, and will attempt to take ALL of the energy from sources (up to its storage capacity).

Then, all power sources discard all energy.

Is this how it actually works? I want to use numerical values, so just being connected to an energy source is not enough. Thanks.


texts: Why light baking has too many big blocks

texts:
I'm baking an indirect lightmap, but the result is terrible (as you can see on the ground). There are big white blocks, and one area on my object is missing, so you can see the inside of the object.
What could be the reason? I've tried to change some values in the inspector, to no avail. The current object is about 10 * 15 units.


texts: How to combine tap and long hold gesture recognizers?

texts:
I have a game in which the player moves around a sprite by tapping on various sections of the screen (left, right, up, down). So far, each tap moves the sprite one tile (I use a tile system for movement, among other things), so to move the sprite a long distance the player has to tap in the direction they want for a while. Is there a way to combine a tap gesture recognizer and a long hold gesture recognizer so that if the player taps once, the sprite moves one tile in the direction tapped and if the player holds, the player moves in that direction until the player stops holding?

Here's my code for a single direction just as an example of what I have:

-(void)handleRightTap {

    self.player.direction = RIGHT;
    float currentSpriteX = self.playerSprite.center.x;
    float currentSpriteY = self.playerSprite.center.y;

    //If the animation is not already happening and the destination is accessible...
    if(!self.isAnimating && self.toTile.isWalkable) {
        self.isAnimating = YES;

        //If the player has reached the edge of the screen...
        if([self checkIfPlayerHasReachedEndForPoint:toPoint]) {
            self.isAnimating = NO;
            return;
        }
        CABasicAnimation *moveAnimation = [CABasicAnimation animation];
        moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(currentSpriteX + TILE_WIDTH, currentSpriteY)];
        [moveAnimation setDelegate:self];
        [moveAnimation setFillMode:kCAFillModeForwards];
        [moveAnimation setRemovedOnCompletion:NO];
        [moveAnimation setDuration:MOVE_ANIMATION_DURATION];
        [self.playerSprite.layer addAnimation:moveAnimation forKey:@"position"];
    }
}


texts: How to decide between strafing, turning etc for lateral character movement?

texts:
I have been studying the character movement of many 3rd person games. But just when I think I have come to understand the conventions or found a pattern, it seems I come across another game which does the complete opposite. I understand that there will always be games that defy conventions, but I am trying to work out at least some basic guidelines to follow.

For simplicity sake I have narrowed down lateral movement into 3 categories:

1) Directional Movement

This is movement where based on input of any of the four main directions (forward, back, left, right), the character will move in exactly that direction. In otherwords they will usually do a quick turn towards their direction and then walk straight in that direction. Therefore the character is always facing where they are going. The Assassin's Creed series is a good example of this.

2) Strafing

Most popular in FPS games, but also used in shooter heavy TPS games such as Gears of War and the Max Payne series. Here the character faces forward irrespective of which of the 4 main directions they are moving in, and therefore strafes when moving sideways.

3) Turning

This is similar to strafing except that when moving left or right the character will turn in that direction, moving in a circular way. Games that use this movement style include the GTA series and recently the Uncharted series.

So based on this I am trying to determine how to decide which movement type is best for which type of game. At the moment I am considering to use (2) for when aiming weapons (since this movement is used in FPS games), and (3) for all other ground based movement. But I am not sure if this is the best approach.


texts: How to make a texture appear the same way in a cube?

texts:
My problem seems so simple, that before asking the question here I did a search on google and this site:

https://forums.unrealengine.com/development-discussion/content-creation/33665-applying-and-manipulating-textures-on-actors
https://www.youtube.com/watch?v=p6O4AgSwTmQ
Trouble applying a texture to a cube
How to produce a texture to represent a vector field
Why do I get a blank material in Unreal Engine 4?
How to create smoke that spreads outward in all directions?

But nothing seemed to be related to my problem.

I imported this image.png:

I created a material and added the image to it:

But I did not get the expected result in the game (I wish this yellow line were under that pink arrow that I drew):

Innocently I thought the solution was obvious, so I added another image.png and added it to the material:

To my surprise, the result was worse, the yellow line did not even appear:

I realized this happens because the floor of my game is a "stretched" cube, so the image I added is appearing correctly on one of its faces, not just the one I want.

I'd like to know how to make it look the same on all faces, or some value that I can change so that it appears correctly on the face I want.

EDIT 1 (attempt using rotator)

I put the input time to see if any value would be compatible with what I want, but none is.

I tried with both texture images, but both presented the same behavior:

See that spinning looks like the shaft rotates around the top left of the floor.

For some moments the yellow line will disappear.


texts: What are good ways to find collaborators for a coding weekend?

texts:
Not sure if this belongs here, feel free to push it somewhere else if needed.

When i was at university we would sometimes come together into a room full of beer and fast food and crank out software in a weekend. Unfortunately the group has kind of split up and its just not possible any more.

My question is now: Where can i find like-minded people on the Internet that would like to do something like this? I have an idea what i wanted to do next, but of course other people have ideas too.


texts: Detecting possible moves in a swap-match game

texts:
I've been coming up with ideas for how I would go about programming a Bejeweled-like minigame. After some deep thought, I've managed to figure out how to detect matches (including special bonus cases like 4 in a row, 5 in a row, intersections...) without any real issue.

However, one major issue I'm struggling with is this: how do I detect possible moves, and influence the dispensing of new tiles in light of them?

Specifically, I need to be able to:

Detect that there are no moves possible on the board

A legal move consists swapping two adjacent tiles in order to create a match of at least three in a row.

Ensure that there are no moves on the starting board layout

This could be a simple case of "generate a board, check if there are any matches, try again until there aren't" but this seems messy.

Ensure that there is at least one valid move on the starting board

Again, can be achieved by generating boards until true, but anything with more finesse than brute force would be nice.

Optionally (based on game mode) ensure that tiles fall such that there is always at least one valid move on the board.

Once again, brute force simply says "pick some tiles to drop in, check there's a valid move, if there isn't then drop some different ones in until there is".

Ultimately almost all of these can be done through brute force, but I'm sure there must be a better way. At the core, however, I really need help with figuring out how to detect potential moves on the board...


texts: Slick - create new texture from part of existing texture

texts:
Say I have the following image:

I want to resize this texture, so I can have resizable buttons with a texture.
Now, as you can't repeat a certain area of an image in OpenGL, I have to create a new texture from the center (from (0.1f, 0.1f) to (0.9f, 0.9f) in texture coordinates.

How can I create a new texture from the inside of this image using the Slick library?


texts: Vuforia jewellery try out without marker

texts:
I need to create a virtual jewellery try out in unity 3d + vuforia. I have done it with  marker as a target but now i need to do it without marker. Is there any way we can track live objects using userdefined targets i mean face , neck ,arm, finger using vuforia.

I have done a lot of research but didnt got anything useful.


texts: EndScreen Not Loading My Best Score And Current Score How To Fix?

texts:
I am trying to make my endscreen save last score and current score but it just appears as 0 for both everytime I die event he I picked up the coins image so basically it isnt saving my coins I had and my coins I have right now

here is my endScreen

#---------------------------------------------------
def endScreen():
    global pause, score, speed, obstacles
    # We need to reset our variables
    pause = 0
    speed = 30
    obstacles = []

    # another game loop
    run = True
    while run:
        pygame.time.delay(100)
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                run = False
                pygame.quit()

        # This will draw text displaying the score to the screen.
        window.blit(bg, (0,0))
        score = 0
        largeFont = pygame.font.Font('BLOODY.ttf', 80) # creates a font object
        lastScore  = largeFont.render('Best Score: ' + str(updateFile()),1,(255,255,255)) # We will create the function updateFile later
        currentScore = largeFont.render('Score: '+ str(score),1,(255,255,255))
        window.blit(lastScore , (800/2 - lastScore .get_width()/2,150))
        window.blit(currentScore, (800/2 - currentScore.get_width()/2, 240))
        pygame.display.update()

def updateFile():
    f = open('scores.txt','r') # opens the file in read mode
    file = f.readlines() # reads all the lines in as a list
    last = int(file[0]) # gets the first line of the file

    if last < int(score): # sees if the current score is greater than the previous best
        f.close() # closes/saves the file
        file = open('scores.txt', 'w') # reopens it in write mode
        file.write(str(score)) # writes the best score
        file.close() # closes/saves the file

        return score

    return last
#----------------------------------------------------------

this is my coins  text where I run it on my main loop

    font = pygame.font.Font('times.ttf',29)
    score = 0
    text = font.render("Hearts  =   " + str(score), True, (255,255,255))
    textRect = text.get_rect()
    textRect.center = ((80,70))

and here where is when I die the endScreen loads

           if playerman.health < -5:
               endScreen()

```


texts: Which method(s) does Unity provide for physical integration? RK4? Verlet? Euler?


texts: How to use default framebuffer's depth/stencil when rendering to a texture?

texts:
Is it possible to use the default framebuffer depth buffer when rendering to a texture (instead of using a depth texture)?

The Idea is to continue to render part of the scene normally but on a separate texture so I can later apply a post-processing effect without having to incur the cost of having another stencil/depth buffer. Ho can I do that?


texts: Is drawing an entire game to a render target and then scaling it up a viable solution to a pixel-mismatching problem?

texts:
To clear up some possible confusion caused by my title, my game is meant to be pixelly. I currently achieve this by multiplying sprite sizes and locations by a constant called World.Scale (currently 8). This means every pixel is now 8x8 on screen, which is what I want.

However, I want an easier way to do game calculations without having to figure out where to fit World.Scale whenever I'm drawing or calculating something. Also, I'm currently having trouble with pixel-mismatching (see image).

To solve this, I thought about rendering everything in the game onto a render target, and then scale that render target up by World.Scale and draw it to the screen but I'm not sure how render targets work so I'm not sure about any possible performance implications of this.

Is it a good idea? Is there a better alternative?


texts: XNA Advanced font rendering (outline, shadows, etc)

texts:
I am looking for a tool that will output spritefonts for XNA consumption that have an outline effect. I know that this can be done by rendering the text multiple times, but I'd like to take care of it in the content pipeline.

The options that I was able to find reference to were hosted at sites that are now offline. I know Nuclex has a vector font option, but again, I'd like to stick with sprite fonts and handle the rendering at compile time.

If anyone can link to an archived copy of those free tools, it would be appreciated.


texts: how to bring movement and rotation vectors of object in the current scene in unity editor

texts:
sometimes in unity i need to zoom to fix the exact position and rotation of an object. but movement and rotation sign of the object always stays on object and i think its pivot of the object.

How can i really bring those movement and rotation signs to simply perform those translations of my object?

thank you for helping.


texts: Why do my 3D models look so different when imported into Unity?

texts:
I am importing an image from Maya into Unity but the shapes look drastically different from one another as well as the color and I am not sure what is causing this how can I fix it?

From maya

From Unity


texts: Tiled PolygonObjects rendering wrong in libgdx

texts:
this is how I render the polygons in Tiled
this is how they get rendered in libgdx. Notice the top part of the triangles is straight instead of being hollow.
here is the code I use to convert the polygon object to a polygonshape

    PolygonShape polygon = new PolygonShape();
    float[] vertices = polygonObject.getPolygon().getTransformedVertices();
    float[] worldVertices = new float[vertices.length];

    for (int i = 0; i < vertices.length; ++i) {
        worldVertices[i] = vertices[i] / ppt;
    }

    polygon.set(worldVertices);

    BodyDef bd = new BodyDef();
    bd.type = BodyDef.BodyType.StaticBody;
    Body body = world.createBody(bd);
    body.createFixture(polygon, 1);
    polygon.dispose();

it this normal behavour for libgdx? to flatten the top of the polygons?