texts: How to draw a string to the screen by fading in one letter at a time?

texts:
I'm making a text adventure-style game with MonoGame. I have created a TextBox class which prints text onto the screen one letter at a time (like it's being typed). It does this by storing received text in a buffer string, and using Update() to periodically push letters into the output string, which is then drawn to the screen (I've written a function for wrapping, so I've had no problem there).

However, this method has some significant limitations - inability to change the font or colour of individual lines, for example - but there is something specific I am trying to achieve: I want each new letter to fade gradually onto the screen instead of just appearing instantly. So far, I've had no luck finding a way to do this.

At the moment, I've been attempting to remake the TextBox class to print each character with its own draw call, allowing me to change a letter's colour - and therefore alpha - individually. However, I've ran into a problem. I am using spriteFont.MeasureString() to allow me to draw the letters in the correct positions relative to each other, but it hasn't been giving me the values I need. Letters are drawn too close together, as it seems to be measuring the actual pixel width of the glyph, rather than the space they would take up if the string was printed all at once.

So, my question is: is there a way around this particular problem with MeasureString, or is there another solution entirely to make each letter fade in individually?


texts: What happens if I make more than $100k with the free Unity license?

texts:
If an indie game developer makes more than $100,000 using the free version of Unity, what happens to the money that goes over $100k? How will Unity people come to know how much money they are making?

What precautions should I take just in case a game is a great success?


texts: What's the best way to generate an NPC's face using web technologies?

texts:
I'm in the process of creating a web app. I have many randomly-generated non-player characters in a database. I can pull a lot of information about them - their height, weight, down to eye color, hair color, and hair style.

For this, I am solely interested in generating a graphical representation of the face. Currently the information is displayed with text in the nicest way possible, but I believe it's worth generating these faces for a more... human experience.

Problem is, I don't know where to start. Were it 2007, I'd naturally think to myself that using Flash would be the best choice. I'd love to see "breathing" simulated. However, since Flash is on its way out, I'm not sure of a solid solution.

With a previous game, I simply used layered .PNGs to represent various aspects of the player's body: their armor, the face, the skin color. However, these solutions weren't very dynamic and felt very amateur. I can't go deep into this project feeling like that's an inferior way to present these faces, and I'm certain there's a better way.

Can anyone give some suggestion on how to pull this off well?


texts: Rotated canvas sprite not drawing properly

texts: First, sorry for my english. Said that: Recently I began to study JavaScript and like a way to consolidate what I learned I decided to make a simple video game with canvas and javascript: kind of Mortal Kombat demo, without library or game engine, just what I had learned until the moment. The problem with my little project is that when and move it or throw a punch with player2 (which is basically player1 rotated) the sprite becomes a mess, even when the code is exactly the same that for player1. I guess is related with rotating the context, but I can't figure it out. Here is the code mortal kombat demo, along with basic instructions.


texts:
I'm having two problems with my collision detection in XNA. There are two boxes, the red box represents a player and the blue box represents a wall.

The first problem is when the player moves to the upper side or bottom side of the wall and collides with it, and then try to go to the left or right, the player will just jump in the opposite direction as seen in the video.

However if I go to the right side or the left side of the wall and try to go up or down the player will smoothly go up or down without jumping.

The second problem is that when I collide with the box and my key is still pressed down the blue box goes half way through red box and and goes back out and it keeps doing that until I stop pressing the keyboard. its not very clear on the video but the keeps going in and out really fast until I stop pressing the key.

Here is a video example:-
http://www.youtube.com/watch?v=mKLJsrPviYo

and Here is my code

Vector2 Position;
Rectangle PlayerRectangle, BoxRectangle;
float Speed = 0.25f;

enum Direction { Up, Right, Down, Left };
Direction direction;

protected override void Update(GameTime gameTime)
{
    // Allows the game to exit
    if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
        this.Exit();

    KeyboardState keyboardState = Keyboard.GetState();

   if (keyboardState.IsKeyDown(Keys.Up))
   {
       Position.Y -= (float)(Speed * gameTime.ElapsedGameTime.TotalMilliseconds);
       direction = Direction.Up;
   }

   if (keyboardState.IsKeyDown(Keys.Down))
   {
       Position.Y += (float)(Speed * gameTime.ElapsedGameTime.TotalMilliseconds);
       direction = Direction.Down;
   }

   if (keyboardState.IsKeyDown(Keys.Right))
   {
       Position.X += (float)(Speed * gameTime.ElapsedGameTime.TotalMilliseconds);
       direction = Direction.Right;
   }

   if (keyboardState.IsKeyDown(Keys.Left))
   {
        Position.X -= (float)(Speed * gameTime.ElapsedGameTime.TotalMilliseconds);
        direction = Direction.Left;
    }

    if (PlayerRectangle.Intersects(BoxRectangle))
    {
         if (direction == Direction.Right)
             Position.X = BoxRectangle.Left - PlayerRectangle.Width;
         else if (direction == Direction.Left)
             Position.X = BoxRectangle.Right;

         if (direction == Direction.Down)
             Position.Y = BoxRectangle.Top - PlayerRectangle.Height;
         else if (direction == Direction.Up)
             Position.Y = BoxRectangle.Bottom;
     }

     PlayerRectangle = new Rectangle((int)Position.X, (int)Position.Y, (int)32, (int)32);

     base.Update(gameTime);
}


texts: How to display distance between Player and object in UI text? Unity 5.5

texts: I am an beginner in Unity, with no experience in scripting. Can someone help me with a script to display distance between Player and object in UI text? Using Unity 5.5, the scene is quite simple just one room with the third person character moving around the object (CT scan). Thanks. Alex


texts: Blending Lightmaps and Dynamic Texture Shadows in HLSL/GLSL

texts:
I'm using Gile[s] as my lightmapper and my engine can execute GLSL/HLSL scripts.

I would like to accomplish something like this for performance reasons. I was told that this technique can only be done by shaders.

Someone has provided me with a quick code example and starting code but it is still far from being implemented.

lightmapColor*=shadowmapValue;
colorIntensity = (lightmapColor.r+lightmapColor.g+lightmapColor.b)/3.0;
lightCol = (1-colorIntensity)*ambient+(colorIntensity)*lightmapColor;

Not sure if it is applicable in my engine so I am looking for some guidance and perhaps some basic hlsl code to accomplish this. My lightmap texture uses the UV2 Channel if it helps. Thanks.


texts:
I am starting out learning XNA and its going smoothly. However I wonder if I am shooting myself in the foot by learning 3.1 not 4.0?

I am also aware Microsoft obviously has a conflict on interest in the matter: the more times we update the more copies of Visual Studio they sell (I know express is free but some will go pro). So one has to read between the lines of the "MASSIVE NEW FEATURES UPGRADE NOW" type blogs from MS employees.

I am aware of whats new: http://msdn.microsoft.com/en-us/library/bb417503.aspx, and that mostly seems to be phone, interfaces and video features - which I am not so interested in - I am more doing the core 3D stuff.

The sticking point is: I have Visual Studio 2008 professional already and do not want to get VS 2010 if there is little difference in the game programming in 4.0.

Has the world moved on? Is what I am learning in 3.1 going to be come redundant?

There are also code differences in libraries, but they are not major, many of them can be seen here: http://www.nelxon.com/blog/xna-3-1-to-xna-4-0-cheatsheet/, for instance this one which I had to figure out compared to Riemers Tut:

XNA 4.0

 protected override void Draw(GameTime gameTime)
 {
     device.Clear(Color.DarkSlateBlue);

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

     effect.CurrentTechnique = effect.Techniques["ColoredNoShading"];
     effect.Parameters["xView"].SetValue(viewMatrix);
     effect.Parameters["xProjection"].SetValue(projectionMatrix);
     effect.Parameters["xWorld"].SetValue(Matrix.Identity);
     foreach (EffectPass pass in effect.CurrentTechnique.Passes)
     {
         pass.Apply();

         device.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 1, VertexPositionColor.VertexDeclaration);
     }

     base.Draw(gameTime);
 }

XNA 3.1

protected override void Draw(GameTime gameTime)
{
    device.Clear(Color.DarkSlateBlue);

    device.VertexDeclaration = new VertexDeclaration(device, VertexPositionColor.VertexElements);
    device.RenderState.CullMode = CullMode.None; // TODO only for testing!
    device.RenderState.FillMode = FillMode.Solid;

    effect.CurrentTechnique = effect.Techniques["ColoredNoShading"];
    effect.Parameters["xView"].SetValue(viewMatrix);
    effect.Parameters["xProjection"].SetValue(projectionMatrix);
    effect.Parameters["xWorld"].SetValue(Matrix.Identity);

    effect.Begin();
    foreach (EffectPass pass in effect.CurrentTechnique.Passes)
    {
        pass.Begin();
        device.DrawUserIndexedPrimitives<VertexPositionColor>(PrimitiveType.TriangleList, vertices, 0, 5, indices, 0, indices.Length / 3);
        pass.End();
    }
    effect.End();

    base.Draw(gameTime);
}


texts: XNA: How to Flip/Mirror a position over a custom vector?

texts:
I want to flip Horizontally my Sprite/Texture however the SpriteEffects.FlipHorizontally isn't cutting it for me as it just flips the texture in place.

I want to flip the texture over a specified Vector2/Vector3?

Thanks!


texts: How can I position a sprite in the same spot across different screen sizes?

texts:
Taking into account the multitude of screen sizes and resolutions, is there a way I can position a sprite so it's at roughly the same spot on every iOS device?

Doesn't matter if you are using SpriteKit or Cocos2D or just using UIKit. The principle for positioning a sprite is roughly the same.


texts:
I've a really quick and maybe dump question and I don't really know how it is handled generaly. I want to make a tile base multiplayer game.
Player doesn't teleport from a tile to another but just walks pixel by pixel. So my client position will be two floats based on the actual position of the sprite on the screen. But on the server, should the position of the player be based on the texture as well, or it must be clientPosition/textureSize ?

Imagine a player being on position x:150;y:100 on his screen, and a tile texture size of 32px, should the position of the same player on the server be 150;100 or 4.6875;3.125 ?

Thank you in advance :)


texts: Combining varying vertex variable and vertex variable in OpenGL. How to?

texts:
Let's say I have 2 triangles sharing an edge defined by 4 vertices. Though the normals for these 2 triangles are unique for each triangle and are defined per vertex. So say I have 4 vertices, 6 normals (as shown in the figure below).

I would like to know how this can be dealt with in OpenGL? I have been using glDrawElement so far, but I understand that this would only work if I had 4 normals (1 normal per vertex) and this it wouldn't allow me to define 3 normals per triangle.

What's the best/common/most efficient of dealing with this case? Do I need to also duplicate the vertices (3 unique vertices per triangle or is there a more clever solution to this?) so that I have as many vertices than I have normals?


texts:
var angle = temp.transform.rotation.eulerAngles;
            angle.y = 90;

temp.transform.rotation = Quaternion.Euler (angle);

I have tried this and some other variation to change the rotation of the instantiated prefab but it does not work at all.

How can I fix this?


texts: Maya 2015 Collada mesh transforms not applied

texts:
I am trying to load a dae (Collada) model into my 3d engine. The problem is they export the vertices and transforms seperately. So in Maya 2015 it looks like this

In the game engine I have it simply read in vertices, normals, etc. It looks like this...

You can tell it loaded the model without any transformations. I would like it so it applies the transformations to the vertices before it exports them to the file. Does anyone know how to do this in Maya. It defaulted like that in maya on my old computer but not on my new one I just built. So now I can't make 3d geometry and load it in the engine.

NOTE: I am also using Assimp to load my models is there possibly a flag that would do this.


texts: Why can't I use the operator '>=' with Vector3s?

texts:
I am trying to get a rectangle to move between two positions which I refer to as _positionA and _positionB. Both are of type Vector3. The rectangle moves just fine. However, when it reaches _positionB it does not move in the opposite direction, like it should.

I went back into the code to take a look. I came to the conclusion that as the object moved, the if statements in the code missed the frame in which the rects position was equal to _positionB. I decided to modify the code to reverse direction if the rects position is greater than or equal to _positionB. My code is not too long, so I will display it below:

using UnityEngine;
using System.Collections;

public class Rectangle : MonoBehaviour
{
    private Vector3 _positionA = new Vector3(-0.97f, -4.28f); //Start position
    private Vector3 _positionB = new Vector3(11.87f, -4.28f); //End position
    private Transform _rect_tfm;
    private bool _atPosA = false, _atPosB = false;

    public Vector2 speed = new Vector2(1f, 0f);

    private void Start()
    {
        _rect_tfm = gameObject.GetComponent<Transform>();
        _rect_tfm.position = _positionA;
        _atPosA = true;
    }

    private void Update()
    {
        /*NOTE: Infinite loops can cause Unity to crash*/
        Move();
    }

    private void Move()
    {
        if (_atPosA)
        {
            _rect_tfm.Translate(speed * Time.deltaTime);

            if (_rect_tfm.position == _positionB)
            {
                _atPosA = false;
                _atPosB = true;
            }
        }

        if (_atPosB)
        {
            _rect_tfm.Translate(-speed * Time.deltaTime);

            if (_rect_tfm.position == _positionA)
            {
                _atPosA = true;
                _atPosB = false;
            }
        }
    }
}

When I changed it, however, it warned me of the following error message:

  Operator >= cannot be applied to operands of type Vector3 and Vector3.

This confuses me for two reasons; first, both values are of the same data type. Second, using the comparison operator(==) on the two values works without error. Why can't I use the operator >= with Vector3s?


texts:
I have been looking into making a game engine using VB.NET but I'm having some trouble finding how I would draw stuff to the screen. In some places, people draw to the screen using the picture box control but I have read else where that it is not recommended to do this as I will run into problems in the future if I draw to a picture box

So I would like to know what would be the best way to draw sprites etc. to the screen. Is it OK to use picture boxes or is there another way?


texts: Adding sub-entities to existing entities. Should it be done in the Entity and Component classes?

texts:
I'm in a situation where a player can be given the control of small parts of an entity (i.e. Left missile battery). Therefore I started implementing sub entities as follow.

Entities are Objects with 3 arrays:

pointers to components
pointers to sub entities
communication subscribers (temporary implementation)

Now when an entity is built it has a few components as you might expect and also I can attach sub entities which are handled with some dedicated code in the Entity and Component classes.

I noticed sub entities are sharing data in 3 parts:

position: the sub entities are using the parent's position and their own as an offset.
scrips: sub entities are draining ammo and energy from the parent.
physics: sub entities add weight to the parent

I made this to quickly go forward, but as I'm slowly fixing current implementations I wonder if this wasn't a mistake.

Is my current implementation something commonly done? Will this implementation put me in a corner?

I thought it might be a better thing to create some sort of SubEntityComponent where sub entities are attached and handled.

But before changing anything I wanted to seek the community's wisdom.


texts: How do multiplayer turn based games handle computation

texts: I am building a turn based multiplayer simulation game that at the end of each turn takes all of the users inputs/actions then compiles all the data and interactions returning the result of the previous decisions made. My problem is how to scale this out. How do games like civ handle the computation of the game each turn without massive overheads on server computation? My game in specific has an economy with many different factors and values which all interact with each other and can trigger events based on random numbers and thresholds. I need to find a way to handle all of the computation without offloading it all to a server dramatically increasing costs.


texts: Body lost a velocity component when hitting a wall

texts:
I am creating a Breakout game using Box2D (of LibGdx if anyone interest). Everything works well until when the ball hits the wall when moving with a very small angle. Please look at the image for details:

I tried to set the wall friction to 0 and restitution to 1, as well as the ball's friction and restitution, but it still move along the wall (I have no World Gravity). This also happens to the vertical wall if the angle is small enough, it will lose X velocity.

How can I move the ball the way I expected? If there is no friction, what caused the problem?

EDIT: In case of LibGdx only, this is a fix:

World.setVelocityThreshold(float threshold);

I set it to 0.1f, and it helped. If you encounter problem, maybe 0 can help, but it is unrecommended..


texts: How does this bezier curve rendering shader determine if a curve is concave or convex?

texts:
I have read an article about rendering quadratic splines on a GPU with a shader.

The algorithm is explained like this:

For each quadratic Bézier curve we use Bézier control points of the curve to create triangles. Triangles we get contain curves that are either convex or concave.
Then we need to assign [u v] coordinates to the vertices of the triangles (article says that we assign values [0 0], [½ 0], and [1 1]; I'm not sure why these values are used).
Then it say that instead of using [u v] coordinate to look up a color value as in texture mapping, we use the [u v] coordinate to evaluate a procedural texture. The pixel shader computes the expression u^2 - v using the sign of the result to determine pixel inclusion. For convex curves, a positive result means the pixel is outside the curve; otherwise it is inside. For concave curves, this test is reversed.

At the end of the article an example implementation of that algorithm is provided (reproduced below). It says it is a "quadratic curve pixel shader" so as I understand it, it should be able to render both convex and concave curves, but I am only able to get it to render convex curves.

Is it an incomplete example? If not, how / where it is specified if the curve is convex or concave?

float4 QuadraticPS(float2 p : TEXCOORD0, float4 color : COLOR0) : COLOR
    {
       // Gradients
       float2 px = ddx(p);
       float2 py = ddy(p);
       // Chain rule
       float fx = (2*p.x)*px.x - px.y;
       float fy = (2*p.x)*py.x - py.y;
       // Signed distance
       float sd = (p.x*p.x - p.y)/sqrt(fx*fx + fy*fy);
       // Linear alpha
       float alpha = 0.5 - sd;
       if (alpha > 1)       // Inside
         color.a = 1;
       else if (alpha < 0)  // Outside
         clip(-1);
       else
         // Near boundary
         color.a = alpha;
       return color;
    }

PS: Gradients and Chain rule sections of the shader are about anti-aliasing I think.


texts: Do I need multiple exports from Game Maker to support Windows versions above 7?

texts:
I just created a game. At the time of exporting it, I targeted windows.

I use windows 7 on my computer. Obviously the game is compatible with windows 7, but I do not know if it is also compatible with windows 8 and 10, because just below appears windows 8.

I intend to launch the game on steam, and even if it was not, it is very important for me not to frustrate anyone.

My question is whether I will have to create multiple executables for different versions of windows, or if selecting the windows option, the game will work for windows 7, 8, 10 and XP.

I looked it up on the developer's website, but it did not help. => https://docs.yoyogames.com/source/dadiospice/000_using%20gamemaker/009_distributing%20your%20game.html


texts: One dimensional, bi-directional terrain generation

texts:
I'm developing one-dimensional terrain generation in my game.

I give the program a seed and based on that I need to be able to walk forwards and backwards on a line that is drawn between a series of points with the same interval but a different height.

So I need a random number generator where I can request both the next and previous number from a given state.

Most PRNGs I can find generate numbers only in the forward direction, and have no ability to operate in reverse. Is there a random generator I can use that can run both forwards and backwards?


texts: How to create a glowing corona/halo around a sun and make it emit light

texts:
I am trying to understand material and shaders in Unity.
make my object glow like a sun. For the moment I do not care if it's not looking like a star, but I would like that it at least emit light.
How do I make something that look like a star, and emit light?
Like this:(And if possible, be able to change the light color)

I tried to play with the Standard shader, and add some emission like this :

I tried legacy self illuminated, but they look like 2d, and have no depth


texts:
I am using the following which is attached on to an enemy, when I press the fire button it lowers the health of that enemy, my problem is HOW do I know if I am actually hitting the game object this script is attached to?

if (Input.GetButtonDown("Fire1"))
        {
            RaycastHit Shot;
            if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out Shot))
            {
                TargetDistance = Shot.distance;
                if (TargetDistance < AllowedRange)
                {
                    if (GlobalAmmo.LoadedAmmo > 0)
                    {
                            EnemyHealth = EnemyHealth - 10;
                    }
                }
            }
        }

So if I am hitting the game object which this script is attached to, it will reduce by 10, but it does not work


texts:
I'm trying to come up with a good Unity dev collaboration solution for a company where TFS is used as main version control system. I've setup the Unity projects to create metadata and store all as text. Like mentioned here: http://docs.unity3d.com/Manual/ExternalVersionControlSystemSupport.html

Then I enabled Unity's YAML SmartMerge for .unity and .prefab files in the Visual Studio Options like you can see in the below screenshot. I followed those instructions: http://docs.unity3d.com/Manual/SmartMerge.html

Now I tried all that and made a change in the Scene.unity on PC 1, checked it into TFS. Then a local change in Scene.unity on PC2 and used TFS Get Latest. But instead of merging the changes TFS showed the Resolve Conflicts screen only with the Take Theirs and Keep Mine options but no way to auto merge not even a manual merge option. :( The changes I did for testing where independent game objects and just a changes of their Position.x value in the Unity editor, so complete independent game objects. This should be easy to auto merge.
I tried the same setup with SVN and GIT and it just worked automatically like expected. Only TFS seems not to trigger the merge at all when Get Latest is used.

Anything else I'm missing with the TFS and VS 2015 setup I'm using?


texts: My Sprite is disappearing when it collides with my floor (libGDX)

texts:
I am just starting to build the game "engine" and I am using a sprite drawn in the same position as a rectangle and the two always move together. I have another rectangle which is the floor when the two collide the sprite/rectangle will stay on top of the "floor" rectangle for a small while then it will disappear. I assume it is falling through it as when I hold the key to move the sprite up again it re-appears.

The class I am using to represent my walls and floor is here:

public class Solids {
    Array<Rectangle> floors;
    Array<Rectangle> walls;

    public Solids(){
        floors = new Array<Rectangle>();
        walls = new Array<Rectangle>();

        floors.add(new Rectangle(0, 0, 1280, 10));
    }

    public Array<Rectangle> getFloors(){
        return floors;
    }

    public Array<Rectangle> getWalls(){
        return walls;
    }

}

I am representing my character in a class called entities which looks like this:

public class Entity {

    Rectangle bottom, left, right, top;
    Sprite sprite;
    Texture texture;
    Solids solids;
    int action;
    float velocity = 100;
    float width, height;
    float velocityY = 0;

    public Entity(Rectangle b, Texture t){
        solids = new Solids();
        bottom = b;
        texture = t;
        width = b.width;
        height = b.height;
        sprite = new Sprite(t, 0, 0, (int)width, (int)height);
        this.setPosition(0, 0);

    }

    public void setPosition(float x, float y){
        bottom.x = x;
        bottom.y = y;
        sprite.setPosition(x, y);
    }

    public void draw(SpriteBatch batch){
        sprite.draw(batch);
    }

    public void moveLeft(float delta){
        bottom.x -= velocity * delta;
        sprite.setPosition(bottom.x, bottom.y);;
    }

    public void moveRight(float delta){
        bottom.x += velocity * delta;
        sprite.setPosition(bottom.x, bottom.y);;
    }

    public void jump(){
        velocityY = 15;
    }

    public void update(float delta){
        velocityY -= 50 * delta;
        bottom.y += velocityY;
        sprite.setPosition(bottom.x, bottom.y);
    }

    /*public int hits(Rectangle r){
        if(bottom.overlaps(r)){
            return 1;
        }
        return -1;
    }

    public void action(int type, int y){
        if(type == 1){
            setPosition((int)bottom.x, y);
        }
    }*/

    public void isCollidedFloor(){
        /* need to know if collided with floor or wall for jumping need two arrays also need array of entities */
        for(int i = 0; i < solids.getFloors().size; i++){
            if(bottom.overlaps(solids.getFloors().get(i))){
                action(solids.getFloors().get(i));
            }
        }

    }

    public void action(Rectangle r){
            setPosition(bottom.x, r.y+1);
    }

}

The calls worth noting to this class from the main class are as follows:

    player = new Entity(new Rectangle(0.0f, 0.0f, 128f,128f), new Texture(Gdx.files.internal("woman.png")));
    player.setPosition(1280/2, 100);
player.update(Gdx.graphics.getDeltaTime());
player.isCollidedFloor();

So my question is, why is this happening, tried just creating one Rectangle outside of the solids class and it still doesn't work. I have been playing around for hours and just cant seem to figure it out. Thanks in advance.


texts: Changing game variables through network in run time for debugging

texts:
I want to implement a system in my game that will allow me to change in game parameters on runtime through the network.
Lets say my game is running on a ps4 or xbox one, I want to be able to register the desired variables in this sub system (for example, lighting values, controls senstivity and other in game parameters) and have them changed in run time from my computer so I don't have to re compile or re-run the game for only small change.
This will be used for debugging and tuning purposes only of course.
I was thinking about something like websockets or have some kind of server in my game that will listen to HTTP requests, maybe use REST APIs and creating an html page for changing the desired parameters.

My knowledge on the subject of web development is very limited so I'm looking for advice here, what do you use for something like that?

I don't even know what to search for so I decided to ask here fist.


texts: How to get access to framebuffer as a uint32_t * in SDL2?

texts: I am making my first foray into SDL. To do this, I would like to have direct access to the framebuffer on the window as a uint32_t *. This is because I have to pass this framebuffer to another file that my friend wrote which only accepts raw framebuffers like this one. I know that to write pixels you have to set up an SDL_Renderer but here  I want direct access to the raw framebuffer. How would I do this using only SDL2?


texts: Creating straight lines between two Vectors? (and slopes?) (interpolation??) libgdx java

texts:
I am trying to make a game with very basic physics (just gravity at this stage). Without using box2d
How is the best way to create the solid ground. I will be wanting to make ramps soon, but at this moment i am even stuck trying to make flat ground.

The approach i've been researching involves 'interpolation' between 2 or more vector2's , this sounds perfect for me as I only need very basic levels (think Excitebike for NES) so I want to be able to provide my level-creator class with just a bunch of height values and i want it to create invisible straight lines joining up those height points.

As i said ive seen about "interpolation" in the vector2 or the libgdx.math classes but I'm very confused on how to go about using those commands.

As usual any help is much appreciated, thanks for reading

(EDIT: I am thinking I could use Rectangles between the straight parts but is this going to work when i start introducing sloped ground?)

for example i have the green dots saved as vector2 and i need a method that makes the lines between (straight lines is fine no need for curves etc)


texts: I have a model that has been modeled & rigged in Maya, whenever i export it as an FBX and take it into unity it seems to collapse at certain areas (see the attachments for a before and after). The model is fine when brought into unity in the T position but once I give a pose in maya & get it to unity it seems to collapse in certain areas. I’ve even tried importing FBX file into 3ds max , model seems to have no problem in it. Its only when I import into unity I seem to get this problem.


texts: Unity Graphics.DrawMesh equivalent for Physics?

texts:
I'm working on something where the same graphics mesh is rendered multiple times in the scene. The problem with this is that each of those graphics items have a physics mesh which isn't there in the manually drawn meshes...

I've looks for something in the Physics and Collider documentation but haven't found anything which does what DrawMesh does for physics meshes. Is there something for this? or will I have to just create a bunch of physics objects manually?


texts: How to handle data for a competitive multiplayer games

texts:
I am kinda new to Multiplayer Games and I am really wondering how I should handle my data

Should each player send and update their data to the database (server) everytime one of their essential variables changes (like health or ingame currencies), or should they save the data as long as the game is running and then update the data all at once at the end of, lets say, each round?

I was thinking about using Firebase and Unity and here's a scenario:

Let's say 2 players connect to a game. Then one of them gets damage and the other one gets gold. Does the data change get sent to the FireBase Database immediatly or should I just update everything when the round ends/they disconnect?


texts: What is the difference between the various Unity Pro licenses? What does Android or iOS pro give me that Unity Pro doesn't? And what is the point of getting Unity Pro if I only care about mobile platforms, besides Win 8/WP 8 which Pro now comes with?


texts: How can I change the color of a SpriteRenderer using a hexadecimal string representation?

texts:
I tried to give color like below but unity doesn't accept the format
spriteRenderer.color = "#ffffff".

How can I give a hex color to a SpriteRenderer in Unity?


texts: What does the Sys_PageIn() function do in Quake?

texts:
I've noticed in the initialization process of the original Quake the following function is called.

volatile int sys_checksum;

//  **lots of code**

void Sys_PageIn(void *ptr, int size)
{
    byte *x;
    int j,m,n;
//touch all memory to make sure its there.  The 16-page skip is to
//keep Win 95 from thinking we're trying to page ourselves in (we are
//doing that, of course, but there's no reason we shouldn't)
    x = (byte *)ptr;

    for (n=0 ; n<4 ; n++)
    {
        for (m=0; m<(size - 16 * 0x1000) ; m += 4)
        {
            sys_checksum += *(int *)&x[m];
            sys_checksum += *(int *)&x[m + 16 * 0x10000];
        }
    }
}

I think I'm just not familiar enough with paging to understand this function.  the void* ptr passed to the function is a recently malloc()'d piece of memory that is size bytes big.  This is the whole function - j is an unreferenced variable.  My best guess is that the volatile int sys_checksum is forcing the system to physically read all of the space that was just malloc()'d, perhaps to ensure that these spaces exist in virtual memory?  Is this right?  And why would someone do this?  Is it for some antiquated Win95 reason?


texts: Measuring enemy "success" against player

texts:
I've been toying with an idea for a game prototype where the player must defend against waves of enemies, but between each wave the enemies "evolve" to better combat whatever tactics the player is using. Essentially each enemy type has some genetic information that can be used to generate their health, speed, attack type and so on; with the more "successful" enemy types being mutated into new sub-types, while ineffective enemy types are phased out.

What I'm trying to figure out, is what is a good way of measuring "success" against the player?

EDIT: Although I don't really want to get too specific about the game mechanics, let's assume that the game world is complex enough that you cannot figure out if an enemy type will be effective against the player without testing it.

So far I've thought of two basic solutions:

Use heuristics like whether a certain
enemy deals damage to the player or survives a long time without
being killed.

The problem I have with this approach is that it can be exploited if (when) the player
figures out how the algorithm works. For example you would be able to
deliberately let the weakest enemies land a few free hits to trick
the game into creating more of them. It may be possible to improve this with better heuristics however.
Only use about half the pool of enemy types at once and
swap types in and out randomly between waves. Analysis could
then be performed on the player's performance throughout the wave and each participating enemy type would be considered equally successful/unsuccessful. After a number of waves the success of  enemy types would be varied enough to perform mutation/deletion.

This solution seems intuitively harder to exploit and it would also pick up on successful combinations of enemy types that might not be possible to detect by looking at individuals, however it might also result in anomalies where useless enemy types are considered successful because they happened to get assigned to waves with stronger enemy types backing them up.

To clarify, I'm not asking about the actual process of evolving enemies, just about how to measure which enemies are successful against the player.


texts: How to block the player from moving left and right from two empty game objects?

texts:
I made the game space shooter in that game my spaceship move left and right but its not stop in right and left corner. When its move to left its go out of the screen. how i stop/block in the left and right screen edges.

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {
    public float speedMove = 3;
    public float bonusTime;
    private Rigidbody rb;
   private float _limit = 3;

    // 1 for right and -1 for left.
    private float _direction = 1;

    // You can call it as speed
    private float _speed = 0.01f;

    private bool toLeft = false;
    private bool toRight = false;

    public GameObject shield;
    public GUIText bonustimeText;

    private bool counting = true;
    private float counter;

    private Weapon[] addWeapons;

    public Sprite strongShip;
    public Sprite normalSprite;
    public Sprite shieldSprite;

    private SpriteRenderer sRender;
    private Weapon weaponScript;

    void Start () {

        counter = bonusTime;
        rb = GetComponent<Rigidbody>();

        sRender = GetComponent<SpriteRenderer> ();
        addWeapons = GetComponentsInChildren<Weapon> ();
        foreach (Weapon addWeapon in addWeapons) {
            addWeapon.enabled = false;
        }

        weaponScript = GetComponent<Weapon>();
        weaponScript.enabled = true;
    }

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

        transform.position = Vector3.MoveTowards (transform.position,new Vector3 (transform.position.x + _direction, transform.position.y, transform.position.z),_speed);

        if (Input.GetMouseButtonDown (0))
            _direction *= -1;

    }

    void OnCollisionEnter2D(Collision2D coll)
    {
        if (coll.gameObject.tag == "StrongMode") {
            Destroy (coll.gameObject);
            counting = true;
            StrongMode();
            Invoke ("Downgrade", bonusTime);
        }

        if (coll.gameObject.tag == "ShieldMode") {
            Destroy (coll.gameObject);
            counting = true;
            ShieldMode();
            Invoke("Downgrade", bonusTime);
        }

        if (coll.gameObject.tag == "Life") {
            GUIHealth gui = GameObject.Find ("GUI").GetComponent<GUIHealth> ();
            gui.AddHealth();
            SendMessage("AddHp");
            SoundHelper.instanceSound.PickUpSound();
            Destroy(coll.gameObject);
        }

        if (coll.gameObject.tag == "Enemy") {
            SendMessage("Dead");
        }
    }

    void Downgrade()
    {
        SoundHelper.instanceSound.BonusDownSound ();
        counting = false;
        bonustimeText.text = "";
        counter = bonusTime;

        sRender.sprite = normalSprite;
        weaponScript.enabled = true;
        foreach (Weapon addWeapon in addWeapons) {
            addWeapon.enabled = false;
        }
        weaponScript.enabled = true;
        shield.SetActive (false);
    }

    void StrongMode()
    {
        SoundHelper.instanceSound.BonusUpSound ();
        sRender.sprite = strongShip;
        foreach (Weapon addWeapon in addWeapons) {
            addWeapon.enabled = true;
        }
        weaponScript.enabled = false;
    }

    void ShieldMode()
    {
        SoundHelper.instanceSound.BonusUpSound ();
        sRender.sprite = shieldSprite;
        shield.SetActive (true);
    }

//  void OnDestroy()
//  {
//      bonustimeText.text = "";
//  }
}


texts: How can I create a line that joins two dots?

texts:
I have four dots and I want to create a line by joining 2 dots horizontally and vertically only. How can I achieve this with flutter?

Here is my code:

import 'package:flutter/material.dart';

class Grid4 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Container(
        padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 10),
        color: Colors.orange,
        child: GridView.builder(
          itemCount: 25,
          itemBuilder: (context, index) =>
              Container(decoration: BoxDecoration(
                  color: Colors.white70, shape: BoxShape.circle)),
          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 5,
            mainAxisSpacing: 40,
            crossAxisSpacing: 50,
          ),
        ),
      ),
    );
  }
}

````


texts: I want to create a sidescroller game for Android but it seems stupid to reinvent the wheel and since there are a lot of android sidescroller games already out I though that there must be some sort of template or something so I can get started quicker, so I can keep developing from there.


texts:
I'm still new to shaders and I'm trying to create a glow a shader. I understand how it all works and I don't think I'll have too much trouble with the rest of it, but I'm stuck at one point in particular which is getting the texcoords of the render target into my pixel shader.

Right now I'm setting the rendertarget, saving it to the texture, passing it to the shader. Then I'm going to do tex2D(texture, coords) but I don't know HOW to get the coordinates into my pixel shader. I've created float2 TexCoord : TEXCOORD0; for my vertex shader output but I don't know how to assign the coordinates as it reaches the pixel shader. Everything else (color,pos, normal) is just automatically passed in through the vertex shader and I'm assuming I don't need to change the format of that to include texcoords and it's something within the actual shader itself I need to add?

Thanks.


texts: How would one implement having a total set of TCG cards vs the specific instances of said cards in a player's deck, hand, field, etc?

texts:
For example, let's say in total there may be 5 cards that are in the game, let's use:

Axe-thrower (3-cost, Creature, 5 Power, 3 Defense, Rush ability)

Ice Elemental (2-cost, Creature, 2 Power, 5 Defense, Crystalized ability)

Party Trick (3-cost, Spell, Swap the Power and defense of a single creature)

Blademaster (3-cost, Creature, 3 Power, 3 Defense, Gains +1/+1 for every other creature on the field)

Minefield (3-cost, Trap, Deal X damage to all enemies, where X is the number of creatures on the opponent's side of the field)

With those in mind, some have default values, which would be simple to store in the database, some would likely remain as 0's or another default value until their effects came into play, etc. Simple enough.

My question is more about how to handle the cards and their values once they're in decks, a player's hand, and on the field.

For example:

The Axe-Thrower is a 5/3 creature, but let's say it's buffed in some fashion - how am I differentiating an object which is the base version of a card, version the version which is modified in some way? The only values stored in the DB Would be the base values, not the modified ones, correct? Unless there was some kind of suspend functionality in which case I would have to track the modified values as well.

My initial thought of an implementation, at least for the Database side of things was as follows:

Cards (ID, Name) -- Base card

CardVersions (ID, CardID, Version, ImagePath, CardStatsID) -- Cards' stats dependent on version

CardStats (ID, Cost, Power, Defense) -- Stats for a given CardVersion

Now those would be the "base" cards, the following could be how the specific instances are handled?:

PlayerCards (ID, PlayerID, CardID, Count) -- Player's cards

Decks (ID, PlayerID, Name) -- Player's decks

DeckCards (ID, DeckID, PlayerCardID, Count) -- How many of a card in a given deck

Which is a decent start, I think, for the cards in a player's deck.

For the cards in a player's hand / on their field, would those all simply be references to the PlayerCards with objects that have modifiable versions of the stats? For example, a GameCard with Original Stats and Modified Stats, where the majority of the time, the Modified Stats will be the Original Stats to start, but will change as the cards are buffed or their abilities are invoked?

Am I missing a super-simple solution to this, what I would imagine, common case for TCGs?


texts: Generating a mesh from a set of generatively produced co-ordinates

texts:
Using Unity I've been producing sculptural forms that look like this. It's made of patterns of cubes that twist around each other using a flocking algorithm. I'm trying to get it into a 3D printable format.

From unity I export a PLY that is a list of the co-ords of each cube that looks like:
ply
format ascii 1.0
element vertex 17500
property float x
property float y
property float z
end_header
35 2.521441 0
34.72401 -2.06799 4.386663
33.90041 3.202552 8.704146
...

Then I've imported that into meshlab and run Filters > Remeshing, Simplification and Reconstruction > Surface Reconstruction: Ball Pivoting with the default parameters.

This is the result (different iteration so doesn't match top image but similar) which is ok, but obviously not 3d printable.
Is there a better way of doing this in Unity to create a single mesh? I'd be happy with either a single mesh with individual lines or a mesh that makes a single shape as if it were shrink wrapped.


texts:
I'm writing a C# player script for a class and when I run, the sound inputs work fine, but the movement inputs don't respond, and I don't know how to fix it.

Code:

Rigidbody rigidbody;
AudioSource audioSource;

void Start(){
    rigidbody = GetComponent<Rigidbody>();
    audioSource = GetComponent<AudioSource>();
}

void Update(){
    ProcessInputs();
}
private void ProcessInputs()
{

    if (Input.GetKey(KeyCode.Space))
    {
        rigidbody.AddRelativeForce(Vector3.up);
        if (!audioSource.isPlaying)
        {
            audioSource.Play();
        }
    }
    else
    {
        audioSource.Stop();
    }
    if (Input.GetKey(KeyCode.A))
    {
        transform.Rotate(Vector3.forward);
    }
    if (Input.GetKey(KeyCode.D))
    {
        transform.Rotate(-Vector3.forward);
    }
}


texts: How to organize messages queue in a fast-paced multiplayer game

texts:
I'm trying to develop a fast-paced multiplayer game. I decided to build my own protocol over UDP and now I'm stuck with the following question.

The idea of the protocol is very basic and it's similar to many others:

Client does NOT do any game logic except of some predictions (like smooth walking). It just sends 'ping', 'connect', 'disconnect' and 'keypressed' / 'keyreleased' actions to the server.
On contrary, the server does game logic based on the users inputs and sends diffs to each client every 30 ms

As I already mentioned, the client sends 'ping' messages (to notify server that we're still alive when there's no other messages in some period of time) as well as 'keypressed' / 'keyreleased' stuff.

I thought that the 'ping' messages can be unrelirable -- the client sends them at steady intervals anyway, so if one was lost, nothing bad will happen.

However, such messages like 'keypressed' and 'keyreleased' should be reliable. By this I mean that the client should resend them in case of any failure and they should appear on the server in the same order they were sent (otherwise 'keyreleased' message could arrive before 'keypressed' resulting in the incorrect game behavior).

So, the questions is -- how is it usually handled? I mean, what is the right way to implement such logic on the server? Should I queue all incoming reliable messages in some container and wait until messages with smaller sequence IDs also arrive? If so, what should I do with unrelirable messages then? Because I definitely shouldn't wait before 'ping' message arrived (and there's a chance that it won't arrive at all). Should I use a distinct sequence numbers for unrelirable messages or should I make 'ping' messages reliable as well?


texts: How can I design good continuous (seamless) tiles?

texts:
I have trouble designing tiles so that when assembled, they don't look like tiles, but look like a homogeneous thing. For example, see the image below:

Even though the main part of the grass is only one tile, you don't "see" the grid; you know where it is if you look a bit carefully, but it is not obvious. Whereas when I design tiles, you can only see "oh, jeez, 64 times the same tile," like in this image:

(I took this from another GDSE question, sorry; not be critical of the game, but it proves my point. And actually has better tile design that what I manage, anyway.)

I think the main problem is that I design them so they are independent, there is no junction between two tiles if put closed to each other. I think having the tiles more "continuous" would have a smoother effect, but can't manage to do it, it seems overly complex to me.

I think it is probably simpler than I think once you know how to do it, but couldn't find a tutorial on that specific point. Is there a known method to design continuous / homogeneous tiles? (My terminology might be totally wrong, don't hesitate to correct me.)


texts: Why are 2D game tiles often lit from the top left?

texts:
I have been in to game programming for some time now, and recently ventured out in to trying to create my own pixel art. So I have learned the basics of lighting and shading etc. and noticed that several games will light their tiles from the top left. Such as Super Metroid and Axiom Verge highlighted in red here:

I assume because there is no distinct light source, one was chosen and consistently applied everywhere where possible?

Why does it tend to be the top left, is it to do with westerners reading left to right, top to bottom perhaps?

And bonus question, what is the reason behind the opposite side shading shown in the blue circle in Axiom Verge?


texts: I'm a new to OpenGL or graphics in general. Trying to write a game with realistic scale. I had a perfectly fine rendering of earth at a small scale, but when I try to scale it up to 1:1 I get this artifact. Any ideas what this could be? I suspect it's because I am using floats, but I would rather avoid using doubles in the shader for performance reasons.


texts: How can I move an object around a canvas in a random direction at random times?

texts:
I am currently trying to move an object (circle ball) around the canvas in a random direction.

I have already written the code for the wall collisions so the ball bounces back into canvas when the ball hits any of the canvas sides.

The canvas size is 600 x 500

in order to move the object around the canvas I have used;

   xPosition += ySpeed;
   yPosition += ySpeed;

From the code above, the ball moves from one end to the other end of the canvas in the same angle and direction, then bounces back at a different angle.

How can I go about doing this, if I wanted my object to move in the same speed but in a random direction around the canvas.

Any help is appreciated, thanks!


texts: Box2D `ApplyLinearImpulse` is not working whereas `SetLinearVelocity` works

texts:
I need to mimic jumping behavior for the player in my game. Player consists of two fixtures with circle and rectangle shapes. Rectangle I use to detect ground and it is a sensor. Is some point for jumping I do this:

float impulseY = body->GetMass() * PLAYER_JUMPING_VEOCITY / PTM_RATIO * std::sin(PLAYER_JUMPING_ANGLE * PI / 180);
body->ApplyLinearImpulse(b2Vec2(0, impulseY), body->GetWorldCenter(), true);

and player does not jump. But when I do this:

body->SetLinearVelocity(b2Vec2(0, PLAYER_JUMPING_VEOCITY / PTM_RATIO * std::sin(PLAYER_JUMPING_ANGLE * PI / 180)));

my player jumps. Also when I change the rectangle shape to be normal (not sensor) shape, its works again. Why? Just in case here are the parameters of my rectangular sensor:

b2PolygonShape boxShape;
boxShape.SetAsBox(width * 0.5/2/PTM_RATIO, height * 0.2/2/PTM_RATIO, b2Vec2(0, -height * 0.4 /PTM_RATIO), 0);

b2FixtureDef boxFixtureDef;
boxFixtureDef.friction = 0;
boxFixtureDef.restitution = 0;
boxFixtureDef.density = 1;
boxFixtureDef.isSensor = true;
boxFixtureDef.userData = static_cast<void*>(PLAYER_GROUP);


texts: How to avoid enemies overlapping each other when chasing player in Unity?

texts:
I am trying to get enemies to chase player but without them overlapping each other when they get closer to the player.

So far what I have is that I check for the distance between current enemy and the another enemy in a list and if their distance is less than 2 then update their position away from each other.

But when I do that, the enemies instantly move away rather than smoothly moving away from each other. What can I do to improve this?

Here is my script for chasing player:

public void ChasePlayer()
{
    foreach (GameObject enemy in enemies)
    {
        if (enemy != null)
        {
            float currentDistance = Vector3.Distance(transform.position, enemy.transform.position);

            if (currentDistance < 2.0f)
            {
                Vector3 dist = transform.position - enemy.transform.position;
                transform.position += dist;
            }
        }
    }

    if (lantern.transform.GetChild(0).gameObject.GetComponent<Light>().enabled)
    {

        gameObject.GetComponent<MeshRenderer>().enabled = true;
        gameObject.GetComponent<Collider>().enabled = true;
        transform.LookAt(player.transform);
        transform.position += transform.forward * speed * Time.deltaTime;

    }
    else
    {
        gameObject.GetComponent<MeshRenderer>().enabled = false;
        gameObject.GetComponent<Collider>().enabled = false;
    }
}


texts: How do I draw a perfect/smooth circle using OpenGL 3.3 and GLSL? I can only find old OpenGL tutorials or ones that have a blocky circle. I would also like to be able to resize the circle to become an oval, but that is not my highest priority.


texts: Apk file installes two instances of a Unity game

texts:
I created an apk in Unity (4.6) and when I install that apk on the device it creates 2 instances of the game (2 icons are visible in the screen). Both icons start the same game, and when I uninstall the game it removes both icons.

In previous builds this didn't happen, so I'm assuming that the changes I made to the Android Manifest have something to do with it. I included the Game Analytics SDK and it caused some problems when I tried to build the game for Android (with the message that the incompatible manifests can't be merged). So I commented out the part of the manifest that was causing the problem and now I have the problem with multiple instances of the game. I did some research and found that this happens when there are multiple activities in the manifest that are marked as LAUNCHER - this is not the case in my app, only one activity has that property. Also, as far as I can see, there is only one AndroidManifest.xml file in the Unity project (only one appears when I type it in the search).

This is the part of the manifest that I needed to change:

 <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
</activity>
<!--<activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
  <meta-data android:name="android.app.lib_name" android:value="unity" />
  <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
</activity>-->

If the commented out part is included, Unity throws the "incompatible manifest merge" error in the building process:

Error: [Temp\StagingArea\AndroidManifest-main.xml:4, [MyGame]Temp\StagingArea\android-libraries\unityads\AndroidManifest.xml:19] Trying to merge incompatible /manifest/application/activity[@name=com.unity3d.player.UnityPlayerNativeActivity] element:

UnityEditor.HostView:OnGUI()

Did anyone have any similar problems and how did you fix it?

Thanks


texts: How to make a Realtime 3D Eulerian Fluid Simulation like "From Dust" in C#/Unity3D?

texts:
So, for a game project I'm going to be working on I need to make a fully working 3D fluid simulator in Unity3D using C#, that can work in real time.

The only problem is, I've never done anything like fluid simulation. I've been doing tons of research on it, and I think a Eulerian based fluid simulator would fit my needs best (just like this).

Basically what I need is something that can react to changing terrain and move realistically.

The people that made that simulator have a research paper online, and I've read through it. I understand the basics, but I have no idea how I could get that in to C# or Unity3D. So I was wondering if any of you could help me, either by linking to other fluid-simulators where the code is open source, so I can pick it apart and change it to my needs, or by giving me tips on where to start/what I would need to do.

I've spent hours looking online for fluid simulators, but haven't found a single one programmed in C# as of yet, I have a program that can convert C++ to C#, but I don't understand C++ well enough to know where to put the scripts in Unity once they're converted.

Any help at all would be extremely appreciated, I'm really interested in teaching myself how to make this system, but I just have no clue where I should start, or what has already been done that I could build off of.


texts: Is there a limit on game updates in the iOS app store?

texts:
Does Apple implement any limit on the frequency / number of updates posted for a given app on the app store?

I have seen that apps that are updated get featured in the "new app" lists. So developers may choose to update their app every week to get featured in these lists on a regular basis?


texts: How to improve my maxscript random blood generation code?

texts:
The idea was simple. Draw basic blood drop meshes. Shuffle them with random generator to get final drop's. Export and render them in game as other meshes.

The problem is that it's not looks like a blood drop, but a rocks.

What is the best way to improve this? Redraw basic drops? Apply some modifier to final drop mesh? But what modifier? How to smooth borders in final drop mesh? I am totally stuck with this. The improvment must be codeable in MAXSCRIPT, not a manual correction of mesh, because I am a programmer not 3D modeller.

The generator final result screenshot.

Final blood drop:

P.S. For those who would like to test generator manually here it goes the prooflink. Works nice at 2010 version.


texts: Rendering multiple RenderTargets to the screen

texts:
Let's say I have a background and a set of entities.
I have managed to draw the background into a Texture2D using a RenderTarget
I have also managed to draw all my entities into another RenderTarget

Now I want to take these two Textures and render them on the screen as so:

// Top-level rendering
entitiesSystem.Process();
background.Process();
Texture2D entitiesTexture = entitiesSystem.EntitiesTexture;
Texture2D backgroundTexture = background.BackgroundTexture;

graphicsDevice.SetRenderTarget(null);
graphicsDevice.Clear(Color.Black);
spriteBatch.Begin();
spriteBatch.Draw(
    backgroundTexture,
    LevelManager.LEVEL_RECTANGLE,
    null,
    Color.White,
    0.0f,
    Vector2.Zero,
    SpriteEffects.None,
    1
);
spriteBatch.Draw(
    entitiesTexture,
    LevelManager.LEVEL_RECTANGLE,
    null,
    Color.White,
    0.0f,
    Vector2.Zero,
    SpriteEffects.None,
    0
);
spriteBatch.End();

Here is how the background system renders the background:

graphicsDevice.SetRenderTarget(BackgroundTexture);
spriteBatch.Begin();
for (int i = 0; i < 2; i++)
    spriteBatch.Draw(textures[i], positions[i], Color.White);
spriteBatch.End();

Almost the same thing happens for the entities: I set the render target to the relevant one (not the same as the one for the background), start the spritebatch (again, not the same one), draw the entities and end the spritebatch.

If I set BlendMode to additive, the result is correct (they blend together). However, if I set to to AlphaBlend, then I can only render one of them (depending on the SpriteSortMode).

I have come as far as understanding that the problem lies in not preserving... something, but I am not sure how to preserve it :P

By the way, I read that multiple render targets are not supported for the XBOX... Soooooooo... what is the alternative of doing what I am doing now?


texts: How to detect collision between a camera and a mesh?

texts:
I am wondering how you would be able to extract mesh properties (i.e. faces, vertices, and vertex normals) and use them to create a collidable object, one that a camera can't go through ?

I am using @TheCodingUniverse's OBJLoader. The files are in the episode_24 and utility folders.


texts:
I'm trying to use an existing FXAA shader for anti-aliasing, which works, but when I try to run it, the filtered image is upside-down (vertically flipped)

[Vertex_Shader]
varying vec4 posPos;
uniform float FXAA_SUBPIX_SHIFT = 1.0/4.0;
uniform float rt_w; // GeeXLab built-in
uniform float rt_h; // GeeXLab built-in

void main(void)
{
  gl_Position = ftransform();
  gl_TexCoord[0] = gl_MultiTexCoord0;
  vec2 rcpFrame = vec2(1.0/rt_w, 1.0/rt_h);
  posPos.xy = gl_MultiTexCoord0.xy;
  posPos.zw = gl_MultiTexCoord0.xy -
                  (rcpFrame * (0.5 + FXAA_SUBPIX_SHIFT));
}

[Pixel_Shader]
#version 120
uniform sampler2D tex0; // 0
uniform float vx_offset;
uniform float rt_w; // GeeXLab built-in
uniform float rt_h; // GeeXLab built-in
uniform float FXAA_SPAN_MAX = 8.0;
uniform float FXAA_REDUCE_MUL = 1.0/8.0;
varying vec4 posPos;

#define FxaaInt2 ivec2
#define FxaaFloat2 vec2
#define FxaaTexLod0(t, p) texture2DLod(t, p, 0.0)
#define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)

vec3 FxaaPixelShader(
  vec4 posPos, // Output of FxaaVertexShader interpolated across screen.
  sampler2D tex, // Input texture.
  vec2 rcpFrame) // Constant {1.0/frameWidth, 1.0/frameHeight}.
{
/*---------------------------------------------------------*/
    #define FXAA_REDUCE_MIN   (1.0/128.0)
    //#define FXAA_REDUCE_MUL   (1.0/8.0)
    //#define FXAA_SPAN_MAX     8.0
/*---------------------------------------------------------*/
    vec3 rgbNW = FxaaTexLod0(tex, posPos.zw).xyz;
    vec3 rgbNE = FxaaTexOff(tex, posPos.zw, FxaaInt2(1,0), rcpFrame.xy).xyz;
    vec3 rgbSW = FxaaTexOff(tex, posPos.zw, FxaaInt2(0,1), rcpFrame.xy).xyz;
    vec3 rgbSE = FxaaTexOff(tex, posPos.zw, FxaaInt2(1,1), rcpFrame.xy).xyz;
    vec3 rgbM  = FxaaTexLod0(tex, posPos.xy).xyz;
/*---------------------------------------------------------*/
    vec3 luma = vec3(0.299, 0.587, 0.114);
    float lumaNW = dot(rgbNW, luma);
    float lumaNE = dot(rgbNE, luma);
    float lumaSW = dot(rgbSW, luma);
    float lumaSE = dot(rgbSE, luma);
    float lumaM  = dot(rgbM,  luma);
/*---------------------------------------------------------*/
    float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
    float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
/*---------------------------------------------------------*/
    vec2 dir;
    dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
    dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));
/*---------------------------------------------------------*/
    float dirReduce = max(
        (lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL),
        FXAA_REDUCE_MIN);
    float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce);
    dir = min(FxaaFloat2( FXAA_SPAN_MAX,  FXAA_SPAN_MAX),
          max(FxaaFloat2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
          dir * rcpDirMin)) * rcpFrame.xy;
/*--------------------------------------------------------*/
    vec3 rgbA = (1.0/2.0) * (
        FxaaTexLod0(tex, posPos.xy + dir * (1.0/3.0 - 0.5)).xyz +
        FxaaTexLod0(tex, posPos.xy + dir * (2.0/3.0 - 0.5)).xyz);
    vec3 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (
        FxaaTexLod0(tex, posPos.xy + dir * (0.0/3.0 - 0.5)).xyz +
        FxaaTexLod0(tex, posPos.xy + dir * (3.0/3.0 - 0.5)).xyz);
    float lumaB = dot(rgbB, luma);
    if((lumaB < lumaMin) || (lumaB > lumaMax)) return rgbA;
    return rgbB; }

vec4 PostFX(sampler2D tex, vec2 uv, float time)
{
  vec4 c = vec4(0.0);
  vec2 rcpFrame = vec2(1.0/rt_w, 1.0/rt_h);
  c.rgb = FxaaPixelShader(posPos, tex, rcpFrame);
  //c.rgb = 1.0 - texture2D(tex, posPos.xy).rgb;
  c.a = 1.0;
  return c;
}

void main()
{
  vec2 uv = gl_TexCoord[0].st;
  gl_FragColor = PostFX(tex0, uv, 0.0);
}

I'm still new to shaders - how can I modify this shader so the filtered image is displayed the correct way up?


texts: Pass information between states in slick 2d?

texts:
I am making simple game in java using Slick 2d. My question is how many ways of passing information between states are available in Slick 2d. I am having a Hero class that holds all the hero stats and carry them between states using Singleton pattern- aka creating a single instance of the object and accessible from everywhere . Are there any possible solutions and workarounds ? Some XML-alike solutions ? Is there DB option ? Is it worth the effort ?

[Edit] Put it simple I want instance of my class hero to be accessible from every state. For example my hero goes to the market and buys some armor.  That should change his stas in all states. My question was if there is another way to do that like storing the hero stats not in a class but a XML or data base.


texts: How to check if two normals/directions "look at" each other?

texts: I need to flip polygons in my application. How do I determine if two vectors face each other, like in the second image below? Note that the origin of the vectors is also important, in addition to the direction.


texts: How can i calculate angle based on movement in C# XNA when i'm moving object with accelerometer? If object is moving up, sprite would rotate in corresponding direction. Should i use two vector coordinates(old, new) to calculate angle using Atan2?


texts: Where should I put code to be run on the client after connecting to a server?

texts: I'm making a multiplayer game with Unreal Engine, and I need to run some blueprint code on the client after they have connected to the server. This includes creating the HUD widget, uploading the player's loadout, etc. Where should I put this code so that it runs only on the client after connecting to a server?


texts:
I'm trying to make a Megaman-style wall jump in my 2D platform game with JavaScript.

The character can do A,B,C motions when it sticks the wall:

My problem is that when I trying to jump off the wall(motion C), it goes to motion A or B first, C was not happened. I think the keyboard input was conflict but I have no idea how to handle it.

Here is my current code:

if(key['right'] && key['jump']) {//it doesn't work
    //jump off the wall
} else if(key['right']) {
    //leave the wall
} else if(key['left']) {
    //stick the wall
} else {//release all keys
    //falling down
}

Please, Any help would be appreciated.


texts: C# Increase move speed for spawned objects

texts:
I'm making a simple shooter game where the player shoots a projectile at objects that spawn in random locations. I'd like to change the speed of the spawned objects and am having two issues

not sure how to call the speed from a separate script. I'm guessing I need to use GetComponent and could use some advice.
how do i vary the speed of spawned enemy objects? Ideally it'd be random from a range of 5 to 20

Move Script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveForward : MonoBehaviour
{
  public float speed = 20f;
  public GameObject Trump;
  public GameObject Player;
  private Rigidbody enemyRb;
  // Start is called before the first frame update
  void Start()
  {
    enemyRb = GetComponent<Rigidbody>();
    Player = GameObject.Find("Player");
    this.transform.LookAt(Player.transform);

  }

  // Update is called once per frame
  void Update()
  {
    transform.Translate(Vector3.forward * Time.deltaTime * speed);

  }
}

Spawn Manager Script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SpawnManager : MonoBehaviour
{
  public GameObject Trump;
  private float spawnRange = 60;
  private float startDelay = 2;
  private float spawnInterval = 1.5f;

  // Start is called before the first frame update
  void Start()
  {
    InvokeRepeating("SpawnTrump", startDelay, spawnInterval);

  }

  // Update is called once per frame
  void Update()
  {
   // MoveForward.speed += speedIncreasePerSpawn * spawnCount;
    //spawnCount++;
  }

  void SpawnTrump()
  {
    Instantiate(Trump, GenerateSpawnPosition(), Trump.transform.rotation);
  }
  private Vector3 GenerateSpawnPosition()
  {
    float spawnPosX = Random.Range(-spawnRange, spawnRange);
    float spawnPosZ = Random.Range(-spawnRange, spawnRange);
    Vector3 randomPos = new Vector3(spawnPosX, 0, spawnPosZ);
    return randomPos;

  }
}


texts: I want to start learning OpenGL with a book I have since a long time ago (Beginning openGL Game Programming) and it uses OpenGL 1.5 so my question is, should I learn OpenGL using this book and then learn a higher version? or should I start learning a higher version at once? are the same core concepts applied to higher versions?


texts: Geometry Shader only creates one primitive

texts:
I am currently trying to use the geometry shader.

My input is a set of points, for which multiple triangle should be created

This is the geometry shader

#version 330
layout(points) in;
layout(triangle_strip, max_vertices = 3) out;

in vec3[] vPos;
out vec3 oPos;

void main() {
    for(int i = -1; i <= 1; i++)
        for(int j = -1; j <= 1; j++)
        {
            for(int k = -1; k <= 1; k++)
            {
                oPos = vPos[0] + vec3(i,j,k);
                EmitVertex();
            }
        EndPrimitive();
        }

}

And this the corresponding C++ code

mMeshGenerator->use();

GLuint query;
glGenQueries(1, &query);
glEnable(GL_RASTERIZER_DISCARD);
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, mMeshVBO->buffer());
glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, query);
    glBeginTransformFeedback(GL_TRIANGLES);
        mPointsVAO->draw();
    glEndTransformFeedback();
glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
glFlush();
GLuint primitives;
glGetQueryObjectuiv(query, GL_QUERY_RESULT, &primitives);

std::cout << "-----" << primitives << "-----" << std::endl;
GLfloat feedback[primitives*3*3];
glGetBufferSubData(GL_TRANSFORM_FEEDBACK_BUFFER, 0, sizeof(feedback), feedback);

for (int i = 0; i < primitives*3*3; i++) {
    printf("%f\n", feedback[i]);
}
glDisable(GL_RASTERIZER_DISCARD);

According to the query only one primitive is written.

Output for input point (10,20,30):

-----1-----
9.000000
19.000000
29.000000
9.000000
19.000000
30.000000
9.000000
19.000000
31.000000

Whats wrong with my code that there is only 1 triangle instead of 27?


texts: Right now Im calling a new activity with an xml-view when I pause my game, but Since I do this I need to use context in my real-time code, and this is causing a memory leak. Is there any preffered way to pause the game? By pause I mean if game is over, if I die, or if I press pause-button. Would a custom dialog work just aswell? this would mean I wont have to leave my main-activity while im in-game.


texts: Separating .js elements/ .js element communication

texts:
So I have 2 questions regarding the code below:

function goldClick(number){
    gold = gold + number;
    document.getElementById("gold").innerHTML = gold;
};

function buyMiner(){
    var minerCostG = Math.floor(100 * Math.pow(2.1,miner));
 var minerCostW = Math.floor(10 * Math.pow(3.1,miner));
    if(gold >= minerCostG){
  if(wood >= minerCostW){
   miner = miner + 1;
   gold = gold - minerCostG;
   wood = wood - minerCostW;
   document.getElementById('miner').innerHTML = miner;
   document.getElementById('gold').innerHTML = gold;
   document.getElementById('wood').innerHTML = wood;
    }};
    var nextCostMG = Math.floor(100 * Math.pow(2.1,miner));
    document.getElementById('minerCostG').innerHTML = nextCostMG;

 var nextCostMW = Math.floor(10 * Math.pow(3.1,miner));
    document.getElementById('minerCostW').innerHTML = nextCostMW;
};

window.setInterval(function(){

 goldClick(miner);

}, 1000);

Question 1: Is it possible to separate these functions (goldclick, buyminer, window interval,) into their own documents so that if I have say, 50 different XXXXclick functions, and 50 buyXXXX functions and 50 interval functions, I have just 3 .js documents instead of 50.

Question 2: If it is possible to separate them, how would I ensure that they are communicating with each other and variable values are not being confused or sent to the wrong <span> in the displaying html.


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

public class AttemptCounter : MonoBehaviour {

    public Text AttemptText;
    public int Attempts = 1;
    public int AddAttempts = 1;

    public void AddAttempt()
    {
        Attempts = Attempts + AddAttempts;
        AttemptText.text = ("Attempts: " + Attempts.ToString(""));
        Attempts = PlayerPrefs.GetInt ("Attempts");
        PlayerPrefs.GetInt ("Attempts");
    }

    void Update()
    {
        AttemptText.text = ("Attempts: " + Attempts.ToString(""));
        PlayerPrefs.SetInt ("Attempts", Attempts);
    }
}

I Am Trying To Add a Attempts System In My Game, Every time a user will restart a level the game will add one attempt, however because when restarting the level it uses the code

SceneManager.LoadScene (SceneManager.GetActiveScene ().name);

It doesnt save the int meaning that its keeping the attempt counter on 1, can anyone help, Thanks.


texts: Unity - Read pixels of camera into memory

texts:
I am trying to develop a bot in a Unity game that takes actions based on the image produced by the camera.

I have attached a camera to the "face" of the bot, which is the camera I need to get the image of. For instance in the following picture I have run the bot and taken a screenshot. For every frame update I need to read the pixels that would be shown on the screen into memory.

How do I do that?

Ultimately I would like the bot to run in batch mode without graphics if possible, as this would speed up the process of evolving the bot.

Is it possible to read the pixels that a given camera would have shown on the screen even without graphics enabled? If so how?


texts:
Hi I'm trying to get NGUI's HUDtext to display a set of text message one of which being "Try using WASD to move" and displaying "Well done!" upon input of any of the four keys. Unfortunately I'm not well versed in C# and am currently stuck and unsure how to implement this.

using UnityEngine;
using System.Collections;
using System;

//public KeyCode KeyCode.Alpha2;

public class Test : MonoBehaviour {

    public int seen = 123;
    public HUDText hudText;

    void Start() {

        StartCoroutine(MyCoroutine());
        //Debug.Log(KeyCode);
        Tutorial ();

    }

    void Tutorial() {

        while (true) {
            while (!Input.GetKeyDown(KeyCode.Return)) Debug.Log ("Hit return");
        }

    }

    IEnumerator MyCoroutine() {

        hudText.Add("Welcome", Color.white, 3f);
        yield return new WaitForSeconds(3);    //Wait one frame

        hudText.Add("This is System Defence", Color.white, 4f);
        yield return new WaitForSeconds(4);

        hudText.Add ("Try using WASD to move", Color.red, 3f);
        yield return new WaitForSeconds(3);

    }

}

I would appreciate it if someone could tell me how would I go about doing this.


texts: Implementing tile-based movement on 2D platformer

texts:
I'm trying to make a cinematic platformer, in the veins of the first two Oddworld games, Flashback, Prince of Persia, Blackthorne and so on. This article describes very well how this kind of movement should work:

  (...) The algorithm is then as follows:

  Create a copy of the character where he’d like to move to (e.g., if moving one tile to the right, make a copy where every tile of the
  character is shifted 1 tile to the right)
  Check that copy for intersection with the background and other characters.
  If an intersection is found, the character’s movement is blocked. React accordingly.
  Otherwise, the path is clear. Move character there, optionally playing an animation so the transition looks smooth.

  This kind of movement is very ill-suited for traditional arc-shaped
  jumps – so games in this genre often have no jump at all (Toki Tori,
  Lode Runner), or only allow vertical or horizontal jumps (Prince of
  Persia, Flashback), which are nothing but special cases of linear
  movement.

Eventhough the idea seems very clear to me, the actual implementation of it raises a lot of questions in my mind. For some of them I feel I have very complicated solutions, while I have no idea how to solve others.

For starters, the basic mechanism for moving: if the player presses right, the character will enter a "walking right". While on that state, the character will move from the starting tile until the next one, even if the player releases the right key; if the player is still pressing the key when the character reaches the next tile, the same thing will happen. However how exactly should that movement inbetween tiles work? Should it be just a regular speed being applied to the character's x position? What should that speed be in order to assure that the character will stop in the precise location in the next tile? And should that speed work with the update's delta time?

Another thing that has me at a loss is how much of the sprite's positioning has to be done by the actual x,y positioning and how much should be done inside the sprite. For example, in the case of a running jump, which is, as noted, a special case of linear movement, should there just be empty space below the character (and position the sprite by its bottom) or should the y position be adjusted accordingly?

I'd really appreciate some help with implementing this kind of platformer. That article above is the only thing I've found that sheds any light on how to do it, and I'm struggling to figured out the rest on my own.


texts:
I am quite new to 3D graphical programming and thus far only understand that normal somehow define the direction in which a vertex faces and therefore the direction in which light is reflected. I have now idea how they are calculated though, only that they are defined by a Vector3.

For a visualizer that I am creating I am importing a bunch of coordinate which represent layer upon layer of line segments. At the moment I am only using a vertex buffer and adding the start and end point of each line and then rendering a linelist.

The thing is now that I need to calculate the normal for the vertices of these line segments so that I can get some realistic lighting. I have no idea how to calculate these normal but I know they all face sideways and not up or down. To calculate them all I have are the start and end positions of each line segment. The below image is a representation of what I think I need to do in the case of an example layer:

The red arrows represent the normal that should be calculates, the blue text represent the coordinates of the vertices and the green numbers represent their indices.

I would greatly appreciate it if someone could please explain to me how I should calculate these normal.


texts: Can you download the XNA Connect app in US so I can deploy to Xbox 360?

texts:
I've got an XNA Creators Club trial membership via DreamSpark, but I cannot download the XNA Game Studio Connect app due to a bug in the site. Users from Finland and US experienced this before and MS fixed something in the Marketplace configuration that enabled them to download this. You need this app to deploy apps to Xbox 360 during development.

Can someone with a Creators Club account please download this app for me and upload it someplace?

I'm legal since my account on App Hub shows Registered, Student, and Premium Member.


texts: What is the differencen between ccTouchesEnded and ccTouchEnded

texts:
I'm learning cocos2d-x. Following the tutorial I found that ccTouchesEnded works perfectly in linux (and windows) but when I replace by ccTouchEnded the event isn't detected anymore.

What are differences between this two functions? And why one is detected and the other isn't.

Taking the HelloWorld project sample as a base, I add the following lines in init()

this->setTouchEnabled(true);
this->schedule(schedule_selector(HelloWorld::updateGame));

Also, add this method to my code:

void HelloWorld::registerWithTouchDispatcher()
{
    // TouchDispatcher::sharedDispatcher()->addTargetedDelegate(this,0,true);
    Director::getInstance()->getTouchDispatcher()->addStandardDelegate(this,0);
}

Then if I add ccTouchesEnded like this:

void HelloWorld::ccTouchesEnded(Set* touches, Event* event)
{
    // Choose one of the touches to work with
    Touch* touch = static_cast<Touch*>( touches->anyObject() );
    Point location = touch->getLocation();

    log("++++++++after  x:%f, y:%f", location.x, location.y);
}

it works perfectly but if I use ccTouchEnded as:

void HelloWorld::ccTouchEnded(Touch* touch, Event* event)
{
    Point location = touch->getLocation();

    log("++++++++after  x:%f, y:%f", location.x, location.y);
}

The events aren't fired.

Any help is welcome
Thanks!!


texts: What is the difference between phy_position_x and x in GameMaker: Studio?

texts:
This is not covered anywhere in the documentation that I can find.

I am using the physics engine, and the reported phy_position_x and x values are different, such that (phy_position_x, phy_position_y) is (0, 0) and (x, y) is (origin x, origin y).

Why are they different and is one preferred over the other in code?


texts: Distance from capsule center to point on the surface

texts:
this question is engine agnostic, I will use the term "object" to refer to entities in my scene.

The scenario is the following:

I have 2 entities
Entity O is a capsule
Entity C is a point

I want to move B toward A's center but stop on A's surface in the less computationally expansive way I can think about.

I figured I'd work out the distance between the center of the capsule and the point on the surface where I should stop and use it as an offset to my destination point (destinationPoint -= direction * computedDistance), but I don't know how to find that distance.

My question is: can you come up with a better way to achieve my goal and if not can you solve the problem I've stumbled upon in my solution?

This is a representation of the secondary problem. In the figure I know the coordinates of C, O, A, B, and I want to know the length of PO or the coordinates of P.


texts:
How are games created for different platforms?

For example, Call of Duty: Modern Warfare 3 is available on PS3, Xbox 360, Wii and PC.

Are they completely reprogrammed with no common code? Is there any intermediate code?


texts: Change Unity 3d viewport shortcuts to match Blender?

texts: The shortcuts in Unity are more similar to Maya (Alt+Middle for 3d orientation, LeftClick select, etc). I've looked into Edit -> Shortcuts but couldnt find them. Is there any way to do this?


texts: 3D Level Navigation Map for a 2D Mobile Game

texts:
I am currently making a game in which I want to create a level screen map. The Map doesn’t have to do anything with the game logic and stuff but I just want to add it to include a bit of richness.
The Map I am planning to add will be a 3D map. I just want to know how I can use a 3D map for usage in a 2D game. What is the best approach to get started with? I have tried iTween’s Tweening stuff to Animate and control camera over a spline curve but I am not sure what can be the best approach for it?
The Map will be just a set of levels/point in which the initial need to clear before you go to the next.


texts: How to save an arbitrarily large image to a file in XNA?

texts:
I have built a level editor for an XNA-based Megaman clone I am working on and one of the features I would like to implement is the ability to save a full-resolution map of the entire level (like this one). My problem is that the levels can be arbitrarily large and XNA has a texture size limit of 4028x4028. I don't need to use the texture for anything in the editor itself, only to save it to disk.

I have stored the image data in an array using game.GraphicsDevice.GetBackBufferData, but I am having trouble finding a way to store this to disk in a readable format (preferably PNG). Everything I've found online says to use the Texture2D.SetData and Texture2D.SaveAsPng methods, but those calls are restricted to the 4028x4028 max texture size.

Any suggestions?

Note: I do realize that the example map I linked above was likely created by hand and while I could certainly output multiple full-resolution images of each screen and put them together by hand in Photoshop, I would like the process to be available directly in the editor if possible.


texts:
Think portal 2, where a laser can go through a cube, and depending on the rotation of that cube, it will redirect it. Examples:

Here is my barely functioning code. It works for one cube, I'm able to get the original (source) laser to hit any 'redirect' cube, then I'm able to cast a line renderer and change the rotation.

Problem comes when I try to use the redirect laser to hit another redirect cube, I can't figure out how to make this code work for multiple cubes hitting off each other.

using UnityEngine;
using System.Collections;

public class outLaser : MonoBehaviour
{
    public sourceLaser1 reference; //referring to another class that has the original (source) laser

    LineRenderer redirectLaser;
    RaycastHit redirectHit;

    void Awake()
    {
        redirectLaser = GetComponent<LineRenderer>();

    }

    void Update()
    {
        if(reference.sourceHit.collider.gameObject == transform.parent.gameObject)
        {
            if(Physics.Raycast(transform.position, -transform.forward, out redirectHit, Mathf.Infinity))
            {
                redirectLaser.enabled = true;
                redirectLaser.SetPosition(0, transform.position);
                redirectLaser.SetPosition(1, redirectHit.point);
            }
        }
        else
        {
            redirectLaser.enabled = false;
        }
    }
}

Tried many different solutions, all with no avail.

Here's what it looks like:

EDIT: I've gotten this far

    if(reference.sourceHit.collider.gameObject == transform.parent.gameObject)
    {
        if(Physics.Raycast(transform.position, -transform.forward, out redirectHit, Mathf.Infinity))
        {
            redirectLaser.enabled = true;
            redirectLaser.SetPosition(0, transform.position);
            redirectLaser.SetPosition(1, redirectHit.point);

            //Logic that allows redirect cube to accept redirect raycasts
            cubeThatsHit = redirectHit.collider.gameObject;

            if(cubeThatsHit.gameObject.tag == "Redirect")       //if the cube that is hit is a redirect cube, do this
            {
                   //This is where I need the logic
            }
        }
    }
    else
    {
        redirectLaser.enabled = false;
    }


texts: Reach concrete, numerical values for certain car values, in a car game

texts:
I am developing a rather complicated racing car management browser game, but I think this applies to any car game.

I have 10 values. Power, acceleration, etc. that can be easily quantified by using available data (hp, 1-100 kmh time). All is well, but I have 4 values (Handling, Braking, Transmission, Front/Back-Weight) that I'm not sure how to quantify.

Would I just say X car has Y brakes were Y = 20 (arbitrarily decided because I think this car brakes Y well) and then put it in a formula with car power and weight to reach this value, or does anyone have a better solution?


texts:
I am to a point on my vehicle where, when im going fast and turning, the vehicle acts weird because the inside tires are moving faster than the outside tires. So i need to figure out how to program in a differential but I can't seem to get it working properly so I am here to see if anyone has experience with this.

I have checked online for the physics but that seems to take more info into account than i can supply in my game (like real gravity influence on the vehicle). Currently I use the following logic to determine the differential wheel speeds. I will try to explain as clearly and simply as possible so I apologize if it is confusing or over-simplified, its confusing to me!

Here is what i do:
I divide my current turn degree by the max turn amount to get a percentage, I then take that percentage and apply that to a modifier percentage (just a percent i have made up and been tweaking to reduce the number passed to the differential, not sure what this should really be. Engine speed? Velocity?). Then in my differential, I check to see if the vehicle is turning left or right and reduce the speed on one side by x% and increase the speed on the other side by the same x%

I'm certain that my biggest problem is the number i'm making up to reduce the turn percent but I cant tell what to put there. I know that directly passing the turn % to the differential (say, 40%) would reduce one side by 40 and increase the other by 40 and that is clearly not right.

I have access to the engine speed, transmission, each wheels axle speed, torque, vehicle velocity, etc but I am not sure which of these i should take into consideration when doing this formula.

Maybe I am over complicating it or maybe i am over simplifying it. Any help in understanding this would be great!


texts: Multiplatform game, save game state and resume it on other platform

texts:
This is for a personal and knowledge acquiring project.

I want to create a little TIC-TAC-TOE multiplatform game, app & web. The choosen technology for the app will be Android or Flutter and for the web Angular.

My doubt is, during a game if the user wants to change from the mobile version to the web version, how to resume or change the game to the web application? What would be the best way to save the game state and load it into the other platform? Having in consideration that the user will play only in one platform at a time, which is the best way to implement this restriction too?

Is this as simple and hard at the same time as implementing all controls in both platforms and storing all the data required in the database?


texts: How to implement special weapon and armor effects (ex: vampiric, holy, damage shield, thorns)?

texts:
I'm working on the inventory system for my game, and am interested in how do I implement additional weapon and armor properties that are not just damage or armor?

If all I have is damage and armor, the equation is simple: damage = weapon damage - armor;

But I'm looking for a more interesting user experience - namely items that have 2-3 properties that modify various game mechanics.

For example, I can use a bunch of flags and write a big if/else statement in my attack method and check for all these at appropriate points:

if (weapon is vampiric)
{
heal attacker for x
}

if(weapon is holy)
{
check defender type, add extra damage
}

if(armor absorbs first x damage)
{
reduce damage to defender by x
}

Another way that I thought might be better is the decorator design pattern - progressively wrapping the output of one weapon creation into another :

public class Main {

    public static final void main(String[] args) {
    Weapon w = new MeleeWeapon();

        w = new Holy(w);
        w = new Vampiric;
        w = new Enchanted(w,1);

        Damage damage = w.damage();

    }

}

It seems to me that decorator would allow me to write more flexible code and add more types later, but I'm not sure if it will just move the if/else statements into the weapons special property method.


texts: I'm curious about the best way to display cutscenes in canvas. When I say cutscene I mean something like a static image fading from one to the other. Would it be best to use a timeout for a certain amount of seconds then go to the next image? Alternatively, would it be better to somehow use the main loop and increment a counter? If anyone has a method they use, post an answer! :D


texts: Zoom at a specific point using Orthographic camera

texts:
Currently I can perform Zoom which seems to be working fine but essentially what I'm really trying to do is zoom on a position offset from center as currently when I zoom then zoom is performed at the center.

Not sure how to achieve this ?

One way i'v though is either not use the orthographic camera and rather clip the texture, so that the my clipped texture will be drawn onto my directx surface covering the entire view. I could possibly perform the clipping using a constant buffer but then that would stretch the entire clipped texture over my viewport area.

Any suggestions on the above ?

I'm using Directx11, SharpDx with D3DImage & C#.

Do note: I'v created my vertexes directly screen co-ordinates.

Edit:

    this.eye = new Vector3(0.0f, 0.0f, 0.0f);
    this.lookAt = new Vector3(0.0f, 0.0f, 1.0f);
    this.up = new Vector3(0.0f, 1.0f, 0.0f);
    viewMatrix = Matrix.LookAtLH(eye, lookAt, up);

NOTE:
My application isn't a game but rather a video player


texts:
I was wondering if someone has read both the:

iPhone 3D Programming

And

OpenGL ES 2.0

books and have an opinion if one is better than the other?

I'm basically wanting to get into doing 3D graphics on iOS including shaders.


texts:
I'm working on an RTS and there is a lot of camera movement involved. The camera moves at a constant speed but it stutters (seems to jump/jerky movement) if I don't enable vsync. I understand why this is happening, if the game is running at 74 frames per second then 14 (my refresh rate is 60 Hz) frames will be ignored/skipped. If the camera moves 10 units between two consecutive frames then a skipped frame means a movement of 20 units instead which makes the movement jumpy.

My question is how do other games manage to keep their movements smooth even at odd frame rates and fluctuations?

I've not included the code because I've ran numerous tests and I believe the code itself is fine. I've also read this article and am using the suggested game loop. Cheers!

Edit: Thank you for the suggestion Lachlac and Mr. Beast. I changed my code to use delta time instead but the movement is still jerky at 70 frames per second.

while(main_event->type != SDL_QUIT)
{
    last_time = current_time;
    current_time = get_tick_count();
    delta = current_time - last_time;

    SDL_PollEvent(main_event);

    if(rect_data.x < 101) vel_x = 600;
    if(rect_data.x > 1300) vel_x = -600;

    rect_data.x += vel_x * (delta / static_cast<double>(frequency));

    SDL_RenderClear(renderer);
    SDL_RenderCopy(renderer, rect_texture, NULL, &rect_data);
    SDL_RenderPresent(renderer);
}

I've tried both fixed and variable time steps and they produce the same jerky motion. I'm guessing it's because of frames being skipped but I've included my code in case I'm doing something silly.

Edit 2: For eBusiness:

I have my physics set to 120 Hz and I'm also interpolation between the last and current game state. Each time the renderer rendered, I made it output the displacement in the render position from last frame to the current frame and also the time difference between last and current frame. Here is some of the data:

10              -0.0159823
10              -0.0160441
9               -0.0158394
9               -0.0150374
9               -0.0150993
10              -0.0160116
9               -0.0159414
10              -0.016037
10              -0.0159659
9               -0.0160212

The data was very consistent, it's just that if a frame is skipped because of the refresh rate then instead of moving 9 or 10 pixels, it'll move about 20 pixels which results in the jumpy motion. I also tried to ignore the interpolation value and just use the latest game state and that didn't help either.

Using variable time steps also have the same problem, the displacement and time difference is consistent and frame skips again ruin the smoothness.