texts: Entity system in Lua, communication with C++ and level editor. Need advice

texts:
I have a 2D basic editor written in Qt, and I'm in the process of adding entities. I want the editor to be able to receive RTTI information from entities to change properties, create some logic being able to link published events to published actions (for example, A level activate event throws a door open action), etc... Because of this I guess my entity system should be written in a scripting language, in my case Lua.

On the other hand I want to use a component based design for my entities, and here starts my questions:

1) Should I define my componentes in C++? If I do this in C++ won't I lose all the RTTI information I want for my editor? On the other hand, I use box2d for physics, if I define all my components in script won't it be a lot of work to expose third party libs to lua?

2) Where should I place the messaging system for my game engine? Lua? C++?

I'm tempted to just have C++ object to behave as servers, offering services to lua business logic. Things like physics system, rendering system, input system, World class, etc... And for all the other things, lua. Creation/Composition of entities based on components, game logic, etc...

Could anyone give any insight on how to accomplish this? And which approach is better?

Sorry for the late response James, I did go to sleep. I have prefered to create a new response becaue I'm going to write a somehow long text.

I think you were not wrong and you did get the idea exactly as I wanted. Let me explain my ideas right now and key points after some sleep to clarify everything:

1) Components: At first I wanted to write them in lua. Now I have clear I'm going to write them in C++ and expose everything needed. Ussually only interfaces are exposed to lua, so I have come across that to export properties to be published in the editor we could get all "getXXXXX" methods (that have been exported to lua) and show them in the editor as XXXXX. Other things like data type, etc... should be thought.

2) Entities: They will be defined in lua through composition of C++ components (entity templates). They could be hardcoded too in the C++ side and have a factory for components and another for entities and let the lua side instantiate them.

All this, is what I can think of now. I know my editor can still be using game objects even if it is external, but the game am I into is for iphone using cocos2d and the editor is writtien in QT, so, I can't have the game running in a qt canvas and make qt<->game talk.


texts: How to get tile rotation from TiledSharp and convert it to XNA/MonoGame

texts:
I am currently working on a game using XNA and Tiled. I use Tiled to create my maps and load them using TiledSharp. Some of my maps have tiles that are rotated by using one or more of the left rotate, right rotate, horizontal flip, vertical flip options in combination.

In the tiled documentation, it shows there are certain ways to find out if an object is horizontally, vertically, or diagonally flipped. TiledSharp tells me this information. However, I don't know what to do if a tile is diagonally flipped. How many degrees should I rotate the tile (in multiples of 90 degrees)?


texts: Move object towards the center of coordinating system

texts:
I would like to move a object towards Vector2(0, 0), but every time I use this script, the object always goes down, instead of going towards the center of the coordinate system.

        void Update()
         {
    //Object rotation
             if (!Input.GetMouseButtonDown(0))
             {
                 _angle += speed * Time.deltaTime;
                 var offset = new Vector2(Mathf.Sin(_angle), Mathf.Cos(_angle)) * radius;
                 transform.position = _centre + offset;
             } else
             {
//Moving object towards center
                 rb.transform.position = Vector2.MoveTowards(transform.position, Vector2.zero, speed * Time.deltaTime);
             }


texts:
I'm developing a game using Box2D (javascript implementation - Box2DWeb), and I would like to know how I can pan the debug draw. I know the usual answer is - don't use debug draw, it's just for debugging. I'm not, however not all my objects are on the same screen, and i'd like to see where they are in the physics representation.

How can I pan the debug drawing?

As you can see the debug draw stuff, is show on the top left, but it only shows a small part of the world.

Here is an example of what I mean:
http://onedayitwillmake.com/ChuClone/

The game is open source, If you'd like to poke through and note something that perhaps i'm doing something that is obviously wrong:
https://github.com/onedayitwillmake/ChuClone

Here's my hacky way that I'm using now to scroll the b2DebugDraw view, in which I added a property offsetX and offsetY into b2DebugDraw


texts:
Note: I dont use tiles, I use 3D Polygons :)

I'm currently working on a real-time renderer for scanned real life objects. My main goal is to have an isometric viewer with the simple ability to rotate the object.

This alone is a simple problem. I basically had the full solution for it, but I wasn't happy with the performance at all.

As you might know, software rendering based on the CPU is slow (but I don't want to code a game engine, just a small viewer which should be okay with a low poly count like < 10000) but for what i need it works surprisingly good.

The only part where my renderer is toooo slow is the z-buffer (multiple seconds for a 3000 poly obj). Mainly because it loops xyobjects*polygons.

Currently I'm using some sort of painters algorithm to draw polygons one after another, which brings me some problems: https://youtu.be/PDq4xtrgoi8

As you can see the distances per poly are calculated very poorly, just the center of the poly to world point 1000,1000,1000.

My question is not just about the pointers algorithm but I'd love to use a minimal failing method of drawing the polygons in a specific order rather than calculating every pixel by z-buffering.

If you have other simple methods which work fast on a CPU, I' d really appreciate hearing about them! :)


texts: Handling input through callbacks or through game loop?

texts:
I've tried to figure out how to handle player input properly, but without luck so far.

As far as I have figured out, I can either:

  Call the respective methods directly through the callback fired when
  an input event is detected.

Or

  Save the input in an array and detect it through my main loop.

I would like some thoughts on this in terms of if there is any restrictions/benefits using one over the other.


texts:
When you start a new game project, what do you do first? How do you begin? What gives you the best head start toward completing the project rather than burning out before it gets anywhere?

Mods please help with the tags... I have no clue how to categorize this... :)


texts: Calculate average of arbitrary amount of quaternions (recursion)

texts:
Simply calculate the average for 2 Quaternions should work like follows right? :

Quaternion.Lerp(rotationlist[0].transform.rotation, rotationlist[1].transform.rotation, 0.5f);

And now I tried to put this into a recursive function, like this:

private Quaternion calcAvg(int pos, List<GameObject> rotationlist)
{
    if (pos < rotationlist.Count)
    {
        return Quaternion.Lerp(rotationlist[pos].transform.rotation, calcAvg(++pos, rotationlist), 0.5f);
    }
    return ???;
}

But I'm not absolutely sure, what to put into the second return.

Edit, I added the last position into the second return but now I get an out of bounds exception:

private Quaternion calcAvg(int pos, List<GameObject> markerList)
{
        if (pos < markerList.Count)
        {
            return Quaternion.Lerp(markerList[pos].transform.rotation, calcAvg(++pos, markerList), 0.5f);
        }
        return markerList[pos].transform.rotation;
}

Edit, fixed the issue, I will test this now but it looks alright :

private Quaternion calcAvg(int pos, List<GameObject> markerList)
{
        if (pos < markerList.Count)
        {
            return Quaternion.Lerp(markerList[pos].transform.rotation, calcAvg(++pos, markerList), 0.5f);
        }
        return markerList[pos].transform.rotation;
}


texts: How to display a list of 2D arrays in the inspector

texts: Simply put, how do I make public List<bool[,]> appear in the inspector? Every 'bool[,]' is a solution to a puzzle in my game and I want to be able to view and edit them in the inspector.


texts:
I'm trying to find out whether or not I want to switch from Java to c++ for my OpenGL game programming. I now have setup a test project in VS 11 professional, with GLUT. I created my windows with GLUT, and I can render OpenGL primitives without any problems.

Now my question: What library(s) is/are used mostly in the indie/semi professional industry for using OpenGL in c++?

With 'using OpenGL' I mean:

Creating and managing an OpenGL window
Actually using the OpenGL API
Handling user-input (keyboard/mouse)


texts:
I am running a client-server architecture with an authoritative server running box2d and the client running box2d as well.

If gravity is set to 0, is there any point to linear interpolation and creating the 100ms buffer to smooth client positioning if the forces and impulses of world objects are sent out with each snapshot (say 5 times a second)?

The client would be smoothly simulating with the server and remove the need for interpolation, right?


texts:
I want to do a simple simulation of water drops producing waves in OpenGL with C/C++. I calculate height for each point of my plane grid in Vertex Shader with formula
 but it seems wrong at the beginning. I will atach a photo to ease the understanding:

This is how the grid looks like at time = 0 (when the drop touched the water). The waves weren't generated only near the touch point and gradually advance. In the corners of the grid (and far from the touch point) there should be no change until a created wave approaches.


texts: How can I find out what URL my game is executing from in Flash?

texts: I want to upload my game to Kongregate and other sites, but on Kongregate I want to invoke one function and other sites I want run another function. How to check in AS3 where (I want to get host like: www.kongregate.com or www.games.com etc) my game is? Or maybe you know other, better way to make this?


texts: Algorithm for a tool to theorycraft stats based on a game(league of legends)

texts:
I would like to create a simulator(basically for testing purposes) for a game(League of legends).

The basics of the game:

you have a hero which has some stats:

Health Point
Attack Damage
Attack Speed
Armor
Armor Penetration
Movement Speed

Hero can have 4 skills(you get one skillpoint at each level)
(They are activated manually, most of the time, has cooldown, damage, attackpower/attackdamage scale ratio, and skill level)
+ a passive skill

You can kill enemy heroes, or neutral monsters, they have the same stats:

Health Point
Attack Damage
Attack Speed
Armor

What I would like to do:

Create a tool to test if a particular item, or a particular stat increase would speed up your killing power/speed.

map: http://evtron.com/Evtron-Alpha/wp-content/uploads/2011/02/Summoners-Rift.jpg

Stat examples:

Hp: 420
Ad: 55
AttackSpeed: 0.613 ( attacks / s -> every attack at 1/0.613 s)
armor penetration: 25

The character gonna autoattack the enemy with the 1/attackspeed, and damaging with attackdamage(there is a formulate to calculate the damage, but thats not important in this phase i guess), once they are dead, moving to the next one with movingspeed(you can see the camps on the map, the yellow skulls)

I was thinking about the algorithm:

I thought if i just make a for from i=0 to i=30000(counting ms), so I can just check the enemy hp and my hp as well at every ms turned out so bad(pretty cpu heavy, and i would like to put some random in it, so i should be able to sum up 1k iteration, which is impossible)
Secondly, i thought i should just do a for from i= 1 to 30, and check every second, and check what happened in the last second, but some of the neutral monsters are in a big camp (up to 4 monsters), and this way the code was getting complicated and complicated.
I'm gonna create threads for each player/monsters, and once they finished look up when they died, and reduce the hp of the player.

My question, is this the right way to go?

TLDR: I would like to create a tool to create analysis(iterate 1k and calculate average) about a game which stat increase would make the character killing faster neutral monsters.

I would prefer java, but atm I'm stuck at the algorithm.

@Karoly S: Yep, it' my bad, .com -> .eu

I've been working on this:

I'm checking the remaining time on each object(player skill, autoattack, buffs), and always pick the shorttest time, and store the last_time, and add the time to time, at the next round I calculate the time by (time-last_time)

If the object has remaining time 0, it will do whatever it needs to do.

I don't know if it's effecient way or not, but that's the best I could do.


texts:
I have webgl 3D scene with background image and few shapes with textures.
I want to add some lines and other shapes and apply on them default color which not affect the shapes with textures.
How can I do this?
this is what I have now:

gl.clearColor(0.0, 0.0, 0.0, 0.0); //alpha=0 for background img
gl.enable(gl.DEPTH_TEST);


texts:
I'm rendering a 3D object to texture (2048x1600) and show this texture on a panel (1600x285) using a RawImage (2048x1600) component as child. This texture is rendered successfully on screen.

This 3d object contains several mountpoints as empty objects. Now I want to show several sprites to visualize those mountpoints on the texture (panel) at their corresponding screen position (must not pixel perfect).

I tried several camera transforms, but could not get the correct position values:

  var main = camera.WorldToScreenPoint(slot.mountpoint.position);
  Debug.Log("Maincam screenpos: " + main.ToString());

  RectTransform rect = this.GetComponentInParent<RectTransform>();
  Debug.Log("Rect size delta: " + rect.sizeDelta.ToString());

  Vector2 viewPos = camera.WorldToViewportPoint(slot.mountpoint.position);
  Debug.Log("Viewport pos : " + viewPos.ToString());

  Vector2 localPos = new Vector2(viewPos.x * rect.sizeDelta.x, viewPos.y * rect.sizeDelta.y);
  Debug.Log("Viewport pos local : " + localPos.ToString());

How I could realize this?


texts: Is there a tried-and-true method for calculating or detecting the edges of platforms?

texts:
In terms of a simple 2D platformer, I was wondering if, over the years, a right way has emerged as far as determining whether or not a strolling character has reached the edge of the platform it is walking on.

My searches haven't produced an answer for this question and there does not seem to be a consensus about what the best way is, but I would like to believe that there is a best way considering the classic nature of the 2D platformer.

Working with Godot 3.0.6 Mono, my current idea is two trace two rays from either side of a character's collision box downward, where a difference in the length (assuming flat platforms) between those two rays before collision means the character is partially over an edge. However, I feel like this can get intense if lot's of characters are being managed every frame. What are some other ways of approaching this? Any other suggestions are appreciated.


texts:
I am working on my custom server for my online game and I was wondering if there is any way to accomplish this in a more performant way.

Basically I will be spawning and despawning objects (such as other players) to clients based on the distance between their positions. Basically, if you are within, say, 500 meters away from another character, the server will send you a "Spawn character" packet to spawn that character on your client. If you move more than 500 meters away from that client, the server will send you a despawn packet.

The only way I can think of doing this on the server is a nested for loop. For every character on the server, check every other character position. That's expensive and obviously as the character count grows, so does the time it takes for process the loops.

Can anyone think of any different approach to this that will be better performant? Most survival games don't do this, and you just have all characters spawned on every client, but this allows for ESP hacks (Extra Sensory Perception which basically is a hack that shows you exactly where everyone is, even if the client isn't rendering them because they are far away) and I don't want that as a possibility.

If you need any other information let me know, thanks.


texts: Rotate camera with quaternion around axis going through the origin

texts:
I am trying to implement my own third person camera using quaternions in DirectX. I first wanted to check that the camera rotates as expected so I started to rotate it around the world y-axis (0,1,0) and then x-axis (1,0,0) and it worked fine. But when rotating around the axis (1,1,0) the effect is not what I expected. Here is a description of what I do.

The scene is composed by a cube of side 2, centered at the world origin. The camera is originally placed at (0,0,-10), looking at the origin (0,0,0) and has the up vector (0,1,0). To test the rotation, at each frame I increase the angle of rotation theta by a constant amount dTheta. I build my quaternion from the axis of rotation (1,1,0) and the angle theta, transform the quaternion to its 3-by-3 matrix form and multiply both the position vector and up vector. I call the D3DXMatrixLookAtLH function to build the view matrix with the new position, the lookAt point (the origin of the world frame) and the new up vector.

What I get is my cube rotating in a very strange way (well, I know it is the camera that is rotating, but you know what I mean, everything is relative). Moreover it seems the distance between the cube and the camera changing because, as the cube rotates, its size oscillates.

I can put some code if someone asks but I first wanted to check there is no mistake in my approach. Thanks.


texts:
Suddenly, a wierd error started to come up in my console saying
More than 2048 allocators are registered. Reduce the allocator count.
This error leads to freezing of editor.


texts: How can I derive force vectors from velocity vectors?

texts:
I'm making a 2d shooter ala Geometry Wars. I've got my own simple physics at work driving the background grid and all my entities. To move anything in the world I apply a Vector2d force to it. The 'engine' calculates the resulting acceleration and therefore the velocity.

I am trying to port some code I found which implements the classic 'Boids' flocking algorithm, but the code I have works by calculating the Boids' velocities directly, so If i use it as is, it bypasses my physics engine. How I can translate the velocity vectors into force vectors that I can apply to the Boids and which will result in the proper velocities via my physics engine.


texts:
Are there any examples of companies or papers using evolutionary algorithms (EA) or genetic programming (GP) in procedural generation of content for games? Does this exist in the industry?

This is about the only place I have really found it:
http://pcg.wikidot.com/pcg-algorithm:automatic-game-design

I've checked these questions as well and I know my way around PCG:
What is "procedural generation" and how is it done?
Procedural Generation of Infinite Level
2d Procedural universe generation


texts:
Possible Duplicate:
  What math should all game programmers know?

How many need know(learn) Math for Game Developer? for 2D and 3D games?
And where best learn Math for game development? in Wikipedia or maybe Books?

Thanks for answers.


texts:
time() is a preset function in pico8 gameengine.

I don't understand whatsoever why I get an error when I write:
time() = var

But it's fine if I write (where var is any variable)
var = time()

What are the rules dictating order? This makes no sense to me.

For some context consider a time function:

time_diff=0

function time_change()
if time() - time_diff > 1 then
time_diff=time()
end
end

if You change to time()=time_diff.....it generates an error.


texts: Is glEnable obsolete/unneeded in OpenGL ES 2?

texts: In an iOS app I am writing I am now culling all the GL 1 crap from my GL 2 code. Can I safely remove glEnable?


texts: Optimizing a quadtree for circles and circular queries

texts:
I'm developing a 2D ant simulation in JavaScript. I'd like to implement a quadtree to store the positions of ants and other markers. I approximate all of these entities as circles, and I'm only querying for circles that fall within the radius of a query circle.
Most of the things I've read about quadtrees implement rectangular entities/queries very efficiently. Is there a more efficient way of implementing a quadtree given all entities/queries are circular? Otherwise I would plan to store each circle as a square and perform a circular collision check on top of each query result.


texts: How should I design game object dependencies between windowing, input and behavior systems?

texts:
This is my first time attempting to create a game engine. I came across a theoretical problem and would like to solve it before implementation. Right now I have a WindowSystem, which opens the window, sets the GL_CONTEXT, etc. I would like it to be responsible for all things window. Then I have another system that manages input called InputSystem. Then I have a BehaviorSystem for game object behavior.

The problem:
Consider a game object representing a menu where it has options to change the resolution/other graphics settings. How can I link these three systems with minimal coupling so that a Behavior script can close the window? Normally systems interact through components, but there's no component for the window. From what I've read systems shouldn't know about each other. I haven't a clue how I could go about such a scenario.


texts: Transparent image changing color to very light when used on light background in Unity

texts:
I'm trying to use this transparent image (transparent brown, with a transparent white shadow):

over this background:

in Unity UI.
But the end result is not similar to what I see in photoshop at all.
What I expect and what I have inPhotoshop:

What I get in Unity:

How can I fix this?


texts: Rotate an object with 'Quaternion.Slerp' in world space

texts:
I'm currently working on a multiplayer skydiving Unity game in which i rotate the players like this:

transform.rotation = Quaternion.Slerp(transform.rotation, desiredRotation, delta);

Now this rotates the player relative to it's own rotation. I know rotation in world space is done by multiplying the quaternion of the desired positon with the quaternion of the current position like this:

localRotation = transform.rotation * desiredRotation
worldRotation = desiredRotation * transform.rotation

But how do i slerp to that position in world space?

Thank you all in advance and have a great day!


texts: Finding cells between two points (along line) to finding obstacles

texts:
My game is in 3D environment partitioned with 2D grids in 2 dimensioned array

So I can get any cell/node by passing row and col like  return _nodes[r][c].

When the an attacker attacks an enemy with ranged weapon, I want to check if there is any obstacle in between the two points.

Without using mesh collision methods, I want to achieve it by checking all the cells which falls between the source and target points and check if there are any obstacles.

I want to write this in a routine which will return false as soon as it finds an obstacle and returns true if it finds no obstacle in any of the cells between the source and target

From the above picture, I want to get yellow that falls between the two end points

Can some one suggest me the approach?


texts:
Hello I have some 2d character in sprite I've rigged to use in Unity 2D.Something like this, with separate body parts.
 Although I've used weights and geometry, these body parts are supposed to move independent of each other, so there is no stretching/blending (or whatever you call it) of the shapes/body parts. Now I've created the rig successfully, I realize that these body parts are no at the order I want, meaning some parts are overlapping others in the wrong order. How should I fix that?


texts:
Is it possible to use Unity3D from within Eclipse?  I've seen that I can import a Unity3D project into Eclipse, but I cannot seem to be able to access classes such as Terrain or Ray.  I don't know if that's because I haven't imported the correct libraries or if that's a limitation and that data can only be accessed by methods within Unity3D.  I am designing an Android game within Eclipse and would prefer to use Eclipse than Unity3D, even if that means my game will only be available for Android.

The only real reason I'm using Unity3d is for use of the 3D terrain and to hopefully help in getting the data, such as slope, terrain type, collisions, etc.


texts:
I'm trying to implement a simple collision response to a point intersecting a convex hull.

So far I can detect if the point is inside the hull.

But now I want a collision response that translates and rotates the hull away from the point so it no longer intersects.

I'd like the simplest algorithm possible, I don't want to implement a physics engine or rigid bodies.

Can someone point me in the right direction?


texts:
I'm working on a game engine in C# at the moment and I've come across a matter I find confusing. I need to know how to get the maximum three component vector in an array.

There is a method in OpenTK that can compare two Vector3s to find out the max, I need this on a larger scale.

I've tried using Array.Max(), but I get the error :

  At least one object must implement IComparable


texts: Storing transformations in game objects. (GLM, C++)

texts:
I'm currently writing a game engine from scratch for learning purposes. I just started implementing transformations. I know how they work in general but I'm not sure how to implement them efficiently in hierarchical structure.

Should I keep each transformation separate or keep them bundled in a transformation matrix? I have a feeling a single matrix would be way more efficient than calculating model transformation matrix each frame for each object in component tree. On the other side, I'd like to access position, rotation and scale individually as I plan on using them later for some other optimizations.

I'm aware of glm::decompose but I'm not sure if it's a good idea to call it every frame.

Should I keep both the matrix and the components, decompose the matrix every frame or calculate it every frame?


texts: Rotation smoothing with Slerp snaps to center when switching between different destination vectors

texts:
I'm making a 3D space shooter in Unity (think Star Fox).  The ship, when I move it around the map, should rotate slightly (smoothly) in the direction I'm controlling it.

I have smoothness mostly working.  When I press an arrow key, the ship banks in that direction, and when I release it, it smoothly returns to the default rotation.

However, if I quickly change the direction it's rotating before it has the chance to get back to the default rotation, instead of rotating from "banking left" to "banking right", for example, it instantly snaps to the default rotation before beginning the smooth rotation.

Here's what it looks like:

In addition, when I connect a joystick (instead of using arrow keys) to control the ship, I get a different problem:  The ship has literally no smoothing at all, rotating one-to-one with the direction the joystick is rotated in.  Here's what that looks like:

Here's the code that controls ship movement:

public bool inverted = true;
public float speed = 20; //speed modifier of horizontal/vertical movement
public float rotSpeed = 120; //speed modifer of rotation (ship tilting)
public float ZRotMax = 30f;
public float YRotMax = 50f;
public float XRotMax = 30f;
public float width = 30;
public float height = 15;
public float centerDriftStrength = 5; //lower is stronger, higher is weaker.

// Update is called once per frame
void Update () {
    //Get input
    float controlHorizontal = Input.GetAxis("Horizontal");
    float controlVertical = (inverted ? -Input.GetAxis("Vertical") :
        Input.GetAxis("Vertical"));

    //Add mild center drift
    float moveHorizontal = controlHorizontal - ((transform.position.x)
        / (width * centerDriftStrength));
    float moveVertical = controlVertical - ((transform.position.y)
        / (height * centerDriftStrength));

    //Modify position
    transform.position += (new Vector3(moveHorizontal, moveVertical, 0)
        * speed * Time.deltaTime);

    //Cosmetic rotation based on controller input
    Quaternion oldRot = Quaternion.identity;
    Quaternion newRot = Quaternion.Euler(XRotMax * -controlVertical,
        YRotMax * controlHorizontal, ZRotMax * -controlHorizontal);
    transform.rotation = Quaternion.Slerp(oldRot, newRot,
        Time.deltaTime * rotSpeed);
}

In particular:

transform.rotation = Quaternion.Slerp(oldRot, newRot, Time.deltaTime * rotSpeed);

Seems to be what I need to look at.

rotSpeed should cap the speed of rotation on the ship, so that it can't instantly rotate in a different direction.  Right now, when rotSpeed is less than 120 or so, the ship twitches while rotating, and if it's particularly low, like 10, the ship barely rotates at all.

(The rotSpeed variable doesn't seem to be working anyways -- setting it to 30000 or something doesn't make the rotation any faster.)

Basically, I want the ship to always rotate smoothly, never jumping instantly from one rotation to the next.  I'm not sure if I need to use Slerp for this, or if there's some better smoothing method available to Unity.

Thanks, and if anybody knows of other ways to smooth rotation between constantly-changing Vector3s/Quaternions, please tell me!


texts:
I have changed the scale in 3DSMax to my own and now I can't create any object, including circle, if it is of the size which is normal for my scale. Instead, I have to create big object first and then modify it to a smaller size. It looks like there is a minimal size protection is set somewhere - where is the setting for it?

UPDATE

While creating a circle, if I drag for 0.04m circle disappears after drag end. If I drag for 0.08m circle also disappears. If I drag for more than 0.1m, circle persists after drag end.

How can I set it so that it persist after 0.01m too?


texts: Simplify Matrix math code- Sun billboarding

texts:
If was trying to set the correct position of my sun billboard in my 3d game. I tried long until it worked correctly, but I wonder why this code must be so complicated:

sun.sprite.Position = Vector3.Transform(Vector3.Transform(-sun.lightDir,
Quaternion.Inverse(world.Rotation)), Quaternion.Inverse(myRelativeRotation));

Can I simplify this expression? I tried changing it at least to this:

sun.sprite.Position = Vector3.Transform(-sun.lightDir,
Quaternion.Inverse(world.Rotation) * Quaternion.Inverse(myRelativeRotation))

But this is giving me different results, so the sun is at the wrong position.


texts: Can I create an 2D texture array with different sizes for each textures?

texts:
I'm making a 2D game engine, and I need a way to batch all textures into one so I only make one glBindTexture call throughout a scene. I am trying to use 2D texture arrays, but they only support textures of the same size.

Do I have to conform to this, or is there a workaround?


texts: Confused about why my projection matrix works

texts:
My projection matrix was  buggy, I'm not great at mathematics, but I checked it against the the songho tutorial, and the broken one seems correct to me but switching nearplane to farplane seems to have fixed it. What am I missing? My nearplane and farplane values are positive, nearplane is small about 0.01, 1.0f last time i ran against both; farplane is usually relatively large about 1000.0f, 500.0f the last time I ran it against both.

f32 l = left;
    f32 r = right;
    f32 t = top;
    f32 b = bottom;
    f32 n = nearplane;
    f32 f = farplane;

    m4x4 Result =  //TODO why did changing n to f in 0 and 5 fix it? and make sure it is fixed
    {
#if 0 // works
        2*f/(r-l), 0, (r+l)/(r-l), 0,
        0, 2*f/(t-b), (t+b)/(t-b), 0,
        0, 0, -(f+n)/(f-n), -2*f*n/(f-n),
        0, 0, -1, 0,
#else // doesn't
        (2*n)/(r-l), 0, (r+l)/(r-l), 0,
        0, (2*n)/(t-b), (t+b)/(t-b), 0,
        0, 0, -(f+n)/(f-n), (-2*f*n)/(f-n),
        0, 0, -1, 0,
    };
#endif


texts:
I have been using OpenGL for a while and have read a large number of tutorials.  Aside from the fact that a lot of them still use the fixed pipeline, they usually throw all the initialisation, state changes and drawing in one source file.  This is fine for the limited scope of a tutorial, but I’m having a hard time working out how to scale it up to a full game.

How do you split your usage of OpenGL across files?  Conceptually, I can see the benefits of having, say, a rendering class that purely renders stuff to screen, but how would stuff like shaders and lights work?  Should I have separate classes for things like lights and shaders?


texts: How do I use graphics APIs to select the proper display device among multiple attached to a PC?

texts: I have an LCD monitor display and Oculus Rift attached to my PC. I have an Nvidia 820M dedicated GPU. How does the GPU know to which display device it has to render (or to send rendered information)? Are there any OpenGL/DirectX calls to bind display with the GPU?


texts:
I was working with SDL2 and when I loaded some textures, I got this warning in the console libpng warning: iCCP: known incorrect sRGB profile
Though this doesn't cause any error, everything works fine but I just wanted to know what this warning is about.

This is the picture I'm trying to load, maybe the fault is in the picture?


texts: XNA 2D Collision Detection with Rectangles: Helper Objects?

texts:
Per this excellent question, and excellent answers, I am attempting to write a breakout clone.

Regarding the collision detection against the walls, does XNA provide a set of helper methods/objects to determine which side of the rectangle was hit? I'd like to use the Vector2.Reflect method to properly create a new velocity vector, but it requires the proper normal. I can write the methods to figure out which side was hit, and thus which normal to use, but I wanted to know if XNA provided code to handle this already.


texts: Best way to transition between multiple Cocostudio defined scenes

texts:
I'm designing a game that has to switch between multiple game scenes. Each scene has been created in cocostudio and is imported into the code as a json file as:

var obj = ccs.load(res.Symbols_json);
this.addChild(obj.node);

This works fine, however when I have to transition to some other scene and then back to the original scene I experience several different issues.

If I create a new instance of the scene I return to as:

returnToScene: function () {
  this.startScene = new startGameScene();
  cc.director.runScene(new cc.TransitionFade(1,this.startScene));
}

PNG files are not loaded properly and transparency is shown as solid white. If I however keep the old instance of the scene as:

returnToScene: function () {
  if (this.startScene == null)  this.startScene = new startGameScene();
  cc.director.runScene(new cc.TransitionFade(1,this.startScene));
}

then I have to manually reload all animations from the json file and all particle systems gets destroyed (as in they are still present but are not updated).

Have anyone else experienced anything similar? I've considered using pushScene and popScene instead of runScene but as far as I can tell it seems to be an outdated way of performing scene transitions.


texts: Why is the background image less smooth on the phone?

texts:
I've just downloaded Gamestate code from create.msdn.com, and as you can see from the image below:

The result is less smooth then the image imported to visual studio, how do I increase the quality?


texts: LibGDX: creating actor conformed by other actors

texts:
I am making my custom actor class, made up by 3 actors(oneProgressBar, one Label and one TextButton), because I will be using this many times, so it's not a good idea to create 3 of that actors when I can create one that can contain them. So I am making my class:

public class MyActor extends Actor {
ProgressBar bar;
Label nameLabel;
TextButton button;
public MyActor(String name, Skin skin, float progress){
    nameLabel = new Label(name, skin);
    button = new TextButton("Buy", skin);
    bar = new ProgressBar(0f,5f,progress,false,skin);
}

@Override
public void act(float delta) {
    super.act(delta);
    bar.setBounds(getX(), getTop()-getHeight() / 3f, getWidth(), getHeight() / 3f);
    nameLabel.setBounds(getX(), getY()+getHeight() / 3f, getWidth(), getHeight() / 3f);
    button.setBounds(getX(), getY(), getWidth(), getHeight() / 3f);
}

@Override
public void draw(Batch batch, float parentAlpha) {
    super.draw(batch, parentAlpha);
    bar.draw(batch, parentAlpha);
    nameLabel.draw(batch, parentAlpha);
    button.draw(batch,parentAlpha);
}

}

So in my game, I add my actor to the Stage using a table:

Table table = new Table();
table.debug();
MyActor actor = new MyActor("whatever",mySkin,1f);
table.add(actor).size(myWidth,myHeight);

The actor is drawn in the correct place(I know because of the debug lines), but the 3 actor are drawn in the 0,0 coordinates, what am I doing wrong? do I need to override another method?


texts: How to get plane geometry associated with primitive 3d plane in unity3d

texts:
I assume there should be a plane (struct) associated with a primitive 3d plane in unity3d, how to get that?
Or if not associated, can we build plane struct object somehow using corner vertices of 3d plane. Can somebody help me how to get cornor vertices of 3d plane mesh.

Update:
What I am trying to achieve is to use Plane.Raycast on a 3d Plane, but I am not certain whether there is any plane geometry component associated with it, or Is there any way to build a plane geometry which should be going through all the corners of the 3d plane, so that I'll be able to use Plane.Raycast from the normal direction of 3d plane towards itself.


texts: How to prevent sending semantically wrong messages in event based architecture?

texts:
I have created the following architecture in C++:

ReceiveMessage has two important parameters:

Scope, which defines the scope, like game object, scene or core. This determines how far the message will be forwarded. For example, core messages will be processed by Core, and game object messages will processed by GameObject.
Event, which defnes the name of the event, as an enum. This might include FIND_GAMEOBJECT_IN_RANGE, PLAY_SOUND, etc.

If I accidentally send an event that can only be handled by Core with the game object scope, instead of core, it is only checked at runtime. Currently, it is possible to send a message like ReceiveMessage(GAMEOBJECTS, PLAY_SOUND, ...);. This would be forwarded to every game object, and won't be handled, because the PLAY_SOUND event is only properly handled by Core.

How do I redesign my messaging system so that the compiler will give an error or warning when I try to send a message with an invalid scope-event pair?


texts: How to handle multiple enemies with the same script?

texts:
i'm working on a basic Top-Down Shooter, kind of like... Nuclear Throne or The Binding of Isaac, but since i'm new to Unity, and it's something i'm required to do for school, i'm quite in a rush so i didn't have enought time to look at all the documentation i should've, so i apologize if i'm asking too much.

The thing is like this : I have the Player that moves around, and a Sword that rotates in the mouse direction, clicking the mouse activates a Trigger Collider around the Sword, and it's suposed to Hit all enemies inside its range

The problem :

How should i "plan" my Scripts? i mean, i have a Sword script that handles the click and the OnTriggerEnter, and it should, somehow (Working on it), check if it hit an enemy, and access the Enemy Script to modify its Life Points, but how do handle the GameObject Enemy = GameObject.FindObjectWithTag("Enemy")[...]? since this just gives me one enemy...

I apologize again since i'm really bad at focusing on one point, i dont think it's neccessary to provide all the code since i dont really need you to provide me with code, just... guidelines or a basic pattern of doing this kind of things.

Thank you a lot!.


texts: I use daylight water in my project but by the default it has not got any waves or light tracing effects. But in some tutorials I see how the user add standard water asset and it has got beautiful world reflection on the surface and beautiful waves. Is this issue because that I am using not a PRO version?


texts:
When using this code:

public static Texture2D MakeTexRed(Texture2D tex)
    {
        Texture2D drawTex = new Texture2D(Game1.graphics.GraphicsDevice, tex.Width, tex.Height);
        Color[] data = new Color[tex.Width * tex.Height];
        tex.GetData<Color>(data);
        for (int i = 0; i < data.Length; i++)
        {
            data[i].R = (byte)((data[i].R + 255) / 2);
            data[i].G /= 2;
            data[i].B /= 2;
        }
        drawTex.SetData(data);

        return drawTex;
    }

I'm getting this exception:

The type you are using for T in this method is an invalid size for this resource.

The size of the texture I'm using is 64x64 pixel.

When using this line:

Texture2D drawTex = new Texture2D(Game1.graphics.GraphicsDevice, tex.Width, tex.Height, false, SurfaceFormat.Color);

it still doesn't work.


texts:
I have the following problem: The levels in my game are made up of a Large Quantity of small Models and because of that I am experiencing frame rate problems. I already did some research and came to the conclusion that the amount of draw calls I am making must be the root of my problems.

I've looked around for a while now and couldn't quite find a satisfying solution. I can't cull any of those models, in a worst case scenario there could be 1000 of them visible at the same time.

I also looked at Hardware geometry Instancing, but I don't think that's quite what I'm looking for, because the level consists of a lot of different parts.

So, what I'd like to do is combining 100 or 200 of these Models into a single large one and draw it as a whole 'chunk'. The whole geometry is static so it wouldn't have to be changed after combining, but different parts of it would have to use different textures (I think I can accomplish that with a texture atlas). But I have no idea how to to that, so does anybody have any suggestions?


texts: glDeleteTextures - release data, but keep the texture ID?

texts:
In OpenGL, is it possible to release texture data, but keep the same texture id? I want to unload textures when they aren't needed, but load them again later when they are.

There are a lot of objects that store texture IDs. (For example - spritesheets - multiple objects use the same texture ID and represent a part of the image). glDeleteTextures releases the id, so another texture (image data) can acquire the same ID. I'd have to walk all objects and change the texture IDs they use.

Is there a way to release the texture data only, but keep its ID, so that later I could do only glTexImage2D on the same ID and keep all references to this ID valid?


texts: How to use rigitbody2d.AddTorque() in JavaScript? (unity2D)

texts: I just want to know how to use rigitbody2d.AddTorque() and an example script would be great :D. I am trying to rotate a cube forever using it as a test.


texts: Saving a high score and updating it as score increases

texts:
I'm following Brackeys "Dodge the Blocks" tutorial. In the video, he covered everything accept the score/high score system.

I have a working score system, which gives you 1 point every time you collect a coin.

In the scene where you play the game, I have a text UI that says "Score:", and another one for the score number, another that says "Best:", and one more for the best number.

I want to make it so that your high score gets saved, and updates in real-time with your score every time you pass the score.

Here are some of the scripts:

UI Manager (Where I want to put the high score code):

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

public class UIManager : MonoBehaviour {

    public Text scoreText;
    int score;

    public static int coinAmount;
    void OnTriggerEnter2D(Collider2D col)
    {
    CoinTextScript.coinAmount += 1;
        Destroy (gameObject);
    }

    public void scoreUpdate()
    {
        score++;
    }
}

Coin Text Script:

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

public class CoinTextScript : MonoBehaviour {

    Text text;
    Text bestScoreText;
    public static int coinAmount;
    public int score;

    void Start()
    {
        text = GetComponent<Text> ();
    }

    void Update()
    {
        text.text = coinAmount.ToString();
    }
}


texts:
I need to display, rotate, and zoom a 3D model in OpenGL ES (iPhone/iPad).  The 3D graphic artists are using Maya (on OS/X).  What export format should I be looking at to use their 3D models in the app?

Also, a number of Maya plug-ins don't work on the Mac (apparently it doesn't handle plug-ins the same way as Windows and Linux), so I may need an external tool to handle the conversion.

I'm still learning my way around the 3D dev-world, so any advice is appreciated.

Thanks!


texts: Loading a scene after Unity Ad plays results in lag

texts:
I have no idea what I'm doing wrong here, but I have Unity Ads set up to play at a random interval when the "play" button is pressed. When that happens, the game freezes for a half second, plays the ad, and then goes back to the previous scene before loading the new one.

It plays out like this Menu Scene > player click play > Menu Scene > Ad plays > Menu Scene > Game Scene

I know why this happens I think, when the Ad is done playing it loads a new level, and that takes a second to do hence the lag. My issue is working around this.

Here's my code

    public void Play()
    {
        random = Random.Range(0, adOdds);

        scene = "Game";

        AdDecider(scene, random);
    }

 void AdDecider(string scene, int random)
    {
        if (random == 1)
        {
            ShowAd();        //shows ad
        }
        else
        {
            SceneManager.LoadScene(scene);
        }
    }

void ShowAd()
    {
        if (Advertisement.IsReady() && PurchaseManager.Instance.AdsOn)
        {
            Advertisement.Show("video", new ShowOptions() { resultCallback = HandleAdResult });
        }
        else
        {
            SceneManager.LoadScene(scene);
        }
    }

    private void HandleAdResult(ShowResult result)
    {
        switch (result)
        {
            case ShowResult.Finished:
                SceneManager.LoadScene("Game");
                break;
            case ShowResult.Failed:
                SceneManager.LoadScene("Game");
                break;
            case ShowResult.Skipped:
                SceneManager.LoadScene("Game");
                break;
          }
      }

Like I said, I'm fairly certain the cause of this is that it takes a second to load the Game scene, but it looks uncanny with the rest of the game. If a player hits "skip ad" and then is back at the menu and a half second later is jolted to the actual game I feel like that'll come off as just a bad UI and lower the quality of my game.

Any suggestions on how to beat this?


texts: D3DX11CompileFromFile() function problem DirectX11

texts:
What do i have to include to use the D3DX11CompileFromFile() function on DirectX11? I'm using visual studio 2015 and reading the "3D Game programming guide" (Frank Luna) and i'm having problem using that function, any solutions?
I read online that is not usable anymore and that now i have to use the D3DCompileFromFile() function, but i have no idea how to do it


texts: Libgdx - Building dynamic 3d models with Modelbuilder/MeshPartBuilder while rendering

texts:
Context: I'm building a mobile game targeted for android with libgdx. It's an endless highscore based game. The environment/terrain is build dynamically. It's kind of a maze/wall/block terrain. I'm using the ModelBuilder and MeshPartBuilder API of libgdx to create the model.

Problem: As the game is endless and the terrain random, I need to build the model while rendering preferably at consistent 60fps. I have put the generation code into a worker thread. This works, but the end() method of the ModelBuilder has to be called in the rendering thread, because of the needed opengl context.

Even if I only build a single rectangle using meshpartbuilder, I get a huge framedrop from calling ModelBuilder.end() .

Codesnippet:

// we are in a worker thread
modelBuilder.begin(); // ModelBuilder instance
MeshPartBuilder wallBuilder = modelBuilder.part("mazePart", GL20.GL_TRIANGLES, Usage.Position | Usage.Normal | Usage.TextureCoordinates, modelMaterial);

... create some meshes with MeshPartBuilder ...

Gdx.app.postRunnable(new Runnable() {
    @Override
    public void run() {
        Model model = modelBuilder.end(); // method that causes a framedrop from 60 to ~35
        activeModels.add(model);
    }
});

Question: How do I achieve stable fps while building models dynamically in libgdx? Is it even possible?


texts: Autonomous robot - moving from 1 object to the next object

texts:
This question falls in line with my last question: Unity 3D - create autonomous moving robot in house + first person camera movement

What I have

I have a 3D model of a house; a first-person camera with movement through the house; a robot that autonomously moves.

What I want

I want the autonomously moving robot to search the house for certain objects. I have placed 4 guns (same model) in the house.

This is the code I have now. This works for 1 gun; not multiple game objects:

using UnityEngine;
using System.Collections;

public class MoveTo : MonoBehaviour {

public Transform goal;

void Start () {
    NavMeshAgent agent = GetComponent<NavMeshAgent>();
    agent.destination = goal.position;
  }
}

What I want - extra

If possible, I want it to communicate with the person navigating the "game" with the first-person camera. For example, if it finds a gun, I want it to say to the person "playing" the game: I found a gun. If it finds the next one: I found 2 guns; I found 3 guns; etc etc.

For that, I used the following code for the player:

using UnityEngine;
using System.Collections;

public class UGV : MonoBehaviour {

    public Player player; //assign this variable in the inspector, or using another method

    public void CallMethodBInPlayer(){
        if(player != null){
            player.MethodB();
        }
    }

    public void MethodA(){
        //do something (Robot)
    }
}

And the same for the robot (but changed accordingly).

I will be honest with you that I have very little understanding of programming or Unity. I want you to know I've been looking for an answer for many hours but even though the idea might be too complicated for me just yet, I still hope you can (and want) to help me :)


texts: The A * algorithm in the map has many moving objects

texts:
I am using the A * algorithm for my game, it is a kind of Isometric map with lots of tiles. If all the game objects are trees, rocks, houses and only one game object is a moving hero, the A * algorithm works well because then all objects are objects static except for my hero. I use a function: Check_Block (i, j) where i is the row and j is the column of the map. This function will return false if at that location there is a rock or house or tree, etc. But if there are many heroes moving together, I will not be able to use this function because the heroes are not in position permanent.

I have a solution if the hero is in a certain cell, Map [i] [j] = Hero. But if there are many heroes in the same box, I think this solution no longer good.
Can someone show me a solution?


texts: How can I acquire marketing and sales data for games?

texts:
I need to evaluate a marketing perspective for a videogame in order to predict its income, sold units, etc. Since this sounds like quite a bit of an impossible task, I thought I could collect some statistic for similar games in order to have an idea.

Is there a way which I could figure out selling statistics about games on specific platform? For example collect statistic for game xyz available on Steam platform or game abc available on HumbleBundle.

I think that could be a good practice to achieve this goal.

EDIT: recently was published SteamSpy, which offers a lot of statistics about games on Steam platform.


texts: Pathfinding With Speed Based Turning Restrictions

texts:
I have been working on a path finding project and I’m a bit stuck at the moment. I have an object that can increase or decrease speed, but the faster it moves the larger it’s turn radius is - so a car basically. I’ve implemented A* with a smoothing algorithm to generate waypoints for the object, however, as you might guess, it doesn’t take into account anything with speed and such. Currently, I’m moving the object at a set speed along it’s forward vector and at each waypoint lerp the direction to the next waypoint.

Is there a method - or a place to start looking - to implement a system to find the best route that’s possible by slowing or taking larger turns? At this point I’d even settle for a way to tell the object exactly how much it needs to slow down for each turn. Thanks for any help!


texts:
In my game main character can move using tap or hold finger on the screen. I wanna create at the menu options, and there button to change control type.
How I can save player choose? Using Prefs?


texts: How to add a volume bar like YouTube for iOS?

texts:
I am almost done with my game in Unity 5. However when the player presses Volume Up/Down, the iOS (version) shows the standard UI to show volume. Android has it's own (looks better on Stock).

I want to make my game consistent on either platform and different variations of Android. So I want to recreate how YouTube (for iOS) handles the change in volume.

I can't figure this out. Any help would be awesome!!!


texts: How do I check for collision between transparent textures?

texts:
I am creating a 2D game using OpenGL.
For sprites, I use textured quads (actually two triangles).
The texures contain transparent pixels, since objects are not always perfectly rectangular.

How do I do collision detection on the objects, not the quads?
I was thinking to first check the quads for collision and if they match, check the textures.

But how can I check if two non-transparent pixels are on top of each other (or next to each other) for the two objects?

Or is there a completely different way of how this is done best?


texts:
I'm trying to render a "skybox" using Allegro 5, that 3D objects can move around "in front" of. I'm having trouble figuring out how to set up the projection transform and where to put the vertices for the quads that will have the background texture applied.

The plan is to use an orthographic transform the size of the skybox textures to place the quads, and only use rotation for the camera. Once the skybox is placed the depth buffer bit will be cleared and other objects perspective-transformed from their respective world-coordinates as normal.

The orthograpic transform API has the form

void al_orthographic_transform(ALLEGRO_TRANSFORM *trans,
 float left, float top, float n,
 float right, float bottom, float f)

while the struct which holds the vertex data the transform will be applied to has the form

Fields:

x, y, z - Position of the vertex
color - ALLEGRO_COLOR structure, storing the color of the vertex
u, v - Texture coordinates measured in pixels

If my skybox textures have pixel widths and heights of say w and h, the same for all 6 sides, how should the vertices be created and transforms applied using the API to render it properly?


texts: rotating an array of images in 90 degree-java

texts:
In my java game,I have a stickSprite in vertical position.I want to rotate this stick in 90 degrees.so that it can hit the floor,once I press a key.
I used a an array of stick sprites to create a large stick.Why I am doing this because I want to increase the stick length differently at different times.

I am using this method to rotate the stick image:

public Image rotateImage(Image src, float angle) {

    int sw = src.getWidth();
    int sh = src.getHeight();
    int[] srcData = new int[sw * sh];

    src.getRGB(srcData, 0, sw, 0, 0, sw, sh);
    int[] dstData = new int[sw * sh];

    double rads = angle * Math.PI / 180.f;
    float sa = (float) Math.sin(rads);
    float ca = (float) Math.cos(rads);
    int isa = (int) (256 * sa);
    int ica = (int) (256 * ca);

    int my = -(sh >> 1);
    for (int i = 0; i < sh; i++) {
        int wpos = i * sw;

        int xacc = my * isa - (sw >> 1) * ica + ((sw >> 1) << 8);
        int yacc = my * ica + (sw >> 1) * isa + ((sh >> 1) << 8);

        for (int j = 0; j < sw; j++) {
            int srcx = (xacc >> 8);
            int srcy = (yacc >> 8);

            if (srcx < 0)
                srcx = 0;
            if (srcy < 0)
                srcy = 0;
            if (srcx > sw - 1)
                srcx = sw - 1;
            if (srcy > sh - 1)
                srcy = sh - 1;

            dstData[wpos++] = srcData[srcx + srcy * sw];

            xacc += ica;
            yacc -= isa;
        }
        my++;
    }

    return Image.createRGBImage(dstData, sw, sh, true);
}

and rotating the single stick(that is not an element of the array.Stick array elements are placed above this base stick.)like this.It worked well.

private void RotateBaseStick() {

    if (smashBool &&angleValue<90) {
        angleValue = angleValue + stickMovingSpeed;
        rotatedImage = rotateImage(stickImage, angleValue);
        stickSprite.setImage(rotatedImage, rotatedImage.getWidth(),
                rotatedImage.getHeight());

    }
    if (angleValue >= 90) {
        smashBool = false;
    }

    }

I am wondering how can I rotate the entire stickArray efficiently to make the feel of a long single stick hitting the ground?
Please help me.


texts:
Why does the following code not work?

public float ThetaScale = 0.0001f;
private int Size;
private LineRenderer LineDrawer;
private float Theta = 0f;

void Start ()
 {
  LineDrawer = GetComponent<LineRenderer>();
  LineDrawer.SetWidth(0.1f, 0.1f);
  LineDrawer.material = new Material(Shader.Find("Mobile/Particles/Additive"));
  LineDrawer.SetColors(Color.blue, Color.blue);
 }

void DrawingCircle(float radius)
{
Theta = 0f;
Size = (int)((1f / ThetaScale) + 1f);
LineDrawer.SetVertexCount(Size);
for(int i = 0; i < Size; i++){
    Theta += (2.0f * Mathf.PI * ThetaScale);
    float x = radius * Mathf.Cos(Theta);
    float y = radius * Mathf.Sin(Theta);
    LineDrawer.SetPosition(i, new Vector3(x, y, 0));
}}

void Update ()
{
    for(int l = 0; l < 3; l++)
    {
        DrawingCircle(l);
    }
 }

I want to plot a multiple circles like that

What's a good way to draw multiple circles?


texts: What is the point of a borderless fullscreen window?

texts:
Quite a lot of game allow user to play in a "borderless fullscreen window" instead of a "fullscreen mode". I've been wondering. Why would one prefer a fullscreen window over the "built-in" fullscreen mode?

Simple test of my own showed me, that using fullscreen mode instead yields better performance. I also tried to search on Google and on SO, but most answers are gaming related or on how to actually create those windows in API X,Y or Z.

So what is the point of having a borderless fullscreen window? Are there any technical reasons?


texts: Achieving 2D Lighting for Terraria-Like Game

texts:
I'm trying to achieve the fog-of-war lighting style that Terraria and Starbound have. Terraria's lighting system seems to be more blocky/tile based, but Starbound's is a lot more smooth.

The Desired Effect:

Starbound is using a shader to render its lighting, but how it's going about that is quite a mystery to me.

The idea I had on how to achieve the desired effect is the following: Create a texture that is black and somehow calculate the area that is white, storing this in a light map render texture, finally doing an Additive Blend of both the main texture and the light map texture to achieve a similar effect to Starbound's. (However this does not take into account lights in the world, which I also have absolutely no clue how to include in my calculation to the light map render texture)

I say somehow in italics because I have no clue as to how I can create this "Mask" effect in the light map render texture. How I can do calculations necessary to create the mask is beyond me; I don't even know how I can begin to translate the game world's data, relative to the what the camera sees, and update the texture accordingly.

TLDR: How can I achieve lighting similar to that of either Terraria or Starbound in Unity 2D?


texts: Require maths help calculating deflection angles of quadrants

texts:
For each quadrant, I need to find a neat way of calculating the deflection angle for a small circular object striking a circle, as shown in the diagram.

Angles a and b are already known.
Angle a is always relative to 0 degrees position.
Angle b is relative to the quadrant.
The initial angle can also be greater than 180, when coming from the
other direction, as shown in the diagram the right.

For quadrant 2, in the following snippet from my code, dy and dx represent the x and y coordinates of a point on the circle:

intersectAngle = atan(dy/dx);

Initial angle is calculated from velocity vectors:

pAngle = PI - (atan2(pVel.x, pVel.y));

For quadrant 0, I came up with this for the rebound angle:

pAngle = pAngle - 2 *(pAngle - tangentAngle);

Where tangentAngel is just the intersect angle with half PI added. Thsi worked for a ball from any direction.

Moving onto quadrant 1, this works for pAngles of less than 90 deg, but not for pAngles from the other direction:

pAngle = pAngle + 0.5 * PI - intersectAngle;

Feels like I shouldn't be writing all this code and that there is a more efficient way. I realise this is an elementary question but I'm studying this so it's all new to me. Please be gentle.


texts:
Is there a way to get an openGL context to do my drawings in UE4?

I'd like to use some shaders before the loading of a scene (kind of an intro thingy), but I couldn't find anything related to get an openGL context.


texts:
I am using pixi.js to learn about HTML5 game development. When using this line of code

var bunny = new PIXI

I get an undefined error saying that PIXI isn't defined.

Here is my HTML

<!doctype html>
<head>
    <title>PixiJS</title>
    <meta charset="UTF-8">
</head>

<body>

<script src="https://cdnjs.cloudflare.com/ajax/libs/pixi.js/4.2.2/pixi.min.js"></script>
<script src="index.js"></script>
</body>


texts: If I flip the normal on a backface, do I need to flip tangent and bitangent

texts:
I have a mesh that is just a plane and need to be seen front and back.
In order to do light computation, on the back face I have to flip the normal, do I have to flip the Tangent and Bitangent?
It seems to me that I have to flip all of the three to keep the computation correct.


texts: my android game works very well on unity editor but not on device

texts: Im working on a android unity project. My game works very well on the editor but, when i build it and run it on blue stacks emulator, it starts working corruptly. Bullets shoot twice in a time. When level is not started, the screen to the next level shows and...  what can be the cause of this problem?  maybe reason is bad emulator


texts: I'd like to read up on path finding algorithms. Is there a primer available or any material or tutorials on the Internet that would be a good start for me?


texts: android opengl-es spritesheet display number

texts:
Whats the best way to display numbers on android with opengl using a spritesheet?

I like to display the number "294" using the spritesheet:
http://i.stack.imgur.com/wv5Zh.png


texts: What is the difference between .obj files and Collada files?

texts:
I am currently making a game in java using LWJGL 2.9 and I am wondering what the difference between the .obj format and .dae format is. Currently I can load .obj files and would like to load .dae files as well.

Any information on .dae files would be great.


texts: How to change the border color of a button in libGDX?

texts:
How to change the border color of a button. I know how to change the background, but I don’t know this, although I reviewed the entire documentation.
And is it possible to find out whether the button is pressed or not


texts: Detect up and down slopes to switch between character animation

texts: There's a player and a slope in my scene. I want the player to automatically switch to 'climbing down' animation when he's at the top of the slope and moving down and similarly switch to 'climbing up' when he's at the bottom and moving up. I'm using the default 'character controller'. I've managed to get the slope angle with 'Vector3.Angle(transform.forward, hit.normal)' and the 'climbing up' is working fine since the angle is > 95 and that's the condition I stated. But when 'climbing down' the angle is not uniform and ranges from 30 - 140 and the condition I've stated is < 70 which is not satisfied all the time and hence the animation switches from 'climbing down' to 'climbing up' and vice versa. How do I get the right slope angle to differentiate between up slope and down slope?


texts: Can I make and test PS Vita games without registration?

texts:
I am currently not registered as a Playstation Developer at the moment, but I have emailed Sony in the mean time to ask how a single person can register as an Indie Developer to publish. But can I still make my game in the mean time?

I have Unity and I know that Unity has Playstation support, so is there any chance that I can test my current game on PS Vita as well without registering with Sony first? That way, when I do register, the game can be closer to release.


texts: How to select the most powerful vkDevice?

texts:
I've been messing around with Vulkan recently. In all of my experiments, when I select a gpu/vkDevice, I always just take the first one vulkan provides. I've looked at the documentation for vkDevice, and found that there is a lot of info, however I don't know how to decide what gpu is best for my program. I've considered using just max resolution, but it seems to me that there must be a better way.

Thanks :D


texts: How do I rotate the Camera around the player by Keypress in Unity?

texts:
I want to rotate the camera around the player by pressing E and Q but it doesnt rotates around the player. I tried RotateAround but didnt worked.

Code:

public Transform player;
public float smoothSpeed = 0.125f;
public float rotateSpeed;
public Vector3 offset;
private Vector3 velocity = Vector3.zero;

void LateUpdate ()
{
    transform.position = Vector3.SmoothDamp(transform.position, player.position + offset, ref velocity, smoothSpeed * Time.deltaTime);
}

void Update()
{
    if(Input.GetKey (KeyCode.E))
    {
        transform.RotateAround(player.position, Vector3.up, rotateSpeed * Time.deltaTime);
    }

    if(Input.GetKey (KeyCode.Q))
    {
        transform.RotateAround(player.position, -Vector3.up, rotateSpeed * Time.deltaTime);
    }
}

}


texts: How can I add a Silverlight menu/hud/interface to an XNA game?

texts: There are some programs that allow you to design some menus/hud/interfaces in flash and then insert them into your game. But is there something similar for making all of this stuff in Silverlight and then mount that content in your XNA game?


texts: What does 'Discretizing Space' mean in the context of paper prototyping

texts:
I was browsing some lecture slides by Eric Anderson for his Cornell course CS 4154 (Analytics-driven Game Design). In a series of slides he mentions discretizing space as a way of paper prototyping action games. As an example he illustrates  with a screen shot of Super Mario with a grid overlay (shown below). Unfortunately the slides do not expound on how this technique is used.

How is discretizing space used to prototype platform games or action games generally?


texts:
How do I get rid of this alpha transparency artifacting with classic fixed function OpenGL?

I tried all kinds of settings but I'm not sure why it's good in the upper half of the mask but not in the lower half.

alpha illustration | 1.7M GIF

I have a two-sided concave mesh and want to fade out the edges with an alpha vector on the vertex colors. I get the same artifact with an RGBA texture also.


texts: Directory paths for resources and assets

texts:
If I have a file stucture for my final, released game something like:

Main folder

Media

Images
Other assets
Sounds

Executable
List item

And a different one for my 'in development' project, with the same Media folder but:

Main

Source and .obj, etc.
Media with everything
Bin folder with executable

I obviously cannot hardcode file pathnames into this, like:  "../Media/Image/evilguy.png" or "Media/Image/foo.jpg"  because they wouldn't work with one of the builds and would require a lot of switching names.

Instead, does it make sense for my resource manager, that loads everything, to have some kind of prefix path? Then, I can just do  Get("foo.jpg") or Get("Sounds/boom.ogg")
And simply switch out, for the final release, the ctr argument from the relative path for the development build to the release layout?

If not, how have other people sorted these sorts of things out?


texts: Which UVs to use when I have more UVs coordinates than vertices Obj

texts:
I have a simple sphere exported from 3DS Max in .obj format. I noticed that I have more UVs than vertices. I parsed the file with a simple program I wrote and then I put the various vertices and UVs coordinates and indeces in WebGL buffers. The result is that the texture is mapped to the sphere, but it is highly distorted. I tried using differend UV unwrap methods, but there still is a lot of distortion, all over the model.

So I'm thinking that maybe I'm using the wrong UVs coordinates. Right now I'm really just parsing the coordinates, and then applying them in the order they come. For example, I have 482 vertices and 559 UV coordiantes, so I just match them in the order they come (Vertex 1 gets UV 1, Vertex 2 gets UV 2...) and then the remaining 77 coordinates are unusued (I assume, I just load them in the buffer and let WebGL do its thing really).

So I thought maybe I should use those later coordinates instead of the early ones. Like, if I have a vertex with two or more sets of coordinates, use the last one I find while parsing the file. Or maybe I'm just plain wrong, can you give me some help? Thank you


texts:
I've just enabled back face culling and I'm noticing a weird behavior: when all vertices of my triangle is outside the view and 2 of them is behind me (I think) the triangle disappears.

So to see it, here is a GIF.

I suspect the projection matrix reverses the order of the two vertices when they fall behind me, and changes the winding of my triangle.

But it's unclear why does the triangles disappear only if all vertices out of view...

How can I work around this problem, if possible?

I develop on Linux if that matters.

UPDATE:

It's pointed out it might not be due to the back face culling. I disabled it and I can indeed reproduce it. The cubes are 20×20 and the vertical field view is 90°. Its vertical apparent size roughly fills the window.

UPDATE 2:

Ok I'll post the relevant part of the code, projection and view matrixes are set up using my own functions:

void createViewMatrix(
    GLfloat matrix[16],
    const Vector3 *forward,
    const Vector3 *up,
    const Vector3 *pos
)
{
    /* Setting up perpendicular axes */
    Vector3 rright;
    Vector3 rup = *up;
    Vector3 rforward = *forward;

    vbonorm(&rright, &rup, &rforward); /* Orthonormalization (right is computed from scratch) */

    /* Filling the matrix */
    matrix[0] = rright.x;
    matrix[1] = rup.x;
    matrix[2] = -rforward.x;
    matrix[3] = 0;

    matrix[4] = rright.y;
    matrix[5] = rup.y;
    matrix[6] = -rforward.y;
    matrix[7] = 0;

    matrix[8] = rright.z;
    matrix[9] = rup.z;
    matrix[10] = -rforward.z;
    matrix[11] = 0;

    matrix[12] = -vdp(pos, &rright);
    matrix[13] = -vdp(pos, &rup);
    matrix[14] = vdp(pos, &rforward);
    matrix[15] = 1;
}

void createProjectionMatrix(
    GLfloat matrix[16],
    GLfloat vfov,
    GLfloat aspect,
    GLfloat near,
    GLfloat far
)
{
    GLfloat vfovtan = 1 / tan(RAD(vfov * 0.5));

    memset(matrix, 0, sizeof(*matrix) * 16);
    matrix[0] = vfovtan / aspect;
    matrix[5] = vfovtan;
    matrix[10] = (near+far)/(near-far);
    matrix[11] = -1;
    matrix[14] = (2*near*far)/(near-far);
}

Projection matrix set up with this call:

createProjectionMatrix(projMatrix, VERTICAL_FOV, ASPECT_RATIO, Z_NEAR, 10000);

(VERTICAL_FOV = 90, ASPECT_RATIO = 4.0/3, Z_NEAR = 1)

Level drawing is simply:

void drawStuff()
{
    GLfloat projectView[16];

    glClearColor(0, 0, 0, 1);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    createViewMatrix(viewMatrix, &camera.forward, &camera.up, &camera.pos);

    multiplyMatrix(projectView, viewMatrix, projMatrix); /*< Row mayor multiplication. */

    glUniformMatrix4fv(renderingMatrixId, 1, GL_FALSE, projectView);
    bailOnGlError(__FILE__, __LINE__);

    renderLevel(&testLevel);
}

Cubes are rendered wall by wall (optimizing this will be another story):

    for (j = 0; j < 6; j++)
    {
        glBindTexture(GL_TEXTURE_2D, cube->wallTextureIds[j]);
        bailOnGlError(__FILE__, __LINE__);

        glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_INT, (void*)(sizeof(GLuint) * 4 * j));
        bailOnGlError(__FILE__, __LINE__);
        glUniform4f(extraColorId, 1, 1, 1, 1);
        bailOnGlError(__FILE__, __LINE__);
    }

Vertex shader:

#version 110

attribute vec3 position;
attribute vec3 color;
attribute vec2 texCoord;

varying vec4 f_color;
varying vec2 f_texCoord;

uniform mat4 renderingMatrix;

void main()
{
    gl_Position =  renderingMatrix * vec4(position, 1);
    f_color = vec4(color, 1);
    f_texCoord = texCoord;
}

Fragment shader:

#version 110

varying vec4 f_color;
varying vec2 f_texCoord;

uniform sampler2D tex;

uniform vec4 extraColor;

void main()
{
    gl_FragColor = texture2D(tex, f_texCoord) * vec4(f_color) * extraColor;
}

The depth buffer simply set up by enabling it.


texts: Swipe and hold character movement not working

texts:
Heres my PlayerControl script

void Update () {

    foreach (Touch FingerTouch in Input.touches)
    {
        if(FingerTouch.phase == TouchPhase.Began)
        {
            FingerInitialPosition=FingerTouch.position.x;
       }
        if(FingerTouch.phase == TouchPhase.Moved)
        {
            FingerMovedPosition=FingerTouch.position.x;
            if(FingerMovedPosition>FingerInitialPosition)
            {
                charcter.transform.Translate(Vector2.right * speed * Time.deltaTime);
           }
            if(FingerMovedPosition<FingerInitialPosition)
            {
                charcter.transform.Translate(-Vector2.right * speed * Time.deltaTime);
            }
            }
        if(FingerTouch.phase == TouchPhase.Ended)
        {
            FingerInitialPosition=0f;
            FingerMovedPosition=0f;

        }

    }

}

}

The problem here is the player doesn't move when you swipe and hold on the touch screen but only moves when you keep swiping.

Can you please help whats wrong or missing in the code so that the player moves when swiped and held?


texts: What has stopped MMORTS games from being successful?

texts:
We all know that there have been attempts to create commercially successful MMORTS games, but all have failed. By failed, I mean that they didn't get really popular in the gaming community. Why is that?

What is an MMORTS?

It's like an RTS (a real-time strategy; Rome: Total war, Stronghold, StarCraft, WarCraft) but has an MMO component, meaning that you not only build your economy and industry, but you get to compete with other players doing just that in real time.

This interests me because I'm trying to make a game that is similar to an MMORTS as well.

Summary: what are the reasons that are stopping the MMORTS genre from evolving?


texts: Creating Smooth Corners when Converting 2D Polylines to 3D Models

texts:
Part of my game takes SVG polylines (which are just basically a set of x,y coordinates that define a multi-segment line) and converts them into 3D 'paths' (ie. a line created as a set of faces all pointing 'up').

I was wondering if there was a standard algorithm I should consider for how to smooth the corners of the lines when there is a change of direction. I don't want to turn the whole path into a smooth curve - I just want to smooth out the corners where the line turns sharply.

What I'd love is an algorithm that - given two vectors (V1 & V2) and a line thickness (T) - returns the best two 2d coordinates to use as the corner vertices so that the I don't have to add any additional polygons to the line, and that both of the incoming lines keep their thickness.

Is this wishful thinking, or is there something like this out there?

Thanks.


texts:
I am planning on developing a multiplayer RPG (kinda like RuneScape, but don't worry, with a different gameplay) and i want to do this in the browser. Now before saying things like "A MMORPG is hard to make" or "Others tryied that too" please keep in mind that i am not dreaming at a huge game, it's just an idea that i want to see "breathing".

The reason i choose JavaScript and HTML5 over other technologies is that i have some experience in web development (which of course includes a deep understanding of JS).

I've looked over some libraries (or so called engines) on the web and i've found some that  might have what i need.

My question is: What is the best way to render this kind of game in the browser, also could you suggest me the library that you think is the most suitable for this kind of job?


texts: How can I make this easing function less jumpy?

texts:
I have this function that acts as an ease-in:

protected static function easeIn(ratio:Number):Number {
  return ratio * ratio * ratio;
}

Ratio is a value between 0 and 1.

The function works okay, but I'd like to make it a bit less "jumpy." I mean, it accelerates too fast and abruptly slows down.

However I'm not sure what values should I play around to achieve what I want, does anyone know?


texts:
I've started to make a 2D sidescroller, the camera and world rendering works as I expect, but now comes the physics part of world.

What I need is that one tile in x or direction should correspond to 1 meter. Since I have a variable time step (Android mobile game), I can't figure it out, since the timing and velocity always will be dependent of the device. So, is there any good way to make one tile to correspond 1 meter? This would be good, otherwise the physics implementation would later be weird.


texts: Flip DDS Texture without original source image for OpenGL

texts: I'm wondering if there's a converter for DDS textures after they've been created. We don't have access to the original source images and we would like to avoid changing our shaders, as I'm told it's less efficient to flip them during runtime. Also we don't want the added load time of flipping them. Does anything like that exist? I couldn't find it if there is...


texts: General visual effects to meshes/entities

texts:
I am trying to add some visual effects to some entities, meshes, or whatever you want to call them as they are looking pretty dull in my game right now.

What I want to achieve is this: http://youtu.be/zox8935PLw0?t=36s (the "texture" gets disintegrated and then goes back to normal, covering the whole mesh.)

Also I would like to know what is the best way to add effects like the one in the video to my game (for example, thunder effects, shattering, etc.) I know that I can do some things with shaders, but I haven't learned them too well and I am still in a beginner level.

I am using Ogre3D, and GLSL for shaders.

Thanks!

Note: this is a screen-shot of my game, I want to apply the effect in the video to my main character):


texts: What to watch out for when creating a autobiographical game?

texts:
I plan to create a game which depicts various events from my life.

During these events, some people I know do not appear in a very positive light. I am afraid that these people might feel that it is an infraction on their personality rights. I also plan to unveil some of my own actions which they didn't know before and which could make them angry if they knew of them.

The story of the game as I currently plan it will be written in a way that if they know I made the game, they would realize that they are the ones depicted. Even if they have different names and appearance.

But despite these risks I feel that this project is important for me and might help me to cope with some events from my past.

What should I watch out for when I write and publish the game to make sure I won't ruin my relationship with these people?


texts: Tips on thinking of a good game mechanic?

texts:
I am trying to make a turned based rpg and I really want to know how can i make original game mechanics like Undertale with it's sparing system.I am not really that creative to think of a good game mechanic,I just need tips on how to improve my creativity for game dev because it is really hard for me to think of something original.
Thanks!


texts: How to deal with VBOs when rendering mesh's that may or may not be displayed?

texts: I'm working on a multiplayer game and will be displaying other players near the player.  At most 16 players could be near the gamer however there could also be 0.  What I'm thinking of doing is setting up 16 empty VBOs so they're ready to load with character's position when the client receives them.  Is it valid to create empty VBOs?  If not how should I go about rendering data that may or may not be there depending on what the server is sending the client?


texts:
After I downloaded unity 5, it became very power consuming. For example, my pc becomes hotter and makes a lot of noise. Also building, compiling, baking of game takes a lot of time. I am making a multiplayer game and need to build the game almost on every change, but it takes hours or sometimes it doesn't even build the game. There are also bugs with directional light, it doesn't work. So yeah, any suggestions?

My internal PC specs: Intel core i3-3130M, 8gb of ram, video card: Intel R4000

I installed unity 5 after Windows 10 came out, maybe it's something with the OS? Also yesterday, I updated Unity but with the same problems.

Also here are some screens:

Directional light is turned off but everything except models is dark, i mean terrain is black.

Also this baking process is more than one hour and stays on 5/11 clustering | 41 jobs


texts: How to Fill the Gap Between Camera Clip Plane And Skybox?

texts:
I'm talking about the brown-greyish area i marked with blue. How can i fill it with something that does fit the environment?

I'm looking for a solution like this plugin.


texts: How does an AI determine the bearing to follow within a nav mesh?

texts:
I've done some reading on nav-meshes, and I understand how to generate a path of polygons to reach a goal. However, what I don't understand is how you determine the bearing to follow within each polygon. Without a central node to aim for, what do you aim for? I suppose you could cast a ray to the goal and then head to the point where that ray crosses into the next cell - but that would only work if that next cell is actually on your path. If your ray doesn't cross the edge into the next cell, do you instead plot a path to whichever corner of the edge is closest to the goal? I think that would get you the path shown in the 3rd diagram, but would it work in all cases?

http://udn.epicgames.com/Three/NavigationMeshReference.html


texts: Objective - Gestures while finger touches screen

texts:
I'm creating a space cocos2d game with objetive-c. I have in the bottom left 2 arrows to move the sprite left or right. I also implemented a swipe gesture to change weapon, however it only happens when I'm not touching the screen.

I would like the player to change weapons while he's moving the sprite and not have to lift the finger from the arrows and stop moving the sprite to change weapons.

Is there any way I can detect Gestures while having a finger pressed un a buton in thes screen?


texts: What is the order-less rendering technique that allows partial transparency?

texts:
I've seen somewhere rendering technique that allows order-less rendering of partially transparent sprites/objects.

Though I can't remember what the technique is called, so I'm having trouble Googling it.


texts:
has anyone experienced vibration causing lag on OnePlus 6 (or other device)? I'm developing a mobile game on unity and lately I have been Integrating Nice Vibrations to our game which is basically a wrapper for both Android and iOS vibration.

Basically whenever vibrations become too rapid, like 10 vibration patterns/second , my OP6 drops framerate from 60 to 20.
This lagging happens with any game that uses a lot vibration so it can't be caused by any bug in our codebase.

Has anyone else faced similar behaviour and managed to fix it?


texts: Why does invoking glm::refract function return NaN?

texts:
At the present time, I make a simple raytracing project and I encounter an issue : When I invoking the glm::refract function, it returns me a vec3 with "NaN" values. However, my input data seems to be correct (2 normalized vec3 and my refractive-index is 1.0). Have you got an idea of the problem ? This function is not so well documented.

EDIT :

Very strange, if my refractive index is 1.0f it's working well actually :

glm::vec3 view = glm::vec3(0.191318035, -0.0721754059, 0.978870869);
glm::vec3 normal = glm::vec3(-0.151046738, -0.988510013, -0.00574064208);
float refractIndex = 1.0f;
glm::vec3 output = glm::refract(view, normal, refractIndex);

However, if I invoke the function and passing a refractive index of 1.10000002f for example (my program seems to approximate values and I don't know why...), it doesn't work => returns vec3 with "NaN" values. Like below :

glm::vec3 view = glm::vec3(0.191318035, -0.0721754059, 0.978870869);
glm::vec3 normal = glm::vec3(-0.151046738, -0.988510013, -0.00574064208);
float refractIndex = 1.10000002f;
glm::vec3 output = glm::refract(view, normal, refractIndex);

EDIT 2 :

More weird : If I try with a refractive-index of 1.1f it doesn't work. Same error.


texts: SteamVR_TrackedObjects disabled on dashboard

texts:
our game relies heavily on some Joints attached (not childs) to the tracked controllers. But those controllers get disabled when a user clicks on the system button which actually break our physics when user get back in game.

Is there a way to keep them active ? i checked they get Disabled in SteamVR_ControllerManager and could just risk commenting that block.

Or any event method called when the user opens the VR Dashboard ?

Thank you.

We are using Unity 5.6.0 and the latest SteamVR plugin.


texts: Changing scene while joining room and RPC buffer problem

texts:
I have a button on my main menu that creates and has the player join a random room. After the client joins this room, I change the scene to the game (main) scene in the OnJoinedRoom method. This works well, until I use the RPC call with buffers.

There are 5 spawn points in the game scene, and every time a player joins the room, they occupy a spawn point, so no-one else can spawn at that point.
So, I have list of spawn points in my code, and every time a player joins, it randomly picks a point from that list and "removes" it from the list. It does this via RPC call, so if a player joins the game late, it removes that point, too.

There is a problem with that RPC's buffer because of the "scene change". After OnJoinedRoom, the RPC buffers are called only when the player joins the room, and before the scene change. Because the scene hasn't changed yet, it has trouble finding the buffered photonview, and it throw outs an error. It doesn't update the list.

Can I delay the buffer calls, is there a better way to change my scene while joining a room?


texts: How can one impliment multiple control schemes for a single player?

texts:
I am working on a platformer and I want to have the player be able to switch control types based on items that may be carried + default controls for things such as water, in the air, on the ground etc...

I understand how to make a player move in anyway I desire but I don't understand how I can encapsulate these behaviors into their own classes and call and apply them to the player when needed.

The way I have it is this:

Input is handled by the input class.
During the update, the player looks at the input class.  It then figures out how it should move itself with a bunch of if statements to figure out what rule set should be applied. For example:  Am I in the water?  Am I on the ground? Am I in the air?  and so on.  Based on the previous questions the player object then decides how to interpret the input.  After everything is done, the results are edited by world rules which applies things such as gravity, etc...

This seems to work but it is not elegant and results in duplicated code.  Its ugly.  How should I set up some classes and how should they talk to each other?  All I manage to do is make a mess of my code trying to class it out.  I have searched around for sometime on how I need to do this but can't find anything.

Any pointers on where I can go to figure this out?  Any advice?  I just know I need the code contained so it's easy to debug later and figure out what is happening.


texts: How should a team share/store game content during development?

texts:
Other than Dropbox, what out there has been especially useful for storing and sharing game content like images during development (similar feature set to Dropbox like working offline, automatic syncing and support for windows/osx)?

We are looking into hosting our own SharePoint server but it seems to be really focused on documents... Maybe Box.net would work?

EDIT

For code, we are using Git.

To be more precise, I was looking for an easy, automatic way for content produced by artists/audio engineers to be available to everyone.  Features like approvals of assets don't hurt either.  Following the answer linked by Tetrad, Alienbrain looked pretty interesting but..is way out of our budget (may be something to invest in in the future).

What ended up doing...

We were going to go with Box.net but downloading the sync apps for desktop use required us to wait to be contacted by them for some reason.  We did not have much time to wait so we ended up going with Dropbox Teams.  Box.net has a nice feature set but we never really felt held back without them.

Thanks for the help :).


texts: 3D Zoom To Mouse Cursor accounting for Change in Camera Pitch

texts:
Overview:

Simply put, I'm trying to make a zoom to cursor algorithm. This would normally be very simple, but the implementation of the camera is making it difficult.

As the camera zooms in and out, the pitch of the camera (angle relative to the ground) changes. At its farthest position from the ground, it looks nearly directly at the ground, and at its closest position, it looks at about a 40 degree angle toward the ground.

This greatly complicates the method for zooming into a mouse position on a non-uniform 3d terrain.

Specifics:

More details for those who are still interested in trying to help.

The camera is implemented in unreal engine using a spring-arm (basically a large stick) attached to an actor that serves as the center of the screen. Zooming in and out simply requires us to shorten the spring-arm and change the angle of the spring-arm. moving the camera around the world is done my moving the actor around the plane at z=0 (0 height).

The problem then becomes: Where should my actor be after zooming in such that the point that the cursor is over doesn't change?

There is already an algorithm in place to determine the current pitch of the camera and the new pitch of the camera, so you can assume that information is already known. We can also easily find the new height of the camera, and the new distance between the camera and the actor (length of the spring-arm). We can fairly easily determine the point the cursor is over in the game world, and we can determine that point when it is projected along the plane at z=0.

I had originally tried implementing this using a naive solution based on some 2D trigonometry, but this didn't account for the direction that the new actor position would be in relative to the cursor position after the translation occurs. After working on this for as long as I have, I'm having trouble coming up with a new solution that also finds this value.

I'm thinking now that I can use an alternative method that would involve drawing a plane with the same normal as the camera using the vector directions of the actor and cursor position as corners, then rotating about a line going through the cursor position and scaling the new triangle to make it identical to the previous one when viewed from the camera. This, though, seems like it would be unnecessarily complicated, and expensive to implement.

I was wondering if anyone had a simpler solution (or any solution for that matter) that they know of for this problem. Or at least if anyone has some kind of direction they could point me in for finding out how I might be able to solve this problem in a reasonable amount of time without it being too computationally expensive.

Let me know if you need any more details.

(Programming language is kind of irrelevant here, so feel free to use whatever you want for explanation or examples, or just use English or pseudo code. I don't really expect anyone to write me an algorithm to do this, I'd just like some ideas on how I ought to approach this problem to keep me from ripping off my head)

Thanks,

Zac Taylor


texts:
The problem I'm having is that my script, which has access to the spriterenderer on my gameobject, won't flip the sprite when I directly type "sprite.flipY = true;" at the end of my FixedUpdate() function.
        if (transform.position.x < player.transform.position.x)
        {
            facingright = false;
        }
        if (transform.position.x > player.transform.position.x)
        {
            facingright = true;
        }
        sprite.flipY = !wasfacingright;

Heres all of the code if you need it
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GunController : MonoBehaviour
{
    public Transform player;
    public CharacterController2D playercontroller;
    public float smoothness = 0.125f;
    public float winglength = 2;
    private Vector2 difference;
    private bool facingright = true;
    bool wasfacingright = true;

    public GameObject bullet;
    public int maxammo;
    public int ammo;
    public Transform rightNozzle;
    public Transform leftNozzle;

    public SpriteRenderer sprite;
    public Sprite normalGun;
    public Sprite emptyGun;
    public GameObject emptyBottle;
    public Animator reloadAnim;
    // Start is called before the first frame update
    void Start()
    {
        player = transform.parent.transform;
        sprite.sprite = emptyGun;
    }

    // Update is called once per frame
    void Update()
    {

    }
    private void FixedUpdate()
    {
        doMovement();
        tryShooting();
        tryReloading();
    }
    private void tryReloading()
    {
        if (Input.GetKey(KeyCode.R) & ammo <= 0)
        {
            Instantiate(emptyBottle, transform.position, Quaternion.identity);
            StartCoroutine(reload());
            ammo = maxammo;
        }
    }
    private void tryShooting()
    {
        if (Input.GetMouseButton(0) & ammo > 0 )
        {
            ammo -= 1;
            if (facingright)
            {
                Instantiate(bullet, rightNozzle.position, transform.rotation);
            }
            else
            {
                Instantiate(bullet, leftNozzle.position, transform.rotation);

            }

        }
    }
    private void doMovement()
    {
        wasfacingright = facingright;
        if (transform.position.x < player.transform.position.x)
        {
            facingright = false;
        }
        if (transform.position.x > player.transform.position.x)
        {
            facingright = true;
        }
        sprite.flipY = !wasfacingright;
        if (wasfacingright != facingright) { playercontroller.Flip(); }
        difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
        float rot = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;

        Vector3 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition) - player.position;
        pos.z = 0;
        Vector3 desiredpos = player.position + (winglength * pos.normalized);
        Vector3 smoothpos = Vector3.Lerp(transform.position, desiredpos, smoothness);
        transform.position = smoothpos;
        transform.rotation = Quaternion.Euler(0, 0, rot);
    }
    IEnumerator reload()
    {
        sprite.sprite = emptyGun;
        reloadAnim.Play("Reload", 0, 0);
        yield return new WaitForSecondsRealtime(0.5f);
        sprite.sprite = normalGun;
    }
    public void die()
    {
        gameObject.SetActive(false);
    }
}