texts: How do I calculate player retention (and other industry accepted stats) for a single-player RTS game?

texts:
Suppose there is a typical desktop RTS game without online multiplayer on a Windows platform, like the original Warcraft: Orcs & Humans. It still connects to a server to log basic anonymous info about the player's sessions. Now it would be interesting to see customer (player) retention (and other stats) in an industry-accepted way.

What are some typical retention (and other stats) available to game developers, relevant to offline desktop games in general?

Unlike other games, RTS implies longer gameplay sessions (40min+). How does it affect retention calculation? What are some useful retention metrics (and other stats) in this case?

How to calculate above retention parameters, what statistics values are needed to do it?


texts: How to import assets to Unity3d Build on runtime

texts:
I am trying to import assets- ex:"fbx files"- into my app that is made using unity3d. this works easily inside the unity editor, but i need to do that in the actual build. any idea how to make this happen.
Note: i already read about asset bundles, but my files are local, so what i need is a way to locally import these files.

thanks in advance


texts: How do I handle game objects with two depths?

texts:
I want to be able to do what you see in the image, but with a single wall. The player should be able to walk on either side of the same object. That is, the same wall is below the hero when I go down from it, and it's above the hero if I come from above it.

It's like two depths in the same wall, so its not just a matter of drawing it before or after. I could cut the object in two, but that would be the easy (and maybe computationally expensive) solution. How should I do this?


texts: How do you make specific collisions in Unity?

texts:
So I have created a "game" where you are automatically running across platforms and you can jump and land on the top of them.
 I want to set it where if you collide with the the left and right side of the platform a death function executes.
How can I implement a collision mechanic to achieve this?What I want the collision to be like


texts:
Games like RollerCoaster Tycoon allow you to rotate the view at 90 degree intervals. I'm wondering how I could apply this to a game I'm making. I'm using MonoGame... but I'm wondering more if anyone could explain the theory behind the transformation rather than something language specific.

This video is exactly what I want to accomplish: http://youtu.be/qitkgiP13gw?t=15s

Basically all my tiles are in a 2D grid, and I just convert each X and Y to isometric for drawing. I'm assuming the transformation might be straight forward since it's a matter displaying the tiles with the right transformation.

Any help is greatly appreciated!


texts: Libgdx change the image inside table dynamically

texts:
I am trying to draw a HUD that shows the score and time and image like loading but I want to update and change the image when the score get higher but I tried to do that but it is not working. I thought maybe I can define new table in the update method and put different image each time but I don't want to define new table each time. is there anyway to update the image only inside the table: this is the code:

public class Hud implements Disposable{

        public Stage stage;
        private Viewport viewport;
        private static Integer worldTimer;
        private float timecount;
        private static Integer score;
        Label countdownLabel;
        private static Label scorelabel;
        private Label timelabel;
        private Label levellabel;
        private Label worldlabel;
        private Label mariolabel;
        private Image loading;
        private Table table;
        public Hud(SpriteBatch sb)
        {
            worldTimer=40;
            timecount=0;
            score=0;
            viewport=new FitViewport(Fruits.V_WIDTH,Fruits.V_HIEGT,new OrthographicCamera());//2
            stage=new Stage(viewport,sb);//stage is as box and try to put widget and organize things inside that table
            table = new Table();
            table.top();//table at top of our stage
            table.setFillParent(true);//table is now fill all the stage
            countdownLabel=new Label(String.format("%02d",worldTimer),new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            scorelabel=new Label(String.format("%02d",score),new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            timelabel=new Label("TIME",new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            levellabel=new Label("1-1",new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            worldlabel=new Label("WORLD",new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            mariolabel=new Label("Score"    ,new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            loading = new Image(new Texture("10%.png"));
            //loading.setSize(40, 10);
            table.add(mariolabel).expandX().padTop(10);

            table.add(timelabel).expandX().padTop(10);
            table.add(worldlabel).expandX().padTop(10);
            table.row();
            table.add(scorelabel).expandX();

            table.add(countdownLabel).expandX();
            table.add(loading).width(50).height(10);

            stage.addActor(table);

        }
        public void update(float dt)
        {
            timecount+=dt;
            if (timecount>1)
            {
                worldTimer--;
                if(worldTimer>=0) {
                    countdownLabel.setText(String.format("%02d", worldTimer));
                    loading=new Image(new Texture("90.png"));
                }
                timecount=0;

            }
        }
        public static int getTime()
        {

            return worldTimer;
        }

        public static void addScore(int value)
        {
            score +=value;
            scorelabel.setText(String.format("%02d",score));
        }
        public static int getScore()
        {
            return score;
        }
        @Override
        public void dispose() {
            stage.dispose();
        }
    }


texts:
I am currently making a mod for Minecraft but I have come to a stop because I am lacking in some knowledge. I need to get data for the entity I am looking at, which I believe requires the use vectors, something I don't really know how to use.

How would I achieve this? Some stuff that I think could help are mc.thePlayer.getLookVector() which returns the normalized vector of the user and mc.theWorld.loadedEntityList, which  is a List with all the loaded currently loaded entities.


texts: What are the requirements for a sound file in android?

texts:
I am creating a game in Android and eventually I am going to outsource the sound effects. I have a few place holder sounds for testing and I have noticed a problem.  I have an OGG sound file which plays correctly through the emulator/headphones but when I put it on my phone it doesn't play.  Putting my ear right up to the speaker I can hear a faint crackle.

So what are the requirements for a mobile sound file?  Frequency, format, etc.


texts: Turn-based strategy games where action happens in real-time?

texts:
Okay, this idea has come up for the 3rd time in conversation now, and it's been bugging me for years. The idea is a game where all players make decisions/issue orders to units while the game is in a paused state, and all the actions are executed at once, in real-time. This could be at any level from a TRPG (i.e. Final Fantasy Tactics), to a small-scale skirmish (i.e. Worms), to a game with bases and many units (i.e. Advance Wars), to a Risk-type game (i.e. Risk).

The main disadvantage to this I can see is that the player doesn't see the result of an action immediately. In a traditional turn-based or real-time strategy game, the user clicks "attack that fool" and there's an explosion straight away. There also might be weird situations (you send your unit to melee a unit running in the opposite direction, for example), but that's a low-level detail; a good game designer should be able to get around these things. Finally, there's the general paucity of turn-based games, but they offer a level of tactical depth impossible in real-time strategy games, and there's always a market for them (dozens of new TBSes appear each year).

Are there any games out there that use this paradigm?
Why aren't there more?
What would be necessary to make this work?
What potential issues could you foresee?

To clarify, I mean pure strategy. The commands are input beforehand, and the resolution is realtime, but it doesn't require realtime "twitch" input by players.

EDIT: Iain's answer pointed me to Laser Squad Nemesis, which basically answered the 2nd and 4th question ;-P -- If you want to know why this won't work, download the demo (It's 9MB) and click the first tutorial. OUCH! Of course, Laser Squad Nemesis's UI doesn't help (play and pause buttons? seriously? and why do I have to click "issue orders" every turn if that's the only thing I'm going to be doing?)

For simpler things (like the board games mentioned in a couple answers, or Zwok that Iain created), this paradigm works great! Issues seem to arise with a more traditional tactics/strategy game, because the lag between the entry of a command and the execution of the command is apparent. In fact Zwok - and some of the board games mentioned - work because off this lag, not in spite of it. You're encouraged to guess what your opponent will do next and "think ahead". However in a more traditional small-scale tactical strategy game, the frustration factor isn't worth it.

It might be interesting to see a game like this on a really large scale. For example, Lee and Napoleon didn't order their troops around in real-time, but rather made decisions based on information that was often hours old -- and it often took hours for those orders to get executed. Even today, generals don't have real-time top-down maps. But taking that "frustration factor" out would require some seriously deft game design.


texts: Help trying to use TinySoundFont library with SDL_Mixer

texts:
I'm using SDL_Mixer in my project currently and I found the following library to play sounds from a soundfont https://github.com/schellingb/TinySoundFont
I tried this example which use the normal SDL_OpenAudio and it works fine https://github.com/schellingb/TinySoundFont/blob/master/examples/example2.c#L72
The issue here is that I'm not sure how to translate this example into SDL_Mixer.
Usually in SDL_Mixer I just load a wav into a Mix_Chunk with Mix_LoadWav, and then I play it with Mix_PlayChannel(-1, myChunk, 0)
In the TinySoundFont example it seems like there is a callback that I'm not sure where to add in the SDL_Mixer, and also, how I put tsf_note_on inside a chunk so it gets played when I call Mix_PlayChannel?


texts: Isometric Game World Boundaries Equation

texts:
I ran into a problem last night and I can't solve it since.
I'm making an isometric game based on tiles with equal rows and columns.
Now I made moving entities which should turn whenever they reach the boundaries of the world. As I illustrated on the picture they are turning back on the upper boundaries (green) , but not on the lower ones (red).
I tried various equations on the lower part, but i cannot figure out for the life of me what is the lower parts code. What would be an appropriate solution for the shrinking lines?

boolean checkBounds(){
        float absX = Math.abs(getX());
        float absY = Math.abs(getY());
        if(absY*2-absX<0 || ??? ) return false
        else return  true;
    }


texts: Get number of sides of a shape created with LineRenderer in Unity

texts:
In my game I'm using LineRenderer to draw a line at every mouse click.

As you can see, everytime the lines collides with itself it creates a new shape.

I'm able to detected position using an EdgeCollider that I update everytime I add a position to the LineRenderer.

This is my code:

    private LineRenderer lineRenderer;
private Vector3 target;
private int currentIndex;
private bool hasTarget;
private EdgeCollider2D edgeCollider2D;
private List<Vector2> edgeColliderPoints;

void Start ()
{
    lineRenderer = gameObject.GetComponent<LineRenderer>();
    edgeCollider2D = gameObject.GetComponent<EdgeCollider2D>();
    currentIndex = 0;
}

// Update is called once per frame
void Update ()
{
    var position = lineRenderer.GetPosition(currentIndex);
    if (hasTarget && target != position)
    {
        var currentPosition = Vector3.MoveTowards(position, target, targetSpeed * Time.deltaTime);
        lineRenderer.SetPosition(currentIndex, currentPosition);

        CheckDetection(currentPosition);
    }
    else
    {
        hasTarget = false;
    }

    if (Input.GetMouseButtonDown(0) && !hasTarget)
    {
        target = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        target.z = 0;
        hasTarget = true;
        currentIndex++;
        lineRenderer.positionCount++;
        lineRenderer.SetPosition(currentIndex,position);
        edgeColliderPoints.Add(transform.InverseTransformPoint(position));
        edgeCollider2D.points = edgeColliderPoints.ToArray();
    }
}

private void CheckDetection(Vector3 currentPosition)
{
    lineRenderer = gameObject.GetComponent<LineRenderer>();

    var hit = Physics2D.Linecast(currentPosition, target);

    if (hit.collider != null)
    {
        print("Hit " + hit.collider.name + " at point " + hit.point);
    }
}

What I want to do is get the number of sides of every shape that is created after a collision.

How can I do that ?


texts: Indicate key options in a keyboard-only game

texts: I am creating a music-based app for one of the courses I teach at a high school, so it's not for sale in the app store, it's only for my students to use. I decided to make it keyboard only partially because I didn't want to have to create a whole bunch of buttons and then link them to code. What's a good way to indicate on the screen what certain keys do? For example, the escape key will exit the user from the settings menu scene, it is also used to bring up a list of options in-game. Is there a slick way to explain what certain keys do without having some sort of legend on screen in the various scenes? Screens = scenes (I'm using SpriteKit for OS X). Remember, using the mouse is not at all an option.


texts: Another way of writing 2D arrays on Game Maker Studio?


texts: Determine if set of connected tiles can fit inside grid

texts:
Feel free to edit the title; I had a hard time figuring out how to explain it in a single line.

Here goes. I'm trying to generate these grids automatically, and randomly.

I have a grid of 25 tiles (indicated by #)

#####
#####
#####
#####

Let's say that I have 2 monsters I want to place in this grid, each monster occupies 3 or 4 tiles, with different patterns (these are not random, but is defined somewhere).

Monster 1 indicated by the letter A
Monster 2 indicated by the letter B

An example of this:

#AA##
#BA##
#BBB#
#####

Or it could be (this is whre the randomness comes in):

AA###
#A###
#B###
#BBB#

How would I go about calculating where, for example, monster B fits in the grid after A has been placde? Monster B has a pattern of:

B
BBB

And A has a pattern of:

AA
 A

A possible pattern could also be (for a different monster than A and B):

C
 C
  C

Is this even possible to automate? Hope that makes sense, otherwise I can try drawing it instead.

Thanks


texts:
I am confused about the triangle strip representation of closed mesh .The vertex buffer for triangle strip representation of the a figure is shown below:

A(0,1) B(0,0) C(1,1) D(1,0)E(2,1)

vertex buffer=[A,B,C,D,E] where, T1=(A,B,C) T2=(B,C,D) T3=(C,D,E)

Now, if I have a tetrahedron with four vertex A(0,0,0),B(1,0,0),C(0,1,0) and D(0,0,1) then what would be its vertex buffer representation?

Thank you very much.


texts:
I am trying to understand how pygame surfaces work. I am confused about Rect position of Surface object.
If I try blit surface on screen at some position then Surface is drawn at right position,
but Rect of the surface is still at position (0, 0)...
I tried write my own surface class with new rect, but i am not sure if is that right solution.
My goal is that i could move surface like image with rect.move() or something like that.
If there is any solution to do that i would be happy to read it.

Thanks for answer and time for reading this awful English

If helps i write some code for better understanding my problem.
(run it first, and then uncomment two lines of code and run again to see the diference):

import pygame
from pygame.locals import *

class SurfaceR(pygame.Surface):
    def __init__(self, size, position):
        pygame.Surface.__init__(self, size)
        self.rect = pygame.Rect(position, size)
        self.position = position
        self.size = size

    def get_rect(self):
        return self.rect

def main():
    pygame.init()
    screen = pygame.display.set_mode((640, 480))
    pygame.display.set_caption("Screen!?")
    clock = pygame.time.Clock()
    fps = 30

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

    surface = pygame.Surface((70,200))
    surface.fill(red)

    surface_re = SurfaceR((300, 50), (100, 300))
    surface_re.fill(blue)

    while True:
        for event in pygame.event.get():
            if event.type == QUIT:
                return 0

        screen.blit(surface, (100,50))
        screen.blit(surface_re, surface_re.position)

        #pygame.draw.rect(screen, white, surface.get_rect())
        #pygame.draw.rect(screen, white, surface_re.get_rect())

        pygame.display.update()
        clock.tick(fps)

if __name__ == "__main__":
    main()


texts: Saving data in the local computer with cocos2d-js

texts: Making a game with cocos2d-js, is there a reliable way to create saved data in my local computer? I see that there is cc.sys.localStorage but it is removed if the user clears the browser's cache or when they simply use another browser.


texts: Android OpenGL: Use several Textures for one Animated Sprite

texts: Good evening. I'm programming an Android Game. To reduce the amount of textures that need to be loaded (OpenGL ES 2.0) I've created several spritesheets of size 1024x1024. Some frames of the same animation are on different spritesheets. Now my question is if that is bad for the performance since I have to bind (OpenGL.bind()) a different texture for each animation frame? Thank you for clarification!


texts: How do I move the paddle with the arrow keys?

texts:
I am making a pong game using gdi+ and c#. I want to move the paddle using the arrow keys by using the move variable, but it does not work; the paddle does move when I use the int move=0; global variable.

I am thinking about nesting my methods.

Is it possible to nest the Form1_Paint into the Form1_Keypress method?

    int move = 0;

    public void Form1_KeyPress(object sender, KeyPressEventArgs e)
    {
        if (e.KeyChar == (char)56)//key 8
        {
            move--;
        }

        if (e.KeyChar == (char)50)//key 2
        {
            move++;
        }
    }

    public void Form1_Paint(object sender, PaintEventArgs e)
    {
        Graphics g = e.Graphics;
        SolidBrush blueBrush = new SolidBrush(Color.Blue);
        SolidBrush redBrush = new SolidBrush(Color.Red);
        SolidBrush whiteBrush = new SolidBrush(Color.White);
        Rectangle rect1 = new Rectangle(0, 250, 35, 100); //blue paddle
        Rectangle rect2 = new Rectangle(750, 250 + move, 35, 100); //red paddle
        Rectangle rect3 = new Rectangle(390, 290, 10, 10); //white ball
        g.FillRectangle(blueBrush, rect1);
        g.FillRectangle(redBrush, rect2);
        g.FillRectangle(whiteBrush, rect3);
        g.Dispose();
    }


texts: Why do Pool.Default D3D volume textures take memory from my process?

texts:
I am working on a Direct3D rendering application that uses a lot of texture RAM. I notice that if I allocate a Pool.Default volume texture:

   _texture = new VolumeTexture(device, size.Width, size.Height, size.Depth, 1, Usage.None, Format.L16, Pool.Default);

my process's system memory decreases by the same amount I allocate on the video card. I think this is unexpected. This texture is supposed to be video-memory only.

Effectively this means I can not use all texture RAM on high end video cards, I can not afford to lose a whole gigabyte of system RAM. We're short on adress space as it is....

Is there anybody who knows what's happening here? Are there ways to prevent this from happening?

This was seen on Windows 7 64 bit from a 32 bit process, using Directx 9c, with several different nVidia cards. The process is marked as /LARGEADRESSAWARE to make sure we get as much as adress space as possible.

You may have guessed by now that I am not writing a game.... but I assume the Direct3D experts are here to be found.... And I can imagine this issue affects games as much as it affects us...

EDIT:

This appears to happen only with Volume Textures. If I allocate 2D textures of the same size it does not happen. By default my volume textures were 32megabytes each. If I make them smaller (I tried down to 2megabytes each), There are still blocks being allocated. According to VMMap, each texture gets a 32 meg block in my process, flagged as "Read/Write/WriteCombine".

The fact that they are labeled as "WriteCombine" makes me really curious, no other block of memory is labeled like that.


texts: How to run a timer parallel to a series of coroutines and WaitForSeconds

texts:
In the code below, I have a cycle for enemies appearing and disappearing.

IEnumerator EnemyCycle()    {
while (isRepeating)
{

for (int j = 0; j < enemies.Length; j++) {

    canStartUpdatingReset = true;
    Enemy currentEnemy = enemies [j];
    var _myMaterial = currentEnemy.GetComponent<Renderer>().material;
    var _currentFade = StartCoroutine(FadeToForEnemy(_myMaterial, 0f, fTime, currentEnemy.gameObject, false));

coroutinesToStop.Add(_currentFade);

if (currentEnemy.hasWeapon) {
                weaponCycleCoroutines.Add(StartCoroutine(FadeToForWeapon(currentEnemy.weapon.GetComponent<Renderer>().material, 0f, fadeTime, currentEnemy.weapon, false)));

            }
}

yield return new WaitForSeconds (hideTime);

for (int j = 0; j < enemies.Length; j++) {

    Enemy currentEnemy = enemies [j];
    var _myMaterial = currentEnemy.GetComponent<Renderer>().material;
    var _currentFade = StartCoroutine(FadeToForEnemy(_myMaterial, 1f, fTime, currentEnemy.gameObject, true));

     coroutinesToStop.Add(_currentFade);
if (currentEnemy.hasWeapon) {
weaponCycleCoroutines.Add(StartCoroutine(FadeToForWeapon(currentEnemy.weapon.GetComponent<Renderer>().material, 1f, fadeTime, currentEnemy.weapon, true)));
}
yield return new WaitForSeconds (showTime);

        }
    }
}

I have an enemyCycleDuration float which is

enemyCycleDuration = 60*(hideTime + fadeTime + showTime + fadeTime)

Note that fadeTime comes from FadeToForWeapon and FadeToForEnemy. The idea here is I want the enemyCycleDuration to be run in parallel to EnemyCycle() so it is reset (please see code below) at the same time that

yield return new WaitForSeconds (showTime);

is reached in the  EnemyCycle().

I am resetting enemyCycleDuration in the following way in the update method but  EnemyCycle() seems to be ahead of enemyCycleDuration, always completing before enemyCycleDuration is reset. How can I get both to run parallel to each other in timing and complete at the same time?

if (canStartUpdatingReset)  {
timeElapsed +=1;
if(timeElapsed >= enemyCycleDuration) {

    timeElapsed = 0;

    Debug.Log ("Reset CycleDuration");
    }
}


texts: Health bar without image collapsing to the centre in Unity 2D

texts:
I am trying to create a health bar that collapse symmetrically to the centre. The color palette of my game is minimal and the health bar is only one color that does not change with size. I am new to Unity and am not sure how to achieve this.

This video uses a GameObject with an Image component, adds the health bar sprite to the image, makes the Image type fill and then changes the fill amount from the script.

I have two questions for my particular case,

I would prefer not to use an image. Since the bar is one color I can use color selector to make the bar, but then it does not have the fill type. Is there a way to do using only color?
The the bar is anchored at one end left or right. I want to anchor it at the centre. One work around is to use two objects side by side and fill them in opposite directions to get the desired effect. Is there a better way?


texts: Update DirectX 11 Texture Created in Unity Asynchronously in the Native (c++) Plugin

texts:
tl;dr version :) Is it possible to update DirectX 11 textures created in Unity asynchronously in a native plugin (C++)?
I've written a plugin that retrieves data from Kinect.
Currently, color stream data is written to a texture created by Unity in a separate thread in the plugin using DirectX 9 as shown in the example below.
D3DLOCKED_RECT lockedRectangle;
colorFrameTextureDX9->LockRect(0, &lockedRectangle, NULL, 0);
memcpy(lockedRectangle.pBits, colorFrameMat.data, colorFrameMat.total() * colorFrameMat.channels());
colorFrameTextureDX9->UnlockRect(0);

With DX9 this works beautifully. As far as I know calling LockRect on a DX9 texture locks the texture data and memcpy after that is thread safe.

Using this code sample from Unity I've added support for DX11 textures.
ID3D11DeviceContext *ctx = NULL;
device->GetImmediateContext(&ctx); // Device is sent from Unity

D3D11_TEXTURE2D_DESC desc;
colorFrameTextureDX11->GetDesc(&desc);
ctx->UpdateSubresource(colorFrameTextureDX11, 0, NULL, colorFrameMat.data, colorFrameMat.cols * colorFrameMat.channels(), 0);
ctx->Release();

When Unity is run in DX11 mode, this runs perfectly for a few second after which it crashes without error report. I believe the problem is in using UpdateSubresource method which doesn't lock the texture causing simultaneous access from Unity's rendering pipeline and plugin thread.
In DX11 documentation I came across the Map/Unmap methods for updating textures which work similarly to LockRect/UnlockRect methods from DX9. However these methods can only be used with DX11 textures created as D3D11_USAGE_DYNAMIC and the texture from Unity is created as D3D11_USAGE_DEFAULT.
Is it possible to change or recreate the texture created in Unity with different usage flags?
Thanks in advance to anyone who even read it all :D


texts: What are the ramifications for lying to the ESRB?

texts:
The ESRB Ratings Process walkthrough describes the steps to get a physical boxed game rated:

  Physical (e.g., boxed) games typically sold at retail are rated using a "Long Form" process whereby ESRB raters evaluate the content of each game in advance of its public release. In these cases the publisher must provide two key forms of content disclosure as their game is being finalized:
  1: a completed ESRB online questionnaire detailing the game's pertinent content, which essentially translates to anything that may factor into the game's rating. This includes not only the content itself (violence, sexual content, language, controlled substances, gambling, etc.), but other relevant factors such as context, reward systems and the degree of player control; and
  2 a video that captures all pertinent content, including typical gameplay, missions, and cutscenes, along with the most extreme instances of content across all relevant categories. Pertinent content that is not playable (i.e., "locked out") but will exist in the game code on the final game disc must also be disclosed.
  Once checked to ensure that all pertinent content disclosed in the completed questionnaire is reflected in the video submitted, the video is reviewed by a group of at least three trained raters who collectively deliberate about what rating should be assigned.

For digital games, the ‘Short Form’ process is similar.

Implicit in all of this is the idea that you will fill out the questionnaire honestly, and that you will submit video footage indicative of questionable game content.

But what if you didn’t? What if a game like, say, GTA ‘marketed’ itself to ESRB as an open-world life simulator, and totally left out the violence/theft/etc. when submitting their materials? When the organization found out the developers lied, what exactly would happen?


texts: How handle Nifty initialization in a Slick2D state based game?

texts:
I'm using Slick2D and Nifty GUI. I decided to use a state based approach for my game and since I want to use Nifty GUI, I use the classes NiftyStateBasedGame for the main and NiftyOverlayBasicGameState for the states.

As the description say, I'm suppose to initialize the GUI in the method initGameAndGUI on my states, no problem:

@Override
protected void initGameAndGUI(GameContainer gc, StateBasedGame sbg) throws SlickException {
    initNifty(gc, sbg)
}

It works great when I have only one state but if I'm doing a call to initNifty several times from different states, it will raise the following exception:

org.bushe.swing.event.EventServiceExistsException: An event service by the name NiftyEventBusalready exists.  Perhaps multiple threads tried to create a service about the same time?
at org.bushe.swing.event.EventServiceLocator.setEventService(EventServiceLocator.java:123)
at de.lessvoid.nifty.Nifty.initalizeEventBus(Nifty.java:221)
at de.lessvoid.nifty.Nifty.initialize(Nifty.java:201)
at de.lessvoid.nifty.Nifty.<init>(Nifty.java:142)
at de.lessvoid.nifty.slick2d.NiftyCarrier.initNifty(NiftyCarrier.java:94)
at de.lessvoid.nifty.slick2d.NiftyOverlayBasicGameState.initNifty(NiftyOverlayBasicGameState.java:332)
at de.lessvoid.nifty.slick2d.NiftyOverlayBasicGameState.initNifty(NiftyOverlayBasicGameState.java:299)
at de.lessvoid.nifty.slick2d.NiftyOverlayBasicGameState.initNifty(NiftyOverlayBasicGameState.java:280)
at de.lessvoid.nifty.slick2d.NiftyOverlayBasicGameState.initNifty(NiftyOverlayBasicGameState.java:264)

The initializeEventBus that raises the exception is called from the Nifty constructor and a new Nifty object is created within the initNifty method:

public void initNifty(
    final SlickRenderDevice renderDevice,
    final SlickSoundDevice soundDevice,
    final SlickInputSystem inputSystem,
    final TimeProvider timeProvider) {
    if (isInitialized()) {
       throw new IllegalStateException("The Nifty-GUI was already initialized. Its     illegal to do so twice.");
    }

    final InputSystem activeInputSystem;
    if (relayInputSystem == null) {
       activeInputSystem = inputSystem;
    } else {
      activeInputSystem = relayInputSystem;
      relayInputSystem.setTargetInputSystem(inputSystem);
    }

    nifty = new Nifty(renderDevice, soundDevice, activeInputSystem, timeProvider);
  }

Is this a bug in the Nifty for Slick2D implementation or am I missing something? How am I supposed to handle Nifty initialization over multiple states?


texts:
I want to set anchor point for the sprite like cocos2d has done for their implementation. I do not found any thing like that in andengine so please provide guidance on that. I want to move the sprite on touch so I use following code but that does not work for me.

super.setPosition(pX - this.getWidthScaled() / 2,
            pY - this.getHeightScaled() / 2);

Because I touch on the corner of the image but automatically it comes at center of the image because of above code. I want to remain the touch at desire position and drag it. For me the anchor point became useful. But I don't found anything in andengine.


texts:
I am trying to load a bunch of prefabs from an asset bundle.  I am building the asset bundles for StandaloneWindows64:

BuildPipeline.BuildAssetBundles(BuildPath, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);

I load my asset bundle using Unity's new web request system:

var www = UnityWebRequest.GetAssetBundle(Url);
yield return www.Send();
if (www.isError)
{
    Debug.LogError(www.error);
    yield break;
}
var bundle = ((DownloadHandlerAssetBundle)www.downloadHandler).assetBundle;

However, my bundle does not have my asset bundle in it.  It only has the manifest:

//Output:  "1 asset: bundlemanifest"
Debug.Log(bundle.GetAllAssetNames().Length + " asset: " + bundle.GetAllAssetNames()[0]);

If I look at my manifest, I can see my asset bundle names "structures" does exist:

ManifestFileVersion: 0
CRC: 3317959940
AssetBundleManifest:
  AssetBundleInfos:
    Info_0:
      Name: structures
      Dependencies: {}

I tried retrieving it from my AssetBundleManifest:

var manifest = bundle.LoadAsset<AssetBundleManifest>("assetbundlemanifest");

But the AssetBundleManifest only has functions which return strings and Hash128s.

How can I instantiate the prefabs in my asset bundle named "structures"?


texts: 2D Game Physics: How to evaluate when an accelerating ray is close to a point?

texts: Given a ray in a 2D world at position p with initial velocity u and acceleration a how can I tell when it's within a certain distance r from a certain point.


texts: How can I animate/draw a line renderer over a given period of time

texts:
I have created a line renderer using the code below:

public class MyLineRenderer : MonoBehaviour {
LineRenderer lineRenderer;

public Vector3 p0, p1;

// Use this for initialization
void Start () {
    lineRenderer = gameObject.GetComponent<LineRenderer>();
    lineRenderer.positionCount = 2;

    lineRenderer.SetPosition(0, p0);
    lineRenderer.SetPosition(1, p1);

    }
}

How can I write a coroutine that will animate/draw the line over specific duration, say 2 seconds?


texts:
I have the following variables:

Point of interest which is the position(x,y) in pixels of the place
to focus.
Screen width,height which are the dimensions of the window.
Zoom level which sets the zoom level of the camera.

And this is the code I have so far.

void Zoom(int pointOfInterestX,int pointOfInterstY,int screenWidth,
   int screenHeight,int zoomLevel)
{
glScalef(1,1,1);
glTranslatef( (pointOfInterestX/2) - (screenWidth/2), (pointOfInterestY/2) - (screenHeight/2),0);

glScalef(zoomLevel,zoomLevel,1);
}

And I want to  do zoom in/out but keep the point of interest in the middle of the screen. but so far all of my attempts have failed and I would like to ask for some help.


texts: Why does this order of Quaternion multiplication not introduce roll into my fps-style character controller?

texts:
I'm working on an OpenGL based project (in C#), employing Quaternions to rotate my camera I first tried to:
cameraOrientation = cameraOrientation * framePitch * frameYaw;

This accumulated an undesired roll in my cam-controller which made rotations unusable.
I found a post on stack exchange which suggested this reordering of operations:
cameraOrientation = framePitch * cameraOrientation * frameYaw;

Which completely solved this accumulation of roll. While I'm comfortable with matrix multiplication, I can't seem to understand why this removes roll accumulation. Does anybody have any articles or images so I can grok what's happening here?
It feels weird not to understand such a fundamental operation in my project.
Thanks!


texts: Directional shadow mapping view/projection matrices

texts:
I've got shadow mapping with directional lights working, but I believe I am constructing the view/projection matrices wrong.

Here's how I build them:

Mat4 viewMatrix = LookAt(lighting.mCameraPosition + (directionalLight.mLightDirection * Z_FAR / 2.0f), -directionalLight.mLightDirection, Vec3(0.0f, 1.0f, 0.0f));
Mat4 lightVP = CreateOrthographicMatrix(-Z_FAR, Z_FAR, -Z_FAR, Z_FAR, Z_NEAR, Z_FAR) * viewMatrix;

The problem is the shadows become skewed and change depending on the camera position, which is bad. What is the proper way of doing this?

EDIT:

1) No, that is what I'm not sure about; currently as you said it is the camera position and thus the shadows moves around when I move the camera, which is bad - what should be the actual position, since directional lights have no position?

2) Also using Z_FAR DOES make it pixelated which is my second problem - but must not the boundaries be Z_FAR in all directions, otherwise objects in the view range may not cast shadows?


texts: What data should a generic collision detection system gather?

texts:
I'm working on a relatively generic 2D AABB collision detection system for a game engine, and I've re-written it more times than I'd like to admit, due to not calculating or recording specific details of each collision. Right now, this is what I'm collecting:

Collision time as a fraction of an update cycle in the game loop.
Location of the collision.
ID of the colliding object.

Each object has a Set that holds this data for each collision (I'm working with a component/entity system) so other systems can use the recorded data. The problem I just ran into was that I needed to know which side of the object the collision takes place on.

What other values or points of interest should I calculate or record, per collision? What do you look for in a standard collision detection system?


texts: Is there a way to duplicate the windows desktop zooming in SDL to make low res pixels look like stylyzed cartoon art?

texts:
When you hit the Win key and numpad plus key at the same time it opens the desktop magnifying glass and the effect of this on low res pixel art is to make it look like super cool stylized cartoon art. I want the game to look like this all the time. Is there a way to do this permanent i SDL or DirectX or OpenGL?

How I have achieved this image is to run the game in a small windows and have the windows 10 magnifying glass hoover over it and I hit print screen. And I want the game to look like this all the time in full screen.

Ps. This is the Gradius 3 ship that I use for place holder graphics for question asking purposes.


texts: Unity WheelJoint2D will not rotate when increasing motor speed

texts:
I have a wheel joint 2D attached to a game object in Unity:

In its associated wheel script I am increasing the motor speed as described in the tutorial.

public class Wheel : MonoBehaviour
{
    WheelJoint2D wheel;
    JointMotor2D motor;

    void Start()
    {
        wheel = GetComponent<WheelJoint2D>();
        motor = wheel.motor;
    }

    void Update()
    {
        if (Input.GetKey(KeyCode.RightArrow))
            motor.motorSpeed += 10;

        if (Input.GetKey(KeyCode.LeftArrow))
            motor.motorSpeed -= 10;

        //Debug.Log(motor.motorSpeed);
    }
}

The problem is that the sprite does not rotate and I am not certain as to why?

Does the wheel joint have to be attached to another rigid body in order to function?


texts: What are these odd distortions on far away textures?

texts:
I'm currently writing a simple voxel engine just to get some practice in, and I'm coming across some odd issues. In order to generate terrain, I create a mesh and then assign UV coordinates on a texture atlas to each vertex. Whenever I run the game, I get strange distortions, like these:

I've tried doing a few things so far:

Generating mip maps for the texture atlas.
Play around with the max size of the texture atlas.
Play around with the format of the texture atlas.

Unfortunately, none of these have worked so far. As of right now, the import settings on the texture atlas itself look like this:

Is there any way I can get rid of these obnoxious distortions?


texts:
Really? Negative zero?!

double Vector2D::GetFacingAngle(const Vector2D& target, const Vector2D& source) {
    a2de::Vector2D facingVec(Vector2D(source) - Vector2D(target));

    //Negating 'y' argument to account for flipped nature of 'y' screen coordinates.
    double result = std::atan2(-facingVec.GetY(), facingVec.GetX());

    //Which causes -0.0 as a possible result when source is right of target at the same 'y' coordinate.
    if(a2de::Math::IsEqual(result, -0.0)) return 0.0;
    return result;
}

Is this a common behavior? (Similar to subtracting 'y' coordinates for 'up' movement in screen coordinates contrary to Cartesian coordinates.)


texts:
I would like to know if there's a way to remap a value that goes from 0 to 1 constantly like this.

Into those values (those are examples).

This might be some function transformation but I can't find the way to do that. I've tried using a lookup texture but in my opinion this is not the best solution.
Thank you very much.


texts:
I've seen a lot of questions about this problem, but really no solution. Hopefully I can explain the issue well enough that I can get some sort of closure on this problem.

I'm using a Fixed Time Step based on the code found here : GAFFER ON GAMES / Fix Your Timestep! , and with that method I'm using an accumulator value to compensate for any slowdowns or speedups in the frame rate. Typically the time between frames is between 15.5 and 17.5 ms (with the fixed rate aiming for 1000/60 fps). What ends up happening is this:

That green chart is showing the accumulator. Which freaks out once the accumulator gets beyond 1000/60 fps. At this point you can see that because of the variance between refresh rates (15.5-17.5) sometimes the accumulator is above or below the threshold of 16.66666666... until it eventually gets to a point that the accumulator is too big to be negated by the next frame variance.

If I simply ignore the refresh rate and assume a constant 60fps the flutter never occurs, so its shouldn't be a vsync issue (right?), it's not the GC kicking in. It's an issue with this part of the code:

accumulator += frameTime;

while ( accumulator >= dt )
{
    update_logic();
    accumulator -= dt;
}

I realize the issue is when the accumulator hits ~0 it actually starts doing double updates and skipping updates for a while causing the flutter/stutter look.

It's very possible that I'm just not understanding how the accumulator is suppose to work, or perhaps the variance in screen refreshing is too much for this to work well.

Thanks in advance!

Update

Here is a screen cap of an output log showing how the variance in frameTime is causing the update call to double up and skip.

The items in red are when the accumulator never gets to 16.66666666...

For the time being I'm 'fixing' the issue by never letting the accumulator to get below the frameTime variance, but this doesn't feel like a real answer, just a patch.

if(accumulator < 1){
    accumulator = 1.5;
}

Perhaps this bit will help explain. If you start the accumulator at 0 and the first frame takes 15.89999ms, we don't update anything, and then if the next frame is 17.55555ms we now have (~33.44ms) so it updates twice. The more the variance in the frameTime the worse the problem.

I've noticed plenty of people with this issue, and typically the conversation ends with no posted solution, it either "goes away" or the thread dies.


texts: I would like to render the bones of the Tiny.x animated mesh.  I know there are 35 bones, and I know their names, but I'm having trouble with each bone's matrix.  Do I need to convert the matrix with d3dxvec3transformcoord function, or can I use the .m41,.m42,.m43 on the vertex buffer ?


texts:
I have been going through the documentation and the Pygame functions and classes today, but couldn't find a reasonable way to either create a circular crop of an image or how to use a mask to perform this: assume an empty circle with a line width of 50px, with a single key color, that is supposed to be removed from surface A and then replaced with the contents of the same pixels on surface B (perhaps I'm mixing definitions here between Pygame's Mask and image editors' - such as Photoshop - masks).

I know surfarray can be used for the task (after a list of pixel coordinates is extracted from surface B), but my tests were too slow and ended up hanging the main loop.

Is there a way to achieve the described above through an efficient and quick method, that can be embedded into the main loop of the application without a significant drawback to the overall processing?


texts: How to reference a GameObject from the Scene Hierarchy in C#?

texts:
I am a novice in Unity. I have a Game Object named 'courtsuit'; you can see it in my Scene Hierarchy panel here:

I added that object instance to my scene by dragging an OBJ file from my Project Assets folder into the Scene Hierarchy panel.

Now I want apply a material man to the game object at runtime. That is, when I click a button, that game object needs to change its material.

I tried and succeed by attaching a script to game object itself:

Material SphereMaterial;

// Use this for initialization
void Start()
{
    SphereMaterial = Resources.Load<Material>("Materials/man");
    if (SphereMaterial == null) Debug.Log("mat null");
    else Debug.Log("mat not null");
    Debug.Log("new Material: " + SphereMaterial.name);
    MeshRenderer meshRenderer = GetComponent<MeshRenderer>();

    // Get the current material applied on the GameObject
    Material oldMaterial = meshRenderer.material;
    Debug.Log("Applied Material: " + oldMaterial.name);
    // Set the new material on the GameObject
    meshRenderer.material = SphereMaterial;
}

But I don't know how to do this from an OnClick script on a different object, because I don't know how to locate the object in my Scene Hierarchy using C# script.

I want to do something like this:

public class ButtonHandler : MonoBehaviour {

    public void ButtonInteract()
    {
        Debug.Log("changing matriel ");
        // Change the material of the game object here

    }
}

How can I change the Game Object courtsuit's material to a material named 'man' from my Resources/Material folder using C#?


texts: I want a straight 3d Python engine that's easily obtainable for linux and easy to use. Soya3D failed for me because of the lack of documentation. I should be able to load common 3D models without an issue.


texts: Is it possible to find a seed based on 10,000 generated random numbers?

texts:
I'm currently entertaining an idea I've had about procedurally generating a world. I would like the entire world to be procedurally generated on the fly. So when a chunk is loaded, it uses a seeded random number generator to create the terrain and objects. It is seeded to maintain persistence. This is nothing new.

Next, I want the player to be able to come in and manipulate the environment (destroy blocks, place blocks; I'm using a minecraft type recreation right now to test the idea because the blocky environment is simple to work with). If we simply used a seeded random number generator, the player's changes would get overwritten once the chunk is discarded and reloaded. So what if we use the new block locations in the scene to generate a seed for a random number generator that will generate the environment. We know the exact order that it will generate blocks, so each time a number will be generated, we know what that number should be. I've looked around the cybersecurity forums a bit but haven't found a good explanation of retrieving seeds given ordered generated numbers. If this works you could save a large scene in only the seed it takes to generate it.

Please let me know if this idea is stupid and should be thrown away, thanks!


texts: Post processing effects not visible on mobile apk build

texts:
While setting up post processing on a project that I am currently working on, I discovered that post processing effects are not visible on the apk build on mobile.

I setup a new Project with URP on Unity 2019.3.0f5 and increased the post processing bloom effect intensity, it works just fine on the editor/play mode, however, it is not visible when I build to a mobile apk.
Is there a different way of setting up post processing specifically for mobile?

Here are screenshots:

[1]: https://i.stack.imgur.com/uKm5d.jpg - Mobile build screenshot(post processing effects are not visible)

[2]: https://i.stack.imgur.com/ivQrQ.jpg - Unity editor/play mode screenshot(post processing effects are visible)


texts: Data structure to store map layers in each Tile while keeping the order of terrain, items and monsters intact

texts:
My game represents its map as a 2D array of tiles, each of which stores a stack of layers. I'm looking for a data structure to efficiently represent this .

I want to be able to add layers dynamically, so fixed arrays won't do.

Additionally, the layers are applied in zones, to make sure that terrain is always drawn before items and monsters, and that items/monsters are drawn before the player. This is the order:

terrainlayer
terraineffectlayers
itemlayers
monsterlayers
playerlayers
specialeffectslayers

I want to store all those zones in the same data structure, so I can traverse it from end to end in either direction. I also need to be able to add a monster layer that would automatically go at the end of monsterlayers data structure while still having a global object that would let me traverse from the all the layers. I also need the ability to access the data structure with index, so I can get the 3rd monster in the tile easily or remove the 3rd monster. Add will always be sequential, but remove are at random indexes.

Does a data structure like this already exist or do I need to make some sort of vector/doubly linked list/deque hybrid?

I have already seen this question but it doesn't help me.


texts: Python library for scripting (C++ integration)

texts:
Please advise me good wrapper/library for python. I need to implement simple scripting in c++ app; Under "good" I mean pretty understandable, well documented, no memory leaking, fast. For creating base interface of GameObject on Python and C++; Your own experience and useful links will be nice!!! I found link about it, but I need more specific within gamedev context. What combinations of libraries you used for python integration into c++? For example about ogre-python it said

  built using Py++ and Boost.Python library

And one more question, maybe someone of you know how Python was integrated into BigWorld engine (it's own port or some library)?

Thank you!!!


texts: Algorithm to make entities closely follow one another?

texts:
I have a group of entities that I want to follow a leader very closely. A good example would be how the player's soldiers move in Cannon Fodder.

Any suggestions for achieving movement like this?


texts: How do I teach the players that their strong but slow attack can not be cancelled?

texts:
Designing the combat mechanics of my current project I've  come to a problem: How do I make players feel responsable of their mistakes instead of they blaming my game?
This is the scenario:

Among other things your character has two basic abilities a quick and a strong melee attacks, and as you may guessed the quick attack does less damage and has a smaller control(time enemies are pushed/stunned after hit), as the strong attack has a slower and obviously longer animation that (here is the catch) cannot be cancelled. And here is my concern; many players may feel that the game is unresponsive instead of realizing that they shouldn't had used a strong attack in that moment.

Extra info:

Neither of the attacks consume resources as stamina.
Receive a hit is a big penalization for the player as heal is hard and
the difficulty lies in progressing through levels loosing less health than
you can find.
Both attacks has a 3 hit chain with cool down after the last, this
means that the managing of this ability to cancel or not the attack
is a core mechanic that the player should learn in order to succeed.
Enemies always give a big hint before attacking the player.

Solutions I thought:

Explain to the player via tutorial.
Pop a message sometimes when the player got hit during a strong attack animation.

Pd: I'm looking to the solution to the problem described above, but any general tips in this mater are also appreciated


texts: Why does the head of my ragdoll act like its about to fly off its shoulders?

texts:
The problem can be seen here: https://gfycat.com/LimpingMerryGermanshorthairedpointer

Ive created my ragdolls by using the Unity ragdoll creator tool.

To begin with, all the limbs of my ragdoll acted like this, then I searched online, found this post: https://forum.unity.com/threads/how-can-i-prevent-ragdolls-from-stretching-and-spazzing-out.328348/ and enabled projections as advised.

This fixed all limbs but the head.. How do I fix this?

Thanks


texts:
Many years ago I coded some AI for a budget pseudo-3d game. There was one calculation which I never really figured out the best way to do, and that was calculating where the enemy would end up if it stopped now. For example:

The enemy is currently at X = 540.0.
The enemy is moving right at 10 pixels per frame.
When the enemy wants to stop, it's speed will drop by 1 pixel per frame until it reaches zero.

Is there a simple formula that would get me the position where the enemy ends up when he is fully stopped? I ended up precalculating and hardcoding the offset which worked for my needs but would have to be calculated separately for enemies with different speeds.


texts: Why do console games not allow completely custom key bindings?

texts:
So I plugged in my PlayStation 2 for the first time in ten years and realized that I could not customize my key bindings, only pick from select pre-sets that the developers put in, which I thought was strange. So I checked through a few of my games on Xbox 360, PlayStation 2, and Nintendo 64 and realized that none of them had customizable controls, only control schemes (if even that)!
Why is this? Is it a limitation of the consoles or is it policy from Sony's and Microsoft's part that games should only offer select pre-sets, not completely customizable key bindings? The same games have customizable key bindings on PC and have no issues with binding to my Xbox 360 PC controllers.
I don't own any more modern consoles, so maybe it's different nowadays. If so, why did the old consoles have these limitations that the new ones do not have?


texts:
As an exercise in trying to learn 3D math, I've been experimenting with hit-testing by casting a ray from 2D screen space into 3D world space. My first attempt was as follows:

Matrix m = Matrix.Invert(
    this.scene.Camera.ViewMatrix *
    this.scene.Camera.ProjectionMatrix *
    homogeneousToViewportTransform());
Vector3 rayOrigin = Vector3.TransformCoordinate(new Vector3(p.X, p.Y, 0), m);
Vector3 rayVector = Vector3.TransformCoordinate(new Vector3(0, 0, -1), m);

This gets the ray origin correct, but not the ray vector. My reasoning was that the vector [0, 0, -1] is facing into the screen when in screen space, so transforming that into world space would give the correct vector. But that doesn't seem to be the case. Looking around, I've found that the correct way to calculate this is by doing:

Vector3 rayVector = new Vector3(
    m.M31 - (m.M34 * rayOrigin.X),
    m.M32 - (m.M34 * rayOrigin.Y),
    m.M33 - (m.M34 * rayOrigin.Z));
rayVector.Normalize();

Can anyone explain what's wrong with my original reasoning, and what the actual algorithm for calculating the ray vector is doing?


texts: I'm very new to Unity, is it all scene/script based?

texts:
I've been watching tutorials for a good amount of time now, basically just how to create a simple FPS game to get an understanding of the design process in Unity.

The tutorial I watched is very heavily based around the designer, and outside of some simple scripts to handle stuff like raycasting it doesn't involve much coding. My previous experience with game development has been only 2D stuff with XNA, and that was more what I'm used to when it comes to programming, where I'm doing pretty much everything.

I'm having trouble making sense of Unity though...it seems like it's all script/scene based from the programmers side? Like say I wanted to jump from one level to the next, do I just unload one scene and load the next and let the scripts I have for that scene + Unity do its thing?

Sorry if this questions been asked, it's not exactly an easy thing to search for.


texts:
The bug here is that my background kind of offset a bit itself from where it should draw and so I have this line. I have some troubles understanding why I get this bug when I set a speed that is different then 1,2,4,8,16,...

In main class I set the speed depending on the player speed

 bgSpeed = -(int)playerMoveSpeed.X / 10;

and here's my background class

class ParallaxingBackground
    {
        Texture2D texture;
        Vector2[] positions;
        public int Speed { get; set;}

        public void Initialize(ContentManager content, String texturePath, int screenWidth, int speed)
        {
            texture = content.Load<Texture2D>(texturePath);
            this.Speed = speed;
            positions = new Vector2[screenWidth / texture.Width + 2];
            for (int i = 0; i < positions.Length; i++)
            {
                positions[i] = new Vector2(i * texture.Width, 0);
            }
        }
        public void Update() {
            for (int i = 0; i < positions.Length; i++)
            {
                positions[i].X += Speed;
                if (Speed <= 0)
                {
                    if (positions[i].X <= -texture.Width)
                    {
                        positions[i].X = texture.Width * (positions.Length - 1);
                    }
                }
                else
                {
                    if (positions[i].X >= texture.Width*(positions.Length - 1))
                    {
                        positions[i].X = -texture.Width;
                    }
                }
            }
        }
        public void Draw(SpriteBatch spriteBatch)
        {
            for (int i = 0; i < positions.Length; i++)
            {
                spriteBatch.Draw(texture, positions[i], Color.White);
            }
        }

    }


texts: Unity 5 Google Cardboard VR SDK Frame Rate

texts:
I am running the Google Cardboard's official demo which doesn't really have much things on the scene (https://developers.google.com/cardboard/unity/download) on my Personal Unity 5 on my Nexus 5.

The fps is around 40 and I am wondering if the fps is so low because of my Nexus 5's hardware specs or is there a way to optimize the fps in Unity or some configuration in Google Cardboard's SDK?


texts: How do I work with gamepad fall back devices in Unity's Input System?

texts:
I was applying  gamepad controls to my game & I found that the fall back device for my gamepad is a joystick. As I understand it, this is standard behavior for the new input system.
I also read this link about overriding HID fallback. This is what I was doing by creating a custom scheme for my MSI gamepad.
There are multiple gamepad that Unity will detect only as joysticks, but I need them to be detected as gamepads, in order to properly use both their left and right sticks and allow their binding. If the device is recognized as joystick, it won't react to any gamepad scheme binding.
I found out that (in mentioned link) I can match devices by product name, manufacturer, etc. There can be also differences in their buttons as I had to remap completely such as the PS4 struct mentioned in link.
My questions are:

Does every single gamepad differ with their offset and bits for the buttons or are the differences just between PS and XBox compatible devices?
How can I handle gamepads that can fallback to joystick? I don't suppose that I have to map every single one... especially since I can't purchase every single gamepad to make it work with my game.
How can a developer handle the various gamepads/controllers that they aren't even be aware of?


texts:
I got a model from TurboSquid. Which is an archer and when i imported the model I got all the textures to be put on properly.  The thing is the actual character has no children nodes, is it possible to still animate this model.  I have looked throughout the files and there are a bunch of textures, but I don't happen to see any animations.

Along side that the asset comes with an Avatar, I looked on the docs and still a little confused as to what that is about.  If I cannot animate this model how could I force it to animate somehow or how could I make my own model.

I am not a artist at all and just focus on the gaming logic and and programming, and I am working solo.  Just wondering what are some options to get a game up and running with some decent graphics.  So, far I use the model to get the game play down, but now I want to make it visually appealing.


texts:
I am playing Starcraft2 and I am fascinated of how it is engineered. So lets say you played a 1v1 ranked game and you pumped 10 marines in the first 320 seconds. You'll get an achievement for that. I was wondering how is the achievements system designed underneath? Yes it analyzes the replay file which is frame based, but how?
There are 1000 achievements now.


texts: Billboarding restricted to an axis (cylindrical)

texts:
I have succesfully created a GLSL shader for a billboarding effect. I want to tweak this to restrict the billboarding to an arbitrary axis, i.e. a billboarded quad only rotates itself about the y-axis. I use the y-axis as an example, but essentially I would like this to be an arbitrary axis. Can anyone show me how to modify my existing shader below, or if I need to start from scratch, point me towards some resources that could be helpful?

precision mediump float;

uniform mat4 u_modelViewProjectionMat;
uniform mat4 u_modelMat;
uniform mat4 u_viewTransposeMat;

uniform vec3 u_axis; // <------------ !!! the arbitrary axis to restrict rotation around

attribute vec3 a_position0;
attribute vec2 a_texCoord0;

varying vec2 v_texCoord0;

void main()
{
    vec3 pos = (a_position0.x * u_viewTransposeMat[0] + a_position0.y * u_viewTransposeMat[1]).xyz;
    vec4 position = vec4(pos, 1.0);

    v_texCoord0 = a_texCoord0;

    gl_Position = u_modelViewProjectionMat *  position;
}

EDIT - The modified shader for cylindrical billboarding.
Its very straight forward! Just swap out the up vector for the axis to restrict rotation about.

precision mediump float;

uniform mat4 u_modelViewProjectionMat;
uniform mat4 u_modelMat;
uniform mat4 u_viewTransposeMat;

uniform vec3 u_axis; // <------------ !!! the arbitrary axis to restrict rotation around

attribute vec3 a_position0;
attribute vec2 a_texCoord0;

varying vec2 v_texCoord0;

void main()
{
    vec3 pos = (a_position0.x * u_viewTransposeMat[0] + a_position0.y * vec4(normalize(u_axis), 0.0)).xyz;
    vec4 position = vec4(pos, 1.0);

    v_texCoord0 = a_texCoord0;

    gl_Position = u_modelViewProjectionMat *  position;
}


texts: Unity 5.3.5 - How to setup a lobby with general game settings?

texts:
I am currently working on the lobby for my game. I have followed these tutorials (https://www.youtube.com/watch?v=jklWlm5v21k), which were very helpful, and was able to setup my lobby like this.

The tutorial explains all about player specific settings using lobby player prefabs, but it does not explain general level settings. I want to be able to select a game type (sudden death, flag match etc), and maybe also a map type.

What would be a good way to do this, and sync it back into the game?

One solution I thought of was adding this to the lobby player prefab, and then only make it editable for the host, and only display the hosts settings for this. Then make the hook change the map/gametype accordingly.

This doesn't quite feel like the right way to do this, so I would be happy to get some pointers on this.

I am using Unity 5.3.5 with c#


texts: How to render multiple displays in Unity

texts:
I have a scene (lest assume, large glass table I want to looking through) and I want to render with 4 displays (each 1920x1080). How can I set up camera for this, I want the "glass cube" to fill entire scene (all four displays).

If I use single perspective camera and I want to see entire scene, I got stretched image near sides - in other words only middle is correct and sides are stretch. If I correct this, than my scene is not filling entire window and is small.

I have tried to create single camera for each "display", but this will cause frustums overlapping and I have part of the image rendered twice (logically). I can use orthographic-camera, there is no overlap, but I have no perspective.

How to solve this problem?

Edit: I am using Unity 5


texts: Should I use text files for my save data?

texts:
My question is whether or not I should use text files to save my game data. I have some basic concerns over doing this:

There's really no way to protect the data, and thus, the user could screw up everything if they touched it and I don't want that to happen.
It's probably not the most efficient way to store my data (There will be a lot of it)

I know how to parse/write to text files effectively, though, so for prototyping they have been fantastic. I just want to look to the future for what I should be thinking about switching to so it doesn't punch me in the face near the end of development.

If I shouldn't use text files, what should I use? I need something C++ compatible.


texts: I have created character human in blender. How to use it in Java/Android

texts: Title says it all pretty much. I can't find anything online which explains it in details. I have created a character model in Blender and I want to use it in Android app. I want to make it move. What's my next step here?


texts: Inconsistent movement / line-of-sight around obstacles on a hexagonal grid

texts:
In a roguelike game I've been working on, one of my core design goals has been to allow the player to "Play the game, not the grid."

In essence, I want the player's positioning to be tactical because of elements in the game world, not simply because some grid tiles are more advantageous than others in relation to enemies. I am fine with world geometry not being realistic, but it needs to be consistent.

In this process, I have run into most of the common problems (Square tiles? Diagonal movement, LOS, corner cases, etc.) and have moved to a hexagonal tile grid. For the most part this has been great, and I've not had too many inconsistencies.

Recently, however, I have been stumped by the following:

Points A and B are both distance 4 from the player (red lines). Lines-of-sight to both are blocked by walls (black tiles). However, due to the hexagonal grid, A can be reached in 4 moves, whereas B requires 5 moves (blue lines).

On a hex grid, "shortest path" seems divorced from "direct path"; there may be multiple shortest paths to any point, but there is only one direct path (or two in some situations). This is fine; geometry doesn't need to be realistic.

However, this also seems inconsistent: Similar obstacles are more effective in some positions than in others. A player running away from an enemy should be able to run in any direction, increasing the distance between the two actors. However, when placing obstacles or traps between themselves and enemies, the player is best served by running in one of the six directions that don't have multiple shortest paths.

Is there a way to rationalise this? Am I missing something that makes this behaviour consistent? Or is there a way to make this behaviour consistent? I am most certainly over-thinking this, but as it is one of my goals, I should do it due diligence.


texts:
Let's assume for the sake of argument, that we have a resource engine in place, and that we use OpenGL. My question is how the engine/game classes should reference the resources.

Lightweight example : among others, we probably have a texture resource. If we now have a class that uses this resource, do we store:

a resource id?
a resource pointer?
the resultant resource (e.g. the GLID of the Texture)

1 gives us the most flexibility, and neat features like being able to reload all textures on the fly (after context destruction), but costs us a lookup each time it is used, and might require a mutex lock.

Another example - a font resource, same questions -- do we hold an id, pointer or a direct font class?

Third example, a model resource has a reference to a texture it uses. Does it store id, pointer or direct link?

If the answers differ between uses, is there a sensible set of rules one can follow to decide what should be used in what case?

EDIT: we're talking about a general use, heavy duty (3d, streaming, resource groups, memory managing) resource manager here in a threaded environment.


texts: LibGDX: Problems with Button Listener in a Dialog

texts:
I'm developing a game where the player has an inventory, and you can find chests in the map with items which you can collect, so I created a class that extends from Dialog to show both item lists, player's inventory and chest's inventory, just like this:

private class InventoryDialog extends Dialog{
    public InventoryDialog(boolean isPlayerInventory, Inventory inventory) {
        super(isPlayerInventory? "Inventory":"Chest", mySkin);

        final List inventoryList = new List(mySkin);
        inventoryList.setItems(inventory.getItems());
        ScrollPane pane = new ScrollPane(inventoryList,mySkin);
        getContentTable().add(pane).size(myDimensions);
        button("Back");

        if(isPlayerInventory){
            button("Use").addListener(new ClickListener(){
                @Override
                public void clicked(InputEvent event, float x, float y) {
                    super.clicked(event, x, y);
                    player.getInventory().useItemAt(inventoryList.getSelectedIndex());

                }});
        }else{
            button("Get").addListener(new ClickListener(){
                @Override
                public void clicked(InputEvent event, float x, float y) {
                    super.clicked(event, x, y);
                    player.getInventory().add(inventory.remove(inventoryList.getSelectedIndex()));
                }});}

    }

}

So they will use or get the item only if they click that button.

My problem is that the get/use listener is always invoked even if the clicked button is the "Back" button, what am I doing wrong? :/


texts: Cross Game Engine Compatibility - Multiple Game Engines for one Game

texts:
I am new to Game Development, infact getting started with it, so reading as much as I can. I came across game engines. Now atleast I have an idea of what a game engine is, and what it does.

In order of reading about game engines, I came across various game engines - Paid, Freeware, OpenSource. Some are good for physics, some are good for loading images, some for sound. At last, it always comes to performance.

Now what comes to my mind, can I use various game engines to develop one game? I mean, one for loading graphics one for animation one for physics. Is this possible?

I know, game engine is like a CPU, and what I am talking about is using various CPUs to work on one PC.

But whatever it is, can this be done? Cross Game Engine Compatibility?


texts: Does opengl performs Visibilty algorithms based on z-index?

texts: Does OpenGL performs Visibilty algorithms based on z-index? Or we have to write our own algorithms. Mainly I'm referring to z-buffer algorithm. Is it in-built?


texts: Why do companies still use really old versions of Visual Studio?

texts:
I understand why C++ is used. That is not what this question is about.

When I install games, commonly Steam (I pretty much only use Steam these days) will install the C++ 2005 Runtime distributable.

My question is why is this the case? What is the reason a runtime released over 8 years ago is still prevalent? Some of the games I've installed recently are slightly older, so assuming a couple of years dev time you could make the case it was the tried and tested standard at the time.

Why do game companies not use a newer version of the VC++ runtime?


texts: What will happen at a different aspect ratio and what is the most efficient and easy way of dealing it?

texts:
Let's say I have built a game for Android at the size of 480x854. If I test this on my device that has this resolution I suppose it will work and look property. But at a different aspect ratio will the game work and look good? Also, what is the most efficient and easy way to handle this?

Thanks in advance.


texts: 3D Flight Path Generation and applying a curve to x,y,z

texts:
I made a little critter that roams around.

var boundary = 10.0;
var startingPoint = <0.0,0.0>
var destination = startingPoint+<randMinMax(boundary-(boundary*2),boundary),randMinMax(boundary-(boundary*2),boundary)>;

It generates a random destination (x,y) within a 10 meter area around its starting point. It then moves to that point, stops, then generates a new point, turns around and faces to the new point, and continues toward it. When it reaches its destination it does the same thing over and over.

This is sufficient for just wandering around using x,y but for flight I want to implement the use of the z axis. So I modified a copy of the script to do the same thing to the z axis, with tweaks and hacks it looked alright flying around, but it appears too programmatic.

I want to take flight to the next level, now I'm not great at math, and a google search shows that 3X^2 + 4X + 6 = 0 can help me calculate a curve, I am looking for advise on how I can apply this to curve the travel when the critter reaches its destination so as to create a 'swooping' movement effect as it moves around (curved x,y,z) to its new destination. This all is begining to seem quite complicated, and I realize that the flight path cant be so random.

Has anyone got any advise for generating 3d flight paths , or assistance applying curve to x,y,z ?

Cheers

C


texts: Get the scene that MonoBehaviour belongs to (multi-scene setup)

texts: Is there a way to get the scene that a MonoBehaviour component belongs to? The MonoBehaviour is part of a setup with several additivly loaded scenes. What I'm looking for is not the currently active scene but an additionally loaded one.


texts:
I am using to GestureDetector to detect drag gesture and determine vector based on position my finger first touched the screen and position when my finger left the screen. I already know that I can get coordinates where my finger touched the screen using touchDown(), but as far as I know there is no touchUp() in GestureDetector.

I tried to acieve this using fling(), but the problem with fling is that it has to be quick, otherwise it is not counted as fling.

pan() would be good, but it doesn't tell you if your finger left the screen.

So is there a way to detect touchUp? Or is there maybe another/better way to achieve what I want?


texts: How can I switch between starting a coroutine vs running the routine all at once?

texts:
I'm generating a level, and I have an optional delay to show the steps level generation one by one.

If my generationDelay boolean is true, I want to use StartCoroutine to spread the generation out over time. If it's false, I want to call the same method but without StartCoroutine.

The problem is that the method is type IEnumerator.

I can make two methods one type of IEnumerator and one not. But I wonder if there is a way to use one method.

In the first script top i did:

public bool generationDelay = false;

Then in a method:

private void BeginGame()
    {
        mazeInstance = Instantiate(mazePrefab) as Maze;

        if (generationDelay == true)
        {
            StartCoroutine(mazeInstance.Generate(generationDelay));
        }
        else
        {
            mazeInstance.Generate(generationDelay);
        }
    }

Then the other script where the method Generate is:
In the top:

public float generationStepDelay = 0.01f;

Then the method Generate:

public IEnumerator Generate (bool generationDelay) {

        if (generationDelay == true)
            WaitForSeconds delay = new WaitForSeconds(generationStepDelay);
        cells = new MazeCell[size.x, size.z];
        List<MazeCell> activeCells = new List<MazeCell>();
        DoFirstGenerationStep(activeCells);
        while (activeCells.Count > 0) {
            yield return delay;
            DoNextGenerationStep(activeCells);
        }
    }

I'm getting an error on the line:

WaitForSeconds delay = new WaitForSeconds(generationStepDelay);

  "Embedded statement cannot be a declaration or labeled statement"

And an error on the line:

yield return delay;

  "The name 'delay' does not exist in the current context"

The reason I want to use a bool variable is that when i'm using StartCoroutine it's kind of slow, even if I change the value of generationStepDelay to 0 it's kind of slow. And if I'm not using StartCoroutine and not using the Generate method as IEnumerator it will work fast.

So i wonder what should I do and how?


texts: Dynamic VBO update possibly corrupting data?

texts:
I want to draw a line between two vertices.  On a mouseclick the vertex data will change and I want to update the line to use the new values.  I am using a VBO for this and it looks like the update process is somehow corrupting the VBO data.  The line is not drawing in a direction that I would expect given the values of the vertices.

There are four lines in total and I am updating only the last two vertices.  The vertex data is initialized as:

      float[] vertLineBuffer = {
          1.0f,0.0f,0.0f,//right
          0.0f,1.0f,0.0f,//top
          0.0f,0.0f,0.0f, //center
          -1.0f,0.0f,0.0f, //START
          0.0f,-1.0f,0.0f //END
            };

The init routine:

  public void setLineVBOs(GL4 gl)  throws Exception {

      vboLineHandles = new int[2];
      gl.glGenBuffers(2, vboLineHandles, 0);

      //populate the position buffer
      FloatBuffer fbData = Buffers.newDirectFloatBuffer(vertLineBuffer);
      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboLineHandles[VERTICES_LINE_IDX]); //the vertex data
      gl.glBufferData(GL4.GL_ARRAY_BUFFER, fbData.capacity() * 4,
              fbData, GL4.GL_STATIC_DRAW);
      fbData.clear(); //don't need this anymore

      //populate the color buffer
      FloatBuffer fbColor = Buffers.newDirectFloatBuffer(vertLineColor);
      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboLineHandles[VERTICES_LINECOLOR_IDX]); //the vertex data
      gl.glBufferData(GL4.GL_ARRAY_BUFFER, fbColor.capacity() * 4,
              fbColor, GL4.GL_STATIC_DRAW);
      fbColor.clear(); //don't need this anymore

      //set vertex array index
      IntBuffer intBuffer = BufferUtil.newIntBuffer(1);
      gl.glGenVertexArrays(1, intBuffer);
      iLineVao = intBuffer.get(0);
      gl.glBindVertexArray(iLineVao);

      gl.glEnableVertexAttribArray(VERTICES_LINE_IDX);
      gl.glEnableVertexAttribArray(VERTICES_LINECOLOR_IDX);

      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboLineHandles[VERTICES_LINE_IDX]); //the vertex data
      // Associate Vertex attribute 1 with the last bound VBO
      gl.glVertexAttribPointer(0,3, GL2ES2.GL_FLOAT, false,0,0);

      //color
      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboLineHandles[VERTICES_LINECOLOR_IDX]); //the vertex data
      gl.glVertexAttribPointer(1,3, GL2ES2.GL_FLOAT, false,0,0);

  }

And then I attempt to update the VBO on an event (mouseclick) like this:

  public void updateLine(GL4 gl, float[] pos)
  {
      //pos contains the new vertex data
      vertLineBuffer[9] = pos[0];
      vertLineBuffer[10] = pos[1];
      vertLineBuffer[11] = pos[2];
      vertLineBuffer[12] = pos[3];
      vertLineBuffer[13] = pos[4];
      vertLineBuffer[14] = pos[5];

      FloatBuffer fbData = Buffers.newDirectFloatBuffer(vertLineBuffer);

      gl.glBufferSubData(GL4.GL_ARRAY_BUFFER, 0, fbData.capacity() * 4, fbData);
      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboLineHandles[VERTICES_LINE_IDX]);

      fbData.clear();

  }

The vertex shader:

#version 430

layout (location=0) in vec3 vertexPosition;
layout (location=1) in vec3 vertexColor;

out vec3 Color;

void main(void) {
    Color = vertexColor;
    gl_Position = vec4(vertexPosition, 1.0);
}

The frag shader:

#version 430

in vec3 Color;

layout (location = 0) out vec4 FragColor;

void main(void) {

    FragColor = vec4(Color, 1.0);

}

Does this look right?  Can anyone see where this might damage the contents of the VBO?


texts: Should I compute impact damage with energy or momentum?

texts:
My game uses physics (Box2D in particular).  Just about every object in the game can be destroyed, and the primary method of combat is by slamming objects into one another at high speed.  It makes sense that I would use the object's velocity and mass in order to determine damage.  My question is...how?

As I see it, my two main options for computing damage are as a function of the object's momentum (p = m*v) or its kinetic energy (KE = .5 * m * (v^2)), both translational and rotational.

The following statements hold true of my game:

Objects can also collide with walls, which are indestructible (but not necessarily immovable).  The object takes damage, but the wall does not.
Objects can move freely, and certain kinds of objects can also rotate.
This is a top-down game, so gravity is not a concern.
Different objects can vary in size, mass, and shape, often considerably.

Given this...

Which should I use to determine the damage an object takes upon collision; its momentum or its kinetic energy?
What other physical properties should I consider when doling out collision damage, and how?
How should I handle the (quite possibly substantial) differences in these quantities between the two colliding objects?


texts: Implement ARToolkit SDK for Augmented reality for iOS application

texts:
I am actually new to Augmented Reality and I have to make a simple augmented reality app of rendering a 3d object over camera view in iOS (Not with Unity!).

I have downloaded the ARToolKit and checked it by running the sample projects. In the sample project for iOS , there is a pattern/object recognition of an image and a 3d cube model is rendered over it.

My question is -
How do I change the image that is recognised? How is the pattern recognition code working in it ?
Secondly , how do I change the Cube (3d model) that is augmented over the camera view ?

Please help!
Thanks in advance!


texts: My [MenuItem()] is not being added to the menu

texts:
In Unity 5, I created a ScriptableObject class which adds itself to the Main Menu:

using UnityEngine;
using UnityEditor;

[CreateAssetMenu(fileName = "MyFancyAsset", menuName = "My Framework/Objects/My Fancy Object")]
public class MyFancySO : ScriptableObject
{
    // Public and [SerializeField] data comes here
}

This code works as expected. When the code is compiled, I can see the new menu being crated and working (a "My Framework" entry appears, and when choosing My Fancy Object), it is created appropriately).

What I am trying to do is to create a method with extended functionality o be added to the menu. So I tried like this:

using UnityEngine;
using UnityEditor;

[CreateAssetMenu(fileName = "MyFancyAsset", menuName = "My Framework/Objects/My Fancy Object")]
public class MyFancySO : ScriptableObject
{
    // Public and [SerializeField] data comes here

    [MenuItem("Assets/Create/My Framework/Objects/My Fancy Object (with more stuff)", menuItem = "My Fancy Object (with more stuff)")]
    public static void CreateInstanceWithMoreStuff()
    {
        // Now I create something, with logic based on what
        //   I can read in several files in the unity2d-extras
        //   repository.
    }
}

And although this code compiles with no errors, I don't see the new menu being created (but just the original menu created by CreateAssetMenu).

What am I missing?


texts: I have a simple question: are there any cases where game LOD models don't need to be created? Obviously you need LODs for landscapes, large props, characters, vehicles etc. But what about small indoor props which are unlikely to be seen from large distances? I understand that it depends on genre and other factors like the distance to the camera, but still, is there any common standard regarding when LODs need to be made?


texts: Possible to create transparency shader which doesn't stack alpha values

texts:
The image above best demonstrates what I'm trying to achieve. It's a transparent shader for objects, but wherever the objects with this shader intersect they don't add together but simply merge with the same amount of transparency.

It seems like a simple thing, but I can't tell if it's even possible from my understanding of how the shader pipeline works. From what I understand of the process (and please correct me if I'm wrong), a fragment is created by each independent object. Once all the fragments for each object are created, the depth buffer chooses which fragment to write to that pixel in the framebuffer at a time, layering them on top of each other, so to speak. Once they've all been added to the framebuffer, the final result becomes the pixel.

If I could access the individual fragments to compare them against each other before they get written ('layered') into the frame buffer, it would be a simple case of tracking them and discarding any extra fragments in the same pixel space that are part of this shader / render queue. But I don't think this is possible with OpenGL?

Is there perhaps another way I can achieve the same effect?


texts:
I'm using vertex array to draw 2d geometry,
but I can't achieve smoothness.

This is the code I'm using:

glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);

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

glColorPointer(4, GL_UNSIGNED_BYTE, 0, shared_colors);
glVertexPointer(3, GL_FLOAT, 0, shared_vertex);

glDrawArrays(GL_LINES, 0, shared_counter);

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisable(GL_BLEND);

Some advice?


texts: Any tips on figuring out programming in Unreal Engine (without focusing mainly on blueprints, or at least a fairly even mix of the two?)

texts:
So for the past few months I've been attempting to learn Unreal Engine. Most tutorials feature blueprints which I guess makes sense as it's new and simple and their solution to artists trying to make games. However, when learning to code or program anything, I've always valued actually understanding what I'm typing in. It makes it easy to remember, especially when it's not a habit like say, typing in int main()
before starting your C++ code.
When I need to write code spontaneously, I find it valuable to understand what I'm typing in.

However, UE4's usage of C++ is almost as if you're learning a new derived language, which is what was once done by users of Unreal Engine. Outrageously though, I've found no source which explains the vast amount of macro's and jargon used when programming games in UE4. Thing's such as GENERATED_UCLASS_BODY() or void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
Perhaps the terms void, class, and override have been mentioned in typical C++, but the Unreal API is a mystery, and I've found no place where I can know what any of this actually means, or more importantly -in my view of course-, why I'm connecting them the way I'm told too. It's somewhat obvious that all these are related, but it's harder to uncover how they're to be formatted and linked together. Does anyone know a way I can get a better understanding of the library of macros and terms Epic has taken no time to explain?


texts: What's a good 2D game engine or framework to work on right now?

texts:
Basically, I'm looking for a good, 2D game engine to build a platformer/contra-like shooter on to bolster (and when I say bolster, I really mean start) my portfolio.

I use the words "right now" in the title because I've read through some questions, and I don't really want to use anything like Java's game API for mobile phones from 2003. (Also, XNA is out of the question as I'm already working on a larger scale project in it.)

I'm fairly competent in Java, and have a basic understanding of other languages like C# and Python, but I'm totally unopposed to learning a new language while learning the engine (within reason).

The engine doesn't have to be super powerful, just free and simple enough that someone of my skill level (3rd year CS major) can get a nice horizontal slice out without too many bumps along the way.


texts:
I would like to implement entity system in my game and I've got some question about entity system and rendering.

Currently, my renderer got two types of elements:

Current design

Mesh   : A default renderable with a Material, a Geometry and a Transformable
Sprite : A type of mesh with some methods like "flip" and "setRect" methods and a rect member (With an imposed geometry, a quad)

This objects inherit from "Spacial" class.

Questions:

How can I handle this two types in an entity system?
I'm thinking about using "MeshComponent" and "SpriteComponent", but if I do that, an entity could have a Mesh and a Sprite at the same type, it's look stupid, right?

I thought the idea to have a parent "rendering" component : "RenderableComponent" for "MeshComponent" and "SpriteComponent" but it will be difficult to handle "cast" in the game (ex: did I need to ask entity->getComponent or SpineComponent, …)

Thanks a lot for reading me!

My entity system work like that:

---------------------------------------------------------------------------
Entity* entity = world->createEntity();

MeshComponent* mesh = entity->addComponent<MeshComponent>(material);
mesh->loadFromFile("monkey.obj");

PhysicComponent* physic = entity->addComponent<PhysicComponent>();
physic->setMass(5.4f);
physic->setVelocity( 0.5f, 2.f );
---------------------------------------------------------------------------
class RenderingSystem
{
    private:
        Scene scene;
    public:
        void onEntityAdded( Entity* entity )
        {
            scene.addMesh( entity->getComponent<MeshComponent>() );
        }
}

class PhysicSystem
{
    private:
        World world;
    public:
        void onEntityAdded( Entity* entity )
        {
            world.addBody( entity->getComponent<PhysicComponent>()->getBody() );
        }

        void process( Entity* entity )
        {
            PhysicComponent* physic = entity->getComponent<PhysicComponent>();
        }
}

---------------------------------------------------------------------------


texts: string[] preallocation to prevent using ToString() and save memory

texts:
I have some levels, with enemy waves and two Text components for:

Enemies killed, like: "13/57"
Waves passed, like: "68"

On each enemy kill/new wave, I make a ToString() call, in order to update these UI components. I already separated "13", "/" and "57" into different Text's to prevent concatenation.

In early game, there's no overhead, but if the game gets more dynamic in time and there are 30-40 enemies on the screen, GC get's mad really quickly. It's not a constant Update(){ tostring() } call, but it's noticable, really, especially while rendering.

The game itself is really, really expensive, so I need to optimize what I can.

The point

The maximum amount of enemies is 200, so this is the maximum string that will be made through ToString().

There's no maximum wave, but it's quite hard to get to 500 (late-game).

I made a simple system:

private static readonly string[] STRING_NUMBERS;

static MathUtils(){
    STRING_NUMBERS = new string[1000];
    for(int i=0;i<STRING_NUMBERS.Length;i++)
    {
        STRING_NUMBERS[i] = i.ToString();
    }
}

public static string GetStringNumber(int i)
{
    if(i > STRING_NUMBERS.Length - 1)
    {
        return i.ToString();
    }

    return STRING_NUMBERS[i];
}

As you can see, I preallocated 1000 strings: "0", "1" ... "999".

If I try to get a higher number, it would ToString() anyways.

My question is, would it work? is this worth? Did I forget something?


texts: Load character animation on button press - Unity3D

texts: I am new to Unity3D and I am going to develop a  simple animation application. There is a human character and there are three button Eg:- "jump", "down" , "roll", I want to bind the animation files with the human character once the player presses the corresponding button. I need your help to know that what are the steps that I need to follow...let me know if anyone has good reference, thank you very much...


texts: How to make a point light cast shadows in realtime?

texts:
I have a solar system...

The central star has a point light attached to it.

However, objects don't cast shadows on each other...

Planets are < 20 units from the star, so it's not a light falloff issue.
The point light is the only light source in the scene.
There are occasions when it works - moon 3 of planet 5 correctly casts a shadow on its parent and siblings, whereas none of the others do.
Here's a video showing the issue more clearly: https://youtu.be/rmlWlXjygk0
Note that there are issues both casting and receiving shadows for all but the outermost moon.

Everything is set to both cast and receive shadows, objects are in the correct layers and not marked static...

I've tried changing from forward to deferred but that only prevented me seeing any shadows at all.
What am I missing? How can I get Unity to cast shadows correctly?


texts:
As a personal project, I'm trying to make a terrain generator that will create terrain looking something like the Castle Story smooth terrain.

If you haven't seen it before, here:

So as you can see, it's  combination of blocks and "smooth" blocks.

What I've tried to do to emulate this look is to give each surface block a mini heightmap.  This generally works, but there are some issues, yielding a terrain like this:

The problem is is that each block is 1x1x1, but sometimes the height at a particular location is negative or > 1.  In that case, I clip it and set the height to 0 or 1.

To better illustrate what I mean, here's a diagram:

To generate the height, I basically do:

genColumn(int x, int z)
{
    int highestBlockY = (int)noise2d(x, z);

    bool is_surface = true;

    for(int y = max_height - 1; y >= 0; y--)
    {
        Block b;

        if(is_surface)
        {
            b = Block.Grass;
            b.HasHeightMap = true;

            // generate heightmap
            for(int ix = 0; ix < 5; ix++)
            {
                for(int iz = 0; iz < 5; iz++)
                {
                    float heightHere = noise2d(x + ix / 4, z + iz / 4) - y;

                    // clip heights
                    if(heightHere > 1)
                        heightHere = 1;

                    if(heightHere < 0)
                        heightHere = 0;

                    b.HeightMap[ix][iz] = heightHere;
                }
            }

            is_surface = false;
        }
        else
        {
            b = Block.Dirt;
        }

        setBlock(x, y, z, b);
    }
}

Perhaps I'm approaching this incorrectly by using the "true" perlin noise value?

Any help would be greatly appreciated!


texts: Camera that follows a target with sub-pixel movement

texts:
As the title says, I have a character that moves at sub pixel movement (no, I can't change this, because this sub pixel movement happens when I normalize the vector during diagonal movements, otherwise it would move faster) and the camera follows it.
The problem as you can see from this video, is that the textures of the various tiles kinda go crazy: https://files.catbox.moe/ve6t0h.webm

This is my camera:

   CameraPos = target.Position + Movement;
        Matrix mPosition = Matrix.CreateTranslation(-CameraPos.X, -CameraPos.Y, 0);

        CameraOffset = CenterOfScreen - target.Origin;
        Matrix mOffset = Matrix.CreateTranslation((CameraOffset.X / Game1.Scale.X), (CameraOffset.Y / Game1.Scale.Y), 0);

        var zoom = Matrix.CreateScale(new Vector3(Game1.Scale.X, Game1.Scale.Y, 1));

        Transform = mPosition * mOffset * zoom;

target.Position is the Position of my character, it can be sub-pixel.
Movement is the movement of the mouse in relation to my character, also can be sub-pixel.

The Sampler.State I'm using is PointClamp, I really don't want to use the linear one, I don't want blurriness.

I've already tried truncating/rounding the position values in the camera, but the result is a very annoyingly shaky camera which I don't want.

Please help, this is driving me crazy.


texts:
I am creating a game using libgdx.

In the same each level has a class. I have stage as a member variable of the class. To this stage, I add actors.

Inside the levels class, I have attaced the input processor to the stage like below.

stage = new Stage();
sviewPort = new StretchViewport(OSR_Constants.VIEWPORT_WIDTH, OSR_Constants.VIEWPORT_HEIGHT);
OrthographicCamera camera = new OrthographicCamera(OSR_Constants.VIEWPORT_WIDTH, OSR_Constants.VIEWPORT_HEIGHT);
camera.position.set(0, 0, 0);
camera.update();
sviewPort.setCamera(camera);
stage.setViewport(sviewPort);

Gdx.input.setInputProcessor(stage);

The level object is instantiated in another class known as GameScreen. GameScreen implements the Screen interface.

I am unable to detect touch events on my actors in the stage. Each actor has also been given bounds as per the world coordinates. I have added the following code on each actor to detect touch

this.addListener(new InputListener(){
     public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
          System.out.println("touchdown at " + x + " " + y);
          return true;
      }
  });


texts: How to rotate a character according to the body alignment of the ragdoll to fit the 'getting up' animations?

texts:
I'm trying to make a character rotate in the right direction so that when the character gets up from a ragdoll state, the animation would closely match the initial lay down position of the ragdoll.
The character has a third person controller and when I move it around, it rotates according to the directions from the joystick. So when it falls it usually gets up in the right direction but sometimes, when the character falls from a cliff, the animation doesnt match the ragdoll orientation.
I'm using this method to calculate whether the hips are pointing upward or downward so I can trigger the right animation.
        wasRootBoneFacingUpward = Vector3.Dot(bones[0].forward, Vector3.down) < 0;

How can I rotate my character so that it fits the body alignment of the ragdoll ?