texts:
I'm creating a game using OpenGL (via SDL) and C++ (via Visual Studios 2010 Professional). During the game, I will be using 3D character animation. I'd like to use wavefront *.obj files for all the 3D models (with the exception of terrain). The characters will need to have fluent movements (realistic), with as many as 250-500 frames (for walking, running, sprinting, jumping, crouching, crawling, etc.). I'd like to use either md2 or md3, but the 3D modelling/animation tool I'll be using (Blender 3D 2.57) doesn't support either one. The game will only be running on Windows.

What I need is a small yet powerful *.obj loader and parser that supports animation. It must be written in C++ and be usable by SDL.

Thanks

Alright, after looking at all the file formats that Blender can export to...I've decided to go with 3DS because it produces the smallest file format when I export the default cube. Thanks @Daniel For recommending 3DS!


texts: Where do you search/look for game developers for an indie game startup?

texts:
I just recently saw stackoverflow had a game dev sister site so here I am, wondering if you experienced fellows know where one can search/look for game developers for an indie game startup? In other words:

I have a game idea which I've written down with as much detail as possible (so anyone else can understand how it works) and now I'm looking for a heavy php programmer with whom to pair up in order to go from idea to reality. I'm a front-end/interface designer and an intermediate programmer. I recognize my project requires heavy programming skills which I do not have as of today =)

So, what websites, communities or places do you recommend I go look into? Where do good programmers interested in indie games go look for projects if they don't have their own?

Thanks in advance
G.Campos


texts: How to calculate Pong ball's expected position perfectly (taking wall bounces into account)

texts:
I'm writing a Pong clone where the player has to type a word in order to move the paddle. Because of this, I need a way to calculate the position of the ball immediately after it hits the CPU's paddle. For each letter the player types correctly, the paddle will move a little bit so that when the player finishes the word, the paddle is waiting for the ball to come. It needs to be very accurate, and relatively fast.

I was considering just simulating a much faster ball and figuring out where it will end up (the time it arrives is not important, but the position is). I'm worried that I'll run into problems down the line when the game speed starts ratcheting up, and the actual ball is going as fast as the simulated one. This normally wouldn't be an issue, but the way the whole typing thing works kinda relies on it.

The tough part of just using an equation to find the ball's position is the existence of walls. An equation would be preferable to a quick simulation/extrapolation but I fail to see how it would be done.

Thanks so much for any insight.


texts:
How can you rotate a quad around its center?

This is what I am trying to do but it is not working:

    GL11.glTranslatef(x-getWidth()/2, y-getHeight()/2, 0);
    GL11.glRotatef(30, 0.0f, 0.0f, 1.0f);
    GL11.glTranslatef(x+getWidth()/2, y+getHeight()/2, 0);
        DRAW

my main problem is that it renders it off the screen..

draw code:

    GL11.glBegin(GL11.GL_QUADS);
    {
        GL11.glTexCoord2f(0, 0);
        GL11.glVertex2f(0, 0);
        GL11.glTexCoord2f(0, getTexture().getHeight());
        GL11.glVertex2f(0, height);
        GL11.glTexCoord2f(getTexture().getWidth(), getTexture().getHeight());
        GL11.glVertex2f(width,height);
        GL11.glTexCoord2f(getTexture().getWidth(), 0);
        GL11.glVertex2f(width,0);
    }
    GL11.glEnd();


texts: Cocos2d-x Finding if a CCPoint is inside a sprite rect

texts:
I'm afraid that I'm missing something. This is what I've done:

I've made a scene using layers (Gimp), then I've exported the layers
with the image size, that way I thought would be more easy to add
the images and have the offsets in the right way.
I made a spritesheet with TexturePacker, trimming the images.

Then I have in the plist file something like:

<dict>
   <key>frame</key>
   <string>{{1028,360},{326,382}}</string>
   <key>offset</key>
   <string>{-316,110}</string>
   <key>rotated</key>
   <false/>
   <key>sourceColorRect</key>
   <string>{{33,83},{326,382}}</string>
   <key>sourceSize</key>
   <string>{1024,768}</string>
</dict>

Then in my code I've made a CCSprite:

granero = CCSprite::createWithSpriteFrameName("04_Granero.png");
capaGrafica->addChild(granero);
pDirector->getTouchDispatcher()->addTargetedDelegate(this, 0, false);

And the ccTouchBegan:

bool Escena00::ccTouchBegan(CCTouch* touch, CCEvent* event)
{
    // This point has the touch location info
    CCPoint touchPoint = CCPoint(touch->getLocationInView().x, touch->getLocationInView().y);

    // Now I want to set a rect, where a little house in the screen is located
    CCRect *graneroRect = new CCRect(granero->getOffsetPosition().x, granero->getOffsetPosition().y,granero->getTextureRect().size.width,granero->getTextureRect().size.height);

    if (graneroRect->containsPoint(touchPoint))
    {
        CCLog("The little house in the left was touched");
    }

    return true;
}

If you take a look now to the plist extract that I've posted you'll read the "sourceColorRect" key. Those coords are the right numbers that I need to use to create my CCRect (33,83, 326, 382). With those numbers I've been able to correctly get the touch over the little house.
However, I don't want to use those numbers with a "hard way".
Using granero->getOffsetPositionX(), I get the "33" number, and using the "getTextureRect()" I can get the third and fourth numbers (size of the rect).
The big issue is the getOffsetPositionY(), or any "y" coordinate. I can't read the "83" number. How can I solve this? Or what am I doing wrong?

Thanks a lot in advance.


texts:
How do I know when I need to use c++, instead of Java, C#, pythonor something else?  All I read is that "when you do real game making" you use C++.  I put the word "real" because that is the feeling I get after reading many articles.

The games in question are for the desktop, Windows in particular.  No genre.


texts: Move car to coordinate with considering z-angle

texts:
I have such question:

I have a car, her coordinates (x, y, z) and z-angle (from 0 to 360 degrees).

And i have x, y, z of checkpoint.

how to calculate the angle to which need to turn the car to get to the point, taking into account its direction?

something like that:

Sorry for my English :D


texts: I want a single line of code which shows a popup dialog with the words "Hello World!" and an "Ok" button.  (I want something simple for now, I know how to make something more complicated but that would be stupid at this point in development).


texts:
I'm making a sky gradient in OpenGL by drawing with glColorPointer and glDrawArrays. I would like to be able to change the sky colour from morning to daytime to evening etc. I can either:

Make a number of sprites and fade them in with my framework
Somehow tween the color vector in openGL over time and use a single sprite

The second one seems like a more efficient option, but my framework doesn't pass the time delta into the draw method for me to decide how far I've progressed into fading.

Here's my current code:

glDisable(GL_BLEND);
glDisable(GL_DITHER);
glDisable(GL_FOG);
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);

CGSize size = [[CCDirector sharedDirector] winSize];
float w = size.width;
float h = size.height;

const GLfloat vertices[] = {
    0, 0,
    w, 0,
    0, h/3,
    w, h/3,
    0, h*2/3,
    w, h*2/3,
    0, h,
    w, h,
};

const GLubyte colors[] = {
    254,255,134,255,
    254,255,134,255,
    230,157,0,255,
    230,157,0,255,
    230,60,0,255,
    230,60,0,255,
    167,0,86,255,
    167,0,86,255,
};

glVertexPointer(2, GL_FLOAT, 0, vertices);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, colors);
glEnableClientState(GL_COLOR_ARRAY);

glDrawArrays(GL_TRIANGLE_STRIP, 0, 8);

glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);

glEnable(GL_TEXTURE_2D);

Which gives me:


texts:
I am working on trying to add a coin system to my game. I have it setup right now so that when the player hits a coin the score text goes up by 1. I have setup a reference in the script, which is attached to the coin, to the score text in my scene. In the game the player can click a button that will switch between two lanes to avoid enemies. These lanes are infinte and in these lanes is where I put the coins. And when a new lane is created the reference to the text disappears from the coin and teh tect does not change. I am not sure why the reference is disappearing.

Here is the coin script that is on the coin

public int scoreToGive = 1;

public Text coinText;

void OnTriggerEnter2D(Collider2D other)
{
    if(other.gameObject.tag == "Player")
    {
        AddScore();
    }
}

public void AddScore()
{
    TheScore.theScore++;
    if(coinText != null)
    {
        coinText.text = TheScore.theScore.ToString();
    }

    Destroy(gameObject);
}

void Update()
{
    coinText.text = GameObject.FindGameObjectWithTag("Ui").ToString();
}

}

Thanks to anyone who can help!


texts:
How is this handled?

https://www.youtube.com/watch?v=egk3yD1w4Wo

It's some form of kinematics which I kinda understand and I have a very solid grip of trig, but I don't know how to start with having both hands attached to a single weapon with each arm moving independently and the torso also moving to accommodate extreme angles. How would one keep the gun completely static (It appears to have an origin/rotation point at the shoulder) while having the arms bend with the hands static on the gun?

Is the gun rotated to point at the mouse and that motion propagates back through the arms? Or does it figure out where the gun needs to be pointed and then rotate the arms to match?

How is the movement handled for the torso? Is the torso only rotated when the arms reach a limit?

etc.

As you can see I have a lot of questions. I'd just like a starting point to begin with, or someone to suggest a way to approach it all. An example or tutorial would be great if you could point me to one.

What I'd like to avoid is using a third party program like DragonBones, Spriter or Spine. I'd like to start at the beginning of the problem to get a fuller understanding of it all.

Thanks!


texts: Normalization of Vectors: Return a copy of the result or alter the object itself?

texts:
When calculating the normal of a vector, which is considered canon:

Returning a copy:

Vector2D Vector2D::Normalize() const {
    double a1 = GetX();
    double a2 = GetY();
    double a3 = GetZ();
    double length = GetLength();
    assert(Math::IsEqual(length, 0.0) == false);
    if(Math::IsEqual(length, 0.0)) {
        throw Exception("Can not normalize a Null Vector.");
    }
    return Vector2D(a1 / length, a2 / length, a3 / length);
}

Or altering the object itself?:

void Vector2D::Normalize() {
    double a1 = GetX();
    double a2 = GetY();
    double a3 = GetZ();
    double length = GetLength();
    assert(Math::IsEqual(length, 0.0) == false);
    if(Math::IsEqual(length, 0.0)) {
        throw Exception("Can not normalize a Null Vector.");
    }
    SetTerminal(a1 / length, a2 / length, a3 / length);
}

P.S.
IsEqual verifies the following: (std::fabs(a - b) <= 0.0001)


texts:
I'm working on a game that will have lots of (more than 100) levels. The player has to finish a level before she can play the next one, but also can play levels again that are already finished.

Now I'm looking for ways on how to present an overview of the levels to the player. A simple list (with a small graphic showing the level) is of course a possibility, but I wonder what other, perhaps less boring, ways there are.


texts:
So I am making an "Asteroids" like game and I can principally get my sprites image to rotate but when I do, the image gets kinda torn apart. This is the method I am using for rotation. Any help would be appreciated.

  def turnLeft(self):

   rotatedSurf1 = pygame.transform.rotate(self.image,10)
   rotatedRect1 = rotatedSurf1.get_rect()
   rotatedRect1.center = (25,25)
   self.image.blit(rotatedSurf1,rotatedRect1)


texts: Play Protect Doesn't recognize this app's developer

texts: I am a game developer. This message is displayed when installing my game. what is this? and how to solve this problem?


texts: Is there a repository of game logic algorithms?

texts:
I'm writing my first 2D game, and I'm writing some tracking logic for the computer enemies. Basic follow-the-player tracking was easy, but ineffectual. Too easy to escape. So I'm trying to implement some more sophisticated flanking and other tactics, and (as expected) it's pretty tricky. This is a topic I know nothing about.

I'm going to keep trying, but it'd be awesome to have some examples or tips to work off of.

Is there any place that has a decent set of pseudocode AI algorithms, or tips or advice on the subject, e.g. for 2D tracking?


texts:
I've got an editor script in Unity 5 that uses the cursor position in the scene view to change objects in the scene when you press the space key. This all works perfectly, except that Unity thinks that space isn't a valid key to press, so it makes the system "boop" sound to let you know that it's invalid or that nothing happened.

So, focus is on scene view, I press space, my script triggers, and the mac system "boop" sound activates. It spams the sound if you hold it down. Is there a way to:

Disable the system boops in Unity

or

Add space to registered hotkeys / stop unity from triggering the system sound for a specific key

(just to be clear, the script works, I'm just wondering about disabling the sound)


texts: Multiple IF statements on Update (Unity)

texts:
Background

I am testing out a "Pause" system for my game. I have a Game Manager script and figured as it's the GM, it's a good place to stick a Pause system.

My pause works that on pressing "P" key, the timeScale is switched between 0 and 1.
Due to the nature of the game, if the game is paused and then unpaused I want the timeScale to not "jump" to 1 but to gradually increase, taking half a second to reach "normal" game speed again.

This aspect is NOT my issue. This is just background.

My Code:

I have the pause detection in the Update script. I figured two if statements to check Timescale values and then to take appropriate action.

(SloMoTime is a timescale that kicks in when the player wins or looses the level)

My Code:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class GManager : MonoBehaviour
{
    public float sloMoTime = 0.2f;
    public bool ballInPlay = false;

    ....

 void Update()
     {
     if(Input.GetButtonDown("PauseGame") && ballInPlay == true)
     {
         if (Time.timeScale == 0)
            {
            //Game is already paused, so now continue...
            // dactivate "paused" text notice
            paused.SetActive(false);
            /***
             * Becauase we are speeding time up we can't use deltaTime
             * Easy as the timescale we want is 0.5f so 1/0.5 == 2. So use 2.
             ***/
            Time.timeScale = Mathf.MoveTowards(Time.timeScale, 1.0f, 2f);
            }
        if (Time.timeScale > slowMoTime)
            {
            //Pause the game.
            Time.timeScale = 0;
            // Show "paused" Text notice.
            paused.SetActive(true);
            }
        }
    } //end Update.
} //close class.

Now, Can you see any major issues here?

My Issue

I found running my script from above, that the game did not pause.

I expected every frame to load Update, then to check IF number 1, and then check If number 2 (hence in that order).  then continue.

I found using error logs that by swapping the If statments around that only the first if statement was ever executed. So the game would alternatively always pause but then never unpause. I additionally found with error logs that the values of TimeScale where not causing this inconsistency.

What I have trouble with is understanding why this happens. Why do two completely mutually exclusive IF statements not both fire, when in the same method?

FAILS:

Class {
    void Update () {
       if(){
          //works
       }

       if(){
         //never works
       }
   } //close method.
}

A Solution

BUT putting the second IF statement within an else solves this issue.

WORKS:

Class {
    void Update() {
       if(){
          //works
       }
       else if(){
         //works
       }
   } //close method.
}

Obviously this is impractical for more than a few ifs at once and I find it hard to understand why this logic works and the previous logic never did.

I havn't yet dug into if this is Update or timeScale (entity rather than value) specific but Why does this happen?


texts:
I'm making some tests with OpenGL ES 2 and got some questions, my current program is like that:

Init
-------
-> create index buffer
-> fill index buffer glBufferData …
-> create vertex buffer
-> fill vertex buffer glBufferData …

Draw
-------
 1. Apply vertex buffer

    -> Bind VAO
       -> bind vertex buffer
          - enable attributs (glVertexPointer, …)
       -> unbind vertex buffer
    -> Unbind VAO
    -> Bind VAO

 3. Apply index buffer
 4. Draw

The problem

The given code crash, after some researches, I've understood why: I need to unbind my index buffer in init part (after "fill index buffer glBufferData") or unbind it before the first "Bind VAO"

My questions are:

Can I put my index buffer in VAO (VAO stock index buffer?)?
Did I have to unbind buffers after each update (glBufferData)?

In my application I've got some buffers who are updated on each frame (Exemple: Particles) so I've got an OpenGL stack like that:

-> bind buffer 1
-> update buffer 1
-> close buffer 1
-> bind buffer 1
-> draw

First 3 lines update the Vertex buffer, the two last draw object, that should be something like that:

-> bind buffer 1
-> update buffer 1
-> draw

Thanks


texts: Managing Unity Scenes during refactoring?

texts:
Most of my Unity project code is in a visual studio project, and I use Unity for UI/Rendering/wiring things together.

I renamed some fields in an object and suddenly the game, when run in unity, became unrunnably buggy. It turned out that a field I had set in the unity frontend had been unset when I renamed it.

What's a good way to avoid these sorts of problems when working with unity? I was using version control and could have reverted to an old build in the worst case, but I couldn't find any human-readable Unity Scene files that could have just shown me what I changed.


texts:
I need to know the best way to calculate an outcome between 2 types of units. Each unit has 3 factors: Health, AttackPower, Defense

There is also a last factor of anti-troop which says that one trooper is better against a certain type. So this factor must be taken accounted for.

Can someone help me with this  ?

Kind regards

Example

Unit1(attacker):

 Amount: 40
 Health/Unit: 10
 AP/Unit: 5
 Defense/Unit: 2

Unit2(defender):

Amount: 20
Health/Unit: 10
AP/Unit: 5
Defense/Unit: 2

How can I get a right outcome of who wins and with how many units left.


texts: Enemy sprite moving to a specific way depending on how it spawns

texts:
So I have a code where the sprite spawn outside the window and I want it to move on a specific straight line depending on where it spawn say if the sprite spawn at the top it goes at the bottom and vise versa if the sprite then spawn to the left it will go right and vise versa.
Game1.cs code:

 public class Game1 : Game
 {
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    Player player;
    List<Enemy> enemies = new List<Enemy>();

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
    }

    protected override void Initialize()
    {

        base.Initialize();
    }

    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
        //player
        Texture2D playertexture = Content.Load<Texture2D>("Player");
        player = new Player(new Vector2(350, 175), playertexture);

        //enemy
        Texture2D enemytexture = Content.Load<Texture2D>("Enemy");
        Random random = new Random();
        var width = GraphicsDevice.Viewport.Width;
        var height = GraphicsDevice.Viewport.Height;

        for (int i = 0; i < 20; i++)
        {

            enemies.Add(new Enemy(new Vector2(random.Next(width, width + 100), random.Next(0, height)), enemytexture));
            enemies.Add(new Enemy(new Vector2(random.Next(0 - 100, 0), random.Next(0, height)), enemytexture));
            enemies.Add(new Enemy(new Vector2(random.Next(0, width), random.Next(-100, 0)), enemytexture));
            enemies.Add(new Enemy(new Vector2(random.Next(0, width), random.Next(height, height + 100)), enemytexture));
        }

    }

    protected override void UnloadContent()
    {

    }

    protected override void Update(GameTime gameTime)
    {
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            Exit();
        foreach (Enemy enemy in enemies)
        {
            enemy.Update(gameTime);
        }
        player.Update(gameTime);

        base.Update(gameTime);
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        spriteBatch.Begin();
        foreach (Enemy enemy in enemies)
        {
            enemy.Draw(spriteBatch);
        }
        player.Draw(spriteBatch);

        spriteBatch.End();

        base.Draw(gameTime);
    }
}

Enemy.cs

class Enemy
{
    Texture2D enemytexture;
    Vector2 enemyposition;

    public Enemy(Vector2 enemyposition, Texture2D enemytexture)
    {
        this.enemyposition = enemyposition;
        this.enemytexture = enemytexture;

    }

    public void Update(GameTime gametime)
    {
        enemyposition.X++;
    }

    public void Draw(SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(enemytexture, enemyposition, Color.White);
    }
}

I wonder if I can do this in a way?

enemies.Add(new Enemy(new Vector2(random.Next(width, width + 100), random.Next(0, height)), enemytexture, enemyposition.X++));


texts:
Video of behaviour:  https://youtu.be/yC5m6k3jf2o

The worm sprite in my Scene Editor is rendered correctly.

When it's in the play window it's getting cropped on the bottom an right though/

I've tried completely deleting the worm and re-adding it and the problem is still there.

The Import Settings are:

Texture Type:  Sprite (2D and UI)
Texture Share:  2D
Sprite Mode:  Multiple
Pixels Per Unit:  1
Mesh Type:  Tight
Extrude Edges:  1
Generate Physics:  true
Wrap Mode: Clamp
Filter Mode:  Point (no filter)

NB:  Just discovered that if I drag directly onto the Scene Editor then it renders correctly, but if dragged onto the Hierarchy_


texts:
I'm using libGDX for an android game; as far as I can tell, it doesn't have an API for blurring.

Reading on Wikipedia, it seems like blur is formed by setting each pixels RGB values to the average of all adjacent values. Which doesn't seem easily possible in libGDX -- setting pixel data.

So my question is simple:

Is it possible to fake (a decent) blur using only images?

I can potentially overlay multiple (in number, transparency, type) images; but can I create a convincing blur like this?

I'm tempted to say "no," but maybe someone else has achieved something similar. For clarity, I want a set of 1+ generic images I can render on top of ANY image to generate a blur-like effect.


texts:
So I've been following an SFML tutorial but unfortunately, it doesn't seem to be working.  The tutorial shows a RenderWindow as a global variable and then accesses it like this:

LevelState.h:

struct LevelStateAssets
{
sf::Texture img_background;
sf::Texture img_player;
sf::Texture img_enemy;
};

extern LevelStateAssets ls_Assets;

class LevelState : public StateBase
{
public:
    LevelState();
    void Input(sf::Event event);
    void Update(void);
    void Render(void);

private:
    sf::Sprite spr_background;
};

LevelState.cpp:

LevelStateAssets ls_Assets;

LevelState::LevelState()
{
ls_Assets.img_background.loadFromFile("res/images/background.png");
ls_Assets.img_player.loadFromFile("res/images/player.png");
ls_Assets.img_enemy.loadFromFile("res/images/enemy.png");

spr_background.setTexture(ls_Assets.img_background);
spr_background.setPosition(0, 0);
}
/* More unnecessary code in the middle */

void LevelState::Render(void)
{
window.draw(spr_background);
}

But when I do this, I get an error that says: "Unhandled exception at 0x774F3632 (ntdll.dll) in SFMLTutorial.exe: 0xC0000005: Access violation writing location 0x00000004"

If you could help me that would be great!
Thanks for your time! :)


texts: Framework suitable for 3D RTS ala Homeworld?

texts:
I would like to make a game that amalgamates Homeworld and Freespace with inspirations from the novel Ender's game. This is probably not a new idea, but I haven't seen anything  that did anything like it. It would be team based and allows players to control units in an RTS (Homeworld) or first person fashion (Freespace)

I was doing some research on frameworks to help get me started, and my findings are summarized below. I believe one of the hardest parts is going to be UI, which Homeworld did a decent job at, but could be improved slightly.

OGRE: just covers graphics, with plugs for collision detection

Irrilicht: Covers graphics / collision with plugins for Sound. looks dated, though mainly because of aged art assets

Unity: While looks fairly complete, the Free version is feature robbed, and Feels more like a "for artists" tool. I would like to be figuring out programming problems, not where buttons are on menus.

Torque: From what I hear is abandoned.

Are there other obvious choices that I missed?


texts:
So, I've been playing around with the concept of a game, mechanically think of the Civilization games(Tile, turn-based strategy) but I am quite uncertain about where I should store the units location in the code. The tiles exist on a X and Y coordination of integers and that's how I imagine that the unit's would work too.

To clarify, I am unsure what's most effective, if it's example one: To have the tiles have a variable for which units are standing upon it and then when the unit move destroy them and recreate them on the tiles they are moving to.

That way when the tile is clicked it should be very easy to get the unit but it seems like it might be unsafe to remove and recreate units or sending a variable along. This might also be very unpractical when issuing an order to move somewhere, though, I am don't know.

The second example is to add the units to some kind of unit arraylist (or alike) but by that the game would have to find the unit with the right coordinates in said list (right?), this might appear as if the game is unresponsive and slow. Though it might not matter when you sort the list every x interval...

Any other ways to do it, ideas, fixes or even comments from you guys would be much appreciated.


texts: Unrealscript tutorials for self-made maps

texts:
I've been looking up tutorials for UnrealScript, but I'm very confused by what I find.

All tutorials seem to use Visual Studio and nFringe for the coding, plus the UDK editor for the maps.

Every tutorial I've come across seems to assume I want to either modify UT2004 or edit physics. This is not the case. I plan on making some custom maps in UDK with no textures or anything, and script some events for those maps. Lights turning on and off. Doors opening and closing. Walls shifting. That kind of stuff.

As such, the tutorials I've found are confusing and take up a lot of time and configuration I don't understand. Can someone get me on the right path for what I'm trying to do here?


texts: Can I save a score as highscore, if it's a float?

texts:
So I have this infinite runner type of game, subway surfers style. I chose a method where the player doesn't move, and instead the obstacles move towards him.
My score is a float and it increases as time passes.
However, I'm unable to figure out how can you save this as a highscore.
I tried a few methods but most of them were for int so it didn't work out.
Here is what I have for the score counting. It's currently missing the save score part completely.
    public class GameManagerC : MonoBehaviour
{
    float score = 0;
    public float scoreMulti = 5;

    void Update()
    {
        if (isPlayerAlive == true)
        {
            score += Time.deltaTime * scoreMulti;
            scoreText.text = score.ToString("Score: 0");
        }
    }

EDIT: Many of you asked how I tried to implement the code I've found so here it is:
public float score;
public float highScore;

void Start()
    {
        score = PlayerPrefs.GetFloat("score");
        highScore = PlayerPrefs.GetFloat("highScore");
        if (score > highScore)
            highScore = score;
        StartGame();
    }

    // Update is called once per frame
    void Update()
    {
        if (isPlayerAlive == true)
        {
            score += Time.deltaTime * scoreMulti;
            scoreText.text = score.ToString("Score: 0");
        }
    }


texts: How to interact with object in HTC-vive Unity

texts: I just start to learn HTC vive app development with unity and want to interact with Object and want to get it as controller interact with it. Try to learning form StreamVR Unity Toolkit documentation. I found a scene in sample demo where Gameobject are interacting through controller but there are so many scripts involved. I am amazed that on a cube VRTK_InteractalbeObject is attached and it is responding to controller. how can i get interacted object in htc vive.?


texts: Blender FBX exports to Unity3D have incomplete animation sequences

texts:
Using Blender, I have rigged and animated this model with this attack action.

I exported this model to an FBX format and imported the said FBX file into my Unity3D project. However, when I imported it, I noticed that the animation sequence is incomplete:

As you can see, the sword does not animate correctly and remains unmoved in its original position.

In Blender, the sword and scabbard are animated in Pose mode with IK and other constraints. However, as I understand it, FBX bakes these constraints into the animation, so I'm not sure if that causes the issue.

Why is the sword not animating correctly? How do I fix this so that the Unity animation is 100% faithful to the Blender animation?


texts: How can I stop certain keys from being prioritized in a 2D platformer?

texts:
I am currently working on a 2D platformer in Monogame. I have implemented WASD and arrow keys control, but because of the ordering of the if statements, the D key is always executed last if down, making the character flip the wrong direction.

if (Keyboard.GetState().IsKeyDown(Keys.Left) || Keyboard.GetState().IsKeyDown(Keys.A))
{
    if (Velocity.X > -MaxVelocity)
        Velocity.X -= Acceleration.X * time;
    spriteEffect = SpriteEffects.None;
}
else //Deceleration
{
    if (Velocity.X < 0)
        Velocity.X += Acceleration.X * time;
}

if (Keyboard.GetState().IsKeyDown(Keys.Right) || Keyboard.GetState().IsKeyDown(Keys.D))
{
    if (Velocity.X < MaxVelocity)
        Velocity.X += Acceleration.X * time;
    spriteEffect = SpriteEffects.FlipHorizontally;
}
else //Deceleration
{
    if (Velocity.X > 0)
        Velocity.X -= Acceleration.X * time;
}

Is there a way to prioritize the key that is pressed last, as well as only performing one every update cycle?


texts: When should I use auto-managed buffers in LWJGL 3?

texts: LWJGL3 has two methods of creating buffers that I know of: Auto-managed buffers that clean up the buffers automatically using the MemoryStack class, and manually managed buffers that must be manually cleaned, are are created with the MemoryUtil class. What I am wondering is should I always use MemoryStack, or are there certain times when one method would be more efficient than the other?


texts: What does NavMesh.AllAreas specify in Unity?

texts: I'm trying to calculate the path to a point in my game using NavMesh.CalculatePath, it takes an argument NavMesh.AllAreas. I read the Unity Manual and couldn't clearly understand what it meant.


texts:
In Unity Shadergraph, how can I create a checkerboard pattern that works independently of the size of the quad that it is applied to?
Here's what I got so far. Since I have set the Frequency to 10x6, this will work for a quad that has a scale of 20x12. However, if I increase the scale of the quad, the checkerboard will get stretched to fit. But instead, I would like it to "add more squares" to fit the new size.
Is there a way to get it to somehow use the size of the quad instead of manually specifying the frequency?


texts: How can I make an object visible only on the minimap in GameMaker?

texts:
I am making a game in which I have created a minimap using views. I want in the minimap (the copy of the world) to add an object, but I want it to be visible only from the minimap. Is there any way to do this?

Any help is much appreciated.


texts: If a 3d surface is occluded by another 3d surface, does this have any effect on the performance and rendering speed?

texts:
We have a 3D character who is wearing a gauntlet on his forearm and visibility of which can be turned on and off. Would it be better to create two versions of arm, one without extra triangles that are hidden beneath the gauntlet? Or we can just one model with gauntlet as separate object which can be turned on and off ?

Does the hidden triangles have any effect on rendering or are they completely ignored by engine?

We are using Unity 3D.


texts: what happens when you set transform.position in Unity?

texts:
Unity has both transform.positionandtransform.localPosition.
When I do transform.position.x += 3f; does unity automatically update transform.localposition?
and vice versa?

Why can I not see this when I go to the definition of transform.position in VS?


texts: Wrong faces culled in OpenGL when drawing a rectangular prism

texts:
I'm trying to learn opengl. I did some code for building a rectangular prism. I don't want to draw back faces so I used glCullFace(GL_BACK), glEnable(GL_CULL_FACE);. But I keep getting back faces also when viewing from front and also sometimes when rotating sides are vanishing. Can someone point me in right direction?

glPolygonMode(GL_FRONT,GL_LINE); // draw wireframe polygons
glColor3f(0,1,0); // set color green
glCullFace(GL_BACK); // don't draw back faces
glEnable(GL_CULL_FACE); // don't draw back faces
glTranslatef(-10, 1, 0); // position

     glBegin(GL_QUADS);

     // face 1
     glVertex3f(0,-1,0);
     glVertex3f(0,-1,2);
     glVertex3f(2,-1,2);
     glVertex3f(2,-1,0);

     // face 2
     glVertex3f(2,-1,2);
     glVertex3f(2,-1,0);
     glVertex3f(2,5,0);
     glVertex3f(2,5,2);

     // face 3
     glVertex3f(0,5,0);
     glVertex3f(0,5,2);
     glVertex3f(2,5,2);
     glVertex3f(2,5,0);

     // face 4
     glVertex3f(0,-1,2);
     glVertex3f(2,-1,2);
     glVertex3f(2,5,2);
     glVertex3f(0,5,2);

     // face 5
     glVertex3f(0,-1,2);
     glVertex3f(0,-1,0);
     glVertex3f(0,5,0);
     glVertex3f(0,5,2);

     // face 6
     glVertex3f(0,-1,0);
     glVertex3f(2,-1,0);
     glVertex3f(2,5,0);
     glVertex3f(0,5,0);

     glEnd();


texts: Isn't there any algorithms for Dynamic Difficulty Adjustment? like a universal algorithm. Or is it made depending on the game that it will be implemented to?


texts: Introducing generic commands in text-based interactive fiction game

texts:
Writing a compact text-adventure engine I was thinking about possible commands a player could use. For each location i have special commands described in the text but what about generic commands like

examine
open / close
trigger
...

So here are my questions concerning this:

Is there anywhere a good enumeration of commands which should be mandatory? If no, what commands would you expect in such game?
Concerning usability, should I suppose that the player knows the commands so he can try to use them from the beginning or should I implement tutorial-like explanations which  unlock the usage of those commands?


texts: Is white the best base color to start with when planning to shade sprites within Unity?

texts:
I'm looking into prototyping a game in Unity which will consist of solid square sprites / tiles. I figure I can represent different types of objects with different colors for each of the tiles in the game.

I figure that I can import a single square sprite and shade it appropriately in Unity as opposed to imported squares of many different colors.

My experience with adjusting the hue and saturation within Photoshop shows that white is not an easy color to change as things that are white often stay white. My testing in Unity shows that I can change the "color" of a sprite to anything other than white and the sprite is seemingly shaded appropriately, despite what I would have thought given my Photoshop experience.

Since white objects do seem to take on the appropriate color shading when changed within Unity my gut tells me that this is the best base color to begin with, meaning that I can import a single white square sprite and simply adjust the color to represent different objects and object states.

Is a white sprite actually the best color sprite to begin with and why does something like this work in Unity as opposed to adjusting the hue and saturation within Photoshop?


texts: 2d Collision detection response equation doesn't work

texts:
I am currently doing some game engine programming as a hobby.  I have been working on getting the collision detection working for a while now, and I'm at my wits end with it.

I started with this guide.  If you scroll down the the picture of the character sprite, you will see that she uses points on the character instead of a bounding box to do the collision.  That is what I currently have implemented, but I'm having a ridiculously hard time making it work perfectly.

I started with axis aligned, but moved to separating axis theorem so that I can implement collision boxes that are at an angle.  The collision response I'm trying to use when a collision occurs on the bottom of the character is this horrible thing:

nextY = (bottomColl.getY1() + bottomColl.getCenterY() + (currHeight() / 2) +
        (nextX + collisionPoints[currState][currFrame][4][0] - bottomColl.getCenterX() + (currHeight() / 2) * tan(angle / 2)) * tan(angle));

Y1 being top left corner and collisionPoints 4 being the bottom right point. (This is for an incline as opposed to a decline. The decline would use point 5, the bottom left point.)

This, however, doesn't work, and updates the character position to slightly lower than he is supposed to be.  This has little effect, unless the frame rate is really high, in which case, the jump animation does not move the character out of the collision box and the character gets pushed way far away.
I realize the code is probably hard to decipher out of context, but I'm pretty damn sure the algorithm should be right, yet it doesn't work properly.

Would it be better to switch to using a bounding box for the character and figure out collision response for that, or does anyone know what the proper equation is for setting the character height on an incline given an X position?

Edit: Here is a picture of me showing the equation works in CAD.  The calculator shows me using my equation from above to get the same number as is indicated on the sketch.


texts: C++ timer function acts as if time limit is instantly reached if it is less than 1 second

texts:
I'm trying to make a Snake clone with C++ and OpenGL/GLUT, but I've been having trouble with programming the timed input. I made a timer class, as you'll see below, to be used for the short time intervals allowed for input and movement. It's function checkTime() is called to start the timer. Then on following calls, it checks if the time limit (represented by the int variable limit) has been reached.

To test it, I set up a simple, looping console program, that displays keyboard input. When working properly, it displays what key is being held precisely at the point when the timer finds the time limit has been reached (it returns "true"). Given a limit of 1 second, it will only display current input every second. If it is given a value below 1 however, like 0.333, it will act as if the time limit has instantly been reached, and will display input instantly whenever a key is pressed. How can I get it to only display the input every 0.333 seconds?

Also - I realize my method of doing things here may not be the best, given the tools I'm using. However, I'm curious why this won't work properly.

#include <iostream>
#include "timer.h"
// Include all files necessary for OpenGL/GLUT here...

using namespace std;

Timer timer;

void update(int value)
{
    if (timer.checkTime())
    {
        if (GetAsyncKeyState(VK_LEFT))
            cout << "You pressed LEFT!" << endl;
        else if (GetAsyncKeyState(VK_RIGHT))
            cout << "You pressed RIGHT!" << endl;
        else if (GetAsyncKeyState(VK_UP))
            cout << "You pressed UP!" << endl;
        else if (GetAsyncKeyState(VK_DOWN))
            cout << "You pressed DOWN!" << endl;
    }

    glutTimerFunc(1000/60, update, 0);
    glutPostRedisplay();
}

timer.h

#pragma once

class Timer
{
public:
    Timer();
    bool            checkTime(int limit = 0.333);
private:
    unsigned long   getElapsed();
    bool            running;
    unsigned long   elapsed;
    unsigned long   start;
};

timer.cpp

#include "timer.h"
#include <ctime>

Timer::Timer()
{
    running = false;
    elapsed = 0.0;
    start = 0.0;
}

bool Timer::checkTime(int limit)
{
    (unsigned long) limit;

    elapsed = getElapsed();

    if (elapsed < limit)
    {
        return false;
    }
    else if (elapsed >= limit)
    {
        running = false;
        return true;
    }
}

unsigned long Timer::getElapsed()
{
    if (! running)
    {
        start = (unsigned long) clock();
        running = true;
        return 0.0;
    }
    else
    {
        return ((unsigned long) clock() - start) / CLOCKS_PER_SEC;
    }
}


texts: File operation(s) failure on game crash/kill by OS/User in Android

texts:
My game saves its state after fixed interval on a file in game/app internal storage. When my game is killed or crashed by user or OS respectively, We write current game state on that file. File writing after fix interval is working fine but when game is crashed/killed by OS or user, file writing operation fails. Operation failure results incomplete game state or empty game state i.e. no data written on file at all.
I have tried multiple solutions using android service, In case the service is NON STICKY service is killed with the app. On the other hand if service is STICKY then it is restarted but intent that was attached initially with service is null or new one.

The question is that how can i save my data (could be ~2-3MB) completely on file in internal storage when my game/app is killed by user/OS ?


texts: How to make a custom event system framerate friendly?

texts:
I have a simple event system:

class GameEvent{
    float executionTime;
    Action action;
}

class EventMgr : MonoBehaviour{

    List<GameEvent> events = new List<GameEvent>();

    void Update(){

        float timeNow = Time.time;

        for(int i=events.Count - 1; i >= 0; i--)
        {
            if(timeNow >= events[i].executionTime)
            {
                exents[i].action();
                events.RemoveAt(i);
            }
        }
    }

    public void ScheduleEvent(float delay, Action action){
        events.Add(new GameEvent(){
            action = action,
            executionTime = Time.time + delay;
        });
    }
}

Then,

I schedule events like this:

eventMgr.ScheduleEvent(0.1f, () => {
    // EVENT A - should be fired first
};

eventMgr.ScheduleEvent(0.15f, () => {
    // EVENT B - should be fired second
};

Everything works fine when I play on 60 FPS. Update() is fired once every ~0.016s. When I play the game on a device with 20-40FPS - things got a little bit tricky. Events seem to run in an incorrect order (Event B fired before event A).

The only possible cause is of course the framerate itself.
If the game runs at 20FPS, Update() would be called less frequently and both of these events would be fired in the same frame - and then, the order of their execution depends on the list itself.

What to do here?
Is there any trick to prevent this, is there any pattern for accurate, ordered event system in games which is FPS friendly?


texts: Implementing `fling` logic without pan gesture recognizers

texts:
So I am trying to port over a simple game that I originally wrote to iphone into cocos2d-x.  I've hit a minor bump however in implementing simple 'fling' logic I had in the iphone version that is difficult to port over to the c++.  In iOS I could get the velocity of a pan gesture very easily:

CGPoint velocity = [recognizer velocityInView:recognizer.view];

However now I basically only know where the touch began, where the touch ended, and all the touches that are logged in between.  For now I logged all the pts onto a stack then pulled the last point and the 6th to last point (seemed to work the best), find the difference between those pts multiply by a constant and use that as the velocity.  It works relatively well, but I'm wondering if anyone else has any better algorithms, when given a bunch of touch pts, to figure out a new speed upon releasing an object that feels natural (Note speed in my game is just a constant x and y, there's no drag or spin or anything tricky like that).

Bonus points if anyone has figured out how to get pan gestures into the newest version (3.0 alpha) of cocos2d-x without losing ability to build cross platform.


texts:
I'm working on a 3D game with large blocky untextured, but individually colored, voxels (similar to CubeWorld). For rendering, right now I naively convert online all visible faces ahead of time to triangles with the color information stored in the vertex attributes. The screenshot below is an example of what I'm currently doing. There's a lot of room to improve here and I want to switch to a system that uses fewer vertices and stores color information in a texture.

What I'd like to do is combine adjacent triangles with the same normals and simplify the mesh so I'm left with a fraction of the vertices. My big hangup is color information. It's easy to add UVs, but the correct choice for texturing isn't obvious. I'm trying to figure out the relative performance of these options:

Use a 1D texture. This is compact but I'm concerned that large 1D textures won't play nicely with texture mapping units optimized for 2D textures.
Use a 2D texture. Simple, but it'll end up with gaps.
Use a 3D texture with the full set of voxels.

Does anyone have insight as to the relative performance of these options? No mipmapping or other filtering is needed here, so all three options should be viable.

For reference I'm making this in C++ using OpenGL on Windows. My target GPU architectures are GTX 780 Ti and higher or AMD equivalent.


texts: Loading premade .xnb files with content manger

texts:
I am trying to load premade .xnb files with the content pipeline.
when I call contentManager.Load<model>("grass");, for which I have a "grass.xnb" file in the corresponding directory, it crashes with: "Error loading "grass_0". File not found."

The grass.xnb file was created using a MSBuild wrapper to build the .fbx files.
I initialized the content manager with :
contentManager = new ContentManager(mainXnaWindow.Services, projectFileOpen + "../Assets/XNB/"));
I am pretty sure the content manager has the right directory, because when I deleted "grass.xnb" from the directory, It just told me "Error loading "grass" File not found"

Does anyone know why it could be adding a "_0" to the name?

Edit: I forgot to include a built version of th texture associated with it. Problem Solved.


texts:
I'm trying to plan how to implement non-fixed boundaries so the player can expand their controlled territory without using a tiled based system. Each pixel can be fought over for who controls it.

I will need to set the color for each pixel depending on who controls it so I'm thinking I'll have to check each pixel for who controls it every refresh?

I'm not sure what the best way to do this and I think performance would be an issue

Any suggestions?


texts: How do you create a perfect maze with walls that are as thick as the other tiles?

texts:
http://journal.stuffwithstuff.com/2014/12/21/rooms-and-mazes/

I read this article about dungeon and maze generation. The author uses a kind of specialized algorithm for generating 'perfect' mazes that have walls of non-zero thickness.

(Edit: I misunderstood the term 'perfect' here.  It actually means there are no loops in the maze)

As I understand, typical maze algorithms work for walls of zero thickness but this is not what I want.

He posted his code in the article, but after a cursory glance, I think I need someone to explain the procedure (or a similar one) in plain english.

My first two attempts looked like:

Which produces an effect with the diagonals that are unsightly.

and then:

Which is better but its not 'perfect' in the sense that it seems to waste some space.

If someone can give me simple english instructions I might post the python code after I get it working.


texts: What is a good technique for 2D tile-based terrain generation meeting these requirements?

texts:
As a summer project I decided it would be fun to make a Flash game.  Right now I'm going for something like the look of Terraria.  It's been a lot of fun, but today I've hit a snag.  I need a way to generate my worlds.  I've read up Perlin noise as a possibility, but I my attempts have given me sporadic looking results.  What are some techniques used to generate these 2D tile-based worlds?

Ideally I would like to be able to generate mountains, plains, and caves.


texts: How to get the 2d field of view using dot or atan2?

texts:
I tried to implement from this site linear-algebra on how do I check the field of view using dot product. But when I check the angle to the given fov angle, I am not getting the desired result. Instead of getting the field of view of 45 degree, I am getting 90 degree. What am I doing wrong?

Vector2 start = Mapper.transform.get(owner).position;
Vector2 end = Mapper.transform.get(target).position;
float facingAngleRad = 0;
Vector2 ownerOrientation =
   new Vector2((float)Math.cos(facingAngleRad), (float) Math.sin(ficingAngleRad));
Vector2 targetOffset = tmp1.set(end).sub(start);

float product = ownerOrientation.nor().dot(targetOffset.nor());
float checkAngle = (float) Math.acos(product);
float FIELD_OF_VIEW_ANGLE = 45 * MathUtils.degeeToRadians;
if(checkAngle < FIELD_OF_VIEW_ANGLE) {
    // in the field of view
}

In the below image, green is the desired field of view (45 degree), but I'm getting 90 degree (red)


texts: Internet Access is always set to required in unity android player settings

texts: I am using unity 2019.4.2f1, I want to remove the internet access permission from the final android manifest file created by unity but, because this option is locked I am not able to remove the permission. Let me know if there is any-workaround to do so or disable this option somehow.


texts:
Is deferred rendering the future of real-time 3d rendering on pc hardware (at least until raytracing becomes feasible)?  I'm aware of the benefits (lots of lights, less state changes) and also trouble spots such as anti-aliasing, translucent items, and higher memory bandwidth.

But will the next-gen engines all be using deferred?  Is forward rendering a thing of the past?


texts:
Most games that I know use a master server to connect players in multiplayer. If it ever gets shut down, without third-party software or master server, the game is effectively unplayable in multiplayer, sometimes not even in LAN. Temporary shutdowns can arguably be worse than permanent, because in the latter case you will likely have a community solution soon, in the former you have to wait for an unknown amount of time.

Assuming good intentions of the game developer, how can such a game be constructed so it remains playable? Can matchmaking be made fully decentralized? Do such solutions already exist?


texts: Game Design: Colour units per team or per unit type?

texts:
In an RTS game where the units are viewed from the top so that they appear relatively small on the screen:

What would be the best game design?

Colour the units per team, for example: enemy is always red, player's units is always blue
Colour the units per ability, for example: the "destroyer" is always red, the "collector" is always green, the "interceptor" is always blue, etc. This will only work with the assumption that the teams would never have the same units and that there are only a small number of different types of units per game.
A combination of 1 & 2 so that the enemy is always represented by warm colours and the friendly units with cold colours. Different unit types are represented by different shades of a colour.

If I choose (1) I am concerned that the player might get confused which unit is which and for example try to attack with the wrong unit type.

If I choose (2) I am concerned that the player might be overwhelmed with too many colours and will not be able to easily tell the enemy from the friendly units.

If I choose (3) I am concerned that it might confuse the players: e.g. say the "destroyer" was light red (enemy) in one game and the next game the player switches sides so that the "destroyer" turns light blue (friendly), the player might not recognize the unit as a "destroyer".


texts:
The game objects move from the right to the left, via a separate, working script. I want them to be destroyed when they cross the left side of the camera. How do I delete instantiated game objects when they move off the left side of the camera?

I am using this script to spawn game objects:

// Use this for initialization
void Start ()
{
    InvokeRepeating ("spawnObject", this.spawnInterval, this.spawnInterval);
}

void spawnObject()
{
        float y = Random.Range(objectMinX, objectMaxX);

        GameObject newObject = Instantiate (this.prefabToSpawn,
            this.transform.position + new Vector3(30,y,-30), Quaternion.identity);

        if (newObject.transform.position.x < Camera.main.transform.position.x)
        {
            // neither the print nor Destroy gets called
            print("destroy");
            Destroy(newObject);
        }
    }


texts: Oculus Rift DK1 and DK2 compatability issues

texts: For a project I need to make a multiplayer game using Unity and the Oculus Rift. My project works fine with the DK2 but it turns out the second rift is a DK1 and it won’t work with Unity. I was thinking the best way forward would be to use an older version of the Oculus Runtime and Unity. Does anyone know what versions of Unity and the Runtime I need to have both the DK1 and DK2 work with Unity?


texts: How do I dynamically grow a voxel world in all directions with chunks?

texts:
I've organized a Voxel world already but the problem is that it can only "grow" outwards. As a result, there is a single corner where it grows from, then outwards from there on. I want to be able to grow the world from all directions.

I figured this would be best done by maintaining a list of chunks with their world position, but that would require iterating through each chunk just to find the one I'm looking for and checking which chunks need to be created (or just to do anything involving that chunk) and it would be a mess to figure out which ones are loaded and which ones aren't.

How do existing Voxel games (such as Minecraft) deal with this issue?


texts: Trying to get events to work for drag and drop

texts:
So I’m playing around with drag and drop with Nifty and I have the drag working. I don’t have a drop set up yet as I’m just trying to get the dragging working at the moment.

For the purposes of my game the default drag and drop behavior of moving the draggable to another spot wont work. I’m working on a tower defense kind of game and when the player goes to drag a turret from the inventory into the game, I still need a copy of it to stay in the starting point. So I am trying to use the DraggableDragStartedEvent to determine when the drag starts and make a copy of the dropable to place in the UI so the player can still add more of that turret if they want to. Or is there another way of changing the default behavior so when the player drags they see the item under the mouse/finger but still leaves a copy at the starting point so it can be repeated from the same location?

Here is what I have and it doesn’t seem to be working:

The Nifty book for 1.3.2 (I just now realize JME uses 1.4.2 so this may no longer work and the docs on the github are not as in depth as this book) says to add a methid to your screen controller with the annotation @NiftyEventSubscriber(id=“elementId”) and it must have a String for the first parameter to pass in the id and the second must have an event of the type you want to listen to and its just supposed to work. But its not. I see “bind” in the log and I see “start screen” in the log but when I drag the draggable nothing gets logged. The dragging is working so I know it should be calling this event.

controller(new ScreenController() {
    @Override
    public void bind(Nifty nifty, Screen screen) {
        System.out.println("bind");
    }

    @Override
    public void onStartScreen() {
        System.out.println("start screen");
    }

    @Override
    public void onEndScreen() {
        System.out.println("end screen");
    }

    @NiftyEventSubscriber(id="layout")
    public void onClick(String id, DraggableDragStartedEvent event) {
        System.out.println("drag started");
    }
});

And my draggable:

control(new DraggableBuilder("chest") {{
    id("layout");
    childLayoutCenter();
    width("101px");
    height("171px");
    panel(new PanelBuilder() {{
        childLayoutCenter();
        text(new TextBuilder(){{
            text("My Cool Game");
            font("Interface/Fonts/Default.fnt");
            alignCenter();
            valignCenter();
            color(Color.WHITE);
            height("5%");
            width("15%");
        }});
    }});
}});


texts:
1) Context
I'm using a regular OpenGL perspective projection matrix created with GLM (glm::perspective) and taking the inverse (glm::inverse) to transform clip-space back into view space (and world space ultimately). Now with z-values at the near and far plane it's easy to choose the x,y,z,w components of the clip-space cube corners and get the world space point of the frustum volume.

2) Question
Now, I want to harness the fact that clip space is a cube and generate a grid over the frustum. for x,y this works with the regular inverse projection matrix. For z, if I take uniform subdivisions of the range [-1.0, 1.0] with w=1.0, the view space z values will not be linear. I haven't got enough sleep recently to convince myself to do the math. What would be an inverse projection matrix to do this?


texts: How can I update vSync settings after creating an SDL_Renderer?

texts: I have an SDL_Renderer which I set to use or not use vSync depending on the user). In my options menu I have an option for enabling/disabling vSync. Can I edit my renderer to update the vSync preferences so that I don't have to destroy and recreate it? Doing so would invalidate a lot of renderer pointers in my game, so I would like to find an alternative solution.


texts: Moving around lightprobes requires using the movetool and all you really can do is move them along global axes and copy paste. There are no functions to scale, rotate, Snap to a surface, not even shift border select is possible. Is there a way to be more efficient setting up lightprobes?


texts:
The Wavefront OBJ exporter of 3DSMax says it can flip YZ axis. Claiming this is "Poser-like". What does this mean?

And what is the exact transformation if we decide to flip?
Is it simply this?

x => x
y => -z
z => y

UPDATE: related matrix transformation

1  0  0
0  0 -1
0  1  0


texts: How to use OpenTK (OpenGL) with MonoGame?

texts:
So I've been making a snake game using MonoGame (DirectX Only). I added movement, controls, feeding and growing in length. I wanted to add smooth animations to the game because the snake is just made out of 32 X 32 squares currently and it moves by 32 pixels (1 square) so it's not smooth at all. So I thought I could use the OpenGL template which has both the MonoGame(XNA) framework and the OpenTK framework so that I can make smooth animations with skewing when changing direction for example. The way I have in mind is to make a "skeleton" for the snake and the textures of the body parts would be skewed (or deformed or whatever) to take the shape of that skeleton. But OpenTK doesn't seem to be set up with the MonoGame framework. So can someone point me towards a way of using it to accomplish my goal?

Thank in advance.


texts: Embed Unity3D and load multiple games from a single app

texts:
Is is possible to export an entire unity3d project/game as an AssetBundle and load it on iOS/Android/Windows on an app that doesn't know anything about such game beforehand? What I have in mind is something like the web plugin does - it loads a series of .unity3d files over http, and render inline in the browser window.

Is it even possible to do something closer for iOS/Android?

I have read a lot of docs so far, but still can't be sure:

http://floored.com/blog/2013/integrating-unity3d-within-ios-native-application.html
http://docs.unity3d.com/Manual/LoadingResourcesatRuntime.html
http://docs.unity3d.com/Manual/AssetBundlesIntro.html

The code from the post at http://forum.unity3d.com/threads/112703-Override-Unity-Data-folder-path?p=749108&viewfull=1#post749108 works for Android, but how about iOS and other platforms?


texts: How to update "dynamicVertexBuffer" correctly with "setdata" on XNA?

texts:
I developed a small 3d games xna and uses a "DynamicVertexBuffer" and "DynamicIndexBuffer" to store and draw my vertices. Everything works fine, but my problem is the "Update" function where I update my buffer.
Each apel update I have to reset my buffer using the keyword "new DynamicVertexBuffer (...." It goes down the performance and reduce the frames per second of my games.

Do I have to initialize my buffer each time in my function "Update ()"? Is it okay to reset every time my buffer to each call / frame

I can not find a solution to update correctly my Dynamicbuffer with "setData ()" function without having to initialize whenever my buffer just before. Am I obliged to Reset-"DynamicVertexBuffer" and "DynamicIndexBuffer" before the update? If I call "setData ()" before reset it, I throw an exception:

Works well but I have initialized every time "dynamicIndexBuffer" and "dynamicVertexBuffer" before update! (Consumes more resources?)

    public override void Update(GameTime gameTime)
    {
                foreach (Octree.Node node in regions[regionIndex].Nodes.Where(n => n.ItemGroup == a).Where(m => arcadia.camera.Frustum.Contains(m.boundingBox) != ContainmentType.Disjoint))
                {
                    //build indices
                    node.Cube.SetUpIndices(indexIndiceBuild);
                    //Add indices tho the collectionList
                    foreach (int indice in node.Cube.Indices)
                    {
                        list_structure_indices.Add(indice);
                    }
                    //Add vertex to the collectionList
                    foreach (VertexPositionTexture posText in node.Cube.Vertices)
                    {
                        vertexPositionStructureCube.Add(posText);
                    }
                    //Add vertexBuffer to the collectionList
                    indexIndiceBuild += 24;
                }
                    //Declare and initialize new buffers
                    //VertexBuffer Initialize again
                    vertexBuffer_cube = new DynamicVertexBuffer(
                    arcadia.Game.GraphicsDevice,
                    VertexPositionTexture.VertexDeclaration,
                    vertexPositionStructureCube.Count,
                    BufferUsage.WriteOnly);

                    //VertexBuffer SetData (update)
                    vertexBuffer_cube.SetData<VertexPositionTexture>(vertexPositionStructureCube.ToArray());
                    //IndexBuffer Initialize again
                    indexBuffer_cube = new DynamicIndexBuffer(Game.GraphicsDevice, IndexElementSize.ThirtyTwoBits, list_structure_indices.Count, BufferUsage.WriteOnly);
                    //IndexBuffer SetData (update)
                    indexBuffer_cube.SetData(list_structure_indices.ToArray());
                    .........
}

I'm just trying to update with "SetData" with new vertices and indices but i throws the exception:
    "The array is not the proper size for the Amount of data requested."

    public override void Update(GameTime gameTime)
    {
                    .........
                    //Only "setdata()" without initialize buffer again ??
                    //VertexBuffer SetData (update)
                    vertexBuffer_cube.SetData<VertexPositionTexture>(vertexPositionStructureCube.ToArray());

                    //IndexBuffer SetData (update)
                    indexBuffer_cube.SetData(list_structure_indices.ToArray());

                    .........
}


texts: OpenGL HUD is flickering when rotating the camera

texts:
I draw game HUD after drawing 3D scene. When I move the camera quickly, HUD starts flickering.
I noticed that it happens only if the distance between the camera and an object its looking at changes after camera's position transformation.It does not happen if there is no mesh in front of the camera. I use separate shader program for HUD rendering. Have tried to enable/disable depth test, blending already. Using VBOs to draw stuff.

Render code:

 def render()
{

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

    glEnable(GL_DEPTH_TEST)
    glDepthFunc(GL_LESS)
    glEnable(GL_CULL_FACE)

    Shader.setCurrentShader(Shader.SHADER_VOXEL)
    Shader.currentShader().enable()
    set3DMatrices()
    updateShaderVOXEL()
    val world = WorldRegistry.getWorldByID(0)
    world.renderWorld()
    Shader.currentShader().disable()

    Shader.setCurrentShader(Shader.SHADER_SIMPLE)
    Shader.currentShader().enable()
    set3DMatrices()
    ManagerRegistry.renderManagerSceneBoundingBox.render()
    ManagerRegistry.renderManagerSceneRectangle.render()
    ManagerRegistry.renderManagerSceneLine.render()
    Shader.currentShader().disable()

    glDepthMask(false)
    glDisable(GL_DEPTH_TEST)
    glDisable(GL_CULL_FACE)

    Shader.setCurrentShader(Shader.SHADER_HUD)
    Shader.currentShader().enable()
    set2DMatrices()
    GL13.glActiveTexture(GL13.GL_TEXTURE0) // Texture unit 0
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, Texture.getTexture("screen/cursor/default.png"))
    HUDRenderRegistry.HUDRender.render()
    Shader.currentShader().disable()

    glDepthMask(true)

    glfwSwapBuffers(window)
}

EDIT

I made a video(captured on the phone, so the quality is bad, sorry) and the rectangle in it is actually fully red, not yellow.
https://youtu.be/HhHEfrgsfiU


texts: City/Nation Builder - Unlocking game elements over time

texts:
Current Git (Needs more documentation)

Current working prototype to play with (Git code is after a BIG refactor)

Background: I'm making a javascript text city/nation builder along the lines of A Dark Room or Candy Box. This is going to be the player managing a city but be able to vassalise other cities (Ala Europa Universalis), giving you a tribute of their income but no specific control over it like your own one.

Each city has a tree of things in it, including buildings, resources, tools/machines and intermediate crafting items. These types each have their own object constructors and can easily have a complex object of about 5-50 keys depending on the item just from a few lines of code. Each tree starts at the top, a category for sorting on the UI/namespace, and then inside that is the actual object itself. So whenever referencing an item in a crafting recipe or production chain there's a "resource.material.wood" or "buildingHouse.tent.small" or such.

The player or "empire" can own multiple cities, but only directly control one in the city view screen (You can tell your city exactly how to be managed, but all other cities you've taken over live their own life, but you can send them requests and investments to boost specific things). Because the item trees are so expansive (170 items in the prototype on my website) I need an easy way to hide things away that aren't unlocked yet. Decided to go with the Civ 5 tech tree route.

Current problem: In the prototype I had the tech tree and items bound to the window instead of to the city. This meant there was only ever a single instance of everything and to unlock something in the UI I could just go (simplified) foreach (unlockedItem) {item.unlocked = true}. I can't do this as easily in the multiple city model because the tech system is player specific, not city specific, and so if you take over a new city they should retroactively build the city's tech level from that player's tech level. I'm not sure how I want to handle inheriting resources/buildings from a more advanced civ yet either.

Relevant code pulled from the Git as an example: pastebin.com/DbbUXbaL

As far as I can tell, there's a not so easy way I can work around this.

Flip the way I unlock things. The item is then bound to a tech that unlocks it instead of a tech being bound to multiple items. In my head I prefer the latter way because it means I can group like items together (The resource with the building that produces it) and it's easier to list the items that the tech unlocks when you're in the research menu. It's also much easier in the code to see what a tech unlocks at a glance, instead of going from class to class. The problem with the latter way though is that it's hard to retroactively unlock things in a newly unlocked city.

The question to Gamedev: Those of you with more experience than I, how would you go about designing a technology system for an entity heavy game like the Anno series or Civ if each tech unlocked 5+ things? Do I have the right idea binding the item to the tech or is there a much simpler way of doing it I'm just not seeing?


texts: From screen space to world space for a 2D game

texts:
I'm making a 2D game and I want the user to be able to position an object in the world using mouse input. After a while I found an answer to 'OpenGL Math - Projecting Screen space to World space coords' on Stack Overflow but even after working on it for multiple hours I couldn't get the right depth (z) value; after clicking the x and y coordinates of the square are correct for this z value, but as you can see the z value is way to big in this case and hence the size is too; It should be as big as all the other squares:

(I clicked where the circle is).

My current handler is:

void mouse_button_callback(GLFWwindow *window, int button, int action, int mods)
{
    if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS)
    {
        double x, y;
        int width, height;
        glfwGetCursorPos(window, &x, &y);
        glfwGetWindowSize(window, &width, &height);

        vec4 pos1(
            static_cast<float>(x / (width / 2.f)) - 1,
            1 - static_cast<float>(y / (height / 2.f)), 0 /*☃*/, 1);

        pos1 = MVPinv * pos1;
        pos1.w = 1 / pos1.w;
        pos1.x *= pos1.w;
        pos1.y *= pos1.w;
        pos1.z *= pos1.w;

        std::cout << pos1.x << " / " << pos1.y << " / " << pos1.z << " // " << pos1.w << std::endl;

        objects[0]->position = vec3(pos1);
    }
}

Here MVPinv is the inverse of the model-view-projection matrix (don't mind the model matrix, it is the identity matrix and if I understand this correctly I can probably get rid of it in this place). I'm using modern OpenGL/GLEW, GLFW and GLM.
Tweaking the z value indicated by ☃ can give me the correct result, but only for a certain view-projection matrix.

All objects I draw currently have a z value of 0. My question is thus: what is the best way to get the right xy coordinates if I want z to be 0?

Note: I'm very new to all these concepts of view-projection matrices, the w value, OpenGL and game development in general.

Edit: This is how the matrix is generated (more or less copied from a tutorial):

const mat4 Projection = perspective(radians(45.f), 4.0f / 3.0f, 0.1f, 100.0f);
const mat4 View = lookAt(
    vec3(0, 0, 10),
    vec3(0, 0, 0),
    vec3(0, 1, 0)
);
const mat4 Model = mat4(1.0f);

MVP = Projection * View * Model;
MVPinv = inverse(MVP);

My updated code after reading the answer:

vec2 vecTranslate;

float factScale;
vec2 vecScale;

mat4 matTranslation, matScaling, matTransform;

void updateTranslate()
{
    matTranslation = translate(mat4(1), vec3(vecTranslate, 0));
}

void updateScale(const int viewWidth, const int viewHeight)
{
    vecScale = vec2(factScale, factScale / viewHeight * viewWidth);
    matScaling = scale(mat4(1), vec3(vecScale, 1));
    matTransform = matTranslation * matScaling;
}

void updateViewport(const int width, const int height)
{
    glViewport(0, 0, width, height);
    updateScale(width, height);
}

void mouse_button_callback(GLFWwindow *window, const int button, const int action, const int mods)
{
    if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS)
    {
        double x, y;
        int width, height;
        glfwGetCursorPos(window, &x, &y);
        glfwGetWindowSize(window, &width, &height);

        const vec2 view(x / (width / 2.f) - 1,
                        1 - y / (height / 2.f));

        objects[0]->position = vec3((view - vecTranslate) / vecScale, 0);

        /* Or:
        const vec4 view(x / (width / 2.f) - 1,
                        1 - y / (height / 2.f), 0, 1);
        const auto pos = inverse(matTransform) * view;
        objects[0]->position = {pos.x / pos.w, pos.y / pos.w, 0};
        */
    }
}

void window_size_callback(GLFWwindow *window, const int width, const int height)
{
    updateViewport(width, height);
}


texts: Help finding bug in seperating axis theroem code

texts:
My collision detection is inconsistent. I am testing between 2 rectangles. When they are un-rotated, it says they are intersecting way before they touch, but when I rotate one, it works properly. I do not understand why.
When rect1 is rotated 0 or 180 degrees it starts saying collision detected about one rect width apart, but when its rotated at a non 90 degree angle, it works properly.
        // storing rotated points in lists for easy looping to avoid duplicate code
        FixedList512<float2> points1 = new FixedList512<float2>();
        points1.Add( bl_r );
        points1.Add( br_r );
        points1.Add( tl_r );
        points1.Add( tr_r );

        FixedList512<float2> points2 = new FixedList512<float2>();
        points2.Add( bl_r2 );
        points2.Add( br_r2 );
        points2.Add( tl_r2 );
        points2.Add( tr_r2 );

        bool intersects = true;

        for ( int shape = 0; shape < 2; shape++ )
        {
            if ( shape == 1 )
            {
                var temp = new FixedList512<float2>();
                temp.Add( bl_r );
                temp.Add( br_r );
                temp.Add( tl_r );
                temp.Add( tr_r );

                points1 = points2;
                points2 = temp;
            }

            for ( int a = 0; a < points1.Length; a++ )
            {
                int b = ( a + 1 ) % points1.Length;
                float2 axisProjection = new float2( -( points1[ b ].y - points1[ a ].y ) , points1[ b ].x - points1[ a ].x ); // invert points for normal to line segement

                float minR1 = float.MaxValue;
                float maxR1 = -float.MaxValue;

                for ( int p = 0; p < points1.Length; p++ )
                {
                    float q = points1[ p ].x * axisProjection.x + points1[ p ].y * axisProjection.y; // dot product of current point and axis of projection
                    minR1 = math.min( minR1 , q );
                    maxR1 = math.max( maxR1 , q );
                }

                float minR2 = float.MaxValue;
                float maxR2 = -float.MaxValue;

                for ( int p = 0; p < points2.Length; p++ )
                {
                    float q = points2[ p ].x * axisProjection.x + points2[ p ].y * axisProjection.y; // dot product of current point and axis of projection
                    minR2 = math.min( minR2 , q );
                    maxR2 = math.max( maxR2 , q );
                }

                if ( !( maxR2 >= minR1 && maxR1 >= minR2 ) ) // break if points dont overlap as we dont have a collision
                {
                    intersects = false;
                    break;
                }
            }
        }

        if ( intersects )
        {
            Debug.Log( "Intersects" );
        }
```


texts: Variable-step update() in game loop is falling behind, how can I get around this?

texts:
I'm working on a minimal game engine for my next game. I'm using the delta update method like shown:

void update(double delta) {
    // Update code that uses `delta` goes here
}

I have a deep hierarchy of updatable objects, with a root updatable that contains several updatables, each of which contains more updatables, etc. Normally I'd just iterate through each of the root's children and update each one, which would then do the same for its children, and so on. However, passing a fixed value of delta to the root means that by the time the leaf updatables are reached, it's been longer since delta seconds that have elapsed. This is causing noticable desyncing in my game, and time synchronization is very important in my case (I'm working on a rhythm game).

Any ideas on how I should tackle this? I've considered using StopWatches and a global readable timer, but any advice would be helpful. I'm also open to moving to fixed timesteps as opposed to variable.


texts:
I am looking to implement an extremely rudimentary FPS game with extremely rudimentary 3D graphics using C++ .NET and DirectX.

I'm not interested in any third party libraries or anything special like that.

Having never done graphics based programming besides 2D stuff I don't really know where to get started or even how to find the right resources online.

I have a few weeks to build this game so im trying to keep it simple.

Can anyone give me a little guidance on how to get started?


texts: How to make nifty gui textfield to use a larger font

texts:
Hi I have a text field on my screen but its tiny:

<panel height="13%" width="100%" childLayout="vertical">
    <text id="label1" height="50%" font="Interface/Fonts/MinionPro.fnt" color="#f00f"
          text="Hello World!" align="center" valign="center" />
</panel>
<panel height="10%" width="100%" backgroundColor="#55a5" childLayout="center">
    <control name="textfield" text="Some text"/>
</panel>

the problem is I can not figure out how to change the font size on it. Please help me out here.


texts: How do I convert a greyscale height map to .3ds format?

texts: I was given some height maps to use for game development, but they are in grayscale PNG format. How can I convert them to 3DS format?


texts: What contributed to the decline of sales of 3D platformers over the past decade?  (Other than Microsoft's acquisition of Rareware.)  Would it be a mistake for a developer other than Nintendo (or indie developer) to start working on one in 2011?


texts: Multiplayer network architecture - why do we need to verify local movements?

texts:
I'm messing around with a 2D game using UDP. I've read some books and articles on the logic of a dedicated server to clients multiplayer game and I can't wrap my head around one thing:

What I've read:
When Client 1 moves, it sends it's input to the SERVER, the SERVER calculates the position, and then sends the new position back to all connected Clients, including Client 1 where the Client 1 player is drawn in the new position. Wouldn't this create a big amount of latency between the local player of Client 1 and their movements?

How I think it should work:
My question is, why not just move the local player based on the movement, and send the new position to the SERVER every time it moves? That what we you press a movement key, it's instant, instead of having to be calculated by the server and sent back and THEN moved.

NOTE: I'm not worried about anti-cheating verification


texts: Collision checking problem on a Tiled map

texts:
I'm working on a pacman styled dungeon crawler, using the free oryx sprites. I've created the map using Tiled, separating the floor, walls and treasure in three different layers. After importing the map in libGDX, it renders fine. I also added the player character, for now it just moves into one direction, the player cannot control it yet. I wanted to add collision and I was planning to do this by checking if the player's new position is on a wall tile. Therefore as you can see in the following code snippet, I get the tile type of the appropriate tile and if it is not zero (since on that layer there is nothing except the wall tile) it is a collision and the player cannot move further:

final Vector2 newPos = charController.move(warrior.getX(), warrior.getY());
if(!collided(newPos)) {
    warrior.setPosition(newPos.x, newPos.y);
    warrior.flip(charController.flipX(), charController.flipY());
}

[..]

private boolean collided(Vector2 newPos) {
    int row = (int) Math.floor((newPos.x / 32));
    int col = (int) Math.floor((newPos.y / 32));

    int tileType = tiledMap.layers.get(1).tiles[row][col];
    if (tileType == 0) {
        return false;
    }

    return true;
}

The character only moves one tile with this code:

If I reduce the col value by two it two more tiles. I think the problem will be around indexing, but I'm totally confused because the zero in the coordinate system of libGDX is in the bottom left corner of the screen, and I don't know the tiles array's indexing is similair or not.
The size of the map is 19x21 tiles and looks like the following (the starting position of the player is marked with blue:


texts: The simplest but most effective and intuitive way to implement Accuracy and Dodge chance in an RPG?

texts:
I am a university student and I have been tinkering with some RPG game ideas recently. One problem I am having is developing a proper mechanics or system of HIT or MISS chance in a monster-slashing game.

First of all, I want my stats to be simple and easy to interpret. So when the player opens his offensive and defensive stat menu he will see something like this:

Accuracy: 90%

Dodge chance (or Evasion rate): 10%

One solution I come up with was this system:

Hit chance = (Accuracy - Dodge Chance)

For example, my character has a base Accuracy of 80%, the monster he is slaying has a Dodge Chance of 10%. Therefore, when I hit the monster I have a 70% chance to make the hit.

Notice that in this system, I allow the Accuracy and Dodge Chance to exceed 100% by means of gearing and buffing. So there can be scenarios like:
My character has a base Accuracy of 80%. He has a weapon with a stat line +20% accuracy and a ring with a stat line +10% accuracy equipped. He also has a skill that says "+30% accuracy for 10 seconds". So when my character equips those items and activates the buff skill, he should see an effective Accuracy of 140% in his stat.

So when this character slays a monster with only 20% Dodge chance he will always guarantee a hit. This makes sense because he should be rewarded for choosing this item and this skill (or this build basically).

Of course, there will be types of monster where there Dodge Chance is high, or incredibly high (maybe 200%) for a super rare creature which could drop lots of legendaries when slain which would encourage players to equip specific builds in order to hunt them.

My question is that, is there a better and more intuitive system than this? I saw some post suggest that we calculate hit chance by:

Hit chance = ((Accuracy - Dodge Chance)/Accuracy)*100 (%)

How is this different than my formula? and which one is more consistent in an RPG? and which would make players feel better playing and building their character? because I have seen some players get frustrated when they miss a crucial hit/skill.

Of course, what are other popular systems regarding HIT and MISS in RPGs which do not rely significantly on RNG but, ultimately, on the players' decisions of choosing their gear, skills and build?


texts: Should NPC dialog be stored in XML or in a script?

texts:
I'm developing an action RPG with some friends. I would like to know the differences and pros/cons of making NPC's dialogue using a file in XMLformat instead of using a script.

I see that script method is often used by game developers for NPC text, but is it better then a XML file? We've thought that a XML file with tags like

<FirstText>[text1]<SecondText>[text2]

et cetera is perfect for NPC text and also for possible quests to give the player.

So what are the differences between this two methods? Is a script suitable for this aim?


texts:
In my game I want to have a chat room where users can enter arbitrary text. I don't think bitmapped fonts will work for me since it must include multilingual characters and emojis (could be wrong about this not working, but my assumption is that bitmapped fonts are really best suited when you have have a small set of characters that the you want to draw text with inside the game). The font rendering should be crisp and clean for high density screens.

I am using libGDX, although a solution doesn't require libGDX specifics, but be aware that this must also run in a webGL context so certain solutions may not apply.

How is arbitrary user text like this typically implemented?


texts: Tire mesh rotates faster than wheelcollider in Unity

texts:
I have a car in Unity. Scripts are C#. I have noticed that my tire meshes' rotation is faster than whellcollider rotation. I am using this code for wheel rotation

 flWheel.localEulerAngles = new Vector3(flWheel.localEulerAngles.x, flWheelCollider.steerAngle - flWheel.localEulerAngles.z, flWheel.localEulerAngles.z);
 frWheel.localEulerAngles = new Vector3(frWheel.localEulerAngles.x, frWheelCollider.steerAngle - frWheel.localEulerAngles.z, frWheel.localEulerAngles.z);

 flWheel.Rotate(flWheelCollider.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 frWheel.Rotate(frWheelCollider.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 rlWheel.Rotate(rlWheelCollider.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 rrWheel.Rotate(rrWheelCollider.rpm / 60 * 360 * Time.deltaTime, 0, 0);

I found this from here

Does anyone know how to fix this?

Edit:

Using AquaGeneral's answer I could able to solve rotation problem. But now front right tire position changed to rear left tire position and  rear right tire rotated 180 on Y axis. need help


texts: How can I destroy trees when placing a building in an RTS?

texts:
I am developing RTS game. When I build buildings on the Terrain, any trees that were in that location end up intersecting with the building.

I want to remove all trees from the building's footprint when placing.

Can I use the building's OnTriggerStay to detect tree colliders with a particular tag and destroy the trees? Or is there a better way to clear out these trees?


texts: AI algorithm for avoiding bullets in a shoot-em-up game

texts:
I am working on a shoot-up-game in XNA, it is going to be my final project in school. I was thinking of utilizing the minimax algorithm for AI agents for making tactics. However, I realized that the most important issue in such a game is to avoid bullets(fired by the player). An AI agent making tactics but no good at avoiding bullets would be useless in a shoot-em-up game I guess.

So, I need your help about what algorithm to utilize. It's not going to be a bullet storm like game, but it's fast(thanks to XNA). I have read about using threat maps and also pathfinding algorithms but couldn't figure out which one is ideal in such a game. I mean it needs to be simple enough for a fast paced gameplay, but it should also help AI agents act intelligently.


texts: Hi I want to make a pause and credits screen for an android game with libgdx the idea I have is creating a new screen like a popup that pauses the background screen and then, I can render the screen I want to show. Please give me some info or ideas for this.


texts: Should I have multiple small textures or a single big one?

texts:
I'm using SDL 2 to create a small 2D game. Based on the docs, this is what I would do:

 SDL_Surface *surface = SDL_LoadBMP("image.bmp");
 SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, surface);
 SDL_FreeSurface(surface);
 ...
 SDL_RenderCopy(renderer, texture, NULL, &dest);

Since I have every single sprite in a different bmp, this would cause hundreds of texture objects to be created.

Another solution would be to create a single SDL_Surface based on all the bmp files, create a single texture object from it and then blit it with something like this:

SDL_RenderCopy(renderer, texture, &src, &dest);

I use  src to select the sprite I'm interested into blitting.

I know SDL 2 takes advantage of 3D acceleration and I'm not an expert of 3D graphics programming, but I do know that selecting the current texture is an operation that is very expensive. However, I'm not sure that a SDL texture is translated into a real Texture.

So my question is: are these 2 approaches the same in terms of performance, when using SDL 2?


texts: Procedural... house with rooms generator

texts:
I've been looking at some algorithms and articles about procedurally generating a dungeon. The problem is, I'm trying to generate a house with rooms, and they don't seem to fit my requirements.

For one, dungeons have corridors, where houses have halls. And while initially they might seem the same, a hall is nothing more than the area that isn't a room, whereas a corridor is specifically designed to connect one area to another.

Another important difference with a house is that you have a specific width and height, and you have to fill the entire thing with rooms and halls, whereas with a dungeon, there is empty space.

I think halls in a house is something in between a dungeon corridor (gets you to other rooms) and an empty space in the dungeon (it's not explicitly defined in code).

More specifically, the requirements are:

There is a set of predefined rooms
I cannot create walls and doors on the fly.
Rooms can be rotated but not resized
Again, because I have a predefined set of rooms, I can only rotate them, not resize them.
The house dimensions are set and has to be entirely filled with rooms (or halls)
I.e. I want to fill a 14x20 house with the available rooms making sure there is no empty space.

Here are some images to make this a little more clear:

As you can see, in the house, the "empty space" is still walkable and it gets you from one room to another.

So, having said all this, maybe a house is just a really really tightly packed dungeon with corridors. Or it's something easier than a dungeon. Maybe there is something out there and I haven't found it because I don't really know what to search for.

This is where I'd like your help: could you give me pointers on how to design this algorithm? Any thoughts on what steps it will take? If you have created a dungeon generator, how would you modify it to fit my requirements? You can be as specific or as generic as you like. I'm looking to pick your brains, really.


texts: I have seen videos on creating the map/level in UE4, but not how to import the map from something like maya. Would I have to import it as an object? I have been playing around in the editor but haven't been able to find any setting that seems to do the trick.


texts: How can I load an asset from a file after I exported the build?

texts:
I am seeking possibility to switch character textures for game, even after I have compiled and built the binary.

For example I have a troll with a Sprite from "/assets/texture1.png"

Now after the game has been released, I can change this sprite.

Currently I have found this method

func _ready():
    var texture = load("res://textures/troll1.png")
    sprite.texture = texture

But after the export, when I change the troll1.png, the texture in the game remains the same.


texts: Keeping an object constrained to a 2d radius based off of the camera

texts:
A few weeks back I posted a question about keeping an object on the screen.  What I would like to do now is clamping an object around a 2d radius based on the camera.

I'm need this for a reticule for this on rail shooter I've been making. (like that of starfox)

Here is the current code I am using :

        Vector3 movementx = transform.TransformDirection(Vector3.right * Input.GetAxis("Mouse X") * aimSpeed);
        Vector3 newPosx = transform.position + movementx;
        Vector3 offsetx = newPosx - centerPt.position;
        transform.position = centerPt.position + Vector3.ClampMagnitude(offsetx, radius);
// the same for the y axis

The problem with this set up is that I'm restricting it around 3-dimensional objects base off their locations in the world. (this is restricting the players movement towards the edges not letting the player to move the reticule to the side)

So this is what I've tried:

   Vector3 screenPosition = Camera.main.WorldToScreenPoint(transform.position);
   Vector3 shipOnScreen = Camera.main.WorldToScreenPoint(Ship.position);

        Vector3 movementx = transform.TransformDirection(Vector3.right * Input.GetAxis("Mouse X") * aimSpeed);
        Vector3 newPosx = screenPosition + movementx;
        Vector3 offsetx = newPosx - shipOnScreen;
        transform.position = shipOnScreen + Vector3.ClampMagnitude(offsetx, radius);
// the same for the y axis

This just seems to send the empty (which the ship is pointing at) off some where else in the world I cant even tell if I'm moving it or if its just moving with the parent object. (I've tried different variations with this moving the screenPosition swapping it with the transforms position in world space to no avail)

My guess is that its not converting 2d space to 3d space when I try to clamp a 3d object within that radius.

I would like to keep my reticule at an empty point on the screen and not replace it with the cursor.

Edit:

Okay i have now thought up a new system that still needs some work. Having an empty object next to the reticule. With this I cut out the need for a 2d radius but I need this object object follow the ship on on the screen with taking in account the perception of the camera.

I have taken a measure of the height and width of the camera. Its not too exact but it should do.

So i guess I would like to know how the coordinate system on the camera is set up. like where is (0, 0)

update:

Okay I've found a way to do this but it took a quite a bit of math on my part and a bit of estimation on my behalf.

The way I've set it up is that I moving the pivot the same way I'm moving the ship only I'm multiplying it times the proportion of distance the ship can move side to side vs the distance the pivot can move side to side. I still have not built in an equation that will allow me to move the point farther back with more accuracy but this is a good temporary fix and if i really have to move it I'll i do the math again. but I would still like to have the equation of the rate of change. I'm not that brilliant at related rates. If you want to see my math I noted it down.

but if i can have an equation out of this it would work perfectly while changing

  ship distance (constant) (61.6209, 27.5131)

  first measure  distance : 100

  point A distance  (320.5, 143.1)

  5.20115872075484 y-multiplier

  5.200473802917458 x-multiplier

  so the multiplier at 100

  5.2

  distance : 50

  point B distance  (192.0436, 85.74551)

  3.11633 y-multiplier

  3.11633 x-multiplier

  so the multiplier at 100

  3.11633

  Rate of change  (5.2-3.1165)/(100-50) = ROC

  ROC = 0.04166934

  mt = 0.042

  y = No idea

  x = distances from ship

  =0.042

Oh in case your wondering how i got my measurements I measured the distance manually with points.


texts: How to set in Unity this Blender material with layer weight node?


texts: Accept keyboard input when game is not in focus?

texts:
I want to be able to control the game via keyboard while the game does not have focus... How can I do this in XNA?

EDIT: I bought a tablet. I want to write a separate app to overly the screen with controls that will send keyboard input to the game. Although, it's not sending the input DIRECT to the game, it's using the method discussed in this SO question:

https://stackoverflow.com/questions/6446085/emulate-held-down-key-on-keyboard

To my understanding, my test app is working the way it should be but the game is not responding to this input. I originally thought that Keyboard.GetState() would get the state regardless that the game is not in focus, but that doesn't appear to be the case.


texts: How do I restart tweens in DOTween and Unity?

texts:
I am trying to restart a couple of tweens when I load a new scene. So far,
I have this in MainMenuController.cs :

void Start () {
    if (currentScene.name == "MainMenuScene") {
        Debug.Log("In current scene");
        tweenList[0] = mainMenuText.transform.DOShakePosition(5, 10)
                                   .SetAutoKill(false).SetRecyclable(true);
        tweenList[1] = playGameButton.transform.DOShakePosition(5, 10)
                                     .SetAutoKill(false).SetRecyclable(true);
        tweenList[2] = exitGameButton.transform.DOShakePosition(5, 10)
                                     .SetAutoKill(false).SetRecyclable(true);
        DOTween.RestartAll(false);
    }

}

However, this does not start when I reload the scene using

public void ExitToMainMenu() {
        SceneManager.LoadScene("MainMenuScene");
    }

The above is called from another script.
Is there some way to restart my tweens when the scene is loaded again?