texts: Whats the least expensive way to play video in unity?

texts:
Alright, Ive asked this various ways but my situation is I have several (over 100) objects that have screens that need to play animated videos on them. There does not need to be sound, but this is for VR so performance is an issue.

So far, after trying render textures and video materials and seeing that fps dropped, Ive been using this script to flip through sets of pngs and put them in the diffuse slot of a material:

public class VideoPlayerRawImage : MonoBehaviour
{
    public Texture[] frames;
    public int framesPerSecond = 60;

    public bool isEmissive = false;

    void Update()
    {
        int index = (int)(Time.time * framesPerSecond) % frames.Length;

        this.GetComponent<Renderer>().material.mainTexture = frames[index];
        if(isEmissive)
        {
            this.GetComponent<Renderer>().material.SetTexture("_EmissionMap", frames[index]);
        }

        if(index >= frames.Length-1)
        {
            index = 0;
        }

    }

Is this the most efficient way to play videos? What would be a drawback to this method/is there a better way?


texts: Issue importing TileMaps/TileSets in Monogame.Extended 1.0

texts:
I've just started coding my first ever videogame using Monogame/Xna. I've reached a point where I would like to start editing maps and importing them into my game using the program Tiled. After reading through the tutorials for Monogame.Extended, I was able to install version 1.0 using NuGet commands, and configure the content pipeline tool references accordingly. Right now, my packages file looks like this:

<packages>
<package id="MonoGame.Extended" version="1.1.0" targetFramework="net45" />
<package id="MonoGame.Extended.Content.Pipeline" version="1.1.0" targetFramework="net45" />
<package id="MonoGame.Extended.Graphics" version="1.1.0" targetFramework="net45" />
<package id="MonoGame.Extended.Tiled" version="1.1.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
</packages>

And Content.mgcb looks like this:

#-------------------------------- References --------------------------------#
/reference:..\..\packages\MonoGame.Extended.Content.Pipeline.1.1.0\tools\MonoGame.Extended.Content.Pipeline.dll

I have a basic map [Orthographic] that is 64 x 64 tiles of size 32 x 32. The content manager allows me to import both the Map.tmx and Tileset.tsx into the project. However, it will fail to compile with one of two errors:

1) If there is a Tileset.tsx file in the Content Manager:

Couldn't find a default importer for 'C:/Users/*****/source/repos/HeavyMetalMachines/HeavyMetalMachines/Content/maps/Test.tsx'!

2) If there is only Map.tmx file in the Content Manager:

DirectoryNotFoundException: Could not find a part of the path 'C:\maps\TestMap.xnb'.

My Content is obviously not directly under my C:\ drive, so I am confused by the second error. It almost seems as if VStudio is converting the map to binary and then trying to place the converted map under C:? The command I am using to import the content is as follows:

//Tiled Test
private MonoGame.Extended.Tiled.TiledMap lcTestMap;
.
Content = new ContentManager(this.Services, "Content");
.
lcTestMap = Content.Load<MonoGame.Extended.Tiled.TiledMap>("/maps/TestMap");

I would like to know if I missed a critical step in the configuration, or if I am not using these classes correctly. I do plan on strictly using Isometric maps in this game, so I'm hoping that it will not be too different from this test. Oh, and I'm using Visual Studio Pro 2017 with Monogame 3.6 - in case that has some impact as well...

Thanks in advance for any help you might have!


texts: Question about creating Enemies in C++ RPG

texts:
I don't know if this is Technically the right place to ask this but I need help designing a function, I need a Rubber Duck if you would.

I'm working on an Enemy class for my C++ RPG and I am in need of some suggestions.

The Base of my design as far as the Battle system and Character Objects and Enemies and such is that all have an ID. A simple int as it were that I associate with Character Names via enum ie.

enum class Character {PLAYER1 = 0, PLAYER2 = 1};

and enemies like so.

enum class Enemy {WOLF = 0, GHOST = 1, LICH = 2};

I have a random number generator and a map to my enemy enum in my mob class that does two things.

selects an amount. // Self explanatory how many enemies there are.
Selects a random ID from the map. // The  type of Monster you'll face.

My Question is, how would I design a function that will construct an enemy based on it's ID?


texts: Game architecture / design question - building an efficient engine while avoiding global instances (C++ game)

texts:
I had a question about game architecture: What is the best way to have different components communicate with each other?

I do really apologize if this question has already been asked a million times, but I can't find anything with exactly the kind of information I'm looking for.

I've been trying to build a game up from scratch (C++ if it matters) and have observed some open source game software for inspiration (Super Maryo Chronicles, OpenTTD and other). I notice that a lot of these game designs use global instances and/or singletons all over the place (for things like render queues, entity managers, video managers, and so forth). I'm trying avoid global instances and singletons and build an engine that is as loosely coupled as possible, but I'm hitting some obstacles that owe to my inexperience in effective design. (Part of the motivation for this project is to address this :)  )

I've built a design where I have one main GameCore object that has members that are analogous to the global instances I see in other projects (ie, it has an input manager, a video manager, a GameStage object that controls all the entities and game play for whatever stage is currently loaded, etc). The problem is that since everything is centralized in the GameCore object, I don't have an easy way for different components to communicate with each other.

Looking at Super Maryo Chronicles, for example, whenever a component of the game needs to communicate with another component (ie, an enemy object wants to add itself to the render queue to be be drawn in the render stage), it just talks to the global instance.

For me, I have to have my game objects pass relevant information back to the GameCore object, so that the GameCore object can pass that information to the other component(s) of the system that needs it (ie: for the situation above, each enemy object would pass their render information back to the GameStage object, which would collect it all and pass it back to GameCore, which would in-turn pass it to the video manager for rendering). This feels like a really horrible design as is, and I was trying to think of a resolution to this. My thoughts on possible designs:

Global instances (design of Super Maryo Chronicles, OpenTTD, etc)
Having the GameCore object act as a middleman through which all objects communicate (current design described above)
Give components pointers to all other components they will need to talk with (ie, in the Maryo example above, the enemy class would have a pointer to the video object it needs to talk to)
Break the game into subsystems - For example, have manager objects in the GameCore object that handle communication between objects in their subsystem
(Other options? ....)

I imagine option 4 above to be the best solution, but I'm having some trouble designing it... perhaps because I've been thinking in terms of the designs I have seen that use globals. It feels like I'm taking the same problem that exists in my current design and replicating it in each subsystem, just at a smaller scale. For example, the GameStage object described above is somewhat of an attempt at this, but the GameCore object is still involved in the process.

Can anyone offer any design advice here?

Thanks!


texts: Bullets moving with the camera, not the world, Java 2D

texts:
I'm building a simple 2D Top-Down shooter game in Java.
I simply cannot get this to work:
I'm moving the camera and world differently. The world is moving when needed (when not in one edge, so it gives nice effect of not showing outside of the world). When the player moves and edges are not visible, the camera is moved when the player moves.
I implemented bullets right now, but the bullets move with the camera, not the world, like the correct physics should be :D
For moving the world relative to player position and camera, I'm using X and Y offsets.
Now the problem:
I'm creating a new bullet like this in my Player.java class:
new Bullet(handler, angle, x + width / 2 - handler.getCamera().getxOff(), y + height / 2 - handler.getCamera().getyOff(), 2, 4);

Bullet constructor:
public Bullet(Handler handler, double rad, double x, double y, double speed, int r)

I have to add half the width and height of the player, because otherwise it will shoot at the corner of my player sprite. Camera X and Y offsets to the bullet X and Y, because otherwise the bullet will be drawn to the coordinates relative to the world and will not shoot from correct places. But when the bullet is moving it moves with the camera.
Really wouldn't like to change the Camera movement!


texts: Is there any potential downside to procedurally programmingh in DirectX 11, without classes?

texts:
I'm learning DirectX 11, and I hope to start a simple 3D engine, some day. I'm following a tutorial series, and I realised that I have no need to create any class to maintain my code. The tutorials also use this procedural approach, but I don't copy and paste the tutorial code; I try to understand the tutorial, and then try to code the new stuff in my way.

I can have the code understable, and working well, with just functions and global variables. When I have enough knowledge of the API, and I want to start creating my own library, could this procedural approach have some downside? Should I start writing some classes?


texts:
My 3D Hero-Model is positioned at a certain point in 3D-Coordinates. Whenever he's colliding with a coin, I want to place an animated sprite sheet there. But my following implementation won't give me useful result.

Viewport vP = GraphicDevice.Viewport;
Vector3 unitPos = modelPos.LocalPosition;

Vector3 screenSpace = vP.Project(unitPos, _cam.Projection, _cam.View, Matrix.Identity);
MySprite sprite = new MySprite(unitPos.X, unitPos.Y);

//... Won't draw sprite where the model is

The sprites are almost at the exact position, but there's approx. a 100px difference.
I am using a perspective camera with these settings:

Matrix Projection = Matrix.CreatePerspectiveFieldOfView((float)Math.PI / 3.0f, 800f / 480f, 1, 3000);

And when I place my camera to Z= 0 Y = 37 and Z = 220,
I have to multiply the result of Vector3 by 3.

The position of my camera is a Vector3 though.

A is the pure calculated value for SpriteY and B is the calculated value *3 (coincidentally is the right position)

So, it isn't correct. Why???


texts: How can I correctly line up differently sized animation frames with a character?

texts:
For educational purposes, I'm developing a 2d game without APIs or libraries. Currently I'm stuck with a sprite drawing problem.

To store sprites for drawing (assuming I have the sprites I need all in one sprite sheet), is it better to

store just the coordinates for each sprite for each entity, and then draw only the corresponding part of the sprite sheet when the entity should draw itself, or
store actual parts of the sprite sheet in each entity and the draw each the cropped sprite?

Another thing I'd like to learn is how to handle sprites with different sizes. See Zelda, for example: Link's walking sprites are all about the same size, regardless of his position or orientation. But when he attacks, the sprites include his sword and depending on his orientation, some sprites are wider and some longer.

Is there a good way to position and align sprites with different sizes relative to a part of the character—their foot, for example? Should I store some sort of offset for each sprite along with the sprites?


texts: What does a Game Designer do? what skills do they need?

texts: I know someone who is thinking about getting into game design, and I wondered, what does the job game designer entail? what tools do you have to learn how to use? what unique skills do you need? what exactly is it you'd do from day to day. I may be wording this a bit wrong because I'm not sure if the college program is become a game designer or learn game design. but I think the same questions apply either way.


texts: How can I make my program get a username?

texts:
I am making a program that I want to load music from library/music on any computer.
To do this I use Music.FromUri().
However, I need the username from the current computer in order for the filepath to work.

Is there any way to get the username and use it in the filepath?


texts: Where should I go looking for low-polygon 3D assets?

texts:
The biggest problem for me as a game programmer (who isn't also an artist) is getting good quality 3D models. I have checked out some of the 3D model market places like The 3D Studio and Top 3D Models but I have had difficulty finding the artwork I am looking for and, when I do find something I like, getting the level of detail appropriate for my platform.

Do people have any suggestions for sites they have dealt with successfully in the past? Am I better off building a relationship with an individual artist?


texts:
I'm using Unity and I want to make a responsive GUI for portrait resolution only. Now I'd like to know if this is a good or bad idea when I force the user to play my game in portrait mode only. Shall I use autorotate? The problem is that when you use landscape mode my GUI looks really shitty.

I have some background images and I'd like to know if I should save them for the highest resolution available in mobile devices (like tablets)? Or shall I ditch the tablets and develop the GUI with the background images for mobile phones only? TIA


texts:
I'm trying to make an AI car controlled by a neural net.

I saw this two videos: Neural Network Demo and Q Learning and neural network in 2D car driving and I want to replicate that.

I already have the neural net code made, with a back propagation algorithm.

The thing is, I don't know how to reinforce the learning of the net. What kind of value should I use to calculate the error?

My car currently have 5 inputs (similar to the first video), and outputs 2 numbers, 1 which is plugged in the rotation torque of the car, if it's positive it will rotate clock-wise, if it's negative counter-clock-wise, and how much it will turn is based on it's magnitude, it ranges from -1~1, and I mapped it to a desired min-max rotation. The second output number is acceleration, it's from 0~1, but mapped to -10~100 (so it can reverse).


texts: Limiting number of user clicks to reduce micro: best method of implementation?

texts:
I'm making a client-server game where the user can select armies and move them from one place to another.

In a bid to reduce the advantage of "being able to click faster" I've decided to implement several anti-micro measures, one of which is to limit the number of clicks (or move orders) that the user may issue.

In order to discourage individual unit micro, group move orders and individual unit orders both count as one move order.

What's the best way to implement this? I've thought of 2 ways:

Have countdown-timers both on the client and server. The timers must be synchronized - perhaps by the server sending the countdown time to the client. If the client issues a move order before the countdown is finished, the order is ignored.
Have randomly generated "move tokens" issued from the server to the client every few seconds. In order for an order to be accepted it must come with a valid move token, and each "move token" is only valid for one mode order.

Which way of implementing it is better? Any other good ways?


texts: How would you design components for an entity like this?

texts:
This is not a question about how to implement a component based system. I have my own system implemented and working fairly well, just can't figure out a good way to split some entities to fit the componnet based paradigm.

The entity is fairly simple, it can walk,jump and fire. It can get into some states like "frozen" that avoids movement of the player. It has other restrictions like can't do double jump.

In my current system, I have an input manager that has a target entity that receives events mapped to actions with semantics. I mean, my entity doesn't know about 'D' key or 'Left mouse click', it knows about Up,Down, Button1, etc...

Now the problem, when the user presses for example SPACE, the  target entity  is notified with a Left action and all the components are notified, but how would for example the Movement Component know that the entity is in "Frozen State" and it shouldn't be applying movement to it?.

Would you throw all this properties into an entity properties component and let all the other components check for them? Would you split entity in such a granulated level that a component for every property would be created? In this case we could have a component that has the "can be frozen" property and when it receives the collision with an ice projectil (it would be receiving a collision message) it can set the main entity state (that I would place it into the brain component) to frozen.

Could you suggest how you handle this tasks? The question could be rewritten as, How would you execute actions from an input system taking into account the restrictions of the entity.

Thanks in advance.


texts:
I have a terrain in OpenGL, and two textures which I am combining using GLSL mix() function.
Here are the textures I am using.

Now I am able to combine and mix these two textures, but for some reason, when I render the textures on the terrain, the terrain becomes transparent.
I render the LHS texture first, and then I render the RHS texture with alpha channel, I don't understand why it is transparent.

Here is an interesting fact, in the screenshot, you can see the result of the terrain when rendered on Nvidia GPU, when I render the same thing on interl HD 3k, I get different result.
This result is how it is supposed to be, nothing is transparent in this following screenshot.

Here is my fragment shader code..

void main()
{
vec4 dryTex   = texture( u_dryTex, vs_texCoord *1 );
vec4 grassTex = texture( u_grassTex, vs_texCoord *1 );
vec4 texColor1= mix(dryTex, grassTex , grassTex.a);
out_fragColor = texColor1;
}


texts:
I'm trying to understand the mapping of texels to pixels, especially in the context of pixel shaders. I already found out the following:

When I define a standard quad with vertices at integer positions (texture coordinates ranging from 0 to 1), a pixel shader for the upper left pixel will be called with texture coordinates (0,0)
When I subtract 0.5 from the vertices' coordinates (as it's recommended when drawing sprites), the pixel shader for the upper left pixel will be called with texture coordinates (1/(2*quadWidth), 1/(2*quadHeight))

My question is about the behaviour of the tex2D function in HLSL:

I would have assumed that it just returns the color of the upper left pixel of the texture when called with texture coordinates of (0,0). But obviously this is not the case, since the second of the above-mentioned variants actually leads to the desired 1:1 mapping.

So is it correct that tex2D returns the original pixel values of a texture when given the following texture coordinates?


texts: Unity Mirror can't reflect another mirror across from it

texts:
I created a mirror in Unity using the FX/MirrorReflection and the script that comes with it.
http://wiki.unity3d.com/index.php/MirrorReflection4

One mirror at a time works perfectly fine, but as soon as I add another mirror in front of the other mirror it starts bugging out.

See image below for the result I'm getting.

Does anyone know how to fix this so that both mirrors can reflect off each other?


texts:
I know the A* algorithm but if I have a long range (firing) enemy 20 metres away in 2D-land and I want it be about 3 metres away from its target (aka the player).

Is there an algorithm for choosing an appropriate path and square?


texts: Libgdx: Check collisions in Stage among actors

texts:
My goal is to check collisions among the actors that are in the Stage.

My question is: is it necessary to maintain a list for each type of actor I have?

Doing that I get 3 problems, 2 bad design problems and 1 exception.

Design problems I don't like:

The Actors used by the player add bullets (another Actor) to the stage. I need to pass my Stage to these Actors as argument in order to add a bullet to the list of bullets, that is held by the Stage.
Each time I need to add an Actor to the Stage, I have to perform 2 add operations, one in the list and one directly to the Stage.
If I check collisions iterating over the lists and I find out that an enemy (another actor) is dead, I need to remove the enemy both from the stage and from the list, but I can't remove it from the list because I get "Concurrent modification exception".

Is there some common design technique to handle this stuff?


texts:
I'm using Tile-Based Deferred rendering and I have run into an issue with my lights flickering.

For a long time now I would just add all my lights at once and let the renderer do its thing eg. build a big light list while generating my world data and just upload the light list to the GPU and leave it there.

This wasn't an issue because I can render 1000's of lights and the render would just take it but because I'm not uploading them every frame the lights are static and that works well for world lights but now I want my projectiles\other things to have dynamic lights so I now upload the light list every frame after culling it with my octree\frustum of course and it works well apart from flickering as I pan the camera\frustum moves.

I update my mesh data the same way and meshes don't flicker so I'm kinda stumped, I have tried offsetting the frustum I use for culling so that my camera is about 25% inside the frustum rather than have the frustum start at the camera position and also widening the FOV.

If there is any code you need to see let me know.

Edits:

It happens to all the lights but I notice it much more as the light moves from in front of me to the sides of the screen, it seem like it would be the lights flickering off for a frame, I have been trying to debug it with the VS GFX tools but I only happens when the camera moves, as soon as I stop moving the lights are fine, I'm trying to cap a frame that shows the lights in the midst of a flicker so I can check for NAN's or Inf. I had a read of another answer for the same type of thing but his fix didn't do anything.

Last night I also tried changing the way I do my containment\intersection tests and still no change.

My directional light is fine no flickering there its just point lights\spot lights that flicker.

While writing this I had a brain storm, another thing I did over the weekend was offset my camera to a 3rd person view so maybe I'm passing my player object position to the renderer and not the actual offset camera position.


texts: What are some good game programming short courses?

texts:
I'm from Brazil, and I want to take a short course on game programming, 2 months at most, in a country that lectures are given in english. I'm almost a BSc in Computer Science alredy.

Can you tell me what you think about this courses?
What are some good courses in that format?


texts: Does Specular Power affect the Brightness?

texts:
I read the book Real-Time Rendering, 2nd Edition. Somewhere in there it say:

But I did the experiment and concluded that the mshi doesn't seem to affect to the brightness (it causes the area just to be narrower):

The experiment is base on http://www.rastertek.com/dx11tut10.html.
Am I missing something? I didn't find an errata for the book on its corrections Website, and my first-languages isn't English, so maybe my vocabulary understanding is wrong?

Does the Shininess means the Brightness? Or what else?


texts: How to setup different weapon colliders for multiple weapons in Unity2D?

texts:
I want to design a Metroidvania style game that uses different primary weapons, having very different hitboxes. I understand that many devs simply hardcode a collider in front of the character, but what would the most efficient way to organize multiple colliders (so that you would activate one whenever its corresponding weapon is swung)?

Also, is it possible that ray casting may be a better option for this function?


texts:
I've been working with a few game oriented gui libraries trying to find a good fit.  More specifically, a GUI that will work on Windows,Linux,iPhone, and Android with minimal special code.

In my tinkering I've noticed a few libraries like to render the their GUI's to an off screen texture that just display the texture instead.

Is this a common GUI technique?
Isn't there a performance hit with rapidly changing GUIs?

Were I the implementer I would have just rendered the GUI directly each frame.  Is there anything particularly wrong or inefficient direct rendering?

Update:
By 'game-centric GUI' I mean a GUI framework that doesn't own the window or the main loop.  There are other features I'd add but the main loop is the only critical one.  This usually involves various rendering backends, input injection, and an update method.


texts: Box2D strange collisions (jitter) on sharp edges

texts:
I'm currently developing 2D side scroll game with Libgdx + Box2D.
And I'm facing some problems with ChainShape (the ground) and PolygonShape (the cart body) collisions.
Please look at this video: http://www.youtube.com/watch?v=gljgMn8lYfs

As you see the PolygonShape jitters(?) when collides with ChainShape.
BUT it only happens on sharp edges!

What I've tried:

Increase/decrease velocityIterations/positionIterations. Didin't
help. Currently they are set to 10/8 (as shown in video).
Turn off CCD. Didin't help. Currently is turned on.
Set velocityThreshold to zero. Didin't help. Currently is default - 1f.
Set restitution/friction values to zero. Didin't help.

Any suggestions why it's happening and how can I fix/avoid it?


texts: What happens to OpenGL buffer data that isn't used?

texts:
I have a vertex struct that has 5 glm::vec3 but some of my objects only use 2 or 3 of those members. So I have two questions :

1.) What happens to the large buffer I create, even though I don't use all the data.

Struct Vertex {
          glm::vec3 pos, color, UV, normal, tangent
              };
std::vector<Vertex> vertices; // will store the vertex data
glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(Vertex), vertices.data(), GL_STATIC_DRAW);

That creates a buffer that is larger than needs to be. Is the additional buffer data not send?

2.) If I send empty data to the buffers, is it causing any performance issues?

glVertexPointer(2, 3 , GL_FLOAT, GL_FALSE, size of(Vertex), reinterpret_cast<GLvoid*>(Offsetof(Vertex, unusedData));

Thanks for the information!


texts: How can I make my score-based game addictive?

texts:
I need some ideas to make players interested in the game result.  Otherwise, the player plays again to get high score. My game is a calculation game that measures the speed of calculations that the user makes.

I added in the result:

The number of right answers
The number of wrong answers
Score of player
High score of all players -  "Mochi High score"

What shall I add to entice the player to play the game again?


texts: How can I create a precise touch in Unity

texts:
Is there a way so that I can touch an object precisely?

I have these aerial cars and there pretty tiny like 32 by 32 and it's hard to touch them using a raycast. I thought I'd spawn an object with a circle collider on it on the first touch and destroy it after the touch.


texts: Qt based C++ game structure : which class types to use here, and how to correctly structure the relationship between these objects

texts:
I am writing a C++ game using Qt. As this is the first time, I am trying to understand how the structure should be.

I have two objects derived from the type QGraphicsRectItem which appear as boxes on the screen, which will each represent a player. I want to make them move independently in response to key presses, with a different set of keys assigned to the motion of each object. These are added to a QGraphicsScene object, which is set by a QGraphicsView inherited object.

As only one of these can be focused at any given point of time, and thus respond to key press events, I have defined a function in a class which inherits from QGraphicsView (and is used as a view for viewing the scene) that receives all the key press events. Its constructor receives pointers to the two box objects, and sends the required information (by setting a variable) to the appropriate object through the pointer based on the key press.

I have a few questions regarding this:

Is QGraphicsRectItem (or QGraphicsItem) the correct class for creating such "objects"? I see that there is a QObject class, but I could not understand where it is meant to be used.
Sending pointers of the box objects to the constructor of the view during initialization doesn't seem right. What would be a more appropriate way to design this? The idea is that based on the key pressed, the corresponding box should respond. The problem is, how does this class access the object, unless it is declared inside it or passed as an argument?
Is there a better or more commonly used way to handle the requirement of different objects responding to different key presses, even if done simultaneously? I have seen suggestions for using Event filters, which would pass the event using postEvent. However, event filters send messages to objects of type QObject, which is not what I am currently using. Additionally, the question again arises - who would receive the key press events? How would it know about the existence of the box objects?

I have been reading about design patterns. Is there any particular pattern that would be suitable for this?

Thank you.


texts: High-performance update of a bitmap grid

texts:
I need to visualize a fast paced process in .NET in 2D. I am planning to use writeable bitmap 800x40px.
The idea is like this - there are objects which are represented by very basic colours and sizes anything from 1x1 to 4x4. each takes 4x4 "cell" - they all are fixed like a chess board.
The objects move between cells and change size. Most importantly they move independently, so I cant (I can but I would like to not) have a sort of refresh rate.. I need to animate each object state change - like say pixels pouring from cell to cell. the transition time should be around 500ms.
In this period of time the states can change multiple times so I should be able to abort outdated animation, move object "instantly" to new cell and start more recent object animation which could have taken over the "old" cell..
The accuracy should be in 1-2ms intervals.
The host application is WPF .NET Framework


texts:
How to represent the following situation best - agent (@) needs to get to the goal($). The path is blocked by a moat(~~~). A rake (or some other device, like waterwalking boots) is available that will make it possible to cross the obstacle.

.....~~~...   . ground
...=.~~~...   = rake
.....~~~.$.   ~ water
.@...~~~...   @ agent
.....~~~...   $ goal

How to properly pathfind from @ to $ provided there is no immediately available path? Should my path have not only cost but also prerequisites?

UPD: The problem is the goal is not accessible and rake is just one of many possible objects on the map. Question then is "how to make the agent understand that it needs the rake?"


texts: Problem with Unity APK Build : Default Activity (Android)

texts:
There was a project developed in Unity 4.5. I successfully updated it to Unity 2018.2.3f1 version without any error. Runs perfectly in Editor.
When I create an APK (internal). I just get this screen when I open it on a mobile.

But when I make a Windows/Mac Build, it runs perfectly.
I've also tried on another Editor (version 2017.3.x) and APK built from this is also good.
I've re-installed Unity, nothing... Also updated the SDK but still a problem.

Some other projects' APK is built successfully with the scenes and everything but they also have some strange problems.
Note: I cannot shift back to 2017.3.x.
Is it a problem the latest Editor? OR Is it a problem with my machine?
What possibly could that be?


texts: How to move objects in any direction by swiping with libgdx android game development

texts:
first of,  I'm new to android game development so I don't know all the classes and dictionaries within android and libgdx. I'm actually following a game development tutorial for the first time (kilobolt) but I already have some ideas for games I want to make after finishing the tutorial. So here's my question:

Let's say you have a box with a small ball in it. When you touch-hold the ball, you hold the ball "in your hand". Then you swipe across the screen with the ball in hand and "let go" (release touch), the ball rolls in the direction you swiped with the speed of your swipe, decreasing in speed according to a set friction.

Is it possible to implement such a function with libgdx? If yes, could you please explain how to make it?


texts: Android Loop : Draw Loop : How to pull off smooth FPS?

texts:
I am writing 2D side scrolling bullet hell-like game.
I am at a point where I struggle to pull off smooth fps.
I have separated loop that manages drawing.

However I want update the position of sprites from game logic(for bullets).
Since there are many bullets, waiting for new set of position significantly decreases the speed in which the drawing loop executes itself.

I thought about another approach like this:

I could upload and stack positions of bullets somewhere. So my drawing method can pull off only the previously completely uploaded data, but doing so it can free itself from worrying about waiting for updating since stacked data is already in there. however <- that approach seems counter intuitive.


texts: Communication pattern in Entity Component System

texts:
I'm putting together a ECS for my game with another two main components: an event bus for communication and a Lua interpreter to load scripts.

Now, the parent element is a framework/game object with references to all this three components. My question is, what is the best communication pattern: drill the interpreter and any other orchestration objects down to every system or centralize all those calls in a subscriptor for the eventbus, and make everything from there.

Example:

// Plan A

   public class CollisionEntitySystem extends EntityProcessingSystem {

   LuaEngine mEngine;

   EventBus mBus;

   MoreThings mThings;

   public CollisionEntitySystem(LuaEngine engine, EventBus bus, MoreThings things){
       mEngine = engine;
       mBus = bus;
       mThings = things;
   }

    @Override
    protected void process(Entity e) {
        //Something wonderful happened here
        mEngine.load("onCollision.lua", parameters);
    }
};

// Plan B

   public class CollisionEntitySystem extends EntityProcessingSystem {

   Bus mEventBus;

   public CollisionEntitySystem(Bus bus){
       mEventBus= bus;
   }

    @Override
    protected void process(Entity e) {
        //Something wonderful happened here
        mEventBus.post(EventScriptCall.create("OnCollision", paremeters))
    }
};

Given that the event bus post is synch the results are the same, so it all boils down to architectural differences: centralized logic and hundreds of event objects or disperse logic with less objects.


texts:
/UPDATE:
I took one of the suggested solutions and tried to implement them. I implemented a BaseGameWorld class that contains the basic tetris gameplay. Every game mode extends this base class. If any of the game modes differ from that classic gameplay they will simply override any methods needed or add new ones. My GameScreen class is now structured like this:

public class GameScreen  {
    private BaseGameWorld gWorld;
    private GameRenderer gRender;

    public GameScreen (int gameMode) {
         // PuzzleGameMode extends BaseGameWorld
         gWorld = new PuzzleGameMode();
         // Constructor of GameRenderer takes a BaseGameWorld object
         gRender = new GameRenderer(gWorld);
    }

    public void render() {
         // Update Game World
         gWorld.update();
         // Draw Game World
         gRender.draw();
    }
}

This is ofcourse not the complete code, but it should show everything important. The idea behind the GameWorld and the GameRenderer classes is to reduce any clutter in the GameScreen class and seperate the game world and the drawing of the game world in two seperate steps with the goal to improve maintainability. So far this approach works quite well.
The type gWorld get's initiated with depends on the gameMode input variable and is handled through a switch-case in the actual code. Just as an example I used the class PuzzleGameMode.

Now my problem is that any new things added in the PuzzleGameMode class can't be drawn inside the GameRenderer class, since the GameRenderer constructor takes a BaseGameWorld object. It can only draw things that are in the BaseGameWorld.

Is there a way to resolve this situation that doesn't involve making a seperate GameRenderer for every game mode? My hope was to only have different classes for each game mode but to have one universal GameRenderer class.

I am currently making a tetris clone to get back into game programming using libGDX. The game is currently seperated in different screens. MenuScreen (includes Options, Highscore, Credits etc.) and the GameScreen itself. The GameScreen also has one member (named GameWorld) that manages all the calculations and game states, aswell as another one (named GameRenderer) that does all the drawing.

This works fine for the moment, however I plan on adding multiple game modes. I could probably add them to the GameWorld class, but it is already very full and managing multiple game modes inside a single class would end up very confusing and not very nice to maintain later down the line.

I could make a different class for every game mode and just use one of them depending on the selected game mode. This would be a solution, however this seems like a waste since I would just copy most of the original code for some of the game modes.
Alternativly I could make a Superclass that all game modes inherit from, however I am not sure how well it would work since game modes can differ quite a bit from each other. One mode might change the fundamentals like collision or intoduce new mechanics that need to be implemented on a deeper level, while others only differ a bit from the classic tetris mode and use most of the already implemented stuff.

What would be a good way to implement different game modes?
If more information is needed or if I should specify something better, just tell me and I will add the missing information. :)


texts: How can I make an infinte terrain with object pooling in Unity?

texts:
I am currently making a 3D endless runner game in unity in C#. I now need to make the platform(3D Tiles) infinite but I don't know how. I already did some research but I don't find the right tutorial.

I already asked a similar question and I got the answer that I need to do it with object pooling but I don't find any good tutorial for object pooling. Does someone know how to make an infinite terrain with object pooling in unity?

Thanks

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

public class TerrainScript : MonoBehaviour
{
    public GameObject[] tilePrefabs;

    public Transform playerTransform;
    private float spawnZ = 4500.56f;
    private float tileLength = 2.0f;
    private int amtOfTilesOnScreen = 2;

    void Start()
    {
        for (int i = 0; i < amtOfTilesOnScreen; i++)
        {
            SpawnTile(0);
        }
    }

    void Update()
    {
        if (playerTransform.position.z > (spawnZ - amtOfTilesOnScreen * tileLength))
        {
            SpawnTile(0);
        }
    }

    private void SpawnTile(int prefabIndx = 0)
    {
        GameObject go;
        go = Instantiate(tilePrefabs[prefabIndx]) as GameObject;
        go.transform.SetParent(transform);
        go.transform.position = Vector3.forward * spawnZ;
        spawnZ += tileLength;
    }
}


texts:
When my game ends I want it to automatically restart from the beginning so that the whole scene repeats itself.
How do I do that in Unity 3D?

Please refer this link for clarification.


texts: How can you make custom direct3D11 calls in Unreal Engine 4?

texts:
I have some custom code that renders to Direct3D11 texture.  Is it possible to use this texture on an object in unreal 4?  Or alternatively, is it possible to draw custom geometry directly to the scene in unreal 4 using raw Direct3d?

So far, it seems like I need to make a custom instance of UPrimitiveComponent which creates and returns an FPrimitiveSceneProxy.  In the FPrimitiveSceneProxy::CreateRenderThreadResources I can call RHIGetNativeDevice and cast its return to ID3D11Device and use it to create Direct3D instances, however, I'm not sure where to put my per-frame draw calls.


texts:
So I'm very new to using OpenGL and LWJGL, although I am proficient in Java itself.
One of the first things I read in the documentation of the Display class was that it maps the origin to the bottom left as opposed to how most other programs map it to the top left.

I was ready to take this into account until I discovered that the OpenGL libraries in LWJGL still map everything to the top left. It would also appear that the two spaces (window coordinates and game/OpenGL space) do not correspond to each other. ie. if I set a quads position to 10 x 10 via a mouse click in the lower left corner of the screen, it will move to what looks more like (windowWidth - 100, windowHeight - 100) or (100,100) using a standard top left origin.

I am attempting to write a 2D game using quads to draw my sprites, and I was wondering if there was a way to get the screen and game space to correspond.

Any help would be greatly appreciated,
Thanks!
Peter

Just in case it helps, here's how I'm creating a window and initializing OpenGL
Display

Display.setResizable(true);
Display.setDisplayMode(new DisplayMode(WIDTH,HEIGHT));
Display.setVSyncEnabled(VSYNC);
Display.setFullscreen(FULLSCREEN);

Display.create();

OpenGL

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0,Display.getWidth(),Display.getHeight(),0,1,-1);

    glMatrixMode(GL_MODELVIEW);

    glClearColor(0,0,0,1);

    glDisable(GL_DEPTH_TEST);

    glEnable(GL_BLEND);
    glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);


texts: How do I create the visual effect of transitioning between night and day?

texts:
I am making an open-world project in Unity 4.5.5 and I want to create a visual effect of transitioning from day to night? The Legend of Zelda: Wind Waker HD has a great example of such a transition.

How can I achieve this? Can I use a script or do I need to create multiple scenes with different skyboxes to make this possible?


texts:
I can calculate the speed when there is no angle, but I can't calculate the speed when it is angle.

Physics paramaters:

Player Physics :
    radius : 15,
    bounce coefficient(coefficient of restitution) : 0.5,
    mass : 2
    damping : 0.96101

Ball Physics :
    radius : 8,
    bounce coefficient(coefficient of restitution) : 0.5,
    mass: 1,
    damping : 0.9902

Gif image(angled): haxball gif angled

Player speed on start: Vx: 5, Vy: 0

Ball speed on start: Vx: 0, Vy: 0

Player speed on collision: Vx: 3.4189778846153844, Vy: -0.9240480769230772

Ball speed on collision: Vx: 2.7721442307692317, Vy: 1.8480961538461544

The formula i use(this formula can calculate the speed when there is no angle):
Formula image: Formula image

V1 = (m1*u1*k1 + m2*u2*k2 + m2*C1*C2*(u2*k2 - u1*k1)) /(m1 + m2)
V2 = (m1*u1*k1 + m2*u2*k2 + m1*C1*C2*(u1*k1 - u2*k2)) /(m1 + m2)

C1 and C2 bounce coefficient of player and ball.

How can i do?


texts: Farseer physics engine: save world simulation and load at a later time

texts:
I have created a windows desktop game using monogame and the Farseer Physics engine (FPE 3.5).

In this game I would like to the user to be able to save the game and continue at a later time.

When I want to save the farseer World simulation, do I have to go looping through the bodies and store their data in XML (or similar) and then redo the regular creation again using this data (as I did when I first set up the simulation).. or can we actually serialize the simulation and restore it in some way?

Havent really found much when googling on the subject.. but I'm sure someone has had to have done this before?


texts: How do one NPC follow a succession of target points?

texts:
I have a project that contains 1 NPC (AI) and 2 target points. In the project I can make the NPC follow any of the 2 target points, but I can not get it to follow target point 1 and then target point 2, and that is what I would like to do, so that I can make a path.

What I would like to know:

tp1 = target point 1 and tp2 = target point 2

What I can do:

In creating the variable that sets the target, I checked the box: instance editable. As you can see in the image, I can set the target in the level editor.

Blueprint of the NPC:

When I went to do the programming for him to follow the other target point (tp2) after reaching the first one (tp1), I did not get it in any way. No results appear with my search, which for me does not make any sense, because in the level editor I can easily.

Looking at the level editor / Looking at the blueprint:

I also tried using the Get All Actor of Class, but without success.

Link from where I also looked for help:

https://docs.unrealengine.com/en-us/Gameplay/HowTo/FindingActors/Blueprints

EDIT 1 (Attempt based on ColdSteel's answer)

I created a variable of type array of actor called varHelp:

As you can see, I added 2 elements to this array, but I can not edit any of the 2.

I researched a way to change this, until I got to this link:

https://answers.unrealengine.com/questions/813065/editing-this-value-in-a-class-default-object-not-a.html?sort=oldest

Unfortunately it caused an error in the code, causing me to give up for now and look for another way to solve my main problem.

Although I created 2 elements in the array, none of the elements appears in the level editor:

But I can create new elements and define them as the desired target points:

However at the time of defining them in the construction script I again error in some detail:

EDIT 2 (Another attempt, based on Stephen's answer)

With the help of Stephen I discovered how to promote a variable (right click button):

New blueprint:

But I still have not got the expected result, see below an explanation of what happens:

Red code (Simple Move) => The NPC moves toward target point 2, without first passing target point 1.

Blue code (AI MoveTo) => Nothing happens.

EDIT 3 (Attempt made thanks to the progress I made with the answers of ColdSteel and Stephen)

This time I managed to get the NPC to do the correct path, but it is not dynamic since the NPC does not go directly from target point 1 to target point 2.

New blueprint:

I know the loop executes all at once, so the value registered in the function to move the NPC was always the last.

With the creation of two Boolean variables, I was able to "circumvent the operation of the loop".

With the delay I assure you that it will allow NPC time to arrive at target point 1, only to go to target point 2.

I know that what I did is far from ideal, to have an idea I would have much more problems if there were more target points.

EDIT 4

Now I can get the NPC to go to target point 2 immediately after reaching target point 1.

I added a collision box to target point 1:

Changes in the blueprint:

Important to inform, that such a loop was not accused as infinite, since I added a collision box only to target point 1.

Now I have to know how to make a code for any amount of target points.

EDIT 5 (Finally I did it!)

For this I used the "Do N" and added an integer variable that will serve as counter.

Blueprint:

Basically, every time the NPC collides with a target point that has collision box, the loop with the "Do N" will be reset, but with the help of the integer variable that serves as a counter, the subsequent target point will be set correctly.

I do not know if this form I found is the most effective and functional. Please feel free to comment and correct me.


texts:
I'm new to Unity and C# (though I'm experienced in python) and I am trying to make a pong clone, I've spent ages googling and trying to fix this issue but for some reason my OnCollisionEnter2D won't work

My paddle hit method:

public void PaddleHit(Collision2D col)
{

    float y = WhereBallHitPaddle(transform.position,
        col.transform.position,
        col.collider.bounds.size.y);

    Vector2 dir = new Vector2();

    //determing direction to left or right depending on the paddle

    if (col.gameObject.name == "Player1")
    {
        dir = new Vector2(1, y).normalized;
    }
    if (col.gameObject.name == "Player2")
    {
        dir = new Vector2(-1, y).normalized;
    }

    rb.velocity = dir * speed;

    //play ball paddle collision sound
    SoundManager.Instance.PlayOneShot
        (SoundManager.Instance.ballpaddle);

}

When I run the game the ball moves, then when it comes into contact with a paddle it just stops moving, and if it comes into contact with a wall it bounces off, but at no point does it trigger the OnCollisionEnter2D. (I think my codes indents aren't showing properly here but it is all indented correctly, there are no compile errors or anything).


texts: Is object-oriented underestimated for game development?

texts:
I'd like to understand whether the object-oriented paradigm applied to game programming is bad, or whether it's just an urban legend.

A friend of mine is developing a game with HTML5 and Javascript using data-oriented paradigm, and he's trying to convince me about the issues of the object-oriented design.

His best example is this:

"If you have a Tree (a static object in the game) and a Warrior (an object which can perform some action, like movements, attacks..) and suddenly you decide to put in your game a Warrior Tree, how do you do it by object-oriented?"

He is right or he is underestimating the "power" of the object-oriented paradigm?


texts: FPS controller initializing at bizarre location

texts:
I have got the hang of basic construction, terrain modification, applying materials, placing trees, etc.  I have created a water plane, positioned my terrain above it, and am able to sink lakes and pools, and raise hills and mountains.  Built a couple of primitive structures too.

Initially (before mucking about with the Y position of the terrain) I was also able to invoke Gameplay mode and walk around my game using FPS Character Controller.  I could walk into and out of my structures and hike over the hills and valleys of my terrain.

However, since changing the Terrain Heightmap to make the "sinkhole" (negative altitudes) work, I am having the strangest trouble with my FPS Character Controller.  I position it at a reasonable height above the terrain, and everything looks fine in Editor mode;  but when I start Play mode my FPS character starts out miles below the world, looking up at the underside of the terrain.

So far nothing I have tried will make the FPS Controller start in the location where I have dragged it in Editor mode.  I have tried Saving Scene and exiting and reloading.  I have deleted and recreated the FPS controller.  No matter what I do, it persists in initializing itself in this oddball "way below the world in outer space" location.

I have googled diligently but have not found any mention of this problem.  Presumably I'm skipping some important step, but tutorial videos don't offer any advice beyond "drag the fps controller into the scene and it should work."


texts: Using C# summary documentation as tooltip in Unity

texts:
In unity, I often end up with duplicating the  tags for code documentation, and the [tooltip] tags for the Unity Inspector.

Is there a way to automatically extract  tags into Unity [tooltip]s, or vice versa?

    /// <summary>
    /// This field sets the whirlygigs speed.
    /// </summary>
    [Tooltip("This field sets the whirlygigs speed.")]
    public float value;


texts: How to read monogame log files on android device

texts:
I am working on a monogame android project where I want to log some data. First try was something like this:

Log.Info(tag, message);

This works great when debugging in Visual Studio via the Android Device Logging-Window. But when I run the app on my mobile android device I have no idea how to view the log entries. As far as I know the logging happens in the so called CatLog, which can be viewed with some Apps. But unfortunately these apps need root access, which I think cannot be given to them on a "normal" android device.

Is there any way to either view the Logfile on my Android device or is there a better way of adding logging to my project?

Thanks in advance
Nick


texts: How can I create background images in OpenSceneGraph?

texts:
I'm trying my hand at using OpenSceneGraph for graphics in my game. I'm having a hard time trying to figure out how to get a background image up. The relevant piece of code that I have can be found in this gist. Does anyone here have an idea of what I'm doing wrong/missing?

BTW:

I know that the image is getting loaded because the logs says so
The log says that it managed to add the camera as slave to the viewer


texts:
I've made a script that should have an x and a y axis, it goes up and down but not left or right; what am I doing wrong?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Mouselook : MonoBehaviour
{

    public float mouseSensititvity = 100f;

    public Transform playerBody;

    float xRotation = 0f;

    // Start is called before the first frame update
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
    }

    // Update is called once per frame
    void Update()
    {
        float mouseX = Input.GetAxis("Mouse X") * mouseSensititvity * Time.deltaTime;
        float mouseY = Input.GetAxis("Mouse Y") * mouseSensititvity * Time.deltaTime;

        xRotation = mouseX

        xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -90f, 90f);

        transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
        playerBody.Rotate(Vector3.up * mouseY);

        playerBody.Rotate(Vector3.up * mouseX);
    }

}


texts:
Microsoft seems to recommend using WM_INPUT for input. I want to only get relative mouse input and hide the mouse cursor all together for a short while (For gesture based input). However, using RIDEV_CAPTUREMOUSE|RIDEV_NOLEGACY while registering the input device only prevents the mouse clicks to other windows, but the mouse cursor is still visible and not constrained to my window. How can I hide it and make it reappear exactly where I left off when my input capture began after the short while?

I know this has been asked before in the context of FPS controls, but it always seemed to be in a different context, mostly with APIs that already implement a mouse grab like this.

It was also mentioned that you could hide the cursor and reset it to its window's center after every move. However, AFAIR, DirectInput let you grab the mouse cursor exclusively. So since that was deprecated in favor of WM_INPUT, is the "old way" without DX the way to go again, or is there something new that works well with WM_INPUT?

Thank you!


texts:
I want to draw an animation, the size of each frame is 500x500px but when I try to resize, the animation seems to rotate...

Here the code to load frames and create animation:

    Texture fireSheet = new Texture(Gdx.files.internal("fire_sheet.png"));

    TextureRegion[] fireFrames = new TextureRegion[4];

    fireFrames[0] = new TextureRegion(fireSheet,0,0,500,500);
    fireFrames[1] = new TextureRegion(fireSheet,700,0,1200,500);
    fireFrames[2] = new TextureRegion(fireSheet,1450,0,1950,500);
    fireFrames[3] = new TextureRegion(fireSheet,2250,0,2750,500);

    fireAnimation = new Animation(0.5f, fireFrames);

In draw method I resize the animation in this way:

    public void draw(Batch batch, float parentAlpha) {

        batch.enableBlending();
        stateTime += Gdx.graphics.getDeltaTime();

        currentFrame = Assets.fireAnimation.getKeyFrame(stateTime, true);

        batch.draw(currentFrame, getX(), getY(), 200, 200 );

    }

So if I use:

batch.draw(currentFrame, getX(), getY() ); // WORKS!!! But too Big for me 500x500px

Instead if I use:

batch.draw(currentFrame, getX(), getY(), 200, 200 ); // Animation doesn't work properly

What Can I do?

Thank you in advance


texts: Does Unreal Engine Has Good grapic texture editor or I have to Learn Maya?

texts:
I'm new in game Development , and I had no experience of it (except programming)
So , for my Engine , I preferred to use Unreal Engine. So here's the question:
Are Maya or 3D'sMax needed to be learned or Unreal Engine has a built in Editor ?
and , in comment , After i learned graphic , witch programming Language Does Unreal Engine support and recommended ?


texts:
I'm developing an application that uses the GPU. Some tasks might be rather long (like a fragment shader with a loop). I have the impression that I can make the entire OS visually freeze by asking the GPU to perform a job that doesn't end. Of course, I'm not doing this on purpose, but when that accidentally happens, I have to force power off my machine and this is very difficult to debug.

Some questions:

Is this behaviour normal? Or could this be a bug in the hardware or driver?
Is there a technique to recover from this without force stopping my machine?
Since the OS is still functioning (only not rendering), I could try to ssh into my machine and kill the process. Would that free the GPU from its job? Update: I tried to ssh into my machine and sudo kill -9 *pid*, but didn't work.

I would like to know if there is an OS independent answer for this. If there isn't, my setup is macOS, with OpenGL (running on Intel HD Graphics 3000).


texts:
In a space game I'm writing in C++11, I have a class Spaceship. Now I want to create 3 more spaceship types, how should I do?

Attack type: have a weapon
Research type: have a sensor
Religious type: have both a weapon and a sensor.

I think I'll write three classes AttackSpaceship, ResearchSpaceship, ReligiousSpaceship, which all inherits from Spaceship, but I think there is another, better solution for this case.


texts:
Possible Duplicate:
  Why are textures always square powers of two? What if they aren’t?

I am using C# and XNA (also MonoGame for other platforms than Windows) to create a game in 2D. Ususally for all textures I use the NVidia plugin for Photoshop to create DDS files with precomputed mip-maps (either full color, or DXT-5).

How important is it, nowadays, to stick to textures with extensions that are a power of two? What are the advantages and disadvantages of doing so?

The background of my question for that I use a number of quite large background images in with 1980 x 1080 pixels in size and storing them in textures of 2048 x 2048 pixels size seems like a tremendous waste of memory.

Let me stress that I am aware that having only power-of-two textures has been important in the past for certain specific optimizations BUT I would like to know whether this TODAY (GPUs of the last ~2 years, current consoles etc.) is still required?


texts:
As part of my master thesis I have to do an softbody simulation.

I 'm using Bullet Physics engine.

I'm trying to render softbody, create from Meshes, with Shaders in OpenGL but the object doesnt seem to be rendered (it doesnt appear in the window).

I'm not sure if the problem is because of the way I created the sobtbody or the way I render it.
Thank you in advance.

I'm using this function for creating a softBody from my OBJ Liver model :

        btScalar* verti = new btScalar[3 * (Liver.getMeshes()[0].vertices.size())];
        for (int i = 0; i < Liver.getMeshes()[0].vertices.size(); i++)
        {
            verti[3 * i] = Liver.getMeshes()[0].vertices[i].Position.x;
            verti[3 * i + 1] = Liver.getMeshes()[0].vertices[i].Position.y;
            verti[3 * i + 2] = Liver.getMeshes()[0].vertices[i].Position.z;
        }

        int* indi = new int[Liver.getMeshes()[0].indices.size()];
        for (int i = 0; i < Liver.getMeshes()[0].indices.size(); i++)
        {
            indi[i] = Liver.getMeshes()[0].indices[i];
        }

        btSoftBody* LiverSBody = btSoftBodyHelpers::CreateFromTriMesh(softBodyWorldInfo, verti,
            &indi[0],
            int(Liver.getMeshes()[0].indices.size()) / 3);

        LiverSBody->m_cfg.kVC = 0.5;
        btSoftBody::Material* pSpMat = LiverSBody->appendMaterial();
        //LiverSBody->m_materials[0]->m_kLST = 0.5;
        pSpMat->m_kLST = 1.0;
        LiverSBody->setPose(false, true);

        btTransform trans;
        trans.setIdentity();
        trans.setOrigin(btVector3(0,0,0));
        LiverSBody->transform(trans);

        LiverSBody->generateBendingConstraints(2, pSpMat);
        LiverSBody->m_cfg.piterations = 2;
        LiverSBody->m_cfg.kDF = 1.0;
        LiverSBody->m_cfg.kSRHR_CL = 1;
        LiverSBody->m_cfg.kSR_SPLT_CL = 0;

        LiverSBody->setTotalMass(10, true);
        LiverSBody->scale(btVector3(0.02, 0.02, 0.02));
        LiverSBody->getCollisionShape()->setMargin(0.1);

        float Friction = 0.9;
        float Restitution = 0.5;

        LiverSBody->setFriction(Friction);
        LiverSBody->setRestitution(Restitution);

        m_pSoftBodyWorld->addSoftBody(LiverSBody);

I'm using this class for loading and visualizing model https://learnopengl.com/code_viewer_gh.php?code=includes/learnopengl/model.h
I need to extract from the softBody some data (Position, normal, texCoords, tangent and bitangent) to fill the vertex buffer objects but i don't know where to find most of it... I know that the position and the normals are in the softbody nodes but i can't find the other information needed (texCoords, ..).

//btSoftbody.h
struct Node : Feature
    {
        btVector3 m_x;       // Position
        btVector3 m_q;       // Previous step position
        btVector3 m_v;       // Velocity
        btVector3 m_f;       // Force accumulator
        btVector3 m_n;       // Normal
        btScalar m_im;       // 1/mass
        btScalar m_area;     // Area
        btDbvtNode* m_leaf;  // Leaf data
        int m_battach : 1;   // Attached
    };


texts: How can I emulate point sprites in D3D11?

texts:
I have points which I pass to a vertex shader and then to a geometry shader, but now I want to get from the geometry shader a "bigger" point. So the point should get a "dadius" like it was possible in Direct3D 9.

Can anyone help me what I have to write in my geometry shader? I actually have the following code, which only passes the point to the pixel shader.

void LightGeometryShader( point GeometryInputType input[1], inout PointStream<GeometryInputType> TriStream)
{
    GeometryInputType output;

    for( int i=0; i<1; i++ )
    {
        output.position = input[i].position;
        output.color = input[i].color;
        output.tex = input[i].tex;
        output.viewDirection = input[i].viewDirection;
        TriStream.Append( output );
    }
}


texts: Gamemaker - Change the fired bullets' direction using objects as guide

texts:
So I am trying to create a shooting-ship-puzzle game at sea on gamemaker. There is a playership that must shoot the enemy ships using only the available "whirlpools". There are many whirlpools in the sea, but there is only one path consisting of whirlpools that will lead the bullets to the enemy ships and destroy them. There are different types of whirlpools, one that can direct the bullets using 90 degrees angle, U-turn whirlpool, etc. But my problem is how to change the direction of the fired bullets using those whirlpools. So can you guys maybe help me out with this problem...?

Thanks,


texts: How do I access variables using namespaces?

texts:
I've got a whole lot of scripts, none of them so far use namespaces. But as I get more and more scripts to deal with I thought it would be a wise idea to start using namespaces. I've never used them before so I'm having a little bit of difficulty. I've declared the namespace in one of my scripts:

using UnityEngine;
using System.Collections;

namespace Train.OnBoardChecker {
    public class OnBoardChecker : MonoBehaviour {
        [SerializeField]private bool isOnBoard;

        public void OnTriggerEnter (Collider col) {
            if(col.gameObject.tag == "Character"){
                isOnBoard = true;
            }
        }

        public void OnTriggerExit (Collider col) {
            if(col.gameObject.tag == "Character"){
                isOnBoard = false;
            }
        }
    }
}

And in my main train script, I've tried to access the 'isOnBoard' bool from the OnBoardChecker script. I was told there were a few ways of doing this, this is what I did:

using UnityEngine;
using System.Collections;
using Train.OnBoardChecker;

namespace Train {
    public class TrainSystems : MonoBehaviour {

        void Start () {

        }

        void Update () {

        }
    }
}

I'm not sure if I'm misunderstanding the whole namespace thing, but I can't access my variables from that script. I've making the variable public, and private (with serialzefield). I've tried these, with the public and private variables, and I even tried making the voids public and not public:

(namespace onboard checker) > OnBoardChecker.OnBoardChecker.insertvariablenamehere
OnBoardChecker.varname

What am I doing wrong, how do I access my variables from the OnBoardChecker script in the TrainSystems script with the namespaces without having to make it public, kind of like the standard assets does.


texts: Do online colleges give you the same experience needed for programming or is it better to go on campus?

texts: I don't know whether I should go online for my game programming degree or to be on campus.  The closest college that offers game programming degree is in a different state 6 hours away.  Any advice?


texts: Render on other render targets starting from one already rendered on

texts:
I have to perform a double pass convolution on a texture that is actually the color attachment of another render target, and store it in the color attachment of ANOTHER render target.  This must be done multiple time, but using the same texture as starting point

What I do now is (a bit abstracted, but what I have abstract is guaranteed to work singularly)

renderOnRT(firstTarget); // This is working.

for each other RT currRT{
    glBindFramebuffer(GL_FRAMEBUFFER, currRT.frameBufferID);
    programX.use();
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, firstTarget.colorAttachmentID);
    programX.setUniform1i("colourTexture",0);
    glActiveTexture(GL_TEXTURE1);
    glBindTexture(GL_TEXTURE_2D, firstTarget.depthAttachmentID);
    programX.setUniform1i("depthTexture",1);
    glBindBuffer(GL_ARRAY_BUFFER, quadBuffID); // quadBuffID is a VBO for a screen aligned quad. It is fine.
    programX.vertexAttribPointer(POSITION_ATTRIBUTE, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
    glDrawArrays(GL_QUADS,0,4);

    programY.use();
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, currRT.colorAttachmentID); // The second pass is done on the previous pass
    programY.setUniform1i("colourTexture",0);
    glActiveTexture(GL_TEXTURE1);
    glBindTexture(GL_TEXTURE_2D, currRT.depthAttachmentID);
    programY.setUniform1i("depthTexture",1);
    glBindBuffer(GL_ARRAY_BUFFER, quadBuffID);
    programY.vertexAttribPointer(POSITION_ATTRIBUTE, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
    glDrawArrays(GL_QUADS, 0, 4);
}

The problem is that I end up with black textures and not the wanted result.

The GLSL programs program(X,Y) works fine, already tested on single targets.

Is there something stupid I am missing?

Even an hint is much appreciated, thanks!


texts: How to seamlessly handle multiple procedural 2D levels in Unity3D?

texts:
I have a dungeon generating algorithm, but I would like to generate X levels, which are all connected somehow.

I have a few approaches, but all of them has problems and questions, and I wonder how i.e. Diablo II handles them so seamlessly.

1. Approach: Upon leaving a level, generate the next one on the fly.

This would be the easiest, but would result in a relatively long loading screen everytime the player enters a new level.
So generating the levels should be at the beginning of a new game, thus the next level will just have to be loaded, which is much faster. In theory not even a loading screen is necessary.

2. Approach: Generate every level at the beginning of a new game and store them.

Okay, now levels just have to be loaded, which could be done under half a second. No loading screen is necessary, maybe just a fade out-fade in.
How do I store them?

Make custom files (i.e. scriptable objects) for them, or is there a simpler way?

3. Approach: Generate and load every level at the beginning.

Zero loading time, because everything is already generated and loaded into the tilemap.
But how do I guarantee that levels don't collide, and the player can't see level Y from level X if there are lots of levels?
And wouldn't it affect the performance? Because everything is loaded all the time. Yes, renderers, rigidbodies, scripts, etc can be turned off, improving the performance a lot... but still... this seems wrong.

What is the best way to solve this problem?


texts:
I'm trying to do alpha blending manually because I only want to apply alpha blending on certain pixels. Underlying is the texture I'm writing to. This is what I got so far, but it doesn't give the same result as when AlphaBlendEnable = TRUE

What formula does default alpha blend in HLSL use?

matrix WorldViewProjection;

texture2D OverlyingShadingMap;
sampler2D OverlyingShadingMapSampler = sampler_state
{
    texture = <OverlyingShadingMap>;
};

texture2D UnderlyingShadingMap;
sampler2D UnderlyingShadingMapSampler = sampler_state
{
    texture = <UnderlyingShadingMap>;
};

struct VertexShaderOutput
{
    float4 Position : SV_POSITION;
    float4 Color : COLOR0;
    float2 TextureCoordinates : TEXCOORD0;
};

VertexShaderOutput SpriteVertexShader(float4 position : POSITION0, float4 color : COLOR0, float2 texCoord : TEXCOORD0)
{
    VertexShaderOutput output;
    output.Position = mul(position, WorldViewProjection);
    output.Color = color;
    output.TextureCoordinates = texCoord;
    return output;
}

float4 SpritePixelShader(VertexShaderOutput input) : COLOR
{
    float4 overlying = tex2D(OverlyingShadingMapSampler, input.TextureCoordinates);
    clip(overlying.a - 0.001);
    float4 underlying = tex2D(UnderlyingShadingMapSampler, input.TextureCoordinates);
    // Alphablending
    float3 rgb = overlying.rgb * overlying.a + (1 - overlying.a) * underlying.a * underlying.rgb;
    float alpha = underlying.a + (1 - underlying.a) * overlying.a;
    return float4(rgb, alpha);
}

technique SpriteDrawing
{
    pass P0
    {
        AlphaBlendEnable = FALSE;
        VertexShader = compile vs_2_0 SpriteVertexShader();
        PixelShader = compile ps_2_0 SpritePixelShader();
    }
};


texts: In Android, neat way to send input info from `GLSurfaceView` to `onDrawFrame` in `GLSurfaceView.Renderer`?

texts:
The input is pinch/drag for camera movement, which modifies a matrix to scale/translate, and sent to a vertex shader. It's working, but ugly.

What's the proper way to do it?

I've noticed:

GLSurfaceView gets onTouch callbacks; but Renderer has access to GL.
Shaders and textures can only be loaded after the onSurfaceCreated() callback, so should be loaded there?
Touch and graphics are on different threads, so should  use queueEvent() or similar.

Is there a game/app on github that's a good example to follow?
Thanks for any help!


texts: Vulkan: Unable to render using multiple view ports

texts:
I have been trying to enable multiple viewports in my Vulkan Pipeline but have been unsucsessfull. I used this code sample as a reference point. The problem is that when I attempt to draw two side by side (splitscreen) views of a scene I am unsuccessful.

Pipeline Initialisation

// Viewport state
VkPipelineViewportStateCreateInfo viewport_state = initializers::PipelineViewportStateCreateInfo(CameraComponent::GetCameraCount(), CameraComponent::GetCameraCount());

// Dynamic shader stages
std::vector<VkDynamicState> dynamic_states = {
    VK_DYNAMIC_STATE_VIEWPORT,
    VK_DYNAMIC_STATE_SCISSOR,
    VK_DYNAMIC_STATE_LINE_WIDTH,
};
VkPipelineDynamicStateCreateInfo dynamic_states_info = initializers::PipelineDynamicStateCreateInfo(dynamic_states);

(Using the debuger shows that CameraComponent::GetCameraCount() is 2)

Command Buffer

vkCmdSetViewport(cmd, 0, CameraComponent::GetCameraCount(), CameraComponent::GetViewports());
vkCmdSetScissor(cmd, 0, CameraComponent::GetCameraCount(), CameraComponent::GetScissors());

(Here CameraComponent::GetCameraCount() is 2 aswell as the viewport and scissor methods returning valid data)

When Using Nvidia NSight we can see that both Scissors and Viewports are detected

As well as there position data existing within the gpu

But when it comes to the result, all that is visible is half of the screen.

When I flip the cameras around within the code, the second half is rendered instead showing that the first camera is being rendered but not the second one.


texts: Can my game be 8-bit even though it has hi-res text?

texts:
My game has 8-bit sounds, 8-bit graphics, 8-bit everything. Except one thing: the level selection screen. It has small text and therefore must be hi-res to be readable. What should I do?
Edit: The arrows on either side of 'select level' are for going to multiple level screens when there is more levels to be shown. A great answer has been given, but more are welcome.


texts:
I'm trying to implement my camera class for a simulation. But I cant figure out how to zoom into my world based on the mouse position. I mean the object under the mouse cursor should remain at the same screen position. My zooming looks like this:

VOID ZoomIn(D3DXMATRIX& WorldMatrix, FLOAT const& MouseX, FLOAT const& MouseY) {
    this->Position.z = this->Position.z * 0.9f;
    D3DXMatrixLookAtLH(&this->ViewMatrix, &this->Position, &this->Target, &this->UpDirection);
}

I passed the world matrix to the function because I had the idea to move my drawing origin according to the mouse position. But I cant find out how to calculate the offset in to move my drawing origin. Anyone got an idea how to calculate this?

Thanks in advance.


texts:
The short version, is that I was asked to look into the feasibility of making a melee weapon, that one could swing at another object in the game, and have it interact physically. I completed the tutorial here http://www.mavrikgames.com/tutorials/melee-weapons, and proved that indeed it is.

The thing is, that only for a brief period in the swing is the sword capable of knocking things around. I've looked through the editor and code for awhile now, and I'm still not sure how to do this.

I was able to lengthen the amount of time it takes the animations run for, but not the length of time with which the sword can bash the barrel around.


texts: Calculating angle to aim at target results in over/under aim depending on whether target is below/above

texts:
I'm calculating the angle (in radians, ranges -3.141 to 3.141 for yaw and -1.343 to 1.396 for pitch) to aim at in order to aim at a target position. The data I have is my local world camera position, and the world target position. The result should be the angle that needs to be set in order to aim precisely at the target.

This is a fairly simple calculation (even though I'm terrible at math) and it works without issue.. but it has a quirk when I'm in third person.

When I'm in first person, the "local world camera position" is effectively my player's eye position. When I'm in third person the "local world camera position" is effectively offset backwards and above from my player's eye position.

The quirk (actually a pretty big flaw right now) is that when the target position is elevated higher than my local world camera position, the result of my calculation results in an angle that over-shoots/over-aims the target. Inversely, when the target position is elevated lower than my local world camera position, the result of my calculation results in an angle that under-shoots/under-aims the target.

I've drawn this very bad sketch to try and explain my issue, for clarity my drawing is 2D and drawn from the side, but my application is 3D: http://i.imgur.com/qXvDnUZ.png

And to clear something up, the further my angle is pitched downwards, the closer my camera position will be to the top of my local player and the further my angle is pitched upwards, the closer my camera will be to the bottom of my local player. If you imagine playing a third person game you should understand what I mean.

Here's the calculation I'm doing:

Vector3 vForwardVector = vTargetPosition - vCameraPosition;
Vector2 vCalculatedAngle = Vector2(atan2(vForwardVector.x, vForwardVector.z), atan2(vForwardVector.y, sqrt(vForwardVector.x * vForwardVector.x + vForwardVector.z * vForwardVector.z)));

I'm not sure what other detail I can provide.. hoping someone can point out an obvious mistake? Happy to provide any extra information!

Thank you everyone.


texts: lookAt with orthographic camera (gl-matrix)

texts:
Technically this is a webgl question though I think it's generic enough to get some opengl, erm, perspective on it too...

If I setup an orthographic camera (perspective matrix) like this:

mat4.ortho(output, 0, screenWidth, 0, screenHeight, 0, 1)

And compose it with an identity matrix as the view, and then compose my model matrix with that - everything is fine and I see the items at the correct size on the screen. However, if instead of using an identity matrix as the view I use lookAt via:

mat4.lookAt(output, [0,0,0], [0,0,1], [0,1,0])

I do not see anything. I've tried some other variations like moving the eye parameter from [0,0,0] to [0,0,-1] and increasing the far value of ortho() but nothing worked.

What exactly is the relationship between lookAt and ortho - are they compatible for perspectivexview, if so what settings can I use for lookAt such that it works correctly here?


texts:
I am currently making a 2d tower defense game with a static, predetermined lane that the enemies follow (i.e. towers cannot block the path and path finding is not the problem I am trying to solve).

I am trying to figure how exactly to make units follow this lane in a smooth way. I have two rough ideas about how to do this, but I would love some input on which is likely to be easier to implement/the more standard technique. Or of course if I there is some totally different way that I haven't considered I would love to learn about that as well.

Waypoints:
My first idea was to define the path as a series of hard coded waypoints. Units would then use a basic "seek" steering algorithm (such as this one) to move to each waypoint along the path in succession. However, I have wondered if it might be hard to keep the units from deviating to much from the lane I want them to follow. I wonder if inability to turn sharply enough might cause them to sort of "glide" out off of the desired lane. I suppose I might be able to prevent that though by allowing for a relatively strong steering force to be applied?

Bezier Curves:
The second solution I have considered is to define the path with a bezier curve and at each time step calculate the point along the curve with is (dt * speed) away from the unit's current location. I suspect that this technique would make it much easier to precisely define the path that units will follow, but I don't know know how exactly to go about implementing this. Any suggestions?

Also, I don't this will change anyone's answers, but units also must be able to travel at a constant speed along the path. Additionally, I am programming this game in python using the pyglet framework.

If anything about the question is unclear please let me know.

Edit:
Also for whatever its worth, I'm sort of trying to replicate the movement behavior of enemies in the Kingdom Rush.


texts: Game loops using Hard realtime systems vs Soft realtime systems

texts:
I have read the article here about realtime systems and am looking for examples specific to game loops.

Am I correct in saying:

Hard realtime systems will lag and slow down gameplay causing slow motion if processing of AI, collision detection, or user input is delayed past the rendering deadline set by the realtime system. Example, must render every 1/30 sec but processing caused delay to 1/20 sec.

Soft realtime systems will render at 30 FPS regardless of the other subsystems processing but if there is a delay in AI, collision detection, or user inputs, the game will be presented in stop motion instead of slow motion every 1/30 sec.


texts: How to manage this problem in a multiplayer client-server game with Photon ?

texts:
Good day.

I'm developing my first simple game, a racing car, using Unity and Photon.
In my game there are a function that generate random Bonus on random position each (for instance) 5 seconds.

The problem is that if I use RPC, each Peer connected generate a bonus each 5 seconds and send that bonus on other client connected . Results: if i have 5 clients, each clients generate 1 bonus each 5 seconds resulting in 25 bonus each 5 seconds.

So, i would like that ONLY the server generate bonus and send this bonus to each clients.

In short: i don't know how to 'tell' unity and photon "If i am the server run this function, otherwise not"

if (i am server )
   generate bonus
   instantieBonus on clients
}

Thanks


texts: Computing the UV coordinates of a 3D point that lies within a 3D triangle

texts:
From a triangular mesh I have a 3D triangle T represented by 3D vertexes v0, v1 and v2. Each vertex has an associated UV coordinate into a common texture image, represented as uv0, uv1, uv2.

Furthermore there is 3D point P, that is guaranteed to be within the triangle T (coplanar to and within boundary of T).

My question is given point P, and triangle T, how does one go about calculating the UV coordinates of P?


texts: Should ammo limitations be controlled by the game class or the weapon class?

texts:
I have a simple shooter game with a GameLevel class and a Shooter class. The shooter has a set amount of ammo, and every time the shoot() function is called, the ammo variable in the shooter decreases.
My question is about when the shooter runs out of ammo. Should the shoot() function be keeping track of ammo and simply stop shooting when ammo is 0, or should the GameLevel class call some sort of canShoot() function and have complete control over whether the weapon shoots or not?
This also applies to for example movement limitations i.e. if (in a simple 2D game) the shooter hits a wall, should the shooter itself prevent any movement or should the GameLevel class check for this first?


texts: What is the range of RAM consumption for the typical 3D character in a video game?

texts:
What is the average number of KB in memory for a 3D character?
Granted, this will obviously be biased based on what game we're talking about.
However, I am less interested in actual size in KB, and more interested in the range.
Simply, a general idea.

I want to know this information, to compare it to my 2D game. Currently, my 2D game has an almost exact scale for how much RAM a character takes up in memory.

The current formula is this: 95KB * Number of Animations * Number of Frames * Number of Directions. So for example, if a character had an Idle Animation with 15 frames, and a Walk animation of 15 frames, and there were 4 directions the character could move, the character would take 11.4MB in memory.

3D Characters have to load their mesh, textures, and animations. 2D characters simply load a image. However, with hundreds of animations- I can only imagine the 2D character would eventually exceed the memory requirements of a 3D character.

I need to get a general idea of how many characters I should limit on screen, how I should load my characters and their animations in memory, etc. I get some performance hits when swapping out textures in memory, probably because they are large spritesheets. I do not know if not using spritesheets would fix this or not. I was always told "Sprite Sheets are good for performance."

What about 3D games? Any example would work, and it doesn't have to be a real range. I just want to know what I may be looking at. An example of a lower quality 3D game and an example of a higher quality 3D game would be perfect.


texts:
In Three.js I am trying to implement an orbiting camera can be rotated around the x and the y axis. I am using these two functions:

    function rotateX(rot) {
        var x = camera.position.x,
            y = camera.position.y,
            z = camera.position.z;

        camera.position.x = x * Math.cos(rot) + z * Math.sin(rot);
        camera.position.z = z * Math.cos(rot) - x * Math.sin(rot);

        camera.lookAt(scene.position);
    }

    function rotateY(rot) {
        var x = camera.position.x,
            y = camera.position.y,
            z = camera.position.z;

        camera.position.z = z * Math.cos(rot) + y * Math.sin(rot);
        camera.position.y = y * Math.cos(rot) - z * Math.sin(rot);

        camera.lookAt(scene.position);
    }

Now the x rotation works fine but the y rotation does not. Once I go over the top of the model as in that the camera's z position becomes negative then suddenly the lookAt method rotates the camera by PI amount on the Z axis and suddenly the left side of the model is on the right and vice versa. Now I can fix this by checking for a negative Z and then just fixing the camera's rotation but this then causes a malfunction when using x ad y rotation at the same time, the x then suddenly gets this inverting behavior.

How should I go about fixing this?


texts: Check if is object in camera field and not covered by other object

texts:
I know how to check if object is in camera view but how I can check if that object is cover by something elese? In my case I want to turn on or off some effect when I look at light. At this moment my code is straight forward, I have created interface for lightable object with method

public bool isVisibleByCam(Camera cam) {
    if (GeometryUtility.TestPlanesAABB(GeometryUtility.CalculateFrustumPlanes(cam), gameObject.GetComponent<Collider>().bounds)) {
        return true;
    }
    return false;
}

I hope there is better way than checking every object in camera view and comparing distnace between camera.


texts: Character Action Sprite Framelength of Late-90's Something, Industry Standards of that Era?

texts:
I'm making a 3d character that emulates a sprite. The game as a whole emulates the feel of a classic RPG game.

Old games like Ultima Online, or Diablo...or similar late-90's generation...

For an average run sequence, they must have had general targets for "smoothness". I'm curious if there was an old industry standard of that time for "sprite frames for this action" in game design.

Example. A walk sequence in Diablo. How many frames would they have targeted in those years?

I'm looking for a general guideline to emulate "that cool 90's RPG". I'd love some advice.

If there was no such standard, and designers of old were as hacky as they tended to be, I'll also take a good educated opinion on the matter.


texts:
Are there any good resources out there for game development in GNU step? I looked at some of the source code for ooLite, but that didn't really have much in Objective-C.

What is there these days?


texts: Shape Centers as Vectors: Local space or World space?

texts:
Given a shape (any shape) in a 2D world where all positions, locations, and centers are two dimensional vectors, should the shape's center be described in local space or world space?

EXAMPLE:

World Space center of a Rectangle: Position: (100, 100); Dimensions: (200, 200); Center: (200, 200);

Local Space center of a Rectangle: Position: (200, 200); Dimensions: (100, 200); Center: (50, 100);

World Space center of a Circle: Position: (100, 100); Dimensions: (50, 50) (diameter); Center: (100, 100);

Local Space center of a Circle: Position: (50, 50); Dimensions: (200, 200); Center: (0, 0);


texts: Gamemaker Studio 2 html5 game sfx influence background music volume

texts:
When I run my game in html5 the game sound effects for shooting makes the background music less audible. It is like the volume of the bg music goes down.
And when shooting is done it goes up again.

When I run my game in test everything is fine.
How can I fix this?


texts: Calculating Directional Shadow Map using Camera Frustum

texts:
I'm trying to calculate the 8 corners of the view frustum so that I can use them to calculate the ortho projection and view matrix needed to calculate shadows based on the camera's position. Currently, I'm not sure how to convert the frustum corners from local space into world space. Currently, I have calculated the frustum corners in local space as follows (correct me if I'm wrong):

float tan = 2.0 * std::tan(m_Camera->FOV * 0.5);
float nearHeight = tan * m_Camera->Near;
float nearWidth = nearHeight * m_Camera->Aspect;
float farHeight = tan * m_Camera->Far;
float farWidth = farHeight * m_Camera->Aspect;

Vec3 nearCenter = m_Camera->Position + m_Camera->Forward * m_Camera->Near;
Vec3 farCenter = m_Camera->Position + m_Camera->Forward * m_Camera->Far;

Vec3 frustumCorners[8] = {
    nearCenter - m_Camera->Up * nearHeight - m_Camera->Right * nearWidth, // Near bottom left
    nearCenter + m_Camera->Up * nearHeight - m_Camera->Right * nearWidth, // Near top left
    nearCenter + m_Camera->Up * nearHeight + m_Camera->Right * nearWidth, // Near top right
    nearCenter - m_Camera->Up * nearHeight + m_Camera->Right * nearWidth, // Near bottom right

    farCenter - m_Camera->Up * farHeight - m_Camera->Right * nearWidth, // Far bottom left
    farCenter + m_Camera->Up * farHeight - m_Camera->Right * nearWidth, // Far top left
    farCenter + m_Camera->Up * farHeight + m_Camera->Right * nearWidth, // Far top right
    farCenter - m_Camera->Up * farHeight + m_Camera->Right * nearWidth, // Far bottom right
};

How do I move these corners into world space?

Update:

I'm still not sure if what I'm doing is right. I've also attempted to build the ortho projection by looping through the frustum corners and getting the min and max x,y,z coordinates. Then simply setting the values of the projection as:

left = minX
right = maxX
top = maxY
botton = minY
near = - maxZ
far = -minZ

I've searched on the internet but all the tutorials use hard coded values so the shadow maps aren't applicable to an open world but a restricted portion of the scene. Any help? Pseudocode is preferred as my linear algebra skills (and reading skills) aren't that great


texts: Positioning ropes equidistantly on a landscape display

texts:
I would like to render 4 similar ropes in my game that are equidistant on a landscape mode display.

How can I proceed? My screen is 1920*1080, at 420 dpi.

Is there any way that I could link the ropes coordinates with pixels or is there another way?


texts:
I have an object with a position matrix and a rotation matrix (derived from a quaternion, but I digress).  I'm able to translate this object along world-relative vectors, but I'm trying to figure out how to translate it along local-relative vectors.  So if the object is tilted 45 degrees around its Z-axis the vector (1, 0, 0) would make it move to the upper right.

For world-space translations I simply turn the movement vector into a matrix and multiply it by the position matrix: position_mat = translation_mat * position_mat.  For local-space translations I'd think I'd have to use the rotation matrix into that formula, but I see the object spin around instead when I apply a translation over time no matter where I multiply the rotation matrix.


texts: How can I make a 2D Sprite bleed/glow colors at a particular spot?

texts:
I am trying to make a gauge glow over the color it is at.  For example, in the image below, when the needle is pointing at the red, the red is glowing.  When it is pointing at the green, then the green is glowing.  I want to replicate this:

My gauge will be on a gradient, so I cannot just color a particular segment.  (There are no segments.)  I am working with 2D sprites.  I have looked into the Bloom asset as suggested here, but I have been met with nothing but failures.  (Probably because that guide is for 3D.)

How can I take the color at a particular position and make it bleed/glow like in the images above?


texts: Player moves in a jerky way when riding on a moving platform

texts:
I have a moving platform script that travels between three positions. This works fine.

I have a script that holds the player to a platform, and this works fine too.

But when I parent my platform that holds my player to an object with the moving platform script, the player's movement is jerky and uneven.

Here are the scripts I'm using:

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

public class MovingMultipalPoint : MonoBehaviour
{

    public Vector3 pointB;
    public Vector3 pointC;
    public float Second = 5.0f;
    public float Speed = 3.0f;
    //public float HoldSecond = 5.0f;

    IEnumerator Start()
    {
        Vector3 pointA = transform.position;
        while (true)
        {
            yield return new WaitForSeconds(Second);
            yield return StartCoroutine(MoveObject(transform, pointA, pointB, Speed));
            yield return new WaitForSeconds(Second);
            yield return StartCoroutine(MoveObject(transform, pointB, pointC, Speed));
            yield return new WaitForSeconds(Second);
            yield return StartCoroutine(MoveObject(transform, pointC, pointB, Speed));
            yield return new WaitForSeconds(Second);
            yield return StartCoroutine(MoveObject(transform, pointB, pointA, Speed));
        }
    }

    IEnumerator MoveObject(Transform thisTransform, Vector3 startPos, Vector3 endPos, float time)
    {
        float i = 0.0f;
        float rate = 1.0f / time;
        while (i < 1.0f)
        {
            i += Time.deltaTime * rate;
            //newRotation *= Quaternion.Euler(0, 90, 0);
            //transform.rotation = Quaternion.Slerp(transform.rotation, newRotation, 20 * Time.deltaTime);
            thisTransform.position = Vector3.Lerp(startPos, endPos, i);
            yield return null;
        }
    }
}

This script holds the player to the platform.

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

public class HoldPlayer : MonoBehaviour
{
    private GameObject target = null;
    private Vector3 offset;
    void Start()
    {
        target = null;
    }
    void OnTriggerStay(Collider col)
    {
        target = col.gameObject;
        offset = target.transform.position - transform.position;
    }
    void OnTriggerExit(Collider col)
    {
        target = null;
    }
    void LateUpdate()
   {
        if (target != null)
        {
            target.transform.position = transform.position + offset;
        }
   }
}

(1st Image) Here is how the moving platform is configured in the Inspector:

(2nd Image) And the holding script:

Also here recorded video of issue

Any ideas how I can keep the movement smooth in this case?


texts: Texture mapping a complex object on openGL ES

texts:
I dont have much experience with openGL ES (or openGL), but i do get the general idea of texture mapping, which is each vertex should be mapped for the relevant UV coordinates of the texture we choose to map. but what happens when i have complex objects?

Lets say i have the known Stanford bunny:

and i want to map this texture:

It is not very simple to calculate all vertices locations on the image at all.
Are there any known methods or best practices for doing that?

Where should i begin regarding this kind of mappings?

Thanks!


texts: Most efficient way to convert Vector3 to Vector2

texts:
What is the most efficient and fastest way to convert a Vector3 to a Vector2?

Casting:

Vector2 vector2 = (Vector2)vector3;

Initializing a new Vector2:

Vector2 vector2 = new Vector2(vector3.x, vector3.y);

Or is there another method that I don't know?