texts:
Hey, I'm creating my second game ever, but this time - using Java. Before I used Pascal and CRT module! =D It's 2D game where you need to drag the ball with mouse from location A to location B. Right now, I have ball on location A and I want to make it "alive". With that I mean that it will move from location A in 135° direction until it reaches wall, then bounce the wall and move in 45° direction, then again wall - in 315° and so on.

Let's imagine that all board is 460x640 units big. So, as you can see in image above, ball's start location is 0. When the ball for the first time bounce the wall, location may be like x = 400, y = 480. In this example I have four possible directions like North, East, South and West, but in real game, when player drags the ball with his mouse, options may be more, right? I think so. So I think that I need to use degrees for it. I made list as example of what do I mean...

45°:
x = x + .5,
y = y - .5
90°:
x = x + 1,
y = y + 0
135°:
x = x + .5,
y = y + .5
180°:
x = x + 0,
y = y + 1
225°:
x = x - .5,
y = y + .5
270°:
x = x - 1,
y = y + 0
315°:
x = x - .5,
y = y - .5
360°:
x = x + 0,
y = y - 1
246°:
x = ?,
y = ?

The main problem is that I don't know how to covert degrees to coordinates and vice versa. For example I need to know x and y for 246°. Why? By knowing x and y I can move ball, because all my application basically is infinite loop that takes pause, then calculate x and y from degrees and then move ball. Please keep in mind that I'm very newbie to games development, I'm not good at math (unfortunately) and English isn't my native language... as you can see.
P.S. Maybe all idea about how-to is wrong!??


texts: Updating object's property on Start is visible for a second when game loads

texts:
I have a world selection scene in which I have GameObjects representing worlds. The GameObjects have default properties when the scene is loaded. For example: the world name text is red and each world has a "locked" status. This initial state can be seen in the following screenshot:

On the Start() method I'm dynamically updating the properties on each GameObject based on values I'm reading from a save file. If a world is unlocked the name text is set to white. If a world is currently selected the name text is set to green. Here's what that looks like at run time:

The problem is that when the scene is loaded from another scene(e.g. by clicking a navigation button) the initial state of the GameObjects can be seen for a second and then they change to the proper values as dictated by the save file. How can I prevent this from happening? I was under the impression that anything that happens in the Start() method takes place before GameObjects are rendered.

Here's some slimmed down code of what my code looks like:

    var worldIcons = FindObjectsOfType<WorldIcon>().OrderBy(x => x.WorldNumber).ToList();
    var saveFile = GameSaveManager.GetSaveFile();

    if (saveFile == null)
    {
        Debug.LogError("Could not find save file while loading worlds");
        return;
    }

    foreach (var worldIcon in worldIcons)
    {
        var savedWorld = saveFile.Worlds.SingleOrDefault(x => x.Number == worldIcon.WorldNumber);

        if (savedWorld == null)
        {
            //add world to save file
            GameSaveManager.CreateWorld(worldIcon.Controller);

            //unlock first world by default
            if (saveFile.Worlds.Count == 0 && worldIcon.WorldNumber == 1)
                worldIcon.Unlocked = LevelMapController.LockedStatus.Unlocked.ToString();
        }
        else
        {
            worldIcon.DisplayName = savedWorld.Name;
            worldIcon.WorldNumber = savedWorld.Number;

            var button = worldIcon.GetComponent<Button>();

            if (savedWorld.Unlocked)
            {
                button.interactable = true;
                button.targetGraphic.color = Color.white;
                worldIcon.Unlocked = LevelMapController.LockedStatus.Unlocked.ToString();
            }
            else
                worldIcon.Unlocked = LevelMapController.LockedStatus.Locked.ToString();
        }
    }


texts: How do I increase object movement speed after some time?

texts:
I'm new to Unity, and am making a game where an object goes up, falls down and is destroyed. This object has been instantiated. I want to increase the object movement speed by 1 after 10 seconds, but not by more than 12, because the object moves off screen.

How do I do that? This is what I have, so far:

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

public class DestroyScript : MonoBehaviour
{
    public Rigidbody2D rb;
    private float destroyTime = 2.0f;
    private int speed = 8;

    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
        Destroy(gameObject, destroyTime);
    }

    void FixedUpdate()
    {
        transform.Translate(Vector2.up * speed  * Time.deltaTime, Space.World);
        transform.Rotate(0, 0, 1);
    }
}

Thank you for your answer and sorry for my incomplete question actually object are spawned. here is the spawned script

public class SpawnItems : MonoBehaviour {

    public Transform[] SpawnPoints;

    public GameObject[] Coins;

    float createRate = 1.5f, createRateTimer;
    float rateIncrease = 0.1f, intialCreateDelay = 1.0f;
    int callCounter = 0, callBeforeRateIncrease = 15;

    // Use this for initialization
    void Start () {
        createRateTimer = createRate + intialCreateDelay;
    }

    private void Update()
    {
        createRateTimer -= Time.deltaTime;
        if(createRateTimer <= 0)
        {
            CustomInvoke();
        }
    }

    void CustomInvoke()
    {
        int spawnIndex = Random.Range(0, SpawnPoints.Length);
        int objectIndex = Random.Range(0, Coins.Length);
        Instantiate(Coins[objectIndex], SpawnPoints[spawnIndex].position, SpawnPoints[spawnIndex].rotation);
        callCounter++;
        if(callCounter >= callBeforeRateIncrease)
        {
            createRate -= rateIncrease;
            callCounter = 0;
        }
        createRateTimer = createRate;
    }
}


texts: How can I define a complex collision area on top of a tile map?

texts:
As many people recommended, I am using Tiled map editor to create a map for my game and it's great particularly because libgdx framework also provides with API for maps from Tiled.

I understand I can define collidable tiles or not in the map editor so I can deal with any collision in my code. But I am currently in a situation that I need to divide a tile into a collidable and non-collidable areas. Manually, I think I can define points and lines of bounds of the two areas and programmatically deal with it. But that's a lot of time-consuming work.

So I googled a lot and found this physics-body editor. This seems like a great tool to automate the process I mentioned above. The system, however, works with each of unpacked image and I am not sure it would work even if I unpack the image for its operation.

I wonder if there is any better way to do this whole process of defining collision area. Any suggestion will be much appreciated.


texts:
I've been working on some custom build scripts, which will manipulate the references of certain MonoBehaviours.

I'm using IPreprocessBuildWithReport to do the manipulation, and I want to reset the references when the build completes. Even if the build fails, I want to do the operation, but I want to do some additional stuff if it fails. I'm also using IPostprocessBuildWithReport and IProcessSceneWithReport as well.

I've tried putting a Debug.Log in OnProcessScene and OnPostProcessBuild. I'm building without JAVA path defined, for Android, or without the Keystore password, which fails the build. The IPreprocessBuildWithReport correctly prints the Debug, but the others don't.

Is there any class or interface which has a callback for Build Failure which I can use? I've tried to get the summary from the BuildReport in OnPreprocessBuild, but the result is always returning Unknown.

Edit: I would also like to make the same changes if the Build was cancelled, rather than just if it was failing.

Platforms: Windows, Android

Unity 2019.3.7f1


texts: Camera lookAt target changes when rotating parent node

texts:
have the following issue.I have a camera with lookAt method which works fine.I have a parent node to which I parent the camera.If I rotate the parent node while keeping the camera lookAt the target , the camera lookAt changes too.That is nor what I want to achieve.I need it to work like in Adobe AE when you parent camera to a null object:when null object is rotated the camera starts orbiting around  the target while still looking at the target.What I do currently is multiplying parent's model matrix with camera model matrix which is calculated from lookAt() method.I am sure I need to decompose (or recompose ) one of the matrices before multiplying them .Parent model or camera model ? Anyone here can show the right way doing it ?

UPDATE:
The parent is just a node .The child is the camera.The parented camera in AfterEffects works like this: If you rotate the parent node while camera looks at the target , the camera actually starts orbiting around the target based on the parent rotation.In my case  the parent rotation changes also Camera's lookAt direction which IS NOT what I want.Hope now it is clear .


texts: How to make a delay between animations in mecanim? For example after anim1 ends then there will be a delay then anim2 starts. I tried to increase the exit time but it doesnt work.


texts:
I'm trying to create a 3D Sword Slash VFX and created the model for the effect in blender. It's basically a wedge or ufo-shaped mesh. I proceeded to paint a simple test texture to see how it would look in Unreal. Now, the UVs are setup correctly for the effect itself (bottom of the texture is outside of the ring and top of the texture is inside of the ring), but it seems like my texture is spilling.

I got clearly visible artifacts and I don't really know why. The artificats go away when I start erasing parts of texture at the bottom, but it also leads to the outside edge of the wedge model to get a gap. What can I do to prevent my texture from spilling over?

*Edit: Making the material I used Unlit helped, but it did not get rid off the problem completely. Using clamp is not an option for me, because I want to animate the texture with a UV-Offset to make it rotate. In the material editor preview there are no artifacts, but in the material instance preview window they appear again.

I created the mesh in this way: add a circle, extrude the edges up and then scale the vertices down. Then do the same but at the bottom. In the UV-Editor I dragged the UVs from the outside edge to the bottom and the vertices from the top circle and bottom circle to the top of the UV map.


texts: OpenglGL Render two scenes with one draw call

texts:
I need to draw a normal-vector scene and default scene.

I could achieve this my having two programs with different fragment shader to produce the following images. It will require me to draw twice.

//somethinglike
useProgram(normal_vector_rendering_program);
render_bunny();
useProgram(just_default_scene_program);
render_bunny();

However when I am rendering the default scene, I am already passing normal vector information to achieve the lighting.

So it got me curious, can I produce two different scenes with one program(a program that has two color_buffer attaches) and one draw call somehow? I think if such is possible then I am saving lots of computer resource by not having to draw multiple times for different images.


texts: Compiling Ogre3d application using the OgreAppWizard

texts:
I have created an ogre application using the ogreappwizard. When I try to compile the solution I get an error saying that Parameter "basePath" cannot be a relative path..

I followed all of the instructions, and have tried reinstalling both the Ogre SDK and the appwizard.

I am losing my head here. What is going on?


texts: Is it possible to use Unity components individually outside of the Unity Studio?

texts:
Such as physics, rendering or math libraries/objects. I would like create a project which would benefit from a few game engine related things but rather than use a mixture of separate libraries I thought a unified solution would be less hassle in the long run.

I'd like to build it using Visual Studio and utilize Unity components or would Unity studio be suitable to build this non-game application which ultimately would almost be like a 3d level editor.


texts:
I'm doing some topological operations on my mesh and I need to know the winding order for my mesh.

Since I will be importing models from different sources I will need to know whether the winding order is clockwise and anti-clockwise so I can get normals and things like that.

Question : Is there a way that I can determine the winding order of a list of vertices.

Edit 1: I am using a 3D mesh


texts: How is a DirectX Adapter Different from a Device?

texts:
I'm relatively new to DirectX programming, and this is one of the more confusing issues I've encountered to date. According to the MSDN Documentation for DirectX 11:

  "A device is used to create resources and to enumerate the capabilities of a display adapter."

and from the MSDN Documentation for DirectX 9:

  "An adapter is a physical piece of hardware. Note that the graphics card might contain more than a single adapter, as is the case with a dual-headed display. "

From my neophyte perspective, these two concepts seem to overlap a fair amount. Am I correct in understanding that a device is an abstraction/encapsulation of a single adapter, which in turn is a software abstraction of a particular graphics card in the system?


texts: Collision detection: a bunch of special cases?

texts: I'm writing a simple physics engine in 2D.  My first goal is to get collision detection working.  I know that my objects will eventually be made up of primitive shapes, but I was wondering - would a collision detection library be composed of a bunch of special case functions, like "rayAndLine", "rectangleRectangle", "rectangleCircle" etc, or is there a common, underlying framework for collision detection that works regardless of which primitives are used to make the shape?


texts: How to change the up vector of something in Unreal

texts:
I'm creating a grapple hook mechanic.

The elements of this particular situation are a Player and a grapple point.

I would like the top of the player to always be pointing towards this grapple point. (the up vector of the player is pointing along the vector to the point).

The default Unreal CharacterMovementComponent is in the falling movement mode right now, and the player's rotation around the Z axis is determined by the movement input. The X and Y rotations are unchanged.

Because the player's position around this grapple point could be anywhere on the sphere of influence of the rope, I never have a definite axis to rotate around to point the up vector towards the grapple point.

How do I achieve something like this?


texts:
I made an MMORPG game using the Graal Online game engine. I hosted the game with their engine and servers, and it was fairly successful. Recently, they stopped hosting my game. The game is still fully functional, but with nowhere to host it, I am unsure of my next move.

The game was on Facebook before the hoster decided to not host it, anymore. We have 4,800 images for the game, 350 scripts that were coded in a language very similar to HTML5 and Java, and over 1,000 animations.

My goal is to have the game playable on Facebook and iOS/Android platforms. I do not know if I can use the old gaming engine or not, but I should be able too. If not, I hope that I still have options; I do not want to let all of this development go to waste.

How do I publish a game written for Graal Online to Facebook?


texts: What should every graphics programmer write

texts:
I've seen this question on SO, but here i want it to focus on GFX.

So in your opinion what applications/features should every aspiring GFX programmer write/change to get better?

Community wiki since there is no "right answer".

LE: Not referring to actual games, but to graphical features for example changing something in an engine (e.g how it loads objects), making a compositor, so on and so forth.


texts:
I use itween for trajectories of car.
I do not want to use him anymore because I find him very heavy.( more 100 cars in my scène)
I found scripts but all one a variable speed to turn around points.
It is always necessary to find the good compromise in the speed of the car and the rotation speed so that the car does not turn non-stop around a point
It is not easy with a car which goes to 90 kmh and a distance of point of 5 m.
I did not arrive this day and in spite of several tried scripts there.

I look for a script where we give the speed, the path.

Thank you


texts: Change width and height of 2D object based on pixel size and count

texts:
I'm working on a shooting simulator with shooting goals that need to be in real world size. I know the certain size of screen display and pixel counts.

Is there anyway to change their size based on screen information?

let me explain more about question.

its a real shooter simulator with real guns. image of unity simulation is projected on a wall or... by a video projector. I want to scale goals as real ones. I know size of screen and even size of every pixel. so I want to scale my rectangular goals with size of real ones.

I think the question now is obvious


texts: Updating object positions after screen moves. Is there a better way?

texts:
I am making a top down 2D shooter using SDL2 for fun and I ran into a problem. I have a whole list of enemies each with their position on the screen stored in an array. Now you only see a portion of the map on your screen, because the whole map is too large. I want to have the player be able to move around the map, in which case I have to update the position of all the enemies. The same goes for projectiles and buildings. So I would have to loop over each of these every time the screen moves. I thought that a smarter way may be possible where you keep track of the entire map for each frame and when you render it you zoom in on only the part you need. That way you only have to keep track of one position vector, for instance the point on the map at which you want your screen to be centered. How is this problem normally tackled?

I realize that both methods will take some time, but seeing as the map is not THAT large, maybe 6x the screen, I thought it might be worthwhile. The problem is then that I am rendering the textures using  SDL_RenderCopyEx and then displaying them with SDL_RenderPresent, and I don't think you can zoom in like that.


texts: How do I draw more than just points in 3D?

texts:
I'm currently working on a 3D rendering engine in JavaScript. I've successfully rendered a cube and can rotate it. My cube is represented by 3D points in an array ([x, y, z]):

var cube = [[-20,-20,5],[20,-20,5],[-20,20,5],[20,20,5],
[-20,-20,-5],[20,-20,-5],[-20,20,-5],[20,20,-5]];

Now that I can render a basic cube I'd like to try rendering something more complicated to make sure my math works well. It's there a standard 3D object file i can import and use or I have to manually specify the 3D positions of every vertex like I did with the cube?


texts:
I am trying to implement texture atlas.

1) I am using the texturepackerGUI and the result is taking 2 files , one png (whicj contains all the images and one .atlas (and not .pack).

2) Now , I want to use the above instead of every seperate image.

Right now , I use for example:

private void loadTextures() {
bobTexture = new  Texture(Gdx.files.internal("data/images/bob_01.png"));
blockTexture = new Texture(Gdx.files.internal("data/images/block.png"));
    }

I want to use texture atlas , so instead of the above :

TextureAtlas atlas;
atlas = new TextureAtlas(Gdx.files.internal("data/images/bobs"));  //bobs.atlas
Sprite bobsprite = atlas.createSprite("bob-01");
Sprite blocksprite = atlas.createSprite("block");

Now,I must initialize TextureAtlas I think because it gives me error "Syntax error on token ";", , expected".I don't know how.

3) I put TexturePacker2 in the android project (MainActivity) :

  ...
  AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    cfg.useGL20 = true;
    cfg.useAccelerometer = false;
    cfg.useCompass = false;
    cfg.useWakelock = true;
    TexturePacker2.process("my-gdx-game-android/assets/images/", "/my-gdx-game-android/assets/data", "bobs.atlas");
 ...

The folders inside TexturePacker are ok syntaxed? Or I must remove the "my-gdx-game-android/assets/"?

Thanks!


texts:
I am trying to render an infinite world floor grid, similar to this question.
My project is using SceneKit with Metal Shading Language but the concepts are no doubt similar between GLSL/HLSL.
Here is an example project where I attempt to render a plane as a full screen quad with the grid lines drawn using a fragment shader.
Full shader code can be found here.

Grid Rendering
A simple vertex shader sets the position and grid coordinate for the plane:
f.position = scn_node.modelViewProjectionTransform * float4(v.position, 1.0);
f.ij = v.position.xy;

The fragment shader then determines which color to render the grid or floor:
fragment half4 floor_fragment(FragmentIn f [[stage_in]]) {

    float2 fractional  = abs(fract(f.ij; + 0.5));
    float2 partial = fwidth(f.ij;);

    float2 point = smoothstep(-partial, partial, fractional);

    float saturation = 1.0 - saturate(point.x * point.y);

    return half4(mix(backgroundColor.rgb, gridColor.rgb, saturation), 1.0);
}

I then remove any MVP transforms and simply set the vertex position as is in clip space to fill the screen. This does have the intended effect of filling the screen but mangles the grid lines.
//inside floor_vertex()
f.position = float4(v.position, 1.0);
f.coordinate = v.position.xy;

Ray Casting
As suggested in the comments, the fragment position should be projected into world space and intersected with the floor plane to find a new vector on the plane. I have an intersect(plane:ray) method returns a hit with a distance and a point on the plane or otherwise false if the ray is orthogonal to the plane.
It is my understanding that by multiplying the position in clip space with the inverseViewProjectionTransform the result will be in camera space. The plane is also converted to camera space with the modelViewTransform and I then test my ray against this which appears to work but with incorrect results.

fragment half4 floor_fragment(Fragment f [[stage_in]], constant SCNSceneBuffer& scn_frame [[buffer(0)]], constant NodeBuffer& scn_node [[buffer(1)]]) {

    //f.ij is in the vertex position in clip space (-1, -1) to (1, 1)

    //convert position into camera space
    float4 position = (scn_frame.inverseViewProjectionTransform * float4(f.ij.x, f.ij.y, 0.0, 1.0));

    //create ray from camera with direction
    Ray ray = Ray { .origin = float3(0.0), .direction = normalize(position.xyz) };

    //convert floor plane from world space to camera space
    float3 worldFloor = (scn_node.modelViewTransform * float4(float3(0.0, -5.0, 0.0), 1.0)).xyz;

    //hit test ray against floor plane
    Plane plane = Plane { .position = worldFloor, .normal = float3(0.0, 1.0, 0.0) };

    RayHitTest hitTest = intersect(plane, ray);

    if(!hitTest.hit) {

        return f.backgroundColor;
    }

    //grab xz values to determine floor fragment color
    float2 uv = hitTest.vector.xz;

    float2 fractional  = abs(fract(uv + 0.5));
    float2 partial = fwidth(uv);

    float2 point = smoothstep(-partial, partial, fractional);

    float saturation = 1.0 - saturate(point.x * point.y);

    return half4(mix(f.backgroundColor.rgb, f.gridColor.rgb, saturation), 1.0);
}

This video shows the final results where you can see that the grid is not correctly aligned with the world axis. The floor plane is positioned at 0.0, -5.0, 0.0 and the rectangle at 0.0, -4.5, 0.0 which should be aligned with each other but this is not the case. It looks to me that the perspective is off as the grid seems much larger than is should be.
Can anyone please point out the obvious mistake(s) I am making?


texts: If I create a VBO in LWJGL of, say, 128,000 vertices, and push it to the graphics card, there's a considerable delay. This delay lasts for about 11 to 12 milliseconds. The same thing happens the second and third time I push the (slightly changed) array. However, after that, the length of the delay sharply drops to between 1 and 3 milliseconds. Why exactly does this happen? I can't seem to think of a plausible reason for this phenomenon; perhaps someone could shed some light onto the situation?


texts: Unity 4.3 (2D) Rendering only the parts of a sprite that are within specific bounds

texts:
I'm working in Unity, using the 2D features to recreate the match-3 style of 10000000 (Ten Million).

I have a parent object (green square) with several children objects (blue rectangles) on top of it, as pictured in the first image. I want to only render the parts of the child objects that are over top of the parent object, as shown in the second image.

I can figure out the size and position of everything just fine, what I'm having trouble with is figuring out how to mask off the parts of the child objects that don't overlap with the parent.


texts:
I am working on a project(Racing car).
When it hit an object the object should be destroyed. The Object is being destroyed when it is hit, but the car stops for a moment after hitting like an obstacle.
How can I make this smooth, like the object is there and it is destroyed on collision but the car moves with the same speed?

Script attached to the object:

void OnCollisionEnter(Collision col){

    Destroy (gameObject);

}

Nothing needs to stop or slow down.
It doesn't need to exert any physical force.

Thanks.


texts:
My maths isn't as good as it should be, I need to pick up some reference books on Trig.

Could someone give me an idea of the maths if I wanted to revolve many sprites around a central point?

It's a 2D system in MonoGame.

I'm going to try to describe the scenario, I can't think of anything quite like it to reference.

Imagine a game screen, you are looking down on the world, with my character in the middle, my character sprite will never change, but if I turn left or right I want everything else to rotate around the central point.  Of course every sprite will have to be moved, and also rotate to account for the spin.

Can someone point me in the right direction?
Thanks.


texts: Why should I use a list of enemies instead of an array of enemies?

texts: I have been making 2d shooter similar to galaga using xna in C#, where the enemies (2 types) are all in rows above the player's ships, and are supposed to randomly launch attacks.  I had previously implemented part of this game using an array to generate the rows of enemies and testing to make sure the other game mechanics worked before implementing the enemy movement system and ai.  I was told later that I should use a list instead of an array to generate the rows of enemies.  What advantage is there to using a list over using an array?


texts: Default movement keybindings for roguelike?

texts:
I'm developing a text based MUD, but unlike MUDs I'm developing without telnet and making a custom interface.  Think Caves of Qud or Dwarf Fortress.  The game only has 6 directions you can walk.  North, East, South, West, Up, Down.  So cardinal directions plus up and down.  The question is I want to map these directions to the numpad. But often these types of games include intermediate directions northeast, northwest, southeast, southwest so I'm not sure I should really use those keybindings from other games.  I could be wrong.  I don't know of any other games that use only the directions I'm using that also include a custom interface.  My personal feeling is the directions would be bound to the numpad as such, but if there is a kind of de facto standard out there I would prefer that.  I'm planning to add key rebindings, but I'm trying to figure what the default should be.

n = 8
e = 6
w = 4
s = 5
u = 9
d = 7


texts: As an indie game dev, what processes are the best for soliciting feedback on my design/spec/idea?

texts:
Background

I have worked in a professional environment where the process usually goes like the following:

Brain storm idea
Solidify the game mechanics / design
Iterate on design/idea to create a more solid experience
Spec out the details of the design/idea
Build it

Step 3. is generally done with the stakeholders of the game (developers, designers, investors, publishers, etc) to reach an 'agreement' which meets the goals of all involved. Due to this process involving a series of often opposing and unique view points, creative solutions can surface through discussion / iteration. This is backed up by a process for collating the changes / new ideas, as well as structured time for discussion.

As a (now) indie developer, I have to play the role of all the stakeholders (developers, designers, investors, publishers, etc), and often find myself too close to the idea / design to do more than minor changes, which I feel to be local maxima when it comes to the best result (I'm looking for the global maxima, of course).

I have read that ideas / game designs / unique mechanics are merely multipliers of execution, and that keeping them secret is just silly. In sharing the idea with others outside the realm of my own thinking, I hope to replicate the influence other stakeholders have.

I am struggling with the collation of changes / new ideas, and any kind of structured method of receiving feedback.

My question: As an indie game developer, how and where can I share my ideas/designs to receive meaningful / constructive feedback? How can I successfully collate the feedback into a new iteration of the design? Are there any specialized websites, etc?


texts:
I have a couple of questions.  Some of this I've done some research on, and some of it may be lacking, but any help is appreciated.

1)  When distributing an XNA game for PC that uses custom fonts that I've installed on my Dev system - will they be usable on a client machine, or will that machine have to have that font installed?

2)  What's the best practice for a)creating installers for XNA games for PC, and b)patching existing XNA game installations?

Thanks a lot.


texts: How can I align a 2D object properly using tilemap collision

texts:
I'm making a mario clone, and I have been working on the collision but I can never seem to get it right.
I started out with "true/false" collision, aligning the player at it's last position, and as can guess, the results were barely ok. The problem was in the alignment and in the direction of movement.
I then converted my collision function to return the rectangle area of intersection as shown in the top left corner: (Yellow rectangle)

I now have a bunch of other problems which I think are more acceptable to solve.
I'm unsure of what to do with the data I get from the function now.
My current logic is this:
// Update Gravity
// Update Movement
// Check for collision
// Intersect2 applies offset to a existing rectangle, and returns true or false.
if(Intersect2(*level, *camera)) // Check collision against level, but only against tiles in camera view.
{
    // Correct Y Movement
    if (offset.height >= 16) sprite.move(0, offset.height); // 16 is half a tile size
    else
    {
        sprite.move(0, -offset.height);
        inAir = false;
    }
    velocity.y = 0;

    // We corrected Y, are we still intersecting? then correct X as well
    if(Intersect2(*level, *camera))
    {
        if (offset.width >= 16) sprite.move(offset.width, 0); // 16 is half a tile size
        else sprite.move(0, -offset.height);
        velocity.x = 0;
    }
    // Reset the offset rectangle
    offset.height = 0;
    offset.top = 0;
    offset.left = 0;
    offset.width = 0;
}

How can I apply the offset in a correct way?
Side note: I have stuttering problems while on ground, as my gravity is always "on" so that I can fall down when walking off an elevated block.


texts: Unable to Render to multiple rendertargets

texts:
I am trying to implement a simple deferred rendering engine in openGL and i have a little problem with the GBuffer. I cant get it to render to more than one texture at a single time, which is the one attached to GL_COLOR_ATTACHMENT0.

GBuffer initialization code:

    glGenFramebuffers(1,&m_FBO);
glBindFramebuffer(GL_FRAMEBUFFER,m_FBO);
//create Gbuffers
glEnable(GL_TEXTURE_2D);
//create diffusemap
glGenTextures(1,&m_Textures[GBUFFER_DIFFUSE_24]);
glBindTexture(GL_TEXTURE_2D,m_Textures[GBUFFER_DIFFUSE_24]);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,m_Width,m_Height,0,GL_RGB,GL_UNSIGNED_BYTE,0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,m_Textures[GBUFFER_DIFFUSE_24],0);
if(!glIsTexture(m_Textures[GBUFFER_DIFFUSE_24]))
    return false;
//create normalmap
glGenTextures(1,&m_Textures[GBUFFER_NORMAL24_MATID8]);
glBindTexture(GL_TEXTURE_2D,m_Textures[GBUFFER_NORMAL24_MATID8]);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB32F,m_Width,m_Height,0,GL_RGB,GL_FLOAT,NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT1,GL_TEXTURE_2D,m_Textures[GBUFFER_NORMAL24_MATID8],0);
if(!glIsTexture(m_Textures[GBUFFER_NORMAL24_MATID8]))
    return false;
//create depthmap
glGenTextures(1,&m_Textures[GBUFFER_DEPTH32]);
glBindTexture(GL_TEXTURE_2D,m_Textures[GBUFFER_DEPTH32]);
glTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH24_STENCIL8,m_Width,m_Height,0,GL_DEPTH_STENCIL,GL_UNSIGNED_INT_24_8,0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glFramebufferTexture2D(GL_FRAMEBUFFER,GL_DEPTH_STENCIL_ATTACHMENT,GL_TEXTURE_2D,m_Textures[GBUFFER_DEPTH32],0);
if(!glIsTexture(m_Textures[GBUFFER_DEPTH32]))
    return false;
GLenum drawBuffers[] = {GL_COLOR_ATTACHMENT0,
                        GL_COLOR_ATTACHMENT1};
glDrawBuffers(2,drawBuffers);
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);

if(status != GL_FRAMEBUFFER_COMPLETE)
{
    printf("FBO error!!, status: 0x%x\n",status);
    return false;
}
glBindFramebuffer(GL_FRAMEBUFFER,0);

And then before i render all geometry i do this:

            glClearColor(0.2f,0.6f,0.3f,0);
    glBindFramebuffer(GL_DRAW_FRAMEBUFFER,m_FBO);
    GLenum drawBuffers[] = {GL_COLOR_ATTACHMENT0,
                            GL_COLOR_ATTACHMENT1};
    glDrawBuffers(2,drawBuffers);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT| GL_STENCIL_BUFFER_BIT);

And then after i rendered all of it i blit it to the normal framebuffer:

            RenderGeometry();
    glBindFramebuffer(GL_FRAMEBUFFER,0);
    glClearColor(0.0f,0.0f,0.0f,0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT| GL_STENCIL_BUFFER_BIT);
    glBindFramebuffer(GL_READ_FRAMEBUFFER,m_GBuffer->GetHandle());
    glReadBuffer(GL_COLOR_ATTACHMENT0);
    glBlitFramebuffer(0,0,1280,720,
        0,0,640,370,GL_COLOR_BUFFER_BIT,GL_LINEAR);

    glReadBuffer(GL_COLOR_ATTACHMENT1);
    glBlitFramebuffer(0,0,1280,720,
        640,370,640,370,GL_COLOR_BUFFER_BIT,GL_LINEAR);
    glfwSwapBuffers(m_Window);

And my fragment shader code is:

    #version 430

    in vec2 Tex;
    in vec3 Normal;

    uniform sampler2D   tex1;
    uniform bool        UseTexture;

    layout(location = 0) out vec3 FragmentColor;
    layout(location = 1) out vec3 FragmentNormal;

    void main()
    {
FragmentNormal.xyz = normalize(Normal);
if(UseTexture)
{
    FragmentColor = texture(tex1,Tex).rgb; //diffuse color
}
else
{
    FragmentColor = vec3(1,1,1);
}
    }

And the result is:

It should be two rectangles drawn to the screen one containing the diffuse color and one containing the screen normals. However i am only getting one.


texts: How do I find out if this particular puzzle can still be solved?

texts:
A while ago, I made a simple game that involved swapping birds to combine them and release them to create points. The idea is that eventually, the birds would get stuck and your game is over, but I found it tremendously hard to think of a way to detect a game-over, so I published it without such an algorithm and just hoped people would see it for themselves. However, I'm still very interested in a solution and hoped someone could help me.

The game works as follows:

6 different kinds of birds are distributed over an n x n (usually 4 x 4) grid.
For every two birds of the same type, if they would form a perfect rectangle together, they merge into one bigger bird of the same type. This means you can have birds that are, for example, 4 x 1 or 3 x 2.
Birds that are big enough can be removed from the grid, generating points. What's 'big enough' depends on the type of bird, some only need to cover 1 square on the grid, others 2 or 3.
Empty squares on the grid will get filled up with new, random birds falling from above. That is, of course, as long as other birds don't block the way. All birds always fall down when they can, and moving a bird upwards is therefore impossible (though, swapping upwards is allowed).
Two birds can swap places if they are of the same width when swapping vertically, or of the same height when swapping horizontally, but only when they are aligned perfectly. A bird can always move to an empty spot, given that its new position would be large enough to contain it and that the new spot wouldn't deny gravity.
Eventually, groups of 2 tall/wide birds will prevent anymore progress. Some birds can still be swapped, and maybe some would even become big enough to be removed when combined with certain others, but they will never get near each other, resulting in a game over.

I'm not too sure whether this is clear enough. I don't really want to post a link to the game here because I'm really only interested in the algorithm, not new downloads. Also I'm not too sure if I'm allowed to, as it could be seen as an advertisement. But please request more clarity where needed!


texts: Tools to generate convex collision geometry

texts:
Does anyone know tools to generate convex collision geometry from given 3D model?

For example, UDK's Static Mesh Editor can do this; Valve instead recommends to use smoothing in 3D editor.

Desired features:

The tool could convert concave geometry into convex shape automatically and remove unnecessary model data.
Could allow us to specify number of vertices/triangles in generated collision shape.
Could export that shape to some interchange file format (like COLLADA or FDX).

Does that tool exist? (it even can be commercial, not free, but could be obtained separately, without particular engine/SDK/bundle...)


texts: Why can't I load images in processing.js and let them be dynamic?

texts:
I can't easily load images. I can only render an image once unless I put this:
 in my html. I also still need to be able to use..... get(x, y, w, h) to get the pixels of an image But I run into this error: processing.js:13709 Uncaught DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data. when ever I operate it on the canvas.
   Also when I try to load the image sometimes it doesn't load.

So how should I fix it? (It still needs to be a processing js image object)

JS:
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext('2d');
var processing = new Processing(canvas, function(processing)
{
    processing.size(800, 800);
    processing.background(0xFFF);

var mouseIsPressed = false;
processing.mousePressed = function()
{
    mouseIsPressed = true;
};
processing.mouseReleased = function()
{
    mouseIsPressed = false;
};

var keyIsPressed = false;
processing.keyPressed = function()
{
    keyIsPressed = true;
};
processing.keyReleased = function()
{
    keyIsPressed = false;
};

processing.getImage = function(url)
{
    //Loading of the home test image - img1
    var img1 = new Image();

    //drawing of the test image - img1
    img1.onload = function()
    {
        //draw image
        ctx.drawImage(img1, 0, 0);

        //ctx.fillStysle = "rgba(200, 0, 0, 0.5)";
        //ctx.fillRect(0, 0, img1.width, img1.height);
    };
    img1.src = url;//Set image url

    processing.externals.sketch.imageCache.add(img1.src);

    var img2 = processing.loadImage(img1.src);

    //img2.url = url;
    //img2.onload = img1.onload;

    return img2;
};

// use degrees rather than radians in rotate function
var rotateFn = processing.rotate;
processing.rotate = function(angle)
{
    rotateFn(processing.radians(angle));
};

with (processing)
{
    var img1 = getImage("images/papermario.png");

    //var img2 = createGraphics(180, 180, P2D);
    background(0, 0, 0);
    image(img1, 0, 0);
    //var img2 = get(0, 0, 400, 400);

    draw = function()
    {
        background(255, 255, 200);

        image(img1, 0, 0);

        //ctx.drawImage(img1, 0, 0);s

        //image(get(0, 0, 180, 180), 80, 80);
        //var img1 = getImage("images/papermario.png");
        //img1.onload();

        //image(img2, 40, 0, 40, 40);
        //image(img2, 0 + millis() / 1000, 0, 30, 30);
    };
}

if (typeof draw !== 'undefined')
{
    processing.draw = draw;
}

});


texts: Why do most 2D platformers start off in the left and progress in the right direction?

texts: In almost all 2D platformers I've played, your avatar always starts off on the left side of the world, and continues on to the right. Is there something designers gain by doing this?


texts:
I needed to create my own VertexElement with the follow - Position, Color & Normal. I found a tutorial explaining how to do this here (http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series1/Terrain_lighting.php).

I created a struct similar to the tutorial and then replaced all the declarations with the new one, but I get this error:

  There is no boxing conversion from 'VertexPositionColorNormal' to
  'Microsoft.Xna.Framework.Graphics.IVertexType'.

and I get it under the rendering line here:

graphicsDevice.DrawUserIndexedPrimitives<VertexPositionColorNormal>
(PrimitiveType.LineList, currentPlayer.LLObject.Vertices, 0,
    currentPlayer.LLObject.TotalVertices, currentPlayer.LLObject.LinelistIndexes, 0,
    currentPlayer.LLObject.TotalLinelistIndexes / 2);

I had a look on Google to see if there was any obvious answers but it's hard to search for. Could someone spread some light on what is going wrong?


texts: How to create a turn-based system with an unknown number of enemies?

texts:
This is my first time using Unity (and my third time creating a game in general), so I hope I can provide the needed information to solve this problem.

I want to create a turn-based system for my 2D Top/Down Roguelike. After the generation of the dungeon, there will be x enemies spawned based on chosen difficulty and chosen quest.

How should each turn look like?
Player for example is an Orc, so he gets 7 movement (meaning he can move 7 tiles).
In his turn he can move for example 3 tiles, then attack, 2 tiles, use a potion and then uses his last 2 tiles of movement. And then he presses "End Turn" and then the enemies go through their turns (based on which type of creature they are). The player can skip his turn completely, attack and don't move or only move. But he always needs to press the "End Turn" button.

What I would do, to solve this issue:
I would create a boolean for every single enemy and the player, then turn them true or false. And whenever boolean is true, that person can do his turn. But to check this, I would need to put it in the "Update" method. So on every frame there would be x+1 checks (all enemies plus player), who can move or not.

A second idea would be to put the player and the enemy in an array, sort by speed variable (so who goes first, and who goes last) and then I would have my turn order without any boolean. But this still leaves the question, how I would prevent the player of moving or doing stuff while it is not his turn.

I don't think any of them would be a good idea. Since I use now Unity, I hope there is a better option for this. And just a heads up, English isn't my first language, but I hope you can understand me. I will happily answer any question.


texts: Question regarding simplification of world creation and collision (VISUAL BASIC)

texts:
In my computer programming class we are creating our own top down adventure games in Visual Basic. Currently I have been able to have the player appear on screen and collide with a block on the screen.

My question comes from the collision code which is here:

Public Sub checkCollide()
        'If player's top is in range of the block above it...
        If yPos = Form1.block1Y + 49 And (xPos >= Form1.block1X And xPos <= Form1.block1X + 49 Or xPos + 49 <= Form1.block1X + 49 And xPos + 49 >= Form1.block1X) Then
            'Disable upward movement
            canMoveUp = False

        Else
            canMoveUp = True
        End If

        'If player's left is in range of the block to its left...
        If xPos = Form1.block1X + 49 And (yPos >= Form1.block1Y And yPos <= Form1.block1Y + 49 Or yPos + 49 <= Form1.block1Y + 49 And yPos + 49 >= Form1.block1Y) Then
            'Disable left movement
            canMoveLeft = False

        Else
            canMoveLeft = True
        End If

        'If the player's underside is in range of the block below it...
        If yPos + 24 = Form1.block1Y And (xPos >= Form1.block1X And xPos <= Form1.block1X + 49 Or xPos + 49 <= Form1.block1X + 49 And xPos + 49 >= Form1.block1X) Then
            'Disable downward movement
            canMoveDown = False

        Else
            canMoveDown = True
        End If

        'If the player's right is in range of the block to the right of it...
        If xPos + 24 = Form1.block1X And (yPos >= Form1.block1Y And yPos <= Form1.block1Y + 49 Or yPos + 49 <= Form1.block1Y + 49 And yPos + 49 >= Form1.block1Y) Then
            canMoveRight = False

        Else
            canMoveRight = True
        End If
End Sub

I was wondering if there was a way to create a struct or class of some sort that allowed for a much simpler way to do this. Each block is a picture box. When creating a new block I need to repeat these steps for each one created, resulting in a huge list that is probably unnecessary.
Thanks.


texts: JavaScript THREE.js webgl spotlight rendering

texts:
I'm playing with webgl/JavaScript/THREE and a spotlight. And I see unexpected results. And I don't understand what's going on, and I'm hoping you can point me in the right direction. In my particular case, the bizarre behavior is when the spotlight is behind the character, but the light is rendered as it's coming from the front. I apologize, I think it's best if you take a look here to see what I mean

http://dhkgames.com/games/redshifted

. Please note that in my tests This website worked in chrome and Internet Explorer, but for some reason not in Firefox. Also, please be patient, the test website is hosted in Singapore, so it may take up to one minute onto the character is downloaded and rendered in the middle of the screen

. What I'm interested in is to understand if the spotlight works as designed, or maybe I can update vertex/fragment programs.
 As a secondary goal, in the spotlight The pants and the jacket material renders somehow differently, and once again I'm not sure why, so if you have some pointers for this as well It would be much appreciated!

. Lastly, I apologize for misspellings, my arms and eyes don't work very well, and I use voice recognition software to interact with my computer…

. Thanks!


texts: Extrapolating performance on cheaper devices

texts:
I am in the final stages of developing a game with XNA and MonoGame and am planning to release it on Windows Phone and Android. I personally have a Blu Win HD LTE and my father and sister have a Nexus 5 and Moto e, respectively.

I am testing on all of these devices. What I am unsure of is how to extrapolate what the performance will be on cheaper devices, like a Lumia 630. I already can use profiling on my phone to make sure I'm under the 185MB memory limit, but I'm not sure what the framerate/performance will be.

I am looking for a way to roughly estimate how much slower the performance will be based on some variable (processor speed, GPU model, number of cores, etc.), such that I can tune performance on my current device and be assured of performance on cheaper devices. Has anyone tried this?


texts: How can cooperation be encouraged in and after a game jam?

texts:
The trouble is that with game jams sometimes loads of people participate, but at the end they say "Right! Bye!" and you never hear from them again. If a cooperative element was introduced, the reward from the jam would not only be a game, but a new friend to create games with.

How do you go around implementing such a design without causing lots of people to drop out?


texts:
I shall submit a 3d asset to the Unity asset store. Their submission guidelines say,"... must include at least an albedo,normal,metallic (or specular) and smoothness texture map."

My query is how do I get the smoothness map and where do I put it ?
There is just one slot by the smoothness slider where I put the metallic map.
Is it really necessary to put a smoothness texture map if I already have a metallic map attached to the material?

It's my first attempt to submit an asset to the asset store.


texts: Unity3D Mapping uv coords from quads with unique vertices directly to texture map

texts:
this is my first post in this stack exchange!

I was wondering how I would go about mapping the texture of my tiles for my tilemap directly to the texture atlas.

I generate the mesh with unique vertices per tile to circumvent having to generate a Texture2D in memory to map all the squares to. I know it's possible to map the uv coords of the vertices to the texture like in the image below, since I have unique vertices per square. But I have no idea how to actually do it in my code. I tried just filling the uv array with random values between 0 and 1 to see if it worked at all but I just get a green mesh, no other colours in there.

Does anyone know a way to implement this?


texts: Monogame/Android: Using content from PCL

texts:
I'm quite new to Monogame and PCL, but I hope someone can help me with my question.

I have a Monogame/Android project with references a PCL which targets .NET 4.5, iOS and Android.
The PCL has content files suchs as SpriteFont and Texture2D. They are set to "Content", "Always copy" and are .xnb files.
The problem is when I start my Android game I get a "asset not found" exception for the content in the PCL. When I launch my Windows game it works all fine.

To begin with, can I have content files in a PCL and is that good practice?


texts: XNA, how to draw two cubes standing in line parallelly?

texts:
I just got a problem with drawing two 3D cubes standing in line. In my code, I made a cube class, and in the game1 class, I built two cubes, A on the right side, B on the left side. I also setup an FPS camera in the 3D world.
The problem is if I draw cube B first(Blue), and move the camera to the left side to cube B, A(Red) is still standing in front of B, which is apparently wrong.

I guess some pics can make much sense.

Then, I move the camera to the other side, the situation is like:

This is wrong.... From this view, the red cube, A should be behind the blue one, B....

Could somebody give me help please?

This is the draw in the Cube class

Matrix center = Matrix.CreateTranslation(
new Vector3(-0.5f, -0.5f, -0.5f));
Matrix scale = Matrix.CreateScale(0.5f);
Matrix translate = Matrix.CreateTranslation(location);
effect.World = center * scale * translate;
effect.View = camera.View;
effect.Projection = camera.Projection;

foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();
                device.SetVertexBuffer(cubeBuffer);

                RasterizerState rs = new RasterizerState();
                rs.CullMode = CullMode.None;
                rs.FillMode = FillMode.Solid;
                device.RasterizerState = rs;

                device.DrawPrimitives(
                PrimitiveType.TriangleList,
                0,
                cubeBuffer.VertexCount / 3);
            }

This is the Draw method in game1

 B.Draw(camera, effect);
 A.Draw(camera, effect);

**


texts: are there any alternatives to developing android apps other than with eclipse

texts:
Ever since I installed the android sdk and avd manager in eclipse for java developers, it's been pretty simple to create apps for the mobile device. The only issue I have is eclipse is way too slow for comfort. Sometimes it takes up to a minute to do simple things like opening up a java class file.

Are there any faster ways to utilize the android sdk/avd manager plugins in some alternative IDE that is stable?


texts: How can I delete an object when it's not stored in an array?

texts:
I have a boss appearing in my game, but since it's only one character I didn't put it in an array. Now I'm trying to make disappear if its health is less or equal to 0 but I don't know how to do that. Is there a way to remove the object? I only know how to remove a property of an object.

Here's the boss object:

function Boss1(x, y) {
    this.sprite = boss1Sprite;
    this.x = x;
    this.y = y;
    this.imgWidth = 160;
    this.imgHeight = 224;
    this.frameWidth = this.imgWidth / 4;
    this.frameHeight = this.imgHeight / 4;
    this.health = 1500;
    this.directionMode = 1;
    this.currentFrame = 0;
    this.SPEED = 1;
    this.delta = 1;
    this.updateFrame = function () {
        this.currentFrame += 0.2;
    }
    this.showHealth = function () {
        ctx.fillStyle="red";
        ctx.fillRect(this.x,this.y - 10,(this.health/100)*3.3,5);
        ctx.strokeRect(this.x, this.y-10, (100/100) * 50, 5);
    }
    this.show = function () {
        this.updateFrame();
        this.walkingMode = Math.floor(this.currentFrame) % 4;
        ctx.drawImage(this.sprite, this.walkingMode * this.frameWidth, this.directionMode * this.frameHeight, this.frameWidth, this.frameHeight, this.x, this.y, this.frameWidth, this.frameHeight);
    }
    //target == hero
    //position == this
    this.move = function () {
        this.dx = hero.x - this.x;
        this.dy = hero.y - this.y;
        this.length = Math.sqrt(this.dx * this.dx + this.dy * this.dy);
        if (this.length) {
            this.dx = this.dx / this.length;
            this.dy = this.dy / this.length;
        }
        this.x += this.dx * this.delta * this.SPEED;
        this.y += this.dy * this.delta * this.SPEED;
    }
}

//enemy wave object
function random(min, max) {
    return Math.random() * (max - min) + min;
}
function Enemy(x, y){
    this.sprite = enemySprite;
    this.x = x;
    this.y = y;
    this.imgWidth = 128;
    this.imgHeight = 192;
    this.frameWidth = this.imgWidth / 4 ;
    this.frameHeight = this.imgHeight / 4;
    this.toDelete = false;
    this.dx = random(1, 3);
    this.enemiesHealth = 100;
    this.directionMode = 1;
    this.currentFrame = 0;
    this.updateFrame = function(){
        this.currentFrame += 0.2;
    }
    this.showHealth = function (){
        ctx.fillStyle="red";
        ctx.fillRect(this.x,this.y - 10,(this.enemiesHealth/100)*50,5);
        ctx.strokeRect(this.x, this.y-10, (100/100) * 50, 5);
    }
    this.show = function(){
        this.updateFrame();
        this.walkingMode = Math.floor(this.currentFrame) % 4;
        ctx.drawImage(this.sprite,this.walkingMode * this.frameWidth,
        this.directionMode * this.frameHeight, this.frameWidth, this.frameHeight,
        this.x, this.y, this.frameWidth, this.frameHeight );
    }
    this.move = function(){
        this.x = this.x - this.dx;
    }
    this.deletion = function(){
        this.toDelete = true;
    }
}

//this is when the boss is spawning
//the game loop
function draw() {
    bullets = bullets.filter((bullet) => bullet.x <= viewLimit);
    enemies = enemies.filter((enemy) => enemy.x >= viewLimit1);
    while (enemies.length <= enemiesPerTick && kills <= 5) {
        var enemy = new Enemy(canvas.width, random(0, canvas.height - 60));
        enemies.push(enemy);
    }
    for (var v = 0; v < enemies.length; v++) {
        enemies[v].showHealth();
    }
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    hero.show();
    hero.update();
    hero.showHealth();
    for (var i = 0; i < bullets.length; i++) {
        bullets[i].show();
        bullets[i].move();
    }
    for (var j = 0; j < enemies.length; j++) {
        enemies[j].show();
        enemies[j].move();
    }
    for (var t = 0; t < enemies.length; t++) {
        enemies[t].showHealth();
    }
    collision();
    drawScore();
    if (enemies.length == 0) {
        boss1.show();
        boss1.move();
        boss1.showHealth();
    }

    requestAnimationFrame(draw);
}

console.log(enemies, bullets);
draw();


texts: Have a particle system's particles obey transparency sort mode individually

texts:
Background

In a top-down game, I have particles that spawn animated textures. I have my 2D renderer settings set-up so that it orders sprites based on their position on th Y-axis via "Transparency Sort Mode > Custom Axis > Y".

The Problem

But instead of sorting for each particle spawned, what happens is the particle system obeys the setting as a whole so that the sort order is only based on the particle's system's center.

Is there a way to have each particle obey Transparency Sort Mode individually?

What I want for each particle:

What actually happens:

Other Solutions

Other people seem to have an old workaround to use GetParticles and setting their "order in layer" individually. See this thread from 2015:

https://forum.unity.com/threads/particle-systems-with-sprites-order-in-layer.464533/

But I'm trying to find if there's a cleaner solution for Unity 2019 without having to fudge with "order in layer".


texts: How can velocity be normalized after a collision if a projectile needs to maintain its height?

texts:
I want a thrown disc to travel along the same height, even after collisions. The problem is, there's an edge case that I'm not sure how to deal with.

The lowest-tech solution would probably be to quickly interpolate the rotation of the disc so that it's flat, and also interpolate its height so that it never collides with another object in a way that would impact its height, but that might be a bit heavy-handed. I worry that it would look really bad if you're holding the disc at an angle when releasing it for a throw, and it just suddenly "swooshes" flat mid-flight. Would that seem janky?

If I don't do that, and I simply retain the disc's rotation as it flies along its path, then it might collide with an object's edge in a way where the correct bounce angle would send it upwards or downwards, which I don't want. But if I simply hard-code the y velocity to 0, then in those instances, the lateral velocity becomes very low. Should I just check for a "minimum" speed, and increase it to that if it falls below that? Because the issue is that in the case where it bounces upward, there's a good chance that the correct bounce angle, if the y velocity is ignored, results in the disc continuing in the same direction rather than bouncing.

So I'm honestly leaning towards extending the collision boxes for these objects really far above and below where the disc could possibly be thrown, that way regardless of its orientation, it would always be the side of a cylinder colliding either with the side of a box or one of its vertical edges, and the velocity change should thus (hopefully) always look like it makes sense.


texts:
I want to shoot a projectile in the direction the gun is facing.

With my current script it only shoots vertically. (I can also make it go horizontally but that's it).

This is my GunController class:

public Transform guntip;
public GameObject bullet;

float fireRate = 0.5f;
float nextFire = 0f;

void Update ()
{
    //playershooting
    if (Input.GetAxisRaw("Fire1") > 0)
    {
     fireRocket();
    }
}

void fireRocket()
{
    if(Time.time > nextFire)
    {
        nextFire = Time.time + fireRate;

        Instantiate(bullet, guntip.position, Quaternion.Euler(new Vector3(0, 0, 0)));
    }
}

This is my ProjectileController class:

Rigidbody2D MyRB;
public float rocketSpeed;

 void Awake()
{
    MyRB = GetComponent<Rigidbody2D>();

    MyRB.AddForce(new Vector2(0, 1) * rocketSpeed, ForceMode2D.Impulse); // explosive force, change vector 2 for horizontal shooting

}


texts: OpenGL App not setting cursor position appropriately

texts:
I have written a small application using OpenGL, and have implemented some rudimentary camera controls. Unfortunately, I cannot get the application to set my cursor position correctly. The cursor is never set to where I tell it to go, so my application just reacts to where the cursor is on my entire screen.

I first attempted to use GLFW, and when I saw that I couldn't set the cursor appropriately, I decided to try SFML. Neither one works.

I'm on an Arch Linux install with a Gnome desktop. I've been trying to figure this out for a few days now to no avail.

The relevant code is as follows:

sf::Vector2i cursor_pos = sf::Mouse::getPosition(*window);
sf::Mouse::setPosition(sf::Vector2i(1280/2, 720/2), *window);

This gets called every frame inside a function that messes with some matrices.

I also set the cursor position at initialization.

Any hints or advice would be greatly appreciated.


texts: My Raycast2D doesn't go where I want and it doesn't return a GameObject

texts:
I want my Objects to teleport when they hit a wall. For that, I want to shoot a Ray backwards and teleport it to where the ray hits the wall, but whatever I try, it always teleports to the centre of the scene and the ray hit doesn't return a GameObject. This version I tried runs on OnTriggerEnter2D:
RaycastHit2D hit = Physics2D.Raycast(transform.position, -transform.up, 300);
Debug.DrawLine(transform.position, hit.point);
transform.position = hit.point;

I tried some other variations too. If you have any idea, please let me know.


texts:
I have a renderer where you can define passes where you pick the shader, and a signal, each object can register a listener to that signal in order to draw himself, the problem comes when some objects are normal meshes, others are sprites, some have skeletal animations, some don't. I was wondering if I could pack within the same vertex shader many different optional main functions, and pick the correct one for each object.

If there is no way, I would have to compile a different shader for each of the types and bind it from zero for all objects, even though all fragment shaders are the same.


texts: Box2d topdown racing game - killing "residual" forces

texts:
I'm making top-down race game in GM:S with Box2D, the car is controled in unusual way: player sets direction and engine's speed, and the car uses them: turns to the desired direction and reaches speed. But the question is about the "residual" speed after the turn. Here is what I mean:

I make rotation by applying torque and move with applying force. I don't have tyres, it's just one plain object.
So how can I get rid of this momentum? I'm working in GM:S, but I'd like to hear any solution, I can adapt it easily.

Movement code:

var ad = angle_difference(phy_rotation, desiredDir);
physics_apply_torque((angleTorque) * -sign(ad)); // rotate the car

dx = lengthdir_x(spd, -phy_rotation);
dy = lengthdir_y(spd, -phy_rotation);

physics_apply_force(phy_position_x, phy_position_y, dx, dy);  // move the car


texts: How to reproduce the 3ds Max Gradient Ramp effect?

texts:
The material definition of a mesh is composed of these three components: Self-Illumunation, Refletcion and Refraction. Each of these components has a Gradient Ramp as a map and the mapping mode is set to spherical environment.
I'm searching for a way to reproduce these effects in a shader (the shader language doesn't matter). Is it possible?

My first idea was to save the Gradient Ramp as a texture: you can see the result in the image below (reflection component):

and using them in the shader through environment spherical mapping, but the result is wrong.

In this image you can see the original rendering (3ds Max, reflection component):

and in this image you can see my rendering:

The underlying idea seems to be correct, in fact there's a correlation between the two images but something goes wrong.

Thanks for any suggestion.


texts: OpenGL Maximal amount of debug string reached

texts:
I was trying to check my current openGL code in gDEBugger, everything works fine.
But, I get these messages

Debug String: >>>>>>>>> 1
Debug String: >>>>>>>>> 2
Debug String: >>>>>>>>> 3
...
Debug String: >>>>>>>>> 497
Debug String: Maximal amount of debug string reached (500 strings).
              Additional debug strings will be ignored

What are these messages, everything in my code runs fine. But its troubling to see these debug strings.


texts: anyone knows any open skeletal/bones 2d animations framework for java?

texts: Some examples could be the animations framework used in Aquaria, or in Crimson Legend.


texts:
I always get the error message "video system not initialized"

I don't get where I went wrong with the code below:

import pygame
pygame.init()

display_width = 800
display_height = 600

gameDisplay = pygame.display.set_mode((display_width, display_height))
pygame.display.set_caption('4 pics 1 word: ASTRONOMY VERSION')

black = (0,0,0)
white = (255,255,255)
red = (255,0,0)
green = (0,255,0)
blue = (0,0,255)

answered = False
satImg1 = pygame.image.load(r'C:\Users\andrea\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.7\img\satellite.png')

def satImg(x,y):
    gameDisplay.blit(satImg1,(x,y))

x = (display_width * 1.0)
y = (display_height * 1.5)

while not answered:
    if pygame.mixer.get_busy() != None:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                answered = True
    gameDisplay.fill(white)
    satImg1 = (x, y)
    pygame.quit()
    quit()


texts: How is scripting done in games such as Zelda?

texts: How do games implement their triggers and events that make up the plot of the story. For example, to be concrete how would one implement the story of a game such as The Legend of Zelda: A Link to the Past. I'm assuming there is some kind of scripting that somehow hooks into the game world state? I know absolutely nothing about scripting and game development. And have no clue how the underlying code would be architected in terms of classes, data structures, design patterns, etc.


texts: How do multipass shaders work in OpenGL?

texts:
In Direct3D, multipass shaders are simple to use because you can literally define passes within a program.  In OpenGL, it seems a bit more complex because it is possible to give a shader program as many vertex, geometry, and fragment shaders as you want.

A popular example of a multipass shader is a toon shader.  One pass does the actual cel-shading effect and the other creates the outline.  If I have two vertex shaders, "cel.vert" and "outline.vert", and two fragment shaders, "cel.frag" and "outline.frag" (similar to the way you do it in HLSL), how can I combine them to create the full toon shader?

I don't want you saying that a geometry shader can be used for this because I just want to know the theory behind multipass GLSL shaders ;)


texts: Why doesn't this weaponpickup script work properly?

texts:
I'm making an FPS game. My guns are disabled at the start.

When I use this script to pick up and hold one weapon at a time, requiring that you click J to drop it, it simply doesnt work!

There are two guns using the same pickup script with different prefabs, and all the prefabs but "MyGun" and "playertransform" are the same.

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

public class weaponpickup : MonoBehaviour {

    public GameObject MyGun;
    public GameObject WeaponOnGround;
    public GameObject DroppedWeapon;
    public Transform playertransform;

    // Use this for initialization
    void Start () {
        MyGun.SetActive(false);
    }

    // Update is called once per frame
    void Update () {
        if(Input.GetKeyDown(KeyCode.J))
        {
            Instantiate(DroppedWeapon, playertransform.position, playertransform.rotation);
            MyGun.SetActive(false);

        }
    }
    public void OnTriggerEnter(Collider other)
    {
        if(other.gameObject.tag == "Player" && MyGun.activeInHierarchy == false)
        {
            MyGun.SetActive(true);
            WeaponOnGround.SetActive(false);
        }
    }
}


texts: Can I prevent diagonal movement from exploring more of the map?

texts:
In a tile-grid where movement in any of 8 directions takes exactly the same amount of turns (chess-board style rules), can I prevent diagonal movement from showing more new tiles than orthogonal movement?

For example: You are the red box in the image below. The green cells are presently visible to you (square field of view). You can move a distance of one tile in any of the eight directions.

If you move north-east, you will explore 13 new tiles (shown in blue). If you instead move south, you will only explore 7 new tiles (shown in purple).

How can I make traveling in each direction equally favorable for exploration?


texts: Moving spotlight (or object) between 2 coordinates (image included)

texts:
Given the origin position and direction for a spotlight.
How can I smoothly move a spotlight between two 3D coordinates?
Please use the picture below so I can easily comprehend this. I would like to move the direction of the spotlight from point A to B, for example.
All values/vectors are in 3D.

EDIT:
How should I properly do this, if given only current position and unit direction of spotlight?


texts: how to make ascii ui like in dwarf fortress

texts:
Only one text field, and inside it - different sections, menus, and popups, all in ascii. How to make that?

I mean something like this:

╔═════════════════╦══════╗
║                 ║      ║
║                 ║      ║
║                 ║      ║
║                 ║      ║
╚═════════════════╩══════╝

I see only the possibility to draw each line, calculating line length and somewhat manually. But maybe there is some kind of a simple way i am not aware of?


texts: Can't understand why transformation doesn't work

texts:
To make a simple transformation like a rotation I want to use linear algebra -multiplying the vec4 vertex_position by a mat4 transformation

If alpha is the angle of rotation, then the mat4 is structured like this:

|first      |second    |third |forth|
|cos(alpha) |sin(alpha)|0     |0    |
|sin(alpha) |cos(alpha)|0     |0    |
|0          |0         |0     |0    |
|0          |0         |0     |0    |

This matrix represents a rotation in the xy plane.

The transformation doesn't work though - can anyone spot my mistake?


texts: - 2 Parts: Object/Material displays at 90degrees + Material Mask will not rotate with object?

texts:
Hi I have a 2 part issue.
Part 1: I have a planet in Unreal, in the object editor it is aligned properly and the material displays correctly but in the game even with the rotation set to 0 it displays as being flipped 90 degrees to one side? Why is this happening and how do I make it display correctly?
Part 2: The material for the planet has a mask on it to make it display day and night. However, when I attempt to manually rotate the object everything BUT the mask rotates which screws everything up. Why does the mask not rotate and how do I make it rotate with the rest for manual manipulation?


texts: How to get a position from a radial distance and angles?

texts:
I have a radius and the 2 angles for northSouth and eastWest rotations in degrees.
I need a Spherical position or a cartesian position (I have code translate one to the other)

Where a position is defined as one of the following ...

class Vector {
  public float x; // distance along x axis
  public float y; // distance along y axis
  public float z; // distance along z axis
}

class SphericalPosition {
   public float radius;       // distance from center
   public float azimuth;      // distance from 0 degrees around polar axis
   public float inclination;  // distance up from equator (x,z plane)
}

I am looking for an implementation to one of the following 2 methods ...

SphericalPosition FromAngles(float radius, float degreesUpDown, float degreesRound)
{

}

Vector FromAngles(float radius, float degreesUpDown, float degreesRound)
{

}

EDIT:
Maybe someone can confirm or deny this but given a radius and 2 angles I believe this is referred to as a polar coordinate?

So in that light I guess i'm asking how to convert from a polar coordinate defined as the following ....

class PolarPos
{
   public float radius;         // distance from center
   public float AngleUpDown;    // rotation of x,z plane
   public float AngleLeftRight; // rotation round y axis
}

... in to one of the above

EDIT 2:
Ah ha ok it looks like what I have are the radius and ...

orbital / inclination angle (in degrees):
http://en.wikipedia.org/wiki/Orbital_inclination

and the polar / azimuth angle (in degrees):
http://en.wikipedia.org/wiki/Azimuth

And essentially I think I need the math to turn degrees in to longitude / latitude type coords (the spherical position as defined above).


texts: Where to put my entity component messaging functionality?

texts:
I've done my research and read as many articles and posts on messaging and ECS's as I could find to help me get mine working. However, I'm at a roadblock on how to get my messag functionality to be handled correctly.

A little information on my ECS system.

Pieces:

Entities - Generic objects that only contains a list of attached components, has a few methods to ask if it has certain components and to retrieve them.

Components - Only holds data specific to their nature and all have a bitMask denoting the component type.

Systems - Functionality code specific to their nature and keeps a list of components it will process.

Messages -
Messages are currently created via the MessageInfo class. A message can be created easily using this line of code:

MessageInfo* msg = new MessageInfo(MESSAGE_TYPE, LISTENER_ENTITY, boost::ANY PARAMS);

I am trying to keep things decoupled as possible and have thought about adding a static MessageCenter that I can push messages to which will then either dispatch them immediately or throw them into a queue (depending on the push function call).

Example being that a message is created and pushed to the message center. The message center then immediately looks through its map of systems that care about X message and dispatches the message to a "RecieveMessage" method that's inherent to all systems. This approach sounded really good to me, so I started to develop it on paper and ended up running into a wall.

Let me put forth one of the scenario's I ran up against.

Scenario:

I have a text label entity being used as a % indicator with the position (x/y coords) component and text component (string, font size, etc). I want to alter some data properties of this entity, such as the text displayed and its color.

Since I know that all systems have a recieveMessage method I am quickly  able to encapsulate functionality specific to those types of requests as shown below.

void SOMESYSTEM::RecieveMessage(MessageInfo* messageInfo)
{
    switch(messageInfo->GetMessageType())
    {
    case MessageType::CHANGE_TEXT:
        {
            boost::any params = messageInfo->GetParams();
            if(params.type() == typeid(std::tuple<BaseComponent*,std::string>))
            {
            auto param = boost::any_cast<std::tuple<BaseComponent*,std::string>>(params);
            TextComponent* textComponent = static_cast<TextComponent*>(std::get<0>(param));
            textComponent->SetTextString(std::get<1>(param));
        }
    }break;
case MessageType::CHANGE_TEXT_COLOR:
    {
        boost::any params = messageInfo->GetParams();
        if(params.type() == typeid(std::tuple<BaseComponent*,sf::Color>))
        {
            auto param = boost::any_cast<std::tuple<BaseComponent*,sf::Color>>(params);
            TextComponent* textComponent = static_cast<TextComponent*>(std::get<0>(param));
            textComponent->SetCurrentColor(std::get<1>(param));
            }
        }break;
    }
}

The wall I run into is where do I put this functionality? Currently the only system that touches text components is my RenderTextSystem. It wouldn't seem proper to implement that RecieveMessage function wanting those specific messages. That system just draws the text to the screen. I could be over-engineering here though.

I have other scenarios similar to this and figured if I could solve this one, I could end up solving 99% of the others.


texts:
I have written a windows based game in XNA. I wish to release it for free but I would also like to monetize it in some way. What are my options?

Possible ways:

Ads - what current libraries/services are available?
Donations - PayPal, what else?
MicroTransactions - what current libraries/services are available?


texts: In Unity, how many directional lights can be active at once? 1, 2, 4, or 8? I thought 2, but I have searched and cannot confirm.


texts:
Runtime Storage (hardcoded) vs Static Storage (file storage)

  (original question)

  I extended my engines GUI from
  procedural style to object orientated
  style, but I still have to create
  menues, buttons etc. So I got the
  choice to create each menue via a
  class or have a static main class
  which loads menues from a XML file. My
  problem is that I actually like to
  have static and external storage in
  XML because it keeps the code and the
  project clean. But if a GUI Object is
  created e.g. a button I want to have
  delegates/callbacks/events on it, but
  I think that isn't possible with
  loading and creating GUI Objects by
  XML files that only contain ints and
  strings.

The question is when do you hardcode parts of your game and when do you store them locally.

Runtime Storage

+ You safe time while you do not have to write a parser or something similar.

- You lose a lot of flexibility in late development

Static Storage

+ You gain a lot of flexibility in the late development

- You spent a lot of time into a system to read and write, and also handle the storage


texts: Games like HL2 and FEAR are legendary for having excellent AI. Recent titles (as of 2018) leave much to be desired. With improvements in our understanding of probability related state machines, and general machine learning (or AI as it's called sometimes) improves, it generally feels many commercial titles forego the development of good AI. Anecdotally, I have personally experienced in recent titles (where the AI is dumb as per say - far cry, wildlands, etc.). I feel having dumb AI may sell games more (giving a more accomplished feeling, pushing players towards multiplayer, etc.). So, let me pose the question, does any research show that bad AI leads to more sales?


texts:
I've run into an issue with A* pathfinding in a chunked world.

This is my current setup:

The world is designed in Tiled and exported as a .json file.
I wrote a little program that converts the .json file into objects that are serialized into binary files the main game loads.
Each chunk is stored in it's own file (-2_-1.cnk for example).
Chunks contain an x, y, width, height, int[,] for tile ids and a bool[,] for solid flags.
The GameWorld contains a Dictionary<Point, Chunk> to store the chunks.
When the game needs to know which tile id exist at (x,y), the world first checks to see if the chunk is loaded. If not it is loaded from disk and stored in memory until it's unloaded.
The pathfinder does not know about chunks, an IGrid interface is passed when FindPath is called, IGrid contains an IsWalkable(x, y) method.
The GameWorld implements 'IGrid' and contains an implemented IsWalkable method.
When IsWalkable is called by the pathfinder, the world calls GetChunk(x, y but does not load a chunk from disk if isn't not already in memory. If a chunk is found, the bool[,] is checked to see if the tile is solid or not. If a chunk is not found, the tile is considered solid.

Pathfinding runs fine, search time range between 0.3ms - 9ms; though I have noticed that there are some corners that take ~40ms to search.

But as for my issue. Say I have a valid, accessible tile that a path can be found for, only it's close to the border of a chunk and can only be reached by leaving the current chunk and moving into an adjacent chunk. This image should be a better representation:

The red lines are the chunk borders, the yellow circle is the goal, the pink circle is the start and the blue line is the path.

For this example, pretend everything ABOVE the red chunk is an unloaded chunk, below the red line is loaded, and the player CAN SEE the goal tile. Diagonal movement is allowed, but not when moving next to a solid tile, so slipping between the trees diagonally is not allowed.

The pathfinder will keep searching the loaded chunk until it reaches the border, the chunk above is not loaded, so any tiles outside the current chunk are 'solid'. The pathfinder will continue to search available tiles in the loaded chunks until it's checked them all and decided a path could not be found.

A work around for this is to allow the pathfinder to load chunks when it reaches chunk borders, but this doesn't seem like a very clean solution.

Is there any way around this? The map is static and will not change, so I can pre-compute 'something' when I convert the map from the .json file.

One solution might be to flood fill each accessible 'region' in each chunk, only allowing paths with goals in the same region the player is standing in. But that would break if the player is standing on the boundary of two chunks, they would have different regions.

Or I'm just way over thinking this and I should just increase the chunks loaded distance so there's more overlap with the on screen and off screen chunks. Then just limit the pathfinding to have a max_search_length limit and stop when it's searched for too long.

Any thoughts?


texts: Serializing nested ScriptableObjects with runtime changes

texts:
I'm making an effort to use ScriptableObjects more in my game architecture, after watching a fantastic Unity Unite talk on the subject. The central idea is to use ScriptableObjects, during runtime, as a kind of pluggable, mutable global data container. It's intended to replace things like the singleton pattern in a more testable, less tightly-coupled way.
I'm not going to go into detail on the arguments in favor of this, but I do definitely recommend watching the talk.
When using this pattern, you'll probably run into data-container-style ScriptableObjects that you want to persist between play sessions. The problem I'm running into is that, when Unity's serializer is run on a ScriptableObject that references other ScriptableObjects, and those referenced ScriptableObjects have changed during runtime, the serializer ignores the changes on those sub-SOs.
Is there a good way to serialize nested SOs containing data that changes during runtime?

For some examples/more in-depth background:
In the game I'm working on, I'm emulating a file system that multiple otherwise-independent game objects are interested in. It looks somewhat like this:
public abstract class FilesystemObject : ScriptableObject
{
    public string FileName;
}

[CreateAssetMenu(fileName = "NewDirectory.asset", menuName = "Directory")]
public class FilesystemDirectory : FilesystemObject
{
    public List<FilesystemObject> Contents;
}

[CreateAssetMenu(fileName = "NewTextFile.asset", menuName = "Directory")]
public class FilesystemTextFile : FilesystemObject
{
    public string Contents;
}

In my project directory, I have a FilesystemDirectory asset file named FSRoot.asset that represents the root directory of the filesystem. It's populated with all the files that need to exist when the player first launches the game.
If a MonoBehaviour wants to read or write to this filesystem (say, an in-game text editor), all I have to do is expose a FilesystemDirectory field to Unity's serializer, and then hook FSRoot up to that field using the inspector. Then, during runtime, if the player creates, edits, or deletes any filesystem data, those manipulations are done directly on the FSRoot object. Any other MonoBehaviour with the same reference to FSRoot sees the same mutated data, since those changes persist in memory.
However, unless you're in the editor, those changes do not persist between sessions. You have to serialize and deserialize the data manually for that. However, when I serialize FSRoot using Unity's JsonUtility, it only captures changes that have happened to FSRoot directly, and not any changes in subdirectories/files inside FSRoot. Any files that were authored in edit time are completely unchanged.


texts: SharpDX: best practice for multiple RenderForms?

texts:
I have an XNA app, but I really need to add multiple render windows, which XNA doesn't do.  I'm looking at SharpDX (both for multi-window support and for DX11 / Metro / many other reasons).  I decided to hack up the SharpDX DX11 MultiCubeTexture sample to see if I could make it work.

My changes are pretty trivial.  The original sample had:

[STAThread]
private static void Main()
{
    var form = new RenderForm("SharpDX - MiniCubeTexture Direct3D11 Sample");
    ...

I changed this to:

        struct RenderFormWithActions
        {
            internal readonly RenderForm Form;
            // should just be Action but it's not in System namespace?!
            internal readonly Action RenderAction;
            internal readonly Action DisposeAction;
            internal RenderFormWithActions(RenderForm form, Action renderAction, Action disposeAction)
            {
                Form = form;
                RenderAction = renderAction;
                DisposeAction = disposeAction;
            }
        }

        [STAThread]
        private static void Main()
        {
            // hackity hack
            new Thread(new ThreadStart(() =>
            {
                RenderFormWithActions form1 = CreateRenderForm();
                RenderLoop.Run(form1.Form, () => form1.RenderAction(0));
                form1.DisposeAction(0);
            })).Start();
            new Thread(new ThreadStart(() =>
            {
                RenderFormWithActions form2 = CreateRenderForm();
                RenderLoop.Run(form2.Form, () => form2.RenderAction(0));
                form2.DisposeAction(0);
            })).Start();
        }

        private static RenderFormWithActions CreateRenderForm()
        {
            var form = new RenderForm("SharpDX - MiniCubeTexture Direct3D11 Sample");
            ...

Basically, I split out all the Main() code into a separate method which creates a RenderForm and two delegates (a render delegate, and a dispose delegate), and bundles them all together into a struct.  I call this method twice, each time from a separate, new thread.  Then I just have one RenderLoop on each new thread.

I was thinking this wouldn't work because of the [STAThread] declaration -- I thought I would need to create the RenderForm on the main (STA) thread, and run only a single RenderLoop on that thread.  Fortunately, it seems I was wrong.  This works quite well -- if you drag one of the forms around, it stops rendering while being dragged, but starts again when you drop it; and the other form keeps chugging away.

My questions are pretty basic:

Is this a reasonable approach, or is there some lurking threading issue that might make trouble?
My code simply duplicates all the setup code -- it makes a duplicate SwapChain, Device, Texture2D, vertex buffer, everything.  I don't have a problem with this level of duplication -- my app is not intensive enough to suffer resource issues -- but nonetheless, is there a better practice?  Is there any good reference for which DirectX structures can safely be shared, and which can't?
It appears that RenderLoop.Run calls the render delegate in a tight loop.  Is there any standard way to limit the frame rate of RenderLoop.Run, if you don't want a 400FPS app eating 100% of your CPU?  Should I just Thread.Sleep(30) in the render delegate?

(I asked on the sharpdx.org forums as well, but Alexandre is on vacation for two weeks, and my sister wants me to do a performance with my app at her wedding in three and a half weeks, so I'm mighty incented here!  http://robjsoftware.org for details of what I'm building....)


texts: Find the next cell in a grid from a point and direction

texts:
I'm trying to solve a very simple problem but I'm unable to come-up with an efficient solution so far. What I'm really trying to do is voxelize triangles in a three dimensional environment but I'll give a 2D example of my problem.
I have a point P and a direction d. P is somewhere inside a cell in the grid. I can easily calculate which cell.
My questions is. When I trace a line from P in direction d what are the coordinates of the first cell I will encounter, and at what location will I enter it? Or, in other words, at what edge and where on that edge will I exit the cell?
As a picture says a thousand words:

I'll also place the broader context here to see if I'm going about this the right way. My idea is to voxelize the triangle with vertices t0,t1,t2 by first voxelizing the edge t0-t1 and then filling in the triangle by tracing multiple edges along the line t0-t1 towards t1-t2. This way I can create the shell of the mesh after which In can start filling it in


texts: How would I make my position interpolation stop once the destination is reached?

texts:
I would like to implement tile-based grid movement and I've heard that linear interpolation comes handy in the implementation process. I've tried to use it but I'm not sure how to make it stop once the target position is reached. I can't find a way to check that on the interpolation. Here's the code I'm using:

function movePlayer(deltaTime) {
    if buttonUp then
       velocity.add(0, speed);
    if buttonRight then
       velocity.add(speed, 0);
    if buttonSouth then
       velocity.sub(0, speed);
    if buttonLeft then
       velocity.sub(speed, 0);

    velocity.scl(deltaTime);

    if (targetPosition.isZero()) {
        targetPosition.add(getNextPosition());
    }

    position.lerp(targetPosition, speed * deltaTime);

    float distance = position.dst(targetPosition);
    if (allowMovement && distance < 0.1f) {
        position = targetPosition;
        allowMovement = false;
        targetPosition.set(0, 0);
    }
}


texts: How to create a over world map with multiple sub maps

texts: my game's idea is to use a open world map consisting of say 4096x4096 size, and multiple grids of 64x64 size. When I click on any grid, the map zooms in to show that grid(either creating in from scratch or loading off a JSON) because saving all the grids could not be memory efficient. Is there any algorithm to do like this?


texts:
I have a game with a HUD which is drawn by fillrectangle.

How would I fade these rectangles when the player is on the HUD?


texts:
I'm trying to do a score that is based on the time taken and number of manipulators used. The faster you do it, with the fewest manipulators, the higher the score. I've managed to get it working with you get the lowest score but not the highest and i can't think how to do it. Any help would be appreciated.

I have a play time (GameTime.TotalGameTime.TotalSeconds - startTime.TotalSeconds) and a count of the manipulators used (grid.NumberOfManipulatorsInGrid(TextureList.GameplayTextures)) to work with


texts: Adapting pen & paper RPG rule system for use in a video game

texts:
I want to make a browser based RPG. I am considering to use an existing pen & paper rule system (like FATE or GURPS) instead of developing my own rule system from scratch.

What pitfalls should I be aware of when adapting a pen&paper system for use in a video game?


texts: How to prevent attackers from compromising multiplayer game servers?

texts:
Consider a relatively small multiplayer game server, written by an individual or a small company. Some malicious user wants to boost their character stats by a factor of 100.

What paths of attack might they have and what are the most important safeguards to prevent these attacks?


texts: I have 2 points A and B in 3D space (say of type Point3D). B needs to travel towards A and then stop either when it reached or passed B. The direction between the two points is known (can be easily calculated), so velocity is easy to set. How do I determine when point A reached or "passed" (given the direction) point B?


texts:
I am drawing two cubes, first a red one and then a green one in front of the red one. When I rotate the camera I can see the green cube through the red cube.

I have enabled depth test and I clear depth buffer. I'm using OpenGL 4.4 core profile and a simple diffuse shader by the way.


texts: How can I create a curved line composed of images?

texts: I have 50 little images. All are connected each other, as in a line, sort of like a cord. I want to move one of the node images and have the rest follow along like a cord, so they become a curve.


texts: How to make an object that has no rigidbody2d component smoothly fall on the ground in Unty2d?

texts:
I have two character in my game: enemy and main character. Enemy can throw different objects into the main character. For this moment i am doing this action in such way:

void FixedUpdate(){
    if (CanMove){
        transform.position = Vector2.MoveTowards(transform.position, TargetPlayer.transform.position,  15 * Time.deltaTime);
    }
}

public void StartMove(bool canMove){
    CanMove = canMove;
    TargetPlayer = GameObject.FindGameObjectWithTag(Tag).transform;
    rigidbody2D.gravityScale = 0;
}

This script is attached to the prefab of the object that will be thrown into main character by the enemy. This script is working, but in this case the object that was thrown will follow  by main character all the time, because of this line of code:
transform.position = Vector2.MoveTowards(transform.position, TargetPlayer.transform.position,  15 * Time.deltaTime);

To my mind this is not good, because i want to give my player the opportunity to escape from the object that was thrown at him. For example run away. When the object reaches the player position (and the player is on the new position) - he will simply fall onto the ground. I did this, but this wasn't looking nice, because when the object was reaching his position, he was hanging in the air. Can anyone give me an advice how to make this process more good-looking?

Edit:
I need to make good-looking movement of the object, that was thrown by the enemy into main character. Every frame i am moving the instantiated object to the current player position. So the player can't escape from that object, because he always knows current player position. I think that this is not good idea, and i want to give to player an opportunity to run away from that object. In this case i am saving the position of the player into variable, and then every frame i am moving the instantiated object to that position. So when the player run away, the object, that was thrown doesn't know anything about new position of my player. But this is looking not good, because when the object is reaches its destination position he hangs in the air((

Edit # 2:
I was thinking about destroying that object anyway, but to my mind this will not look good: the object is moving and suddenly disappears from screen(. May there is some ways how to make him smoothly fall onto the ground? The problem is in that this instantiated object has no Rigidbody2d component attached to it, so it will never fall down by itself.