texts: How to run code selectively only when a specific trigger collider has been hit

texts:
I have 2 objects both with trigger colliders. The first object has only 1 trigger collider (imagine this to be a sword).

The second object (a person) has multiple colliders. One is a non-trigger collider (used for collision detection for walls, ground) and then multiple trigger colliders on different parts of the body (the purpose is for hurt box).

Now when the sword hits the person, I want to only process code for those trigger colliders and to be able to detect which of those trigger colliders got hit (arm, leg, etc.).

But the event only exposes a parameter hit for the other collider:

void OnTriggerEnter(Collider other)
{
    if (other.gameObject.layer == LayerMask.NameToLayer(Constants.LAYER_HITBOX_PLAYER))
    {
        // Run code here
    }
}

I want to run code only when certain trigger collider are hit, like for example, when the head is hit, or the body, etc. How do I get this info to be able to run conditional code on this method?


texts: what happens with missing vertices in geometry shader

texts:
I am relatively new to GLSL shader programming, and the documentation I found is unfortunately often inscrutable. I am having trouble understanding a few things with how geometry shaders fit into the pipeline.

I am trying to implement silhouette detection by detecting boundary triangles in a geometry shader. A triangle is a boundary triangle if it is front-facing and an adjacent triangle is back facing. The idea then is to emit additional camera-facing triangles to outline them.

For this purpose, I am looking at GL_TRIANGLE_ADJACENCY shaders, since they seem to fit the bill. Let's assume for the moment that I have already got the data loaded properly into the buffer.

For clarity: I plan on doing skinning and the Model View transform in the vertex shader, but to hold off on the perspective projection until I decide what to do in the geometry shader (this seems reasonable, but maybe I am wrong).

Here is where the uncertainties start to come in. First of all, am I expected to manually perform backface culling at some shader stage?

Second, if a triangle has incomplete adjacency information(only 2 out of three triangles for example), how is this conveyed to the shader? Does it just have a length less than 6 vertices?

Third, what does the pass through shader (the one that does nothing special) have to perform? Do I emit every vertex in the input list, or just 3 from the first triangle? And again, am I supposed to/allowed to cull backfaces?

And last, if I decide to emit additional geometry, is there anyway to distinguish that from the (passed-through) input geometry from the point of view of the fragment shader? I'd like to be able to texture map them separately if it is possible.

If I am on the wrong path on any of this, of course feel free to let me know. In case it is important, I am using OpenGL 3.3.

Based on my understanding and Nathan's answer, I could start with a passthrough shader that looks something like this:

layout(triangle_adjacency) in;
layout(triangle_strip, max_vertices = 14) out;
flat out float is_border;

void main() {
    gl_Position = gl_in[0].gl_Position;
    is_border=0.0;
    EmitVertex();

    gl_Position = gl_in[2].gl_Position;
    is_border=0.0;
    EmitVertex();

    gl_Position = gl_in[4].gl_Position;
    is_border=0.0;
    EmitVertex();

    EndPrimitive();
}

And then when/if I add triangle strips for outlines, I will set is_border=1.0 for each of those vertices.


texts: GLSL - Declaring global variables outside of the main function scope

texts:
Does it help to declare variables outside of your main function scope in GLSL? Do these variables actually get reused and is it more efficient?

Here is the code in question:

varying vec2 vposition;
uniform float seed;
uniform float top;
uniform float bottom;
uniform float phi;
uniform float theta;
uniform float scaledPI;
uniform float yn;
uniform float ym;
uniform float rx;
uniform float ry;
uniform float radius;

const float PI = 3.141592653589793238462643383;

float left;
float right;
float mscaled;
float xn;
float xm;
void main() {
    float t = vposition.y * yn + ym;

    if(t <= 0.0 || t >= PI){
        left = phi - PI;
        right = phi + PI;
    }else{
        mscaled = scaledPI / (1 - abs(Math.cos(theta)));
        mscaled = mscaled < PI ? mscaled : PI;
        left = phi - mscaled;
        right = phi + mscaled;
    }
    xn = (left - right) / ((-rx / 2.0) - (rx / 2.0));
    xm = left - ((-rx/2.0) * xn);
    float p = vposition.x * xn + xm;

    vec3 coords = vec3( sin(p) * sin(t), cos(t), cos(p) * sin(t) );
    float nv = surface( vec4( coords, seed ) );
    gl_FragColor = vec4( vec3( nv, nv, nv ), 1.0 );
}


texts: How to monetize and protect a engine's and its framework's copyrights and patents?

texts:
I created a game engine that handles:

Rendering levels with 2d textured curved surfaces
Collisions with curved surfaces
Animationn paths on and navigation in 2d-sapce

I have also made a framework for:

Procedural organic level generation with round surfaces
Level editing
Light weight sprite design

The engine and framework are written in AS3 and I am in the process of translating the code into HaXe to better support other platforms.

I am also interested in adding

Animated curved platforms
More advanced level editing features

Currently, I have a part time job and any time I spend on this engine is either taken out of my limited free time (I'm a student working to support myself through school) or out my time working at my job.

I really believe this engine can make life much easier for people designing Tower Defence games, Shooters and and Platformers while also possibly improving their results. It could also support RTS, RPGs and racing games very well.

It continains original algorithms that could be used for procedural generation of organic round and smooth levels. The algorithms I used are new and are not available in any other level editor I've seen.

In order to constantly improve the Engine and have it tested thoroughly I think the best route is releasing it to the public.

What are the best ways to benefit myself and others with my new framework?

I want to have some lisence, allowing me to share the framework and still benefit from it.

Any advice would be appreciated. This issue has been on my mind a lot this year. I am hoping to find a solution that will bring me some relief.

I am thinking of designing three sample games, releasing them and starting a kickstarter, any advice and thoughts on the matter would be valuable.

My goal is like Markus von Broady suggested, to get people involved in developing the engine and let people use it for games for either a symbolic fee or for free and charge for support.
That or use some form of croud sourcing.

Do I need to hire a lawyer to get some sort of legal document to protect my work?


texts: Player is not looking at correct direction

texts:
My Enemy/Bot is facing the wrong direction as shown in the attached screenshot 1.
Basically what I want is that Enemy/Bot gun should directly face the player, not enemy/Bot himself.

Note: White line in the image is representing Aim direction which is
correct.

Here is my Code:
Vector3 targetPosition = kbcrd.playerToEngage.thirdPersonPlayerModel.shootTarget.position;
targetPosition .y = 0;

Vector3 botPosition = pb.thirdPersonPlayerModel.gunDirection.position;
botPosition.y = 0;

Quaternion targetRotation = Quaternion.LookRotation(targetPosition - botPosition);

//pb is Bot which is holding transform and other scripts.
pb.transform.rotation = Quaternion.RotateTowards(pb.transform.rotation, targetRotation, kbcrd.lookingInputSmooth);

What I Get from the above code is this: (Screenshot # 1)

What I want is this: (Screenshot # 2)

Guns And player Orientation:

Full function if needed:
public override void WriteToPlayerInput(Kit_PlayerBehaviour pb)
{
    CampaignModeControlRuntimeData kbcrd = pb.botControlsRuntimeData as CampaignModeControlRuntimeData;
    CampaignModeEnemyAI botCampaignModeAI = pb.gameObject.GetComponent<CampaignModeEnemyAI>();

    if (botCampaignModeAI.enemyInRange)
    {
        if (kbcrd.enemyPlayersAwareOff.Contains(botCampaignModeAI.detectedEnemies) == false)
        {
            kbcrd.enemyPlayersAwareOff.Add(botCampaignModeAI.detectedEnemies);
        }

        kbcrd.playerToEngage = botCampaignModeAI.detectedEnemies;
        //CheckForEnemies(pb, kbcrd);
    }
    else
    {
        kbcrd.playerToEngage = null;
    }

    UpdateAimPosition(pb, kbcrd);
    FiringDecision(pb, kbcrd, botCampaignModeAI.enemyInSight);
 }

Any help is appreciated. I know its simple problem but I struggling now. :(


texts:
Flash CS5 AS3
Is there a way to reset all the timelines while/if the Frame 1 en Scene 1 is called?

I happen to have lots symbols with timelines, if I gotoAndPlay Scene 1 frame 1, most symbols  won't restart.

I use

MovieClip(root).gotoAndPlay("one");


texts: Changing player color without multiple player bitmaps

texts:
Possible Duplicate:
  How to colorize certain parts of a model - like RTS games have those team colors?

Ok, so here is my current situation. I have a player model, fully UV mapped, and textured. At first I made multiple bitmaps for the character representing multiple colors for each team in the game. (red, blue, green, yellow, etc) Well, as my player count build up, space lowers. So I needed to make a new method of keeping the game effecient, clean, and fast. So I thought of the idea of having a color mask (alpha map covering the areas to be colored). I am using OpenGL, and I just have NO idea on where to begin!

So I ask you, are there any libraries? methods? anything that could help me do this?


texts: How do you calculate a sprite's localScale to resize the sprite to a defined height?

texts:
I'd like to uniformly scale a Sprite in Unity, so that its height on the screen matches the height of a button on a canvas. The scene setup looks like:

Canvas with a CanvasScaler and a reference resolution of 800x1280 pixels.
A button on the canvas with a height of 90 pixels.
A sprite with a texture size of 250x250 pixels.
The sprite's pixels per unit setting is set 100.
An orthographic camera with a size of 5.
The transform.scale values of all involved components are (1,1,1).

Now the question is, how do you calculate the sprite's localScale value so that it appears with the same height (90 pixels) as the button? What's the math behind it?


texts: How to select parent of currently selected object?

texts: When i select an object, i can't find a function to select its parent. Does this basic feature exist ? I want to select the parent of selected object and then step up to find parent of parent so on without using the hierarchy window.


texts: Help with converting an XML into a 2D level (Actionscript 3.0)

texts:
I'm making a little platformer and wanted to use Ogmo to create my level. I've gotten everything to work except the level that my code generates is not the same as what I see in Ogmo. I've checked the array and it fits with the level in Ogmo, but when I loop through it with my code I get the wrong thing. I've included my code for creating the level as well as an image of what I get and what I'm supposed to get.

EDIT: I tried to add it, but I couldn't get it to display properly

Also, if any of you know of better level editors please let me know.

xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("Level1.oel"));
        function LoadXML(e:Event):void
        {
            levelXML = new XML(e.target.data);
            xmlFilter = levelXML.*
            for each (var levelTest:XML in levelXML.*)
            {
                crack = levelTest;
            }
            levelArray = crack.split('');
            trace(levelArray);
            count = 0;
            for(i = 0; i <= 23; i++)
            {
                for(j = 0; j <= 35; j++)
                {
                    if(levelArray[i*36+j] == 1)
                    {
                        block = new Platform;
                        s.addChild(block);
                        block.x = j*20;
                        block.y = i*20;
                        count++;
                        trace(i);
                        trace(block.x);
                        trace(j);
                        trace(block.y);
                    }
                }
            }
            trace(count);


texts:
I bought some animated models which came as FBX files from the unity asset store and I'm trying to export them to PNG sprite sheets in Maya (for an html5 web project).

The file seems to be main fbx (character.fbx) and then an FBX file for each animation named character@animation.fbx.

I was wondering if there was a way for me to import all of these fbx files into Maya and then batch render each animation to PNG frames with some naming/directory structure?

Currently, I can import the main character fbx and an animation fbx and then render that single animation. This works, but it's tedious. Is there anyway to render all the animations at once?


texts:
I am working on a fast paced turn based game, each turn the player can move left, right or stay put and choose whether or not to fire. Each turn the shots move one block in the direction they are pointing.

I would like to implement NegaMax on this game for curiosity's sake.

Could anyone recommend a brilliant tutorial they tried and found satisfactory?

Thanks


texts: How to fix problem in serpentine case using Blinn/Loop algorithm

texts:
I'm trying to implement Blinn/Loop algorithm to render cubic bezier on shader. I calculate the curve type using code below (v0, v1, v2, v3 are cubic bezier segment):

CurveType CurveRenderer::DetermineType (Point    v0,
                                        Point    v1,
                                        Point    v2,
                                        Point    v3,
                                        double& d0, double& d1,
                                        double& d2, double& d3)
{

    CurveType curve_type;

    Eigen::MatrixXd M3(4,4);
    M3 << 1,  0,  0, 0,
         -3,  3,  0, 0,
          3, -6,  3, 0,
         -1,  3, -3, 1;

    Eigen::MatrixXd B(4, 4);
    B << v0.x, v0.y, 0, 1,
         v1.x, v1.y, 0, 1,
         v2.x, v2.y, 0, 1,
         v3.x, v3.y, 0, 1;

    Eigen::MatrixXd  C = M3 * B;

    Eigen::MatrixXd m0(3,3);
    m0 << C(3,0), C(3,1), C(3,3),
          C(2,0), C(2,1), C(2,3),
          C(1,0), C(1,1), C(1,3);

    Eigen::MatrixXd m1(3,3);
    m1 << C(3,0), C(3,1), C(3,3),
          C(2,0), C(2,1), C(2,3),
          C(0,0), C(0,1), C(0,3);

    Eigen::MatrixXd m2(3,3);
    m2 << C(3,0), C(3,1), C(3,3),
          C(1,0), C(1,1), C(1,3),
          C(0,0), C(0,1), C(0,3);

    Eigen::MatrixXd m3(3,3);
    m3 << C(2,0), C(2,1), C(2,3),
          C(1,0), C(1,1), C(1,3),
          C(0,0), C(0,1), C(0,3);

    d0 =  m0.determinant();
    d1 = -m1.determinant();
    d2 =  m2.determinant();
    d3 = -m3.determinant();

    double D = 3.0 * d2 * d2 - 4.0 * d1 * d3;

    curve_type = CURVE_TYPE_UNKNOWN;

    if(d1 != 0 && D > 0)                    curve_type = CURVE_TYPE_SERPENTINE;
    else if(d1 != 0 && D < 0)               curve_type = CURVE_TYPE_LOOP;
    else if(d1 != 0 && D == 0)              curve_type = CURVE_TYPE_CUSP_WITH_INFLECTION_AT_INFINITY;
    else if(d1 == 1 && d2 != 0)             curve_type = CURVE_TYPE_CUPS_WITH_CUPS_AT_INFINITY;
    else if(d1 == 0 && d2 == 0 && d3 != 0)  curve_type = CURVE_TYPE_QUADRATIC;
    else if(d1 == 0 && d2 == 0 && d3 == 0)  curve_type = CURVE_TYPE_LINE;

    return curve_type;
}

Where finally I obtain klm from matrix rMat (4 by 4), which is rMat = inverse M3 * F:

...
Eigen::MatrixXd rMat = invM3 * F;
...

To calculate Matrix F, I use this code:

...
case CURVE_TYPE_SERPENTINE:
    tl = d2 + ((1.0 / sqrt(3.0)) * sqrt(3.0 * d2 * d2 - 4.0 * d1 * d3));
    sl = 2.0 * d1;
    tm = d2 - ((1.0 / sqrt(3.0)) * sqrt(3.0 * d2 * d2 - 4.0 * d1 * d3));
    sm = 2.0 * d1;

    F << tl * tm,                   tl * tl * tl,           tm * tm * tm,           1,
        -(sm * tl) -(sl * tm),      -(3.0 * sl * tl * tl),  -(3.0 * sm * tm * tm),  0,
        sl * sm,                    3.0 * sl * sl * tl,     3.0 * sm * sm *  tm,    0,
        0,                          -(sl * sl * sl),        -(sm * sm * sm),        0;

    break;

case CURVE_TYPE_LOOP:
    td = d2 + sqrt(4.0 * d1 * d3 - 3.0 * d2 *d2);
    sd = 2.0 * d1;
    te = d2 - sqrt(4.0 * d1 * d3 - 3.0 * d2 * d2);
    se = 2.0 * d1;

    F << td * te,                   td * td * te,                               td * te * te,                           1,
        (-se * td) - (se * te), (-se * td * td) - (2.0 * sd * te * td),     (-sd * te * te) - (2.0 * se * td * te), 0,
        sd * se,                    te * sd * sd + 2.0 * se * td* sd,           td * se * se + 2 * sd * te * se,        0,
        0,                          -sd * sd * se,                              -sd * se * se,                          0;

    break;
...

I'm encountering a problem on serpentine type where the result appears wrong,
From the paper, they say if(curveType == SERPENTINE && d1 < 0) i need to flip the k^3 - lm <= 0 equation to k^3 - lm > 0. It doesn't work. Strangely, the problem also occurs even when d1 > 0.


texts: How can I import a .3ds file into JMonkeyEngine 3?

texts:
I am trying to import an animated character body (with skeleton) from 3D Studio Max to JMonkeyEngine 3, but while we succeeded at importing some animations, we cannot seem to export the skeleton to .skeleton.xml using OgreXML format. Since OgreXML seems to be the favored way to import models into JME, we dropped .obj files and such.

How can I get a .3ds file into my JMonkeyEngine project?


texts: OpenGL 4.5 Primitive Restart vs. Base Index

texts:
From how I understand the two techniques (Primitive Restart and Base Index) explained on https://www.opengl.org/wiki/Vertex_Rendering , they both do the very same thing. Simply spoken, they allow me to put many meshes into the same buffer and then render them as multiple meshes again. Is my understanding right?

If my understanding is indeed right, then my next question would be how well either of them works together with indirect rendering and multi-rendering.
Let's just use the following example: I have multiple meshes, which are put together to one entity. Multiple entities are put together to one scene. In a scene, entity attributes, like location, textures,... might change. What would be the most optimized way to render them performance vise? By using glMultiDrawElementsBaseVertex() (is there an indirect version?) or by setting glPrimitiveRestartIndex() and then using glMultiDrawElementsIndirect()?
If there is no indirect variant for the former, shouldn't the latter be the better choice?

Of course, there might be a better way of doing things. If so, I would really like to hear it :)


texts: Playing different particle effects in Unity on the same ParticleSystem

texts:
The question really sums it up: What is the best way to use one particle system for playing different particle effects?

The scenario: GameObject is picked up and it starts playing a simple indicator particle effect. If the GameObject is placed on a special platform it will play another particle effect.

I have very little experience with particle systems - how would you do this?


texts: Importing audiofile into Unity3d gets shown after ending playmode

texts:
I am working on a game where the user has the possibility to import custom audio tracks that can be listened to during the game.

For this I am making use of System.IO.File.Copy method. This works, there are no issues or flaws here. When I inspect the target and destination folder the file(s) get copied properly and show up in the folder.

The issue however is that the Unity Editor doesn't show the file despite it actually being there. During play mode in the Unity editor the new file isn't shown in the resources folder (which I use as destination for now). When I use windows file explorer I can clearly see the file in the corresponding folder. Using debugs (in Unity) also state that the folder is empty, however when I use debugs outside of Unity it shows that the folder contains the copied item. Keep in mind that these both debugs are called roughly at the same time. I have tested this in many ways to be 100% certain that Unity doesn't see the file, while it is there.

So once I stop playmode it starts loading/importing/processing the new file and then it shows up in the folder in unity as well. When I launch playmode after this the file is indeed loaded and included in the game as well.

I however need this to happen without having to stop playmode. So there is probably some type of processing that I haven't called for Unity to process the addition of the new file and for it to be visible.

So in a nutshell basically copying a file from folder to folder isn't enough for Unity to directly utilized in the same play session (and all after). How can I make the audio-file directly showable and accessable?

There aren't any errors or warnings. The file plays correctly after it has been processed. I am at a loss with this issue/bug.


texts: Handling Ctrl- shortcuts in Unity, respecting user preferences

texts:
I am implementing some software with Unity that needs to support Ctrl-<key> shortcuts such as Ctrl-c. I want to do this in a way that respects the user's operating system keyboard preferences; for example, these shortcuts must still be recognized when the user uses sticky keys, or when the user has mapped caps lock as control.

Many of the solutions I found online for implementing keyboard shortcuts look something like this:

if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) && Input.GetKeyDown("c")) UnityEngine.MonoBehaviour.print("C-c");

This solution is totally unacceptable to me because it "hard-wires" holding down a control key as the method for sending a control-key modifier, bypassing the operating system's possibly-customized handling of the control key modifier.

Most games don't support keyboard preferences properly, but I am hell-bent on making sure the software I write will do this properly. I'm particularly concerned about supporting sticky keys because this is an accessibility issue - some more complicated shortcuts will not be available to users with disabilities if sticky keys isn't handled correctly.

How can I support keyboard shortcuts properly in Unity?


texts: How can I check If sublicensing a game to someone is not subject to cheating?

texts:
Basically I have a game, but here In Italy I need to subscribe to Commercial Chamber just to start selling (3000€/year). So my idea was to let a friend sell the game on the AppStore/PlayStore/Windows store using his accounts. He will instead pay me after keeping a royalty on the revenue. Or at least this seems to become the contract (if you are actually italian and can give me hints on this topic it would greatly appreciated)

Is there any tool available to various stores so I can check the income of my apps even if sold by third parties (the idea is to be sure he takes only the royalty we previously agreed on). In example: enable my account to become developer account so I can test In-App purchases with my account, and then sell the apps with the account of my friend.

One idea was to use analytics tools, but that's unviable:

If the app get cracked analytics tools will not show correct results (and hackers can easily remove analytics too so).
If my friend has to access source code/ Unity project file he could remove any tracking code (he need to have that access, because he have to setup license Keys on each build anyway).

Thanks.


texts: How to change 100 GameObjects' color without pushing RAM to hard?

texts:
I'm developing a mobile game and one of the gamemodes has 100 gameobjects(basic cubes). And they all have same material. I need to know how to change their color one by one with script.

I'm not very good at programing, so only idea that i have for this situation is declaring 100 objects to var, and then change their color one by one.

But like a said it's a mobile game so i need to do it with simplest code so performance would be perfect.


texts: Determining IF & WHERE a line intersects with a 2D plane (in 3D space)

texts:
The following problem I'm working on is for one of my favorite past-times: game development.

Problem: We're in 3D space. I'm trying to determine if a line between two vectors in said space is passing through a circle; the latter of which consists of: center vector, radius, yaw & pitch.
In order to determine that, my aim is to convert the circle to a plane which can either be infinite or just have the diameter of the circle for all it's sides.
Should the line between the two vectors in fact pass through that plane, I am left with the simple task of determining whether that intersection point is within the radius of the circle, in which case I can return either true or false.

What's already working: I have my circles set up and the general framework is there. The circles are appearing/rendered in the 3D space exactly as specified, great!

What was already tried: Copied some github gist codes and tried to make them work for my purposes. I kinda worked, sometimes at least. Unfortunately due to the nature of how the code was written, I had no idea what it was doing and just scrapped all of that. Researched the topic a lot, too. But due to me not really understanding the language people speak when talking about line/plane intersections, I could have read the answer without recognizing it as such.

Question: I'm stuck at line intersections. No idea where to go and how it works logically! So, where do I go from here and how can one comprehend all of this?

Note: I'm working with Java, but I'm not looking for spoon-fed code. It's a logical issue I'm trying to get past. If explained well enough, I will make the code work with trial and error!


texts: Is there an easy way to calculate the velocity of an object on a pendulum?

texts:
Want to have a rope travel to the mouse on  m2 click and then act as the pivot of a  pendulum, with the player being the bob.
Used some math I don’t really understand to get the angle of the mouse from the player,  and can get the distance very easily. Is that enough information to calculate the velocity of the bob? If not what other information do I need? How do I calculate velocity from that?
Using sfml. Beginner to programming so apologies if this is a stupid question.
Edit: Found out how to find the period and frequency of a pendulum, how do I apply those to velocity?

edit 2: https://youtu.be/9iaEqGOh5WM this video was very helpful


texts: Rotating Object using Unity's Bolt system

texts: I want to rotate a object and stop when it reaches a certain angle using Unity's Bolt, visual scripting.


texts: How to use CreateGridMesh in RuntimeMeshComponent

texts:
I don't know to pass on the 5th parameter. I'm still new with C++ so if someone could help me with the pointer

void AGrid::GenerateMeshes_Implementation()
{
    FRuntimeMeshDataPtr Data = GetRuntimeMeshComponent()->GetOrCreateRuntimeMesh()->GetRuntimeMeshData();
    Data->EnterSerializedMode();

    Data->CreateMeshSection(0, false, false, 1, false, true, EUpdateFrequency::Average);

    auto Section = Data->BeginSectionUpdate(0);

    FVector BoxSize = FVector(100, 100, 100);
    URuntimeMeshShapeGenerator::CreateBoxMesh(BoxSize, *Section.Get());
    URuntimeMeshShapeGenerator::CreateGridMesh(128.0f, 128.0f, 64, 64, *Section.Get()); // <---- This one

    Section->Commit();
}

It says it needs to be a TSharedPtr<FRuntimeMeshAccessor>&

void URuntimeMeshShapeGenerator::CreateGridMesh(float Width, float Height, int32 NumSubdivisionsX, int32 NumSubdivisionsY, const TSharedPtr<FRuntimeMeshAccessor>& MeshBuilder)
{
    MeshBuilder->EmptyVertices(CREATEGRIDMESHTRIANGLES_NUMVERTS(NumSubdivisionsX, NumSubdivisionsY));
    MeshBuilder->EmptyIndices(CREATEGRIDMESHTRIANGLES_NUMTRIS(NumSubdivisionsX, NumSubdivisionsY));
    FVerticesBuilderFunction VerticesBuilder = [&](const FVector& Position, const FVector& Normal, const FRuntimeMeshTangent& Tangent, const FVector2D& UV0)
    {
        int32 NewVertex = MeshBuilder->AddVertex(Position);
        MeshBuilder->SetNormalTangent(NewVertex, Normal, Tangent);
        MeshBuilder->SetUV(NewVertex, UV0);
    };

    FTrianglesBuilderFunction TrianglesBuilder = [&](int32 Index)
    {
        MeshBuilder->AddIndex(Index);
    };

    CreateGridMesh(Width, Height, NumSubdivisionsX, NumSubdivisionsY, VerticesBuilder, TrianglesBuilder);
}


texts: Is it bad practice to for the server to request data for a client from another client?

texts:
I'm making a collaborative whiteboard app so that when someone is drawing and uses a rectangle for example, a rectangle packet is sent to the server with parameters like x, y, width, height, color and then that packet is sent to everyone else in the room so that a rectangle is drawn on their screen.

So far everything works perfectly and there's also a stack on each client of all the commands thus far for infinite undo and redo. However, there server does not contain this stack because all it has to do is forward commands to clients in the room.

Everything is working perfectly so far and everyone can see everyone else drawing in real time but I'd like to implement a feature where if someone joins a room late they can see the current whiteboard. That is, the entire command stack would have to be sent to someone. However, this data isn't stored on the server, but each client has their own (identical copy).

Would it be bad for when someone joined to have the server ask one of the clients (which? round-robin?) to send his command stack to the server and have the server forward it to the client? My concerns are the delay and teh amount of data being sent in one go (congestion).

What do you all think? Are there any other options?


texts: How to setup animation based events without depending on an animation?

texts:
How can I have events based off animations without relying on them? Take for example reloading in a FPS game. You'd hit a button to reload your weapon, the animation will play, then animation will hit a certain frame, then the weapon will be reloaded. There's a dependency on the animation eventually hitting that key frame before the weapon can reload and the character can go into another state. Without the animation, the weapon would never reload, and without some arbitrary timeout, the character would be stuck in that state forever.

Checking for the existence of an animation is an option. However, this requires us to still know about some sort of animation, and what it's playing. Am I over engineering this? Would it be okay for the logic of some object to have some information about it's animations?


texts: How to detect intersections with only colliders and not use the physics engine?

texts:
I do not want to use the physics engine, I only want the collider to detect when they have entered into another collider, then I want to handle what happens to the objects.

Moving static colliders (colliders that do not attach to a rigidbody) around has a penalty, so how would I accomplish this without incurring a penalty for moving colliders around that do not attach to a rigidbody?

I could use a Kinematic Rigidbody Collider for this, but this seems kind of hacky since they are meant to be used in conjunction with Rigidbody Colliders (at least thats what their intention seems like from the manual). I have also looked into CharacterController, it says it "does not make use of Rigidbody
physics", but it does not say how the physic system treats it which would come with a penalty if the physic system sees it as a static collider (as it uses a capsule collider with no rigidbody). I tested to see if it did have a penalty, but unless stated how it works within the physics system, it is just speculation which could lead to undesired results.

Other than a Kinematic Rigidbody Collider or CharacterController, is there any way to accomplish this in unity?


texts: How can I draw crisp per-pixel images with OpenGL ES on Android?

texts:
I have made many Android applications and games in Java before, however I am very new to OpenGL ES. Using guides online, I have made simple things in OpenGL ES, including a simple triangle and a cube.

I would like to make a 2D game with OpenGL ES, but what I've been doing isn't working quite so well, as the images I draw aren't to scale, and no matter what guide I use, the image is always choppy and not the right size (I'm debugging on my Nexus S).

How can I draw crisp, HD images to the screen with GL ES?

Here is an example of what happens when I try to do it:

And the actual image:

Here is how my texture is created:

//get id
int id = -1;
gl.glGenTextures(1, texture, 0);
id = texture[0];

//get bitmap
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.ball);

//parameters
gl.glBindTexture(GL10.GL_TEXTURE_2D, id);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER,
        GL10.GL_NEAREST);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER,
        GL10.GL_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
        GL10.GL_CLAMP_TO_EDGE);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
        GL10.GL_CLAMP_TO_EDGE);
gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE,
        GL10.GL_REPLACE);

GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);

//crop image
mCropWorkspace[0] = 0;
mCropWorkspace[1] = height;
mCropWorkspace[2] = width;
mCropWorkspace[3] = -height;
((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D, GL11Ext.GL_TEXTURE_CROP_RECT_OES, mCropWorkspace, 0);


texts: Which would a game development company prefer; UDK experience or C++ game projects?

texts:
Which would a game development company prefer, a developer with experience in UDK engine, or a developer with projects made entirely in c++ with a graphics engine like Ogre3D?

I think that a coder can demonstrate better his abilities with games made in c++, because it requires a knowledge deeper in many fields. However, currently there is a lot of companies that develop games with UDK. Now I don't know if it's better specialize in a game engine like UDK or not.


texts: Which of these two approaches to particle generator design is preferable?

texts:
What is a better idea for a particle generator (bearing in mind the intention to instance the draws to all the particles in the future)?

A particle emitter that maintains its own list of particles and calls their update.
A particle emitter that is passed through a global list of all particles in the world, adds the necessary particles to it and lets one global particle update take care of the rest.


texts: HDRP Decals, how to fix streching decals

texts:
Is there a quick way to fix strenched decals when they don't quite perpend. to the normals in it's entirety?

What I do now is to get the normal of the surface and rotate decal accordingly, but with extreme angled corners it gets streched as a result.


texts: Is the June 2010 DX SDK really the latest?

texts:
I have not been involved in game development, using the DirectX SDK, since around 2008. From the looks of it, the June 2010 release, of the DirectX SDK, is still the latest release. This release is more than two years ago, based on the name. Is this still the latest release, or has there been a naming convention change and I am missing something newer? I've seen mention of it being rolled into a Windows SDK, so I am confused and figured I would come here to ask.

Thanks


texts: Is there an algorithm to detect the "mainland" on a 2D map?

texts:
On this map, the "mainland" is all the land that can be connected to the center of the map in the four cardinal directions (north, south, east, west -- not diagonally).

I would like to detect the mainland and fill the holes in it. I thought of three things:

Search in every non-water (dark cells) cell if can be connected to the center of the map using a path finding algorithm. Too expensive! But this could work for the islands.
The mainland is filled with a bucket of green paint. Each hole is surrounded by paint... now what? If i check every water point inside the mainland for adjacency i'll delete some peninsulas and other geographical features displayed on the shoreline.
Some kind of edge detection to figure out the mainland. Keep whatever is inside, fill it if it's water, remove what's outside. Complex?

Perhaps some game experienced developer can help me out with this, possibly giving me the name of some known algorithm or technique?


texts: How to create button prompts for interactable objects in Unity?

texts:
I have a class of objects tagged as interactables that my player can interact with when within range.

When my player is near them, I want to display a button prompt at the bottom of the screen, along with a description of the type of interaction possible (for example, "inspect", "use", etc.).

I want to account for the possibility that the player might be within range of two or more of them at once, and thus allow him to toggle through them, displaying their button prompts in turn.

If my player interacts with something which generates a text box or other modal, I want the button prompt to disappear, but to return when the text box or modal is closed.

Any advice on how to go about achieving this?

I've done it in the past in different engines, but I have always been unhappy with how convoluted my method was. I'd like to hear how others might tackle this. Given how common this kind of thing is in games, I'm surprised I haven't found a good tutorial on it yet.

You can be as general or as specific as you'd like in your answer.


texts: Make platformer character stay in the air at the top of a jump

texts:
I have a player who can jump. I want the character to stay in its position and not fall to the floor.
This is the code I am using so far:
private void FixedUpdate()
{
        if(moveup)
        {
            rigid.AddForce(new Vector3(0, 1f, 0) * speed, ForceMode2D.Impulse);
            moveup = false;
        }
}

How can I stop the character from falling?


texts: How to set C++ language standard for VS2019 in an Unreal project?

texts:
I am trying to a simple thing, just like that, in a header file;
#include <filesystem>
#include <iostream>

namespace fs = std::filesystem;

And IntelliSense goes:
namespace std has no member filesystem.
Okay no worries, it's an easy fix.
Just set the C++ language standard in the propery pages...
Well, it turns out it isn't, it's not an option in Unreal VS project. Tried typing in search bar, View -> Property pages, but no luck.
Okay let's try doing the whole thing in a console project first.
Same message from IntelliSense as before.
Ok, no worries, I found this.
I found my settings under: Project > projectname Properties
And voila, the console app works.
Let's try it in the Unreal project.
Well, well... My options are limited here.

I had a look around in the project settings as well:

How do I get this filesystem header work with my project?


texts: Isometric game engine in JavaScript/HTML5

texts:
Is anybody aware of any stable-ish (ie out of alpha) isometric drawing engines for JavaScript/HTML5?  I have done some Google searches and found a few, but they were mostly in alpha/invite-only status.

Is there anything mature enough to be used in a production environment?  Or should I simply roll my own implementation for now and wait for the rest of the world to catch up?


texts: Trying to open an .fx file, text editor full of random symbols

texts:
Sorry, I'm a complete newbie to this place, and I don't know how appropriate my question is, but I didn't know where else to ask.

I'm trying to make a mod for The Sims 2, and this game uses a lot of internal formats which it bundles up in .package files. Its main modding program is called SimPE. SimPE can read some of these internal formats (for which plugins exist), others not. Specifically, it lacks a plugin for .fx files, which are all stored in a game file named Effects.package. This file had one resource which I've exported as an .fx.

I've opened the .fx with Notepad, with Visual Studio and with FXEditor, but for the most part it's not intelligible. It looks like this:

I understand I'm supposed to see code here.

Is there a way to fix my .fx (heh), or to get it into a readable format?


texts: Why isn't my aspect ratio calculation working on Android platforms?

texts:
I have this method:

public final float aspectRatioHeight(float originalW, float originalH)
{
    float newHeight = (originalH / originalW) * (Gdx.graphics.getWidth()-20);
    return newHeight;
}

To calculate my an aspect ratio for the height of a sprite, but when i try run the app on an android device, the height still stretches out the app.

This is what im doing to set the size.

splashSprite.setSize(Gdx.graphics.getWidth() - 20, aspectRatioHeight(SW, SH) - 20);


texts: Cocos2dx Windows Phone 8.1: Seperate Characters in RTL Label

texts:
I use below code to show a text :

auto label = Label::createWithSystemFont("سلام و خداحافظ", "BTitrBold", 24);

( RTL text like Persian, Arabic and Hebrew)
This code works fine in both **Android** and **iOS**. But when I run project on **WindowsPhone8.1-universal** device, the label shows the characters not only separated but also LTR , as below screenshot:

I was faced same problem in Android long time ago. But It solved Link.

In order to solving problem I compiled fribidi library for windowsPhone. this library solve separated character problems (somehow) but still Wrapping is a big problem.

Please solve Right-To-Left problem in WindowPhone8.1. We really miss this platform's store.

PS: cocos2dx 3.10


texts: Unity animation transition with 0 Exit Time doesn't transition immediately

texts:
Question

Why doesn't an animation transition with an Exit Time of 0 immediately transition to the next state?

Minimal example

Using Unity 2018.3, I set up an AnimatorController with two states: Initial and Next. I wanted Initial to transition to Next immediately, so I tried setting an Exit Time of 0. However, this doesn't transition immediately:

As shown above, Initial state still runs instead of transitioning immediately to the Next state. (There is no Motion attached to the AnimationState, so perhaps it's using a default duration.)

Below are screenshots of my animation transition settings.

Strange behaviour with small non-zero ExitTime

I also tried using an Exit Time of 0.01 (i.e. transition after 1% of the animation has played), and it transitions almost immediately as I expect most of the time. However, occasionally it will still play the Initial state:

In this case, even though it transitions to Next immediately most of the time, it still occasionally waits for the Initial state to complete. (It happens much less frequently than the image above suggests, but the issue becomes more frequent if I set the ExitTime even lower, e.g. 0.003).

Workaround

From searching online, the recommended solution for immediate animation transitions seems to be to turn off Exit Time and use a condition (e.g. bool or trigger) to transition immediately instead.

(Edit: in my case, I've defined an animator bool parameter called ImmediateTransition and set it to true by default instead of using Exit Time 0.)

This seems to work, but I would like to better understand how Exit Time works and why it's not working the way I expect.


texts:
I'm making a 2D, top-down platformer, in which four or five layers are rendered each time the game draws.  Everything is fairly performant except for the bottom layer, which is the game map.  This is because the map uses a modified version of this effect to draw shadows under the solid objects on the map.

The effect provides different options for the light attenuation and edge blending, which can make pretty realistic looking shadows.  I originally had it blurring edges as much as possible, but not attenuating light.

In my game, only a small portion of the screen is initially visible (most of the rest of the screen is black), so I was able to set the size on the components used to create the shadows to very small.  Ideally, however, I would like the visible size to be able to grow/shrink - meaning I can't set the size for these components and rendertargets once, unless I set them to the full size of the window.  Notice that in the demonstration of the effect, they have a fixed size for the visible region.

Here's where the problem comes in.  If I use edge blending on the entire visible screen, the FPS dies - especially since it's fullscreen.

I've been trying to think of different approaches to mitigate this.  So far I've come up with:

Disabling the edge blending on shadows - this is what we're currently doing as a workaround.  The original effect is performant enough to draw hard-edged shadows without dropping frames noticeably
Multi-threading - I took a look at my processor usage and noticed that although I have eight cores in my dev machine, only one was being used significantly by my application. If it's possible to offload some of the work being done to render shadows, that'd be great.  The problem is that currently, I am rendering everything to the same target (null, or the default target).  What I thought of doing is rendering each layer to a separate render target and threading all of that - the divide and conquer approach.  The problem is that I believe you can only have one active render target at a time, since you can only have one GraphicsDevice.  I'm a bit of a newbie concerning XNA's finer points and threading in C#.  Would it be possible to lock the GraphicsDevice instance so only one thread is using it at a time?  Then I could just try to make sure that each layer is performing all [spritebatch].Draw() calls in as concentrated of a space as possible.  I'm not sure if this would help, though, since the most time-consuming function call is GraphicsDevice.DrawUserIndexedPrimitives(...)
Only rendering the effect on a portion of the screen - I didn't have a very fully-formed idea here.  But it would be nice to be able to only apply the effect on a specific Rectangle.  That way I could set the size of the components to the whole screen, and just pass in the necessary area that is actually visible at the time of rendering.  Ultimately, though, this wouldn't be a great solution, since the visible area in my game has no theoretical upper bound.
Rendering multiple effects at once - I noticed that the effect I linked to has to render six times each time it draws the shadows (if you use edge blending).  The first time is to distort the image and compute the distance to each point (see the link for a more in-depth explanation), then it applies a horizontal reduction, then it actually draws the shadows with the selected attenuation settings, then it blurs them horizontally, and finally, it blurs them vertically.  Not only does this mean setting up six identical sets of vertices for a triangle list, but it also means applying six separate effects for six separate DrawUserIndexedPrimitives calls.  Is there some way to apply multiple effects to a single draw call?

I'm open to any other suggestions, too - or any references you have which may help optimize and improve my game's performance.


texts: Unity GameObject.Find() not working in batchmode?

texts:
I am trying to make GameObject.Find() work in batchmode but for some reason it returns a null object.

my code:

public class test: Monobehaviour {
    public static GameObject go;

    static void doing()
    {
        go = GameObject.Find ("testing");
    }
}
//testing is the name of the gameobject in the editor

I call it from the console on mac using: /Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -projectPath "" -executeMethod test.doing


texts: Changing text through a cursor hover trigger

texts:
In my game I have several house groups (see image below), I want to show a specific message when the mouse hovers a specific house group.

For some reason, this only works on the first switch case (house) but fails on the second switch (house2). The default case doesn't work either. I verified that the case house2 is found by the engine. By not working I mean the text does not appear.

Do you have any idea about the problem?

Code:

public class MouseIsOver : MonoBehaviour {

    private Image TipImage;
    private Text textObject;
    public string text;
    private bool displayInfo;

    void Start ()
    {
        TipImage = GameObject.Find("realtyInformation").GetComponent<Image>();
        textObject = GameObject.Find("realtyInformationText").GetComponent<Text>();
        TipImage.enabled = false;
    }
    void Update();
    {
        Display();
    }

    void Display ()
    {
        if (displayInfo)
        {
            switch (text.ToLower())
            {
                case "house":
                    textObject.text = "house text1";
                    break;
                case "house2":
                    textObject.text = "house text2";
                    break;
                default:
                    textObject.text = "Click on the building";
                    break;
            }

        }
        else
        {
            TipImage.enabled = false;
            textObject.text = "";
        }
        TipImage.enabled = true;
    }

    private void OnMouseOver()
    {
        displayInfo = true;
    }

    private void OnMouseExit()
    {
        displayInfo = false;
    }
}


texts: Calculating t value to use with Hermite interpolation

texts:
I'm developing an FPS in Unity using Photon for networking. The Photon-provided interpolation is very basic so I decided to roll out my own using the Hermite spline.

It works good and is significantly better than the provided interpolation.
However, I was wondering what's the correct way to choose the t value. In a perfect world, it should be incremented by deltaTime*timeBetweenPositionUpdates. However, that doesn't work since even if the tickRate is set to 10 for example, sometimes the client sends it at 9.5, and then at 10.2 and so on and so forth. This means that we can't have a constant increment rate for the t value since it'll either lag behind or move too fast and we'll run out of buffered frames.
What I decided to do is to send the time between frame updates as well and interpolate using that. But, this also isn't perfect by any stretch of the imagination and the receiving client will soon lag very much behind.

What I'm doing now is using a multiplier on the t value such that if there is more frames in the buffer than we want to have then it'll speed the interpolation up, and if there's less than how many we want in the buffer then it'll slow the interpolation down. This works pretty well, but it's a hack I believe.

Is there a better way, or a proper way to do this?


texts: How to manage different shaders dynamically?

texts:
Currently I have only a really basic shader and a shader class.

My question is that if I want to make different shaders (with different uniforms, inputs, etc) how should the architecture look like?

Edit: I want it in a way that I can add/remove/modify shaders without recompiling.

(#1, #2, #3 were written before this edit, so I'm sorry if they are irrelevant now)

(I wrote #4 just now, and currently I am very happy with it, but I would like to hear your opinion about it.)

I have a few ideas:

(1.) Should I make an abstract shader class, and a derived class for every invidual shader program?

(So the abstract class handles the general things, and the derived class handles the specific things, like uniforms, inputs, etc)

But in my opinion this isn't a good practice, because for every shader I create, I have to create a new class too, which means that if I want to add a new shader, or modify one's source, I have to recompile the engine.

(2.) Should I register the shader specific things (location of inputs, uniforms, etc.), and pass EVERY possible required data to the shader, which will use only the ones which were registered during the shader's compile time?

Like Shader A needs position and normal, Shader B needs position and UV.
position, normal and UV will be passed to the active shader object, and it will buffer only those which it needs (based on the registered inputs, uniforms, etc) and won't care about the others.

(3.) Having every possible input, uniform etc in all the shaders. The active shader will receive every required input, uniform, etc. So a shader is only unique in its main(). Like Shader A uses input 1,2,3, shader B uses input 1,2,5. (But both of them will receive all inputs)

These are the way I thought of, but these aren't very good in my opinion, there must be a good way for this.

Edit:

(4.) What I most recently thought of:

Only one shader class. has a field: unordered_map < name, location at shader >
During shader initialization, I store the input, uniforms, etc in the previously mentioned map.
When I want to render the Object, I call the active shader's SetInput(...) or SetUniform(...) method
These methods receive a string and a data (like vec3, vec4, mat4, etc)
In these methods, I check if the string is in the map, and if it is, I buffer the data to the location.

I think this is good, because there will be a few method calls for every object, and then finding a key in an unordered_map is really fast.

What do you say?


texts:
I am doing a space game and I have a little problem when doing the GUI.

As you can see here:  the objects from the scene overlap the text from the GUI.

From what I've seen on other topics, it seems that using Camera screen space any object closer than the Plane distance overlaps, but if I decrease the plane distance I can't see the canvas.

I've also tried setting the screen space to overlay, which should fix this, but then the GUI is not shown in the screen.

Anybody knows how to prevent the overlapping or at least what should I do for being able to use screen space overlay? Thanks!


texts:
I am developing my first LibGdx game, and I would like some help understanding Scene2D/Ui.

So far I understand a "Stage" contains the various UI elements, and a "Table" contains the layout; an input processor can be assigned to buttons and stuff to define what they will do.

What I don't really understand clearly so far is how to utilise tables and skins, and if I'm doing this correctly.

So far I have a MainGameScreen class which extends Screen, and renders a Tiled map.

I want to render the UI on top of it, I have defined a Stage, a Table and a Skin, as well as a button; here are my relevant code snippets.

//declaration of stage, table, skin
public class MainGameScreen implements Screen, InputProcessor{
    ...
    private Stage stage;
    private Table table;
    private Skin skin;
}

//class constructor
public MainGameScreen(final MyGame game){
   ...
   stage = new Stage(new ScreenViewport());
   table = new Table();
   skin = new Skin(Gdx.files.internal("uiskin.json"));
   table.setFillParent(true);
   stage.addActor(table);
   button = new TextButton("TEST BUTTON", skin, "default");
   button.setWidth(200);
   button.setHeight(50);
   stage.addActor(button);

//Screen render function
public void render(float delta) {
    ...
    stage.act(Gdx.graphics.getDeltaTime());
    stage.draw();
}

It works, the Tiled map gets rendered, a button appears on the bottom left.

Now, please take a look at this Warcraft 2 screenshot: http://en.war2.ru/wp-content/uploads/2015/03/screenshot-14.png

I'd like to implement a top bar similiar to that, meaning "Menu" "Pause" buttons as well as rendering an icon + value for each resource (variable) at the top of the screen.

I understand that I'd have to use the Image widget for the icons, Label for text and Button for Menu and Pause, but I don't get how to lay them out properly using a Table and ensuring scaling.

I'd be grateful if someone could provide a simple implementation, or point me on the right direction.


texts:
Currently I have Ocean, Desert, Grassland, Mountain, and Snow biomes. These are generated in subtractive layers of noise that prioritizes Low->Mid->High areas using multiple noises around 8km across. Ocean takes up the Low area. Desert and Grassland take up the Mid using a second noise. Mountain and Snow take up the High area based on height. (a 32km2 shot. The starting area is always forced to grass)

This is about all I can squeeze in, and already things are overlapping causing slivers of biomes in some places.

One approach is to just make 0-35% of a "biome" noise biome1, 35-50% biome2, etc. But this way biome1 is always surrounded by biome2 and can never touch biome3 or biome4.

Another approach would be to have multiple layers of noise and using when noiseA is at 0-35% and noiseB is at 0-35% apply biome1 (see below). But again that limits who can border who. Maybe the only way to go about it with noise though. (Minecraft / Empyrion)

What I want to do: Add even more biomes, up to a dozen. The only way I can come up with to try and keep them somewhat even and still random is to assign polygonal sections a random biome. For example every 8x8 kiolmeters rolls to see which of the 12 biomes it is and then becomes that biome completely, sort of like Settlers of Catan. Maybe with a kilometer of noise based blend zones on each edge to reduce the squareness.

Are there other approaches?


texts: Phaser / PIXI: World size vs. Stage size

texts:
I am using Phaser to build a zoomable / pannable 2D map with the intended functionality being that the home camera position is always in the middle of the World coordinates. I have a problem where my Stage (Phaser.Stage) size is slightly smaller than my explicitly-set World coordinates, and it appears that my groups (Phaser.Group) within my world (Phaser.World) are the same size as the Stage (less than my world size).

From http://docs.phaser.io/Phaser.World.html:

  By default a world is created the same size as your Stage.

I am aware that Stage comes from PIXI and is used for rendering:

  A Stage represents the root of the display tree. Everything connected
  to the stage is rendered.

From http://docs.phaser.io/Phaser.Stage.html

  The Stage controls root level display objects upon which everything is
  displayed. It also handles browser visibility handling and the pausing
  due to loss of focus.

I have learned from the html5gamedevs.com forums that Camera (Phaser.Camera) does not have zoom capabilities (or multiple cameras) built-in at the time of writing this question (Phaser v2.1.1 | Pixi.js v1.6.1). Based on my experimentation so far, I believe that the camera translation (x, y) works by translating the world coordinates. However, I'm still running into some escaping issues regarding a camera offset with my zoom system.

I have not yet found any examples online (including the official Phaser examples) of working directly with the Stage (Phaser.Stage), or how the stage dimensions play into the World, Camera, and Groups.

What is the relationship between the Stage and the World in Phaser?


texts: Places to Test Player Interest In Storyline

texts:
I am working on an iPad game, and have a few different intro story lines. I would like to get gamer feedback on the intros.

What websites or techniques have others used to get such feedback?


texts:
In my CheckKeyboard(Keys.Enter) it does both of the things when I only want it to do one and the other on the next to enter click, I can't think of how to fix it. Here is the related code;
enum CurrentState
{
    Menu,
    NewGame,
    LevelSelect
}
private CurrentState _currentState = CurrentState.Menu;
public void Update(GameTime gameTime, Game1 game)
{
    keyboard = Keyboard.GetState();
        switch (_currentState)
            {
                //Error-  The name 'Menu' does not exist in the current context.
                case Menu:
                {
                }
            }
    prevKeyboard = keyboard;
}
public bool CheckKeyboard(Keys key)
{
    return (keyboard.IsKeyUp(key) && prevKeyboard.IsKeyDown(key));
}


texts:
I'm thinking about making games for tablets. Coming from a PC/console background, I'm keenly aware of the huge differences in the user interfaces, and that I need to design it with the target platform in mind.

One aspect I'm worried about is player fatigue. The input devices used on PCs and consoles - keyboards and game controllers - are optimized for extended play and have mature, ergonomic designs. Most seasoned players can easily use them for an hour, clocking in thousands of key/button presses, without suffering from fatigue. Designers can depend on this when designing the user experience, with consequences ranging from size/length of levels, steps required to execute commands, pace of the game and many more.

What about touch-screen tablets? Do players become fatigued faster, or are unable to execute as many taps/swipes per unit of time? If so, are there any resources or guidelines about this matter?


texts: How best to handle ID3D11InputLayout in rendering code?

texts:
I'm looking for an elegant way to handle input layouts in my directx11 code.

The problem I have that I have an Effect class and a Element class. The effect class encapsulates shaders and similar settings, and the Element class contains something that can be drawn (3d model, lanscape etc)

My drawing code sets the device shaders etc using the effect specified and then calls the draw function of the Element to draw the actual geometry contained in it.

The problem is this - I need to create an D3D11InputLayout somewhere. This really belongs in the Element class as it's no business of the rest of the system how that element chooses to represent it's vertex layout. But in order to create the object the API requires the vertex shader bytecode for the vertex shader that will be used to draw the object. In directx9 it was easy, there was no dependency so my element could contain it's own input layout structures and set them without the effect being involved.

But the Element shouldn't really have to know anything about the effect that it's being drawn with, that's just render settings, and the Element is there to provide geometry.

So I don't really know where to store and how to select the InputLayout for each draw call. I mean, I've made something work but it seems very ugly.

This makes me thing I've either missed something obvious, or else my design of having all the render settings in an Effect, the Geometry in an Element, and a 3rd party that draws it all is just flawed.

Just wondering how anyone else handles their input layouts in directx11 in a elegant way?


texts:
To be specific I want to do bad sprite scaling like in Operation Thunderbolt. For some reason I'm getting it all wrong so far.

I started over from scratch and I've literally got a sprite that follows the mouse and scales larger as the Y position increases. I've got a horizon line at y128. I don't want the sprite to start scaling until it passes the horizon. I've been through countless examples of pseudo 3d but I want to start simple, one thing at a time so I can get the maths right in my head :S

Right now the code is:

set scale: Sprite.Y / Scalerate

Which keeps the scaling even as I move the mouse up and down but now I want to limit it to only growing after the horizon at 128.  As if a person is walking down the road at you, or maybe an equation that let's you set a start and end point on the y axis.

I'm totally new at the sprite scaling stuff!


texts: Multiplayer and creeps (NPC enemies): how to compute bullet hits given the lag?

texts:
We are making a multiplayer co-op game, where players will shoot not each other but AI enemies (creeps), controlled by the game. The chosen implementation is client-server with an authoritative server. Edit: we use client-side prediction for both creeps and avatats to give the illusion of immediate responses. So far we managed to make creeps movement syncronized on the client and the server, that is at the same point in time each and every creep are located in the very same place on the client and on the server.

However, the player avatars cannot be syncronized in this way - it is simply impossible. Player avatar will always lag on the server. Now the problem arises when we try to shoot and hit the creeps. The two avatars (client and server ones) will fire bullets in different places (because one lags from another), but the creeps positions are equal. Bullets hit almost instantly, which means that quite often the bullets will not hit the creeps on one of the machines and, as the server is authoritative, it will have the final say in what actually happened. Ofcourse such behaviour is unacceptable.

One solution would be to force creeps to lag on the server, but that is a poor solution as the lag (ping) may vary dynamically and, more importantly, the game is designed to allow for up to 4 player multiplayer mode and I cannot even start to think, how to fit this solution to other players' bullets.

The only thing I could find so far on the internet is the fact that in FPS multiplayer shooters you see your opponent in the past and the server "rewinds" each of you before hit-scanning. But how do you exacly implement this? Do you keep the list of recent positions/actions on the server? But what if hit-scanning involves taking skeletal animation into account? Do you store recently played animations aswell? Any advice would be appreciated.


texts: Unity - how to check if object is fully covered by another objects (2d)

texts:
I am creating an educational game for kids , and in one of the levels player must to paint animals , like in color book, so I created scene where 2 object , already colorful lion and white lion (white is above) and script, which is instantiating circle sprite masks in players touch position , how can I check if white lion is fully covered by masks and not visiable .

P. S. If you have better idea for painting (like painting with brush) and checking , please say.


texts: Why game loop should be running on a separate thread?

texts:
I am struggling to fully understand the responsiveness argument suggesting to run the game loop on a separate thread other than main thread.

When OS sends a user event (touch, mouse move, etc.) it will be handled within the main thread. Then you would have to forward this event into a game loop thread where this event usually is placed into a queue. The OS may think that event was processed instantly, but user will still have to wait until event is actually processed.

In this case there is an inevitable latency before the event gets processed.

It is exactly the same latency when event is processed in the main thread, but in this case OS can detect the latency.

Is it this latency that separate thread game loop is trying to avoid, or is there anything else?


texts: Triggering animation in character OnTriggerEnter?

texts:
I've been stuck on this for hours.

I have a character whose animations are based in mecanim to transition based on the bool variable ShivaEnter. One invisible cube is set to change the bool value from false to true and vice-versa OnTriggerEnter.

The code is as follows:

using UnityEngine;
using System.Collections;

public class PontyAnimations : MonoBehaviour {

  //[SerializeField]
  private Animator animator;
  //private GameObject ponty;
  //private GameObject ponty;

  void Awake () {
    animator = GetComponent <Animator>();
  }

  void OnTriggerEnter (Collider other) {
    if (other.gameObject.tag == "Player") {
      animator.SetBool ("ShivaEnter", true);
    }
  }

  void OnTriggerExit (Collider other) {
    if (other.gameObject.tag == "Player") {
      animator.SetBool ("ShivaEnter", false);
    }
  }
}


texts: Merging InputProcessor and GestureDetector

texts: I'm planning to make a simple soccerball app. When I attempt to drag the ball, I use the touchDragged() from InputProcessor to move the ball left or right. Next, while holding before releasing, I use the fling() from the GestureDetector to set the power. However, when I'm trying to set the input processor of both the implementing InputProcessor and the GestureDetector, it didn't work.  Moreover, whenever the last time you set the input processor and that would be either the two of them. Why?


texts: How to play animation using parameters in a function Unity

texts:
I am trying to play an animation based off of a parameter in my function, but the parameter is only recognized as a String. How would I be able to make a function that can run an animation off of a parameter?

Class1:

public void FrontDoor(PlayMode openA)
{
    if(!doorLocked)
    {
        if (!doorOpen)
        {
            TestRaycast.hit.collider.gameObject.GetComponent<Animation>().Play(openA);
            Invoke("DoorOpen", 1);
        }
        if (doorOpen)
        {
            TestRaycast.hit.collider.gameObject.GetComponent<Animation>().Play("CloseDoor1");
            Invoke("DoorClosed", 1);
        }
    }

    //unlocks door
    if(doorLocked)
    {
        if(Display.lockpickActive)
        {
            doorLocked = false;
            Display.lockpickAmount--;
        }
    }
}

Class2:

switch(hit.collider.tag)
{
     case "front door":
            hit.collider.GetComponent<OpenCloseObjects>().FrontDoor("OpenDoor1");
            break;
}


texts: Is it better to make a cpp and hpp file for every new object or is it better to make one parent class and define types in there?

texts:
Let's say we make a game. The game has items, enemies, allies, etc and there are multiple of them, like zombies and robots as enemies. Do you think it would be better to make one parent class called "Enemy" (and the corresponding cpp/hpp files) and making a class for each enemy (zombie or robot in this example) and making 2 files per enemy or would it be better to make an enumcalled "type" in the Enemy class and having all child objects in that one class?

Thank you for your help!


texts: Optimizing spawning 500 objects every 3 seconds

texts: Using Object Pooling, assuming I'll like to spawn 500 cubes once every three seconds. How do I make it performance friendly? I need ideas, not the code itself.


texts:
I'm having a really hard time deciding which way to go on this.  I'm about to start developing a game and I haven't been able to find many good comparisons between these approaches.  I don't have many requirements for the game yet, but here is what I do know.

needs to work on iPhone
I don't have much money ($400 for Unity for iPhone is probably too much. I can probably afford $99 for Corona.)
Graphics will be 2D
Physics support is not needed
Ability to use particles would be nice
Game Center support would be nice (Corona is planning to support it soon)
It would be nice to be able to support Android as well if it isn't much effort.

I have done my own research, so I know basic things about them.  I know Corona uses Lua and Cocos2D uses Objective C.  I know that Corona allows deployment to iPhone and Android, but how easy is it?

Cocos2D is free, but so many people talk about how easy it is to use Corona, but I don't like being restricted to features Corona supports or the price tag.  I feel so torn here.


texts: Snake AI - Is a Hamiltonian approach valid for all grid sizes?

texts:
So, as has been done many times before, I am designing an AI that can play Snake as effectively as possible. It didn't take me long to find this extremely useful thread here: How to find a safe path for an AI snake?
 where the top answer first and foremost recommends forming a Hamiltonian circuit for the grid and begin by just having the Snake follow this route.

However, after attempting this, I realised it didn't work with my initial grid size (23x23), at least I don't think it does. My understanding may be incorrect, but from what I gather, with m rows and n columns, if mn is odd, then there is no Hamiltonian circuit possible. If this is the case, then should I abandon this method? Or is there any way of implementing it in some case?


texts: Why the color of gameobjects is different if i make new instance for color in script or select color from editor?

texts:
In the script top:

public Color blocksColor;

Then inside a method:

//block.GetComponent<Renderer>().material.color = blocksColor;
block.GetComponent<Renderer>().material.color = new Color(241, 255, 0, 255);

When i'm doing the instance of the color my self with the values 244,255,0,255 the color is just like what i wanted.

But if i'm using the color from the variable:

block.GetComponent<Renderer>().material.color = blocksColor;

And in the editor i'm setting the color to be with the same values:
Now the color is not even close to what it was when i was setting the color with my own instance in the script:

In the inspector it seems like the same color but the grid color is not the same.

The complete code:

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

public class GridGenerator : MonoBehaviour
{
    public GameObject gridBlock;
    public int gridWidth = 10;
    public int gridHeight = 10;
    public float spaceBetweenBlocks = 1.5f;
    public Vector3 blocksScale = new Vector3(1, 0.01f, 1);
    public Color blocksColor;

    private GameObject[] wallsParents = new GameObject[4];
    public GameObject[] allBlocks;

    void Start()
    {
        wallsParents[0] = GameObject.Find("Top Wall");
        wallsParents[1] = GameObject.Find("Left Wall");
        wallsParents[2] = GameObject.Find("Right Wall");
        wallsParents[3] = GameObject.Find("Bottom Wall");

        GenerateGrid();
        allBlocks = GameObject.FindGameObjectsWithTag("Blocks");

        var findpath = GetComponent<PathFinder>();
        findpath.FindPath();
    }

    public void AutoGenerateGrid()
    {
        allBlocks = GameObject.FindGameObjectsWithTag("Blocks");

        for (int i = 0; i < allBlocks.Length; i++)
        {
            DestroyImmediate(allBlocks[i]);
        }

        var end = GameObject.FindGameObjectWithTag("End");
        DestroyImmediate(end);

        GenerateGrid();
        allBlocks = GameObject.FindGameObjectsWithTag("Blocks");

        var findpath = GetComponent<PathFinder>();
        findpath.FindPath();
    }

    public void GenerateGrid()
    {
        for (int x = 0; x < gridWidth; x++)
        {
            for (int z = 0; z < gridHeight; z++)
            {
                GameObject block = Instantiate(gridBlock, Vector3.zero, gridBlock.transform.rotation) as GameObject;
                block.transform.parent = transform;
                block.transform.name = "Block";
                block.transform.tag = "Blocks";
                block.transform.localPosition = new Vector3(x * spaceBetweenBlocks, 0, z * spaceBetweenBlocks);
                block.transform.localScale = blocksScale;
                block.GetComponent<Renderer>().material.color = blocksColor;
                //block.GetComponent<Renderer>().material.color = new Color(241, 255, 0, 255);

                if (x == 0)//TOP
                {
                    block.transform.parent = wallsParents[0].transform;
                    block.transform.name = "TopWall";
                    block.transform.tag = "Blocks";
                }
                else if (z == 0)//LEFT
                {
                    block.transform.parent = wallsParents[1].transform;
                    block.transform.name = "LeftWall";
                    block.transform.tag = "Blocks";
                }
                else if (z == gridHeight - 1)//RIGHT
                {
                    block.transform.parent = wallsParents[2].transform;
                    block.transform.name = "RightWall";
                    block.transform.tag = "Blocks";
                }

                else if (x == gridWidth - 1)//BOTTOM
                {
                    block.transform.parent = wallsParents[3].transform;
                    block.transform.name = "BottomWall";
                    block.transform.tag = "Blocks";
                }
            }
        }
    }
}


texts: How do I open Gdevelop with Termux? Is it even possible?

texts: I use a samsung chromebook 3 and I am trying to get the FULL version of Gdevelop. I installed it for linux, and I dragged it to be one of my termux files. I am trying to run a command in termux that opens the full version of gdevelop. But it keeps saying: "NO SUCH FILE OR DIRECTORY" Is there a command I can run in termux to open the full version of Gdevelop?


texts: How to import character from Blender to Unity?

texts:
I am trying to import a character into Unity from Blender. I exported the model (which has actions/animations) from Blender as a FBX file and dropped in into my Unity project’s Assets folder. The model with all of its components (mesh, armature, animations) appears in the project window; however, Unity doesn’t immediate associate the animations with the model when I drag an instance of the model into my scene.

I have also imported a Blender default model (“Constructor” - a man with red overalls and a wrench), and have been comparing the settings of my model to the Blender model in order to find discrepancies.

3 observations I have made:

Blender’s model is automatically assigned an “Animation” window in the Inspector panel (image #1), while mine is assigned an “Animator” window (image #2). Since the former window is the one where the animations are listed and you assign the default animation, it seems like this one is crucial. How do I import my model such that the “Animation” window appears in its Inspector window? (I’ve tried adding an “Animation” window myself, but it doesn’t recognize the model’s animations as the Blender model’s “Animation” window does.

In Unity, my model’s animations all begin at -1.0 (even though they begin at keyframe 0 in Blender) (image #3). For each animation, I get the message, “The clip range is outside the range of the source take.” I get this message even when I move the animation forward several keyframes in Blender and re-export the file to Unity as a FBX.
I compiled several of my actions into an animation that I then exported as a .mov file, and this is the sequence of actions that begins when I press “Play” in Unity. When I deleted this animation from Blender (as I thought this was the issue), my model now does nothing when I press “Play.”

I am using:

Blender 2.67 and Unity 4.1.5f1

My actual question: How do I import my character into Unity such that it is automatically assigned an “Animation” window?

I have been struggling with this issue for several hours now, and none of the online tutorials or forums seem to address it.


texts: LibGDX: Issue with unitScale for Tiled and Box2D

texts:
I've got the following: I use a TiledMap (loaded from a .tmx), each tile 32x32 pixels in size and generate the Box2D bodies for collision from the TiledMap's ObjectLayer. That all works fine, no errors or issues. The only thing is a very strange behavior of the OrthogonalTiledMapRenderer: It gets a unitScale with the value 1 / 32 (because one unit is 32 pixels) as advised on the LibGDX GitHub wiki page. The same unit scale is used for Box2D. Thought in theory this should work just fine it renders the map very small (same is the case for the Box2D bodies, they're shown very small by the Box2DDebugRenderer):

Here is my code (more or less simplified):

public class MainScreen {
    private OrthographicCamera camera;
    private ScreenViewport viewport;
    private SpriteBatch batch;
    private World world;
    private TiledMap tiledMap;
    private OrthogonalTiledMapRenderer tiledMapRenderer;

    public MainScreen() {
        this.batch = new SpriteBatch();
        this.world = new World(new Vector2(), true);
        float unitScale = 1.0f / Constants.TILE_SIZE;

        this.camera = new OrthographicCamera();
        this.camera.setToOrtho(false, Gdx.graphics.getWidth() * unitScale,
            Gdx.graphics.getHeight() * unitScale);
        this.viewport = new ScreenViewport(this.camera);
        this.tiledMap = (new TiledMapLoader()).load("level/test-level.tmx");
        this.tiledMapRenderer = new OrthogonalTiledMapRenderer(this.tiledMap,
            unitScale, this.batch);

        // Create bodies in world based on map
        Collisions.create(this.world, this.map, unitScale);
    }

    public void render(float delta) {
        // Clear the screen
        Gdx.gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        this.world.step(delta, 6, 2);
        this.camera.update();
        this.tiledMapRenderer.setView(this.camera);
        this.tiledMapRenderer.render();
    }

    public void resize(int w, int h) {
        this.viewport.update(w, h);
    }
}

I've got no idea why this is happening... Thanks in advance :)


texts: Unity my game starts in windowed mode, but the fullscreen box is checked

texts:
When I open my game the fullscreen box is checked, but the game is windowed. If I uncheck and check the box it will go into fullscreen. What is the fix?

public class Settings : MonoBehaviour
{

   public void SetFullscreen (bool isFullscreen)
{
    Screen.fullScreen = isFullscreen;
}
}

I save the current display resolution when the player hits the quit button

    public void Quit()
{
#if UNITY_EDITOR
    UnityEditor.EditorApplication.isPlaying = false;
#else
    Application.Quit();
#endif
}


texts: Libgdx Scene2D Table background not showing up

texts:
I am using Libgdx's Scene2D API to build my UI and everything has been working as expected until now. I created a Skin and a TextureAtlas and linked them as so:

Skin skin = new Skin();
TextureAtlas uiElements1 = new TextureAtlas("skins/uielements1.txt");
skin.addRegions(uiElements1);
skin.load(Gdx.files.internal("skins/uiskin.json"));

And then I tried to create a Table:

Table table = new Table(skin);
table.setWidth(stage.getWidth());
table.align(Align.center|Align.top);
table.setPosition(0, Gdx.graphics.getHeight());
table.padTop(30);
table.setBackground("grey_button02");

Finally, I added a Label to the Table:

Label gameTitle = new Label("Nameless Project", skin, "title");
table.add(gameTitle).padBottom(10).row();

Once I added the Table to my Stage, only the elements in it would show up and not the background image. I tried using background(String s), setBackground(String s), background(Drawable d), and setBackground(Drawable d). None of those seemed to work for me.

I also tried calling pack() and setFillParent(true) but both of those made my table disappear. I have gone through just about every Google result and I can't find anyone else with my issue.

Here is my uiskin.json file

{
  com.badlogic.gdx.graphics.g2d.BitmapFont: { default-font: { file: fonts/FutureThin.fnt } },
  com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
   default: { down: blue_button03, up: blue_button04, font: default-font },
  },
  com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle: {
    default:  {
      titleFont: default-font
     }
   },
   com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle: {
    title: {
        font: default-font
     }
   }
}

And the entire class rendering the stage:

public class MainMenu implements Screen {

    GameClass myGame;

    Stage stage;
    Skin skin;

    Table table;
    TextButton singlePlayer;
    TextButton multiPlayer;
    Label gameTitle;

    public MainMenu(GameClass g) {
        myGame = g;

        // Create Skin, load texture Atlas, load skin
        skin = new Skin();
        TextureAtlas uiElements1 = new TextureAtlas("skins/uielements1.txt");
        skin.addRegions(uiElements1);
        skin.load(Gdx.files.internal("skins/uiskin.json"));

        // Create stage
        stage = new Stage(new ScreenViewport());

        // Create Table
        table = new Table(skin);
        table.setWidth(stage.getWidth());
        table.align(Align.center|Align.top);
        table.setPosition(0, Gdx.graphics.getHeight());
        table.padTop(30);
        table.setBackground("grey_button02");

        // Game Title
        gameTitle = new Label("Nameless Project", skin, "title");
        table.add(gameTitle).padBottom(30).row();

        // Single Player button
        singlePlayer = new TextButton("Single Player", skin, "default");
        singlePlayer.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent e, float x, float y) {
                myGame.setScreen(new WorldTesting(myGame));
            }
        });
        table.add(singlePlayer).width(300).padBottom(30).row();

        // Multiplayer Button
        multiPlayer = new TextButton("Multiplayer", skin, "default");
        multiPlayer.setWidth(350);
        multiPlayer.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent e, float x, float y) {
                // Change Scenes
            }
        });
        table.add(multiPlayer).width(300).padBottom(30).row();

        stage.addActor(table);
        Gdx.input.setInputProcessor(stage);
    }

    public void show() {

    }

    public void render(float delta) {
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        stage.act(Gdx.graphics.getDeltaTime());
        stage.draw();
    }

    public void hide(){

    }
    public void resize(int x, int y) {

    }
    public void pause() {

    }
    public void resume() {

    }
    public void dispose() {

    }

}


texts:
Good evening.

Im currently trying to create a Dungeon Generator . First I place randomly some rooms. Right after that I dig in a randomized maze.

But sometimes it happens that some rooms or even some maze paths are unreachable.

Is there any way to avoid that ? Are there any good Methods for avoiding that ? Any ideas or examples?

Im currently doing it like so (pseudocode) :

Pick a random Number of rooms
Create an arraylist for those rooms
Pick random Positions with random sizes
Try to place all those rooms without overlapping and add them to the list.

-- Room placement Done --

-- Maze Generation Begins --

Loop over the whole Map, if Theres an empty tile ( No wall, No floor and No paths) than Beginn to grow the maze .
When the Statement above ist true, than create a 'Cell arraylist' and put the 'start' cell into it with the coords of the empty tile above  . ( A cell just contains x and y coords) .
While the cell list isnt empty, Pick the latest cell (cellsList.Size()-1) and Check the possible direction it Can move. If Theres just empty space in that direction ( No wall, No floor and No paths) than the direction is true.
Pick a random Number and Check for every direction if the assigned Number fits with the random one. If it fits, then dig into that direction and create a new cell at the End . If Not redo this step until one paths ist diged Out.
At least kill 'Dead ends'. Those path tiles which are surounded by 3 empty tiles or those which are completly isolated.

I Hope I mentioned everything . Im currently at my phone and cant acess my Files at my Home PC :/ im gonna Update this later when im Back Home.


texts: Turning model from 3ds max file into sprite

texts:
I'm planning to buy animated 3D assets to render and use as 2D sprites in my game, but i don't know anything about 3ds max or own any software. How do i render the animations (i need top-down ones) to turn them into a bunch of pngs?

From there i already know how to create a spritesheet.

I assume there is a more streamlined way of doing this than opening each file in the 3D software, looking at each animation frame, and capturing the screen?


texts: Can Entities Have Their Own Shader In Deferred Rendering?

texts: Since you need to use the general g-buffer shader to fill g-buffer, how can entities have their own shaders, like giving a box normal mapping feature ? As I remember, you can't use two shaders at the same time. So there is a possible solution that every object will have their own renderers, but If I have to make each entity have their own renderers that also include g-buffer filling in their shaders, wouldn't there be unnecessary g-buffer shader code everywhere, extra variable passings to GPU ?


texts: Libgdx - Screen tearing (or artifacts) while in fullscreen

texts:
I have a problem with libgdx, fullscreen and what I believe is screen tearing or any other sort of artifact.

In windowed mode, everything works fine, but when i switch to fullscreen, moving sprites create some sort of screen tearing effect:

Had to take a photo with my phone, because using the print button does not work in fullscreen, and I could not capture the screen tearing effect using a libgdx "TakeScreenshot" Function.

I am using a TexturePacker and I tried changing the Filtering (Nearest, Linear) as well as edgePadding and duplicatePadding with no positive result.

I enabled vSync which also did not fix the problem.

Maybe anyone has encountered such a problem and can lend a helping hand.

Thanks in advance.

Edit:

This is how i enabled vSync:

LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.vSyncEnabled = true;
//some other config stuff
new LwjglApplication(new MyGame(), config);


texts: How to automate baking pizza in Corona SDK?

texts:
I'm writing a game about making pizza in Corona SDK. When you buy chefs, the new chef is supposed to make some pizzas on its own like automation.

I tried everything I knew about, I couldn't think of anything that would do what I'd like so I ask you guys to help me.

Here is the code I think is relevant:

local widget = require("widget")

local pizzeria = display.newImage("background.png")
pizzeria.x=160
pizzeria.y=230
pizzeria:scale(1,1)

local pizzas=0
local chefs = 0
local pizzatext = display.newText( "Pizzas:", 100, 200, display.contentWidth*0.6, display.contentHeight * 0.7, native.systemFont, 16)
pizzatext:setFillColor( 10, 0, 0)

local pizzacount = display.newText(pizzas,165,200,display.contentWidth*0.7,display.contentHeight*0.7,native.systemFont,16)
pizzacount:setFillColor(10,0,0)

local chefstext = display.newText("chefs:",320,200,display.contentWidth*0.7,display.contentHeight*0.7,native.systemFont,16)
chefstext:setFillColor(10,0,0)

local chefscount = display.newText(chefs,363,200,display.contentWidth*0.7,display.contentHeight*0.7,native.systemFont,16)
chefscount:setFillColor(10,0,0)

local function pizzamaker( event )
  if ( "ended" == event.phase ) then
    pizzas=pizzas+1
    pizzacount.text=pizzas
  end
end

local function addchef( event )
  if("ended" == event.phase) then
    if(pizzas>=5) then
      chefs=chefs+1
      chefscount.text=chefs
      pizzas=pizzas-5
      pizzacount.text=pizzas
    end
  end
end

local pizzamaker = widget.newButton
{
  left = 100,
  top = 400,
  defaultFile="button.jpeg",
  overFile = "button.jpeg",
  label = "Make Pizza",
  height = 50,
  width= 100,
  onEvent = pizzamaker
}

local addchef = widget.newButton
{
  left = 100,
  top = 100,
  defaultFile="pizzachef.png",
  overFile="pizzachef.png",
  height = 50,
  width = 50,
  onEvent = addchef
}


texts:
I recently asked a question about the creating an accurate Depth Intersection Shader.

When creating this in a fragment / vertex shader it could be achieved by the following code

SubShader
{
    Blend SrcAlpha OneMinusSrcAlpha
    ZWrite On

    Tags
    {
        "RenderType" = "Transparent"
        "Queue" = "Transparent"
    }

    Pass
    {
        CGPROGRAM
        #pragma target 3.0
        #pragma vertex vert
        #pragma fragment frag

        #include "UnityCG.cginc"

        struct appdata
        {
            float4 vertex : POSITION;
            float2 uv : TEXCOORD0;
            float3 normal : NORMAL;
        };

        struct v2f
        {
            float2 uv : TEXCOORD0;
        };

        sampler2D _MainTex;
        float4 _MainTex_ST;
        sampler2D _CameraDepthTexture;
        fixed4 _Color;
        fixed4 _GlowColor;
        float _FadeLength;

        v2f vert(appdata v, out float4 vertex : SV_POSITION)
        {
            v2f o;
            vertex = UnityObjectToClipPos(v.vertex);
            o.uv = TRANSFORM_TEX(v.uv, _MainTex);

            return o;
        }

        fixed4 frag (v2f i, UNITY_VPOS_TYPE vpos : VPOS) : SV_Target
        {
            float2 screenuv = vpos.xy / _ScreenParams.xy;
            float screenDepth = Linear01Depth(tex2D(_CameraDepthTexture, screenuv));
            float diff = screenDepth - Linear01Depth(vpos.z);
            float intersect = 0;

            if(diff > 0)
                intersect = 1 - smoothstep(0, _ProjectionParams.w * _FadeLength, diff);

            return fixed4(lerp(tex2D(_MainTex, i.uv) * _Color, _GlowColor, pow(intersect, 4)));
        }
        ENDCG
    }
}

However, when I try to put the same logic into a surface shader, the result does not show any depth intersections.

SubShader {
    Blend SrcAlpha OneMinusSrcAlpha
    ZWrite On

    Tags
    {
        "RenderType" = "Transparent"
        "Queue" = "Transparent"
    }

    CGPROGRAM
    // Physically based Standard lighting model, and enable shadows on all light types
    #pragma surface surf Standard fullforwardshadows alpha:fade

    // Use shader model 3.0 target, to get nicer looking lighting
    #pragma target 3.0

    sampler2D _MainTex;

    struct Input {
        float2 uv_MainTex;
        float4 screenPos;
        float eyeDepth;
    };

    half _Glossiness;
    half _Metallic;
    sampler2D _CameraDepthTexture;
    fixed4 _Color;
    fixed4 _GlowColor;
    float _FadeLength;

    // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
    // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
    // #pragma instancing_options assumeuniformscaling
    UNITY_INSTANCING_CBUFFER_START(Props)
        // put more per-instance properties here
    UNITY_INSTANCING_CBUFFER_END

    void surf (Input IN, inout SurfaceOutputStandard o) {
        float2 screenuv = IN.screenPos.xy / _ScreenParams.xy;
        float screenDepth = Linear01Depth(tex2D(_CameraDepthTexture, screenuv));
        float diff = screenDepth - Linear01Depth(IN.screenPos.z);
        float intersect = 0;

        if (diff > 0)
            intersect = 1 - smoothstep(0, _ProjectionParams.w * _FadeLength, diff);

        fixed4 col = fixed4(lerp(tex2D(_MainTex, IN.uv_MainTex) * _Color, _GlowColor, pow(intersect, 4)));
        o.Albedo = col.rgb;
        o.Alpha = col.a;
        o.Metallic = _Metallic;
        o.Smoothness = _Glossiness;
    }
    ENDCG
}


texts:
I'm writing a 2D hack-and-slash game using XNA. I really want to implement the blur-like, refractive effect of a sword or such moving really quickly, seen in such games as Dust: An Elysian Tail and Vampire Dishwasher. Anyone know the technical name for this effect? For those who aren't sure what I'm talking about:

shows exactly the effect I'm trying to achieve.


texts: Using box2d DrawDebugData with multi layer scene?

texts:
In my Game, a Scene is composed by several layers. Each layer has different camera transformations.

This way I can have a layer at z=3 (GUI), z=2 (Monsters), z=1 (scrolling background), and this 3 layers compose my whole Scene.

My render loop looks something like:

renderLayer()

   applyTransformations()

   renderVisibleEntities()

   renderChildLayers()

end

If I call DrawDebugData() in the render loop, the whole b2world debug data will be rendered once for each layer in my scene, this generates a mess, because the "debug boxes" get duplicated, some of them get the camera transformations applied and some of them don't, etc.

What I would like to do, would be to make DrawDebugData to draw only certain debug boxes. In that way, I could call something like

b2world->DrawDebugDataForLayer(int layer_id)

and call that on each layer like :

renderLayer()

   applyTransformations()

   renderVisibleEntities()

   //Only render my corresponding layer debug data
   b2world->DrawDebugDataForLayer(layer_id)

   renderChildLayers()

end

Is there a way to subclass b2World so I could add this functionality ( specific to my game ) ?

If not, what would be the best way to achieve this (Cocos2d uses a similar scene graph approach and box2d, but I'm not sure if debugDraw works in Cocos2d... )

Thanks


texts: How do I apply the Bloom Effect Line Renderer's only? I'm using the bloom effect from the Unity Pro image effects script but it's affecting the way light is rendered to the scene.


texts: Not able to see xbox live user status for friends?

texts:
Developing an xbox application using UWP not really a Game. I would like to see the status of my signed in user on one xbox to the friends of the user. For Example, in device(Xbox) one signed in user is User1 and in device two signed in user is User2. Also the User1 and User2 are friends each other.

Now when the user1 runs the App say App1 in device1, under friends list of the user2 we should be able to see the status "App1 Xbox" for user1.

I am getting this behavior by default. But I would like to change the status from "App1 Xbox" to "App1".

Anybody have any idea on how to do this from within the application?

Another scenario is like in device1 with user1 signed in open the settings App, it just shows the status as "Settings" for user2 in device2. Like that I would like to see "App1" instead of "App1 Xbox".


texts: Is replacing a struct field in a class generating garbage using C#?

texts:
I am somewhat aware of the differences between classes and structs, when each is allocated on the heap vs the stack, what happens when calling methods etc.

As far as I know, the memory for a struct field in a class is located on the heap, since it is part of the class. What happens when the struct is replaced with a new instance though? Is the content in the area on the heap that the old instance pointed to simply replaced with the content of the new instance? Or is the memory of the old instance targetted for garbage collection and the new instance getting some fresh memory?

struct Vector2 { ... }
class Player
{
     public Vector2 Position;
     ...
}

void Main // Whatever
{
    var player = new Player();
    player.Position = new Vector2(); // <--- Will this cause garbage collection?
}