texts: Kinect for Xbox One (+ adapter) and Windows 10

texts:
Can I use Kinect Xbox One (with adapter like Kinect for Windows V2 device), SDK 2.0, to build applications on Windows 10? I've read the requirements for Kinect and it lists only Win 8.0 and Win 8.1.

I'd like to use Kinect Xbox One device with Unity 3D and Hololens. Before I buy the device I'd appreciate if anyone can share some experiance or at least to confirm that would be possible to develop apps with Kinect for Xbox One on Win10?

Many thanks.


texts: How flat-file and databases compare in games development?

texts: Typically games built with a goal of being easily modded often store data in plain text documents, such as Rimworld. I can't see why an entire database system would be implemented just to read a few saved variables in other games? Sure if it's more efficient or built into the engine there's likely no reason not to use it.


texts:
Do you think it is technically possible to write a fully-fledged 3D MMO client with Browser JavaScript - WebGL for graphics, and WebSocket for Networking?

Do you think future MMOs (and games generally) will be written with WebGL?
Does today's JavaScript performance allow this?
Let's say your development team was you as a developer, and another model creator (artist). Would you use a library like SceneJS for the game, or write straight WebGL? If you would use a library, but not SceneJS, please specify which.

UPDATE (September 2012): RuneScape, which is a very popular 3D browser-based MMORPG that used Java Applets so far has announced that it will use HTML5 for their client (source).

Java (left) and HTML5 (right)

UPDATE (June 2013): I have wrriten a prototype of a WebGL/WebSocket based MMO:
https://github.com/alongubkin/xylose


texts: What could I use to search tiles in a game

texts: I'm creating a tile based game similar to Minesweeper. When a user clicks on a tile and its not a mine or a number space I need to search and expose the adjacent tiles that are empty and stop when it hits a number or the edge of the board. I have it working right now so that it will clear the row of the tile clicked and stop at a numbered tile or the edge of the board. What I have is going to get ugly quickly and I am sure there is a easier way of doing this. Is there a searching algorithm I can use that will find all adjacent tiles to the one the player click only stopping once it hits the edge of the board or hit a numbered tile?


texts:
I am using SDL2 and SDL2 Image to render png images.

When I rotate the textures, they turn out very ugly, like this:

This is the code responsible for the rotation and alpha mod.

SDL_Rect srcRect;
SDL_Rect destRect;
srcRect.x = width * currentFrame;
srcRect.y = height * currentRow;
srcRect.w = destRect.w = width;
srcRect.h = destRect.h = height;
destRect.x = x;
destRect.y = y;

SDL_SetTextureAlphaMod(m_textureMap[id], alpha);
SDL_RenderCopyEx(pRenderer, m_textureMap[id], &srcRect, &destRect, 10.0, 0, flip);

Do I need to set a blendmode too?


texts: Unity: Resources folder empty in Build and public variables NullReferenceException

texts:
I got 2 big problems that after a lot of research I´m unable to solve.

First problem: I got 5 xml files and a sub-folder inside the Resources folder but when I build my project, the Resources folder is empty (well, only two unity files in there: unity default resources and unity_builtin_extra. So I can´t access my xml files when I do: Resources.Load, anywhere on my code.

I post images to clarify:

Second problem: As Resources file was not working I decided to use public variables for my xml files declaring: public TextAsset myXmlDoc, but I realize that, only when I build this isn´t working as it gets NullReferenceException as if my public TextAsset variable wasn't assigned by me (wich is not true)

I post images and code to clarify:

public class LoadXml_Narrator : MonoBehaviour {

    NarratorTextClass narratorClass;
    public TextAsset file;

    void Awake()
    {

        print("Xml file " + file);
    }
}

This is the output log of my Build:

NullReferenceException: Object reference not set to an instance of an object
  at LoadXml_Narrator.Awake () [0x0001d] in D:\Projects\PC\Majorel_\Majorel_\Assets\Scripts\XML\Narrator\LoadXml_Narrator.cs:20

(Filename: D:/Projects/PC/Majorel_/Majorel_/Assets/Scripts/XML/Narrator/LoadXml_Narrator.cs Line: 20)

  Note: IN the editor everything works
  perfect. The issue is only when build
  and execute the project.


texts: Collision detection between draggable object and world objects?

texts:
I have a game I'm making in Javascript that will involve combining items by dragging and dropping them onto each other. Think Alchemy or similar.

So far, so good, but I hit a snag while trying to figure out how I can detect collisions between the two entities! I have a (really) basic bounding box test -

function isColliding(a, b) {
    if (a.x + a.width < b.x || a.x > b.x + b.width || a.y + a.height < b.y || a.y > b.y + b.height) {
        return false;
    } else {
        return true;
    }
}

The trouble I'm having is that in practice, this is fine for detecting the mouse colliding with an object to pick it up, but I'm stuck on how I can, after I've grabbed an object, test to see if that object I have grabbed is colliding with any of the multiple other objects that exist in the window. I tried doing -

Core.objectCollision = function() {
    if (Core.Mouse.isHolding != null) {
        for (i in Core.Objects) {
            if (isColliding(Core.Mouse.isHolding, Core.Objects[i])) {
                console.log("Colliding with world object!");
            }
        }
    }
}

This function is inside my update loop, but of course the object I'm holding is within my Core.Objects array too, so technically collides with itself.

I really think I'm missing something obvious, but a lot of my searches for help have been returning how to simply detect collision between two already known items, however I need it so any item I grab can be tested against any other item in the view.

Please also note I'm trying to avoid libraries for the time being, I'd rather learn the functionality myself.
Thanks for any help!


texts: How can I provide attribute extensibility in a component-based entity system?

texts:
This question and its answers move against utilizing an entity component system where the component itself is just a generic class with an dynamic container for the attributes/properties  of the component.

Some definitions for this thread:

Entity = ID + collection of components
Component = Container (std::map<attribute_name, attribute_value>) of attributes/properties, such as health, age, name, gender, etc.

I understand and am aware of the drawbacks (no compile-time type safety, added overhead of looking up values from the container). Nonetheless, I currently am working on/with such a system, with the following argument, which I would now like to put to the test: data-driven design.

If all the attributes of the component are in a dynamic container, it is very easy (in fact possible at all) to add new ones later on, outside of the source code. So you can easily script new attributes later on. And dumping/saving the state of the component is a piece of cake.

Compared to the proposal in the above mentioned thread, I also have an own class for each component, to implement some basic behavior and helper methods directly in them (but those also need to look up their values from the container).

Example:

My component base class has a map for all the attributes/property:

typedef std::map<std::string, PropertyBase*> PropertyMap;

So an actual component looks something like the following. In the constructor I populate the attributes I want the component to have, by adding them to the map. Later I can read and update them if needed, but always with a performance penalty, since I first have to find them in the std::map.

class Person : public ClonableComponent<Person>
{
public:
    Person(ComponentFactory* const pFactory, ComponentType type, ComponentID id, GameEntity* const pEntity)
    : ClonableComponent(pFactory, type, id, pEntity)
{
    // General
    addProperty(new Property<int>("age", PROP_INT, 0));
    addProperty(new Property<String>("gender", PROP_STRING, "unknown"));
    addProperty(new Property<String>("currentLocation", PROP_STRING, "unknown"));

    // Feelings
    addProperty(new Property<bool>("isTired", PROP_BOOL, false));
    addProperty(new Property<bool>("isHungry", PROP_BOOL, false));
    addProperty(new Property<bool>("isThursty", PROP_BOOL, false));
}

void enterLocation(GameEntity* pLocGE)
{
    if(pLocGE->hasComponent(COMP_TYPE_LOCATION))
    {
        updateProperty("currentLocation", pLocGE->getName());
        updateProperty("casinoEnteredDateTime", (int)std::time(0));
    }
}

void leaveLocation()
{
    updateProperty("currentLocation", std::string("unknown"));
}
};

However, that thread made me think, and I am now doubtful that my approach will work well in the long run (maintenance, scaling and performance wise) and I am therefore considering moving to an directly typed approach with no look-up overhead. At the same time I don't want to loose that data-driven extendability.

I thought of a hybrid approach: Keep all known variables as actual language variables but also add a container (std::map) for scripted/data-driven variables. Therefore I'd know that my internal access is very fast and only the later added scripted extension would have the slow look-up and the other mentioned penalties.

Question:
What do you use / would propose as an approach for a data-driven ECS in terms of attribute storage/handling? How do you keep it extendable? Would you recommend such a hybrid approach (real variables internally, container for new, external definitions)?


texts: Efficient way of loading wavefront models in openGL game

texts:
In my game, a RTS game, the units are all wavefront obj. all their animation frames are each seperate wavefront obj file. ie. without any skeletal animation; fully rigid models. So when many units are loaded before a game starts, it takes too much time. for example, if 20 types of units are loaded, they take approximately 700/800MB in memory, take atleast 3 minutes to load.

Can it be done in an efficient way somehow?

Solutions I have already used:

As obj parsing take too much time. I have stored each obj as memory dump and load that dump. This helped a lot atleast reduced to 3min from 10min, for above example.

Further Possible solution I tried:

I tried loading the anination frames on runtime, when they are accesessed. But this is making the game slow at some crucial time. Like when fighting, all units' fighting frames are loaded together. thus making the game slow.
loading the units in different threads. Makes no improvement


texts: How to redraw the node canvas when the zoom changes on the Godot editor?

texts:
I have an addon that extends EditorPlugin and a companion script attached to a node. The companion script draw a rectangle with a size stablished by an exported property that can be edited from a gizmo on the editor. The general idea is that the plugin shows a handle that allows to drag the visual representation of the exported property, but is the companion script the one that draws its representation on the editor. The only problem is that the node won't redraw itself when zoom changes. Is there a way to fire a redraw event when the zoom changes instead of using _process(delta), since doing it every frame would increase CPU consumption dramatically for the Godot editor on a MacBook Air laptop.
This video shows the issue I'm describing https://youtu.be/wv382kOCKHY


texts: How to solve this card game turn requestes clashing issue

texts:
So I am developing a poker card game using JS +node.js + socket.io.

It is turn-based game. There will be a host and 4 other players.The flow is the players need to make a yes/no choice, then the host need to make a yes/no choice upon players' move, then players will need to make another yes/no choice, then the server will determine who wins.

Put simply,

1:Host set up the hand ----->2: inform all players----> 3:A player make a move(ticking yes or no) --> 4:this move will show up on the host's screen--->5:the host need to make his/her move(ticking yes or no)--->6: the host's move show up on players' screen, they make another yes/no choice----> 7:the server determine who wins.

The issue lies on step 5.

There will be multiple moves waiting for the host to process. Now the current design is all moves are shown by the form of a custom confirm box. It has yes/no button. It works perfect when there is only one host and one player. But when there is more than 2 players, there is a serious clashing problem.

If player A makes a move, it shows on the host's screen, and before the host ticking anything, player B makes a move and then player B's move (confirm box) will replace player A 's confirm box. In this case the host will not be able to process player A's move and the game cannot finalise.

How to get this clashing issue sorted? I hope I am not making this issue sound too complicated but I have been scratching my head.


texts: Multi-tile agent path-finding algorithm?

texts:
Suppose we have a uniform rectanglular grid as shown below. The a is an agent, o is obstacle and g is goal. What are the options of handling multitile agents (e.g. dragons or tanks)?

.  .  .  .  o  .  .  .
.  .  .  .  o  .  g  .
.  a  a  .  .  .  .  .    <-- too tight
.  a  a  .  o  .  .  .
.  .  .  .  o  .  .  .
.  .  .  .  .  .  .  .    <-- should go through this gate
.  .  .  .  .  .  .  .
.  .  .  .  o  .  .  .

Update: Found this article on clearance-based pathfinding from Red Alert 3. It covers not only the clearance - size, but also a capability - ability of certain units to use certain terrains.


texts: Converting Mouse Coords to 3d coords with Camera position

texts:
So I've looked at all the answers I can possibly find, and nothing seems to fit what I need exactly (because im bad at math).

I'll explain what I have thus far:

A camera with x,y,z, Pitch and Yaw float variables.

Scene is rendered like so:

glTranslatef(0.0, 0.0, -(player->cam->getCamY())); // Distance from the ground
glRotatef(player->cam->getPitch(), 1.0, 0.0, 0.0);
glRotatef(-(player->cam->getYaw()), 0.0, 1.0, 0.0);
glTranslatef(-(player->cam->getCamX()), 0.0, -(player->cam->getCamZ()));

(Pitch looks up and down, Yaw looks left and right - the getCam's just return value of x, y or z of the camera)

A ray function already implemented - It shoots a ray straight out of the camera into whatever direction the camera is facing, and intersects with whatever tile is in the center of the screen.
and this function that I copied from the internet:

vector3d GetMousePos3D(int x, int y)
{
GLint viewport[4];
GLdouble modelview[16];
GLdouble projection[16];

GLfloat winX, winY, winZ;
GLdouble posX, posY, posZ;

glGetDoublev( GL_MODELVIEW_MATRIX, modelview );
glGetDoublev( GL_PROJECTION_MATRIX, projection );
glGetIntegerv( GL_VIEWPORT, viewport );

winX = (float)x;
winY = (float)viewport[3] - (float)y;
glReadPixels( x, int(winY), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ );

gluUnProject( winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ);

return vector3d(posX, posY, posZ);

which, as you can probably tell, does not return the desired results because it doesn't interact with the camera. I have no idea how to do this.

Basically, if I can work out the mouse coordinates relative to the camera coordinates, then everything should work fine.

If you need any other information, just ask. This problem is causing me a lot of distress, and the math feels beyond me.


texts: How to avoid CollisionShape2D bouncing which prevents Area2D detection?

texts:
Consider the player with a rectangular CollisionShape2D:

and a round enemy with a CollisionShape2D and a little bigger Area2D:

I observe frequent collisions with no body_entered signal sent by the enemy area.
I have tried to reduce the radius of the collision shape in the enemy. It works, but enemy behavior against walls is not satisfaying anymore.

Edit
My question was unclear... Bouncing is not appropriate to describe what is happening.
Player and Enemy are KineticBody2D.
After some reflection, I have an hypothesis:
Maybe it is because Enemy changes x direction each time _is_on_wall() which means that he changes direction when he hits the player too.
Anyway, if changing direction is the cause of the absence of detection of the player Body by the enemy Area, for the player and enemy to collide, the body of the player must be in the area of the enemy.
For @Theraot remark on adding on Area to the player, I have decided to leave to the enemy the responsability to detect and damage the player, because it is easier to make type of enemy this way I presume.


texts:
I am working on a game with a number of different grid components. Each grid would be about 15 squares wide by 15 squares tall. Each of the squares may either contain an item or not.

Is there any way to create this array and only include the components that have a value. Example (for a 5x5 array):

[
   [5,3, , ,3],
   [ ,1,0,2,2],
   [ , , , , ],
   [5, , ,2, ],
   [ , , , ,1]
]

Is there any way to do this in JavaScript or should I just add a bunch of NULL values to the array?

A simplified version of this, might be an Xs and Os game. Before the game starts all squares are empty. Over time, some of the grid may have either Xs or Os in specific squares.


texts: How should I draw the GUI if I use a 2D camera?

texts:
I have a camera in my 2D side scrolling game and I want to implement the GUI. How can I do that?

For the moment, I draw everything like this:

spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.AnisotropicClamp, DepthStencilState.None, RasterizerState.CullNone, null, scaleMatrix * camera.GetMatrix());
  player.Render(spriteBatch);
  GUI.Render(spriteBatch);
  ...
spriteBatch.End();

Should I separate the GUI drawing code from the camera's transformation matrix? How can I do that? What is the best way to implement the GUI in a Windows Phone 8 project?


texts: Clarification on RenderTargetUsage in XNA 4.0

texts:
I'm trying to understand the exact meaning of RenderTargetUsage.DiscardContents. The documentation says:

  Determines how render target data is used once a new render target is set.

  DiscardContents - Always clears the render target data.

Does calling GraphicsDevice.SetRenderTarget(null) to return to the back buffer count as setting a new render target (therefore clearing discarding any previous one)?
Are the contents discarded either way at the end of the frame (i.e. when the graphic device presents), or do they persist into future frames even in this mode?


texts: Can I publish a non-commercial game that uses assets from a 30 years old Konami game on Steam, Google Play and App Store?

texts: Do major platforms like Google Play, App Store, and Steam allow apps to use assets without owner permission in case of 100% non-commercial releases? Do companies like Konami care?


texts: How do I create a simple animation for use in Unity?

texts:
I'm trying to create a simple shrinking animation for use in Unity. The goal is to create an animation that shrinks the object to be 0.1 scale.

I've created an Animator Controller with an empty state, and an Animation, and assigned the Animation into the Animator Controller's empty state's "Motion" slot, but I have no idea what to do next. This is what the inspector looks like on the Animation:

When I click "Open", nothing happens. There doesn't seem to be any area to edit the animation.

I have no idea where to start, sorry if the question isn't detailed enough.


texts: Unity SceneView Positionning object with mouse position in Editor script

texts:
I would like to create an editor tool who can change the position of an object in the scene view into other object in the world, based on mouse position, like in the picture bellow (the red pyramid is my object to positionnate/rotate)

I would like to do a raycast from the scene view camera to the mouse position (or something like that), to get the gameObject over the mouse, and then get the position of the verticle / normal for position and rotation of my gameObject

For now, I have tryed some code who didn't work, I have my object named "preview", and inside the methode OnSceneGUI() in a editor script i have managed to move my preview object, but now I have to know where to put it...
Thanks !

EDIT: here some of my try:

Transform previewPoint; //here my transform

void OnSceneGUI()
{
   PointCreator();
}

 private void PointCreator()
  {
  //test 1
      Camera sceneCam = SceneView.GetAllSceneCameras()[0];
      Vector3 spawnPos = sceneCam.ViewportToWorldPoint(Event.current.mousePosition);
      previewPoint.position = spawnPos;

      //test 2
      Vector3 mousePosition = Event.current.mousePosition;
      mousePosition.y = SceneView.currentDrawingSceneView.camera.pixelHeight - mousePosition.y;
      mousePosition = SceneView.currentDrawingSceneView.camera.ScreenToWorldPoint(mousePosition);
      mousePosition.y = -mousePosition.y;

      previewPoint.position = mousePosition;

  }


texts: Strategy for controlling the physics of a bike

texts:
I'm new(ish) to Actionscript 3 and I was wondering what the code what would be like for controlling the bike in a game.

How would the animation of the bike work? Would I have to create a bike animation of the wheels moving and make it start and stop when the key to go forward is pressed. How would I go about it slowly stopping when the key to go forward is released?


texts:
In my game I use a really simple control mechanic to control a character on screen. But my problem is that users do not understand this control.

Beside a little delay problem they work this way:

  As soon as I do a swipe +x or -x my character moves left or right.
  And as long as I hold my finger it continuous to move to the direction
  in that I swiped. When I swipe into the opposite direction of my last
  swipe without leaving my finger from the touch ground, my character
  should move into this direction. When I release my finger from the
  touch screen, my character should stops instantly.

a) Do you think this mechanic could work, if my users learn to use it?

If yes: what would be the best way to show them how it works? A short video? Or some graphics? Maybe a tutorial level?

My concern is that it might be not a good mechanic, because people do not understand it when playing my prototype the first time. That could be because they only know swipe and tap, but not swipe-hold-swipe.

I do not know if there is a right answer or if it is just a question of opinions.


texts: How to test a turn-based ios Game Center game with 2 devices?

texts: This might well be a very dumb question, but here goes anyway, I'm planning my turn-based ios game center game, obviously I know I'll need 2 iDevices to test it on, but how would I test the online turn-based play between the devices? As I'm to understand it, if the 2 devices are local (i'e close to each other) they automatically revert to a local communication method? is it possible to force them to communicate online so I can test that part of the project?


texts: Does CADisplayLink automatically control the app's timestep?

texts:
I'm writing an iOS game that uses OpenGL ES 2.0. I have my 'OpenGLView' which contains a

- (void)setupDisplayLink {
    CADisplayLink* displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(render:)];
    [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
}

And then my

- (void)render:(CADisplayLink*)displayLink {

function which at the end of the processing calls

[_context presentRenderbuffer:GL_RENDERBUFFER];

Like most people I've found the http://gafferongames.com/game-physics/fix-your-timestep/ tutorial but I've been thinking.

With a CADisplayLink, has the framerate limiting been done for me already by iOS, meaning I don't need to calculate the timing of each frame?

Also, as a sanity check, the 'render' function is where all my game logic goes? I'm currently treating it as the equivalent of a

while (!quit) {
  do_stuff();
  render();
}

loop you see in traditional game loop designs, or is this only for rendering?


texts: I'm currently making a color switch game. All my obstacles are made out of 4 shapes of a different color. The shapes are in an array with their index being the same index as its color in a array of colors. The player is a ball or Ellipse shape with a color curColor. How do I see if it overlaps shapes with a different color?


texts:
In OpenGL, most shader uniform variables are easy, a float or a vec3 or whatever is associated with a shader program. But samplers are different, we associate a texture unit to the shader program, and associate a texture with a texture unit.

To change a texture on a shader program, there are two approaches:

reassign the texture unit, or
use the same texture unit with a new texture.

Codewise:

glUseProgram(theProgram);

// way 1 setup
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, texture1);
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, texture2);

// way 1 assign before each draw
glUniform1i(uniformLocation, 1);
...draw...
glUniform1i(uniformLocation, 2);
...draw...

or

// way 2 setup
glUniform1i(uniformLocation, 1);

// way 2 assign before each draw
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE2D, texture1);
...draw...
glBindTexture(GL_TEXTURE2D, texture2);
...draw...

I profiled both, and got inconclusive results. On desktop (mac pro), "Way 1" is much slower. On laptop (mac retina), they're about the same.

Both ways work, so neither is "wrong"... so perhaps this question is loose. Best would be to profile every video card, but I cannot.

Is there a recommended approach for managing textures & texture units?

(Or, at the risk of making the question even vaguer, is there some mental model I should have for how textures, texture units, and shader programs interact which makes it obvious why Way 2 might be faster on some platforms?)


texts: How deep does the GameObject.GetComponentsInChildren() , Go?

texts:
So I have a GameObject which my scene will be it's children.
I wanted to get the BoxCollider of all the objects and their sub-objects and their sub-objects's sub-objects and ... .
So can I do that with just the GetComponentsInChildren(), or should I navigate through them all and find them one by one?


texts: Reading filename(image) to a string using corona

texts:
Is there a way to get the filename from image and read it to a string using corona?
I can't find any help regarding this issue.

In example, if I had:

local movieTitle = display.newImage("pulpfiction.png")

How could I print the image name(pulpfiction.png) or store it in a string?


texts: Can you use a sprite with uneven dimensions in Unity 2D?

texts: I'm new to game development as a whole, so forgive me if this is an idiotic question in itself, but I want to use a sprite sheet where the entire sprite sheet's dimensions are 104x144, and the dimensions of an individual "pose" of the sprite is 26x36. If I can use this sprite, and I'm asking if I can, what Pixels Per Unit would I put? Again, I have absolutely no idea how this works, and I'm probably being a huge idiot about this entire thing.


texts:
I don't know why my attempt to read keypresses in Pygame is not working.
import pygame

pygame.init()

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

w = 500
h = 500

x = 15
y = 480
vel = 5
screen = pygame.display.set_mode((w, h))

square = pygame.image.load(r'/Users/lanik2009/Downloads/square.PNG')
square = pygame.transform.scale(square, (46, 40))
triangle = pygame.image.load(r'/Users/lanik2009/Downloads/triangle.PNG')
triangle = pygame.transform.scale(triangle, (46, 40))

def player():
    screen.fill(black)
    pygame.draw.circle(screen,white, (15, 480), 10, 500)
    screen.blit(triangle, (80, 460))
    screen.blit(square, (180, 460))

running = True

while running:

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

    userInput = pygame.key.get_pressed()
    if userInput[pygame.K_LEFT]:
        x = -vel
    if userInput[pygame.K_RIGHT]:
        x = vel

    player()
    pygame.display.update()


texts:
I want to implement ball movement similar to that in the Puzz Loop 2 game.

The goal consists of clearing all the balls moving on a rail, with the trailing one pushing all the others.

You can watch a footage for a better illustration, here.

The game was running on a CP System II, driven by a Motorola 68000 @ 16 Mhz.

Question

How would one go for replicating the same game mechanic of balls moving along a rail?


texts: Why / how does XNA's right-handed coordinate system effect anything if you can specify near/far Z values?

texts:
I am told repeatedly that XNA Game Studio uses a right-handed coordinate system, and I understand the difference between a right-handed and left-handed coordinate system.  But given that you can use a method like Matrix.CreateOrthographicOffCenter to create your own custom projection matrix, specifying the left, right, top, bottom, zNear and zFar values, when does XNA's coordinate system come into play?

For example, I'm told that in a right-handed coordinate system, increasingly negative Z values go "into" the screen.  But I can easily create my projection matrix like this:

Matrix.CreateOrthographicOffCenter(left, right, bottom, top, 0.1f, 10000f);

I've now specified a lower value for the near Z than the far Z, which, as I understand it, means that positive Z now goes into the screen.  I can similarly tweak the values of left/right/top/bottom to achieve similar results.

If specifying a lower zNear than zFar value doesn't affect the Z direction of the coordinate system, what does it do?  And when is the right-handed coordinate system enforced?

The reason I ask is that I'm trying to implement a 2.5D camera that supports zooming and rotation, and I've spent two full days encountering one unexpected result after another.


texts: Problem making shooting follows an actor/object

texts:
At first I created an actor to be a projectile, he acts with a simple projectile. When generated it goes straight, anyway...

To do this, I added the Projectile Movement component.

It turns out that I wish this projectile did not go straight ahead simply, I would like it to be generated when it came to a minion.

Then my problems began, because being simply an actor, it seems that he can not move with the Simple Move to Actor/Location function.

I created 3 sockets:

One for each shot/projectile I was going to test.

Shooter Blueprint:

The Event Atirar causes the 3 shots/projectiles I created to be generated (TiroActor, TiroCharacter and TiroPawn).

TiroActor Blueprint:

TiroCharacter Blueprint:

TiroPawn Blueprint:

I wish that when they were generated, they would go towards the only existing minion in the game, but this does not happen:

The Tiro Actor goes straight, and nothing makes it stop (I activated the "call in editor" option for the Event Andar, but it does not match).

The Tiro Character falls to the ground and does nothing, but corresponds when I call the Event Andar manually:

The Tiro Pawn is not even generated...

I modified the "Auto Posses AI" option of Tiro Character and Tiro Pawn to Placed in World or Spawned.

I removed the gravity of all the components of the Tiro Character, but even so when generated it falls to the ground.

I would like to know how to make an object (be it actor, pawn or character) when it is generated follow the target (in this case a minion) until it collides with it.

EDIT 1 (complement)

If it was difficult to understand, I'd like to know how to do something like an AA from a Clash of Clans archer, even a champion AA that attacks from a distance, whether from Dota or LOL.

The projectile of the Dota/LOL tower would be a good example. A guided missile too...


texts: What is the difference between graphics filters in Adventure Game Studio?

texts:
Adventure Game Studio supports following graphics filters:

max nearest-neighbour filter and 2x-8x nearest-neighbour filter
2x-8x anti-aliasing filter

What graphics filter offers the best image quality? What is the difference between "nearest-neighbour filter" and "anti-aliasing filter"?


texts: Conceptual question regarding Belief-Desire-Intent agent

texts:
I've been researching the Belief-Desire-Intent model and the way they used it in the original Black and White Game(which is the same, but they also defined decision trees as opinions).

I have a question about the distinction between opinion and belief.

From what I understand, beliefs are linked lists in the form of attribute: value.

So let's say a tree would be something like:
Condition: Inanimate
Type: Plant

So let's say I try to apply the command cut on it and the npc cuts down the tree in like 2 turns, by doing 50 damage each turn. So the newly formed belief is that the hp of a that tree is more than 50.

From what I understand, that this is now a newly formed belief, so the new belief about the tree would be:
Condition: Inanimate
Health: >50
Type: Plant

What about the fact that the npc now knows it takes 2 turns to cut down the tree, is that now a newly formed belief or an opinion? If it's not, what kind of opinion could be formed out of that?

Help from anyone who's dealt with this would be appreciated as I'm finding it hard to find open source code examples of this.


texts: If I project a sphere in 3D will it be a circle?

texts:
Assuming I have infinite vertices to represent the sphere, if I project the sphere from any position/scale in 3D to 2D, will it be a circle?

I know it will not be a circle on the screen, because of scaling and different resolutions. But do field of view and aspect ratio effect the results?

Edit: Sorry yes, I am talking about perspective projection. Seems the answer is no then, perspective will distort the sphere. Thanks!


texts: How can I toggle enabled on a specific script within an object in Unity?

texts:
I have the CarController script inside my car GameObject. I need to set it to disabled at the start so the countdown timer can start the race.

I thought I knew how to do it but once again I have failed :/

Any ideas why this doesn't work??

void TogglePlayerEnabled(bool b)
{
    playerCar.GetComponent<CarController>().enabled = b;
}
void ToggleAiCarEnabled(bool b)
{
    aiCar.GetComponent<CarController>().enabled = b;
}

If I use a print line saying "Toggled" or something, that appears in console as expected. But the CarController script seems like it stays active as both me, and the AI car can just drive whilst the countdown is happening still.

Here's the full class:

public class GameManagerControl : MonoBehaviour {

public GameObject playerCar;
public GameObject aiCar;

public int sceneChangeZValue;

private string countdown = "";
private bool showCountdown = true;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    // TODO: This will change the scene when the track ends.
    //if (player.transform.position.z >= sceneChangeZValue)
    //      {

    //          SceneManager.LoadScene("race_track_lake");
    //      }

    if (showCountdown)
    {
        StartCoroutine(GetReady());
    }

}

// call this function to display countdown
IEnumerator GetReady()
{
    countdown = "3";
    TogglePlayerEnabled(false);
    ToggleAiCarEnabled(false);
    yield return new WaitForSeconds(1.5f);

    countdown = "2";

    yield return new WaitForSeconds(1.5f);

    countdown = "1";

    yield return new WaitForSeconds(1.5f);

    countdown = "GO";
    TogglePlayerEnabled(true);
    ToggleAiCarEnabled(true);
    yield return new WaitForSeconds(1.5f);

    showCountdown = false;
    countdown = "";
}

// GUI
void OnGUI()
{
    if (showCountdown)
    {
        GUI.color = Color.red;
        GUI.Box(new Rect(Screen.width / 2 - 100, 50, 200, 175), "GET READY");

        // display countdown
        GUI.color = Color.white;
        GUI.Box(new Rect(Screen.width / 2 - 90, 75, 180, 140), countdown);
    }
}


texts: What's the best phone for game development?

texts:
Yeah yeah I know, best is probably a bad way to phrase this. But I need some pros and cons. I need a new phone and if I'm going to get a smartphone and pay all that money, I better get one that I can develop for, and games are what I want to make (not apps).

So the way I see it is the iPhone would be a bit too expensive to get into. I currently do not own a Mac and do not know Objective-C, so both of those things would be major road blocks to getting an iPhone for game dev purposes. Are there any really good or bad things to know about iPhone game development?

Windows Phone 7 is pretty attractive to me, since I already have a basis in XNA and it would be pretty easy and cheap to pick up. For game development it looks pretty attractive.

After that, my research kind of dies. I have no idea what the deal is on Android, RIM's OS or any other mobile OSes. Does anyone have any experience on these?


texts:
I have created a very simple lighting shader. It currently only supports point lights, but it lights up surfaces that are completely blocked from the light. I know why, but I want to know how I can fix it. I was thinking of using a form of shadow mapping to darken those areas, but shadow mapping is difficult for me to understand and has very major performance issues. I was hoping for a more elegant and efficient version, even if it is not as nice.

Until something like that exists, I need a nice, efficient way of checking to see if a fragment or vertex is visible and computing things from there. I would also like to add that I intent to support semi-transparent objects, which should block light based on and alpha value.

The things I want:

Fast (25+ fps with the modified shaders, I currently run at 82)
Easily modified to incorporate more lights (three or four at most, probably).
Support for edge smoothing (user can enable it, but will lose performance)

The things I do not want:

Pulling information from the GPU during rendering (view stuttering is always visible when that happens)
Visible/noticeable moving of lighting when scene is stationary (like the light is moving when it really isn't, due to randomizing)
Expensive operations when the scene first renders.

I do not expect anybody to implement these things - just to leave room and maybe a comment where these would be done. I know this is the "holy grail" of rendering when combined with bump maps and such, but if you tone down the quality a bit, I hope it is possible. I may have to do some extra work on the CPU, but that is acceptable.

Now for the shaders I currently have working:

Vertex shader

varying vec4 color;
varying vec3 normal;
varying vec4 position;

void main (void) {
    color = gl_Color; // pass color to the fragment shader
    normal = normalize(gl_NormalMatrix * gl_Normal); // calculate useable normals from the basic normal data.

    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; // set position
    gl_TexCoord[0] = gl_MultiTexCoord0; // set texture coordinates
    position = gl_Vertex; // pass gl_Vertex to the fragment shader for light calculations.
}

Fragment shader

varying vec4 color;
varying vec3 normal;
varying vec4 position;

uniform sampler2D texture;
uniform vec4 light; // position of the light, same coordinate system as non-transformed objects

void main (void) {
    vec3 vector = light.xyz - position.xyz; // get the vector needed to determine length
    float distance = sqrt((vector.x * vector.x) + (vector.y * vector.y) + (vector.z * vector.z)); // determine length
    vec4 final = color; // set color

    final.xyz *= (1.0 / distance); // calculate light intensity on pixel

    gl_FragColor = final * texture2D(texture, gl_TexCoord[0].st); // multiply by texture color
}

I can do a lot of extra cool things with this current code, such as giving lights their own colors and giving objects their own material properties, but that is not the point now. I just want basic code, preferably without needing more buffers and shaders, to determine visibility. From my research, it sounds like the stencil and depth buffers may be of use here, and they already setup, so they may be a better way to do it.

I can not stress enough that I only need the bare essentials here - nothing overly fancy. Thanks in advance for your help.


texts: Can I use copyrighted images and music in my game?

texts: I am working on my first ever project , and I have used some copyrighted images(images taken from some other well recognized games). Is it even possible that I edit the images a little bit and then use them as royalty free images?


texts: How to implement different shapes for an area of affect spell?

texts:
Let W = wizard

Let 0 = Cast range of spell, or AOE

Here is the problem:

I have a 2D tile map of squares. Let's say I want to have a wizard cast a spell that surrounds his body equally. For this, it would be as simple as using a flood fill or Dijkstra's algorithm, and it would look like this:

===0===
=00000=
000W000
=00000=
===0===

No problem! However, how will I implement a spell, that, for whatever reason, looks like a plus sign?

===0===
===0===
000W000
===0===
===0===

Or the spell goes longer in the direction the wizard is facing?

=00000=
=00000=
==0W0==
==000==
=======

Or two different locations?

=======
=00====
===W===
====00=
=======

Or, even more awkward, its a ranged splash spell where the player can choose where they want to cast it?

=======
=======
===W===
======0
=====00

One way would be to have a list of all the locations relative to the wizard beforehand, and add them to the wizards location later. (E.g, for the affect to be 2 tiles north of the wizard, it would store (x+0, y+2), and later add them to the wizard's position, which could be at x=30, y=19, so the affect would be at x=30, y=21.)

A limitation to this, unfortunately, is that it doesn't take into account where the wizard is facing, and it feels inelegant to manually typing in all the locations that the AOE will affect.

Bottom line: How should I approach this problem and create a good, easily adjustable AOE system for a tile based map, that takes into account different AOE shapes and cast positions?


texts:
I downloaded this package ("Frost Effect by Steven Craeynest") on Unity Asset Store and altered it into making the effect happen once I click on a button (button 1), I first disabled the frost button (button 1) in my inspector before playing the game and created another button (button 2) to activate the frost button(button1). However I'm having issues with the frost effect. You see when I click on button 2 to activate the frost button (button 1) frost effect works for a bit but then stops at delayBeforeUnfreeze like time.timescale is equaled to 0 and the only way of making time.timescale is equaled to 1 is by pressing my pause button and clicking the resume button. Anyway this is my script:

private FrostEffect frost;
float duration = 0.2f;
float delayBeforeUnfreeze = 0.34f;
private float previousTimeScale;
public GameObject frostbutton;
public int buttonCount = 0;
int timesActivated =  0;

public void Check() {
    buttonCount ++;
}

// Use this for initialization

void Start () {
    previousTimeScale = Time.timeScale;
}

public void Activate ()
{
    frostbutton.SetActive (true);
}
public void CreateFrost ()
{
    if(timesActivated < buttonCount)
    {
        timesActivated++;

        GameObject.Find ("Main Camera").GetComponent<FrostEffect> ().enabled = true;
        //Slow timescale
        Time.timeScale = 0.06f;
        //Freeze time effect
        DOTween.To (x => FrostEffect.FrostAmount = x, 0.0f, 0.34f, duration)
    .OnComplete (() => {
            //Unfreeze tween effect
            DOTween.To (x => FrostEffect.FrostAmount = x, 0.34f, 0f, duration)
                .SetDelay (delayBeforeUnfreeze);

            //Set timescale back to previous.
            Time.timeScale = previousTimeScale;
        });
    }
}

}
Thank you. :)

Second Edit

This is my panel animation script:

public void DisableBoolAnimator(Animator anim)
{
    anim.SetBool ("Shown", false);
}

public void EnableBoolAnimator(Animator anim)
{
    anim.SetBool ("Shown", true);
}

This Youtube link will show you what my panel animation looks like: 31:47.
Thank you. :)


texts: Recording equipment for game sounds, music and dialogues

texts:
I've checked this question but I wasnt satisfied.

So basically I'm a one man indie team and I wanted to have custom sounds, dialogues and maybe music (I have a few friends who are musicians) in my game. I was looking at some equipment and I found several options.

A condenser USB microphone

relatively cheap (50-75$) and quite handy, but the good sounding one (Samson Go Mic) likes to break all of a sudden (bought one and it lasted 30 sec, no improper use) and the others arent as good.

An interface with phantom power supply and a regular condenser mic of my choosing. This setup is easily upgradable (better mic) but least portable and handy ( I was thinking of M-audio M-track that comes with AIR Ignite software) This is also the most pricy option as the interface alone costs ~100$ and you also need a mic, mic stand, cable... But it also allows to easily record some instruments, like guitars, basses etc.
A hand recorder, like the Zoom h1. It costs a bit over 110$, but is the most portable solution, and it allows for recording sounds and background noise for various environments almost everywhere. Not sure how well it would do with music, instruments etc.

The brands and models mentioned are just an example of the hardware I have in mind. I do everything myself, and I want to do sounds, music and dialogues. I want it cheap and reliable. Being mobile is a big plus (I do quite a lot of game jams).

My question is:

Which of these options would be the best for an indie game dev?  Which of these solutions would have the best (versatility+quality+reliability)/price ratio? What should I consider when looking for recording equipment for my purposes?


texts: Difference between Gdx.graphics.getWidth() and camera.viewportWidth

texts:
I am a newbie in game development and I am developing an android game using Libgdx on intelliJ IDE.
I want to understand the difference between Gdx.graphics.getWidth() and camera.viewportWidth .
As I want the size of everything (example buttons) in my game to be by percentage of width and height of the screen, so what should I use for that Gdx.graphics.getWidth() or camera.viewportWidth ?


texts:
I want to start learning 3d modeling. I already have experience with maya and 3dsmax but I made a long pause (2 years)

Now I have free access to maya, 3dsmax and blender (I am a student). I know that all tools are very powerful so I thought I just pick the one with the best learning materials.

The best site that I found is http://www.digitaltutors.com/11/index.php and it has over 7600 videos for maya.

Maybe you can recommend me some other learning sites that are as good as digitaltutors?


texts:
I have a non axis aligned rectangle, like a car, in my game. I have to check and resolve the collision between the rectangle and circle, which is stationary.

I have found lots of ways to determine the collision, but couldn't find anything on resolving it. It is clear that i have to push back the rectangle away if there is a collision, but I can't find a proper way.

Is there a way of handling and resolving the collision between a rectangle and a circle? Like an algorithm?

I am developing in c++.


texts: How can I tell in code if vsync is disabled on desktop PC?

texts:
My game needs to behave differently to get the best performance if the user disables vsync globally (basically, I need to change the scheduling on my housekeeping operations).

Is there a graphics card independent way (SDK call, C/C++) for me to find out if vsync is disabled?

I'm using opengl/glfw 3.2.1, and I can use glfwSwapInterval(0) to force vsync disabling, but that's not the same as reading the player's current default preferences.

I can always use application settings, but it'd be good if the game could default to the most suitable approach for the default video settings.


texts: Masters in Computers Science OR Game Design and Development?

texts:
Hey guys so I've been very confused on what path to take in terms of education. I'm a soon to be computer science graduate with a BS in Computer Programming.
My hope is to one day land a job in the gaming industry but I've read a few posts on what people have said against and for a degree in game design. They have all been about a bachelors degree and in my case that will already be obtained.

It is true that a computer science degree is more general and that many non gaming employers will not think of it as any less, compared to a game design degree. But since I already will receive a computer science degree will it still look bad if I have a masters in game design and a BS in computer science when interviewed for a gaming company and non gaming company? As well as is the masters in game design worth it or should I stick to with computer science?

what i hope to gain from my degree is further understanding of game creation, I want to develop my own game and I have been learning to use Unity and Unreal but want to expand my knowledge in other areas.

I want your input on what you consider the best choice and why.

Thanks.


texts: I am new to unity. I have created an asset by using Blender and managed to put it in the scene. But somehow now I can only see one item at a scene. For example I can only see camera when I clicked "Main camera" at the Hierarchy toolbar. When I clicked the asset, the camera is hidden from the scene along with lighting etc. This is difficult for me since I need to put my asset in front of the camera. Where can I toggle back the views for everything in the scene?


texts:
I want to create some ROI tools on my game for personal analysis.

Let's say that I have 3 different level of special powers with a recursive cost and certain bonus. So, I want to see when certain level will start have income.

1st example: 1000 coins for 10 uses. Bonus: +10% on farming speed. 2000 coins for 10 uses. Bonus: +20% on farming speed. Etc

In this example, I know exactly what the bonus will do. I have the price of the farming per unit and I can calculate the income per use for each power level. So, I can tweak the numbers using the ROI tool to make the effect better.

2nd example: 1000 coins for 3 power ups on a weapon. Bonus: +1 attack power, +5% chance to destroy the weapon. 2000 coins for 3 power ups on a weapon. Bonus: +2 attacking power, 10% chance to destroy the weapon.

3rd example: 1000 coins per use. Bonus: 30% heal, 5% chance to get injured. 2000 coins per use. Bonus: 50% heal, 10% chance to get injured.

As you can see, the first example is simple to calculate the income vs cost. However, the second and third example don't have an exact effect and both of them have a probability to either good or bad effect. How do you work on this type of ROI? How do you calculate the pros of each level?


texts: Correct way to project a texture with alpha and colors onto surfaces in Unity

texts:
I am experimenting with Unity and wanted to project a unit circle beneath a unit and my very first naive approach was to create a child plane below the unit, assign the material to it and stretch it using the Pro Builder UV editor but it looked horrible:

In order to figure out what's wrong I read a lot of various approaches to "fix" that issue which were mostly the following:

use a higher resolution for the texture
do not use any compression
do not use a POT resolution
change the filtering option from bilinear to point
...

Eventually I figured that I have to do something completely different and that is how I stumbled upon the idea to use a shader attached to a projector game object in order to project a material. Unfortunately though it turns out the shader expects a grayscale image and only tints the projection based on a parameter. For reference this is the shader I have just copied from the web (source):

Shader "Projector/AdditiveTint" {
    Properties {
        _Color ("Tint Color", Color) = (1,1,1,1)
        _Attenuation ("Falloff", Range(0.0, 1.0)) = 1.0
        _ShadowTex ("Cookie", 2D) = "gray" {}
    }
    Subshader {
        Tags {"Queue"="Transparent"}
        Pass {
            ZWrite Off
            ColorMask RGB
            Blend SrcAlpha One // Additive blending
            Offset -1, -1

            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"

            struct v2f {
                float4 uvShadow : TEXCOORD0;
                float4 pos : SV_POSITION;
            };

            float4x4 unity_Projector;
            float4x4 unity_ProjectorClip;

            v2f vert (float4 vertex : POSITION)
            {
                v2f o;
                o.pos = UnityObjectToClipPos (vertex);
                o.uvShadow = mul (unity_Projector, vertex);
                return o;
            }

            sampler2D _ShadowTex;
            fixed4 _Color;
            float _Attenuation;

            fixed4 frag (v2f i) : SV_Target
            {
                // Apply alpha mask
                fixed4 texCookie = tex2Dproj (_ShadowTex, UNITY_PROJ_COORD(i.uvShadow));
                fixed4 outColor = _Color * texCookie.a;
                // Attenuation
                float depth = i.uvShadow.z; // [-1 (near), 1 (far)]
                return outColor * clamp(1.0 - abs(depth) + _Attenuation, 0.0, 1.0);
            }
            ENDCG
        }
    }
}

With that shader I was able to render the following effect:

Since I have no experience with shaders at all I just blatantly copy & pasted it and do not know (yet) how to customize them or even write custom ones in the first place.

Assuming my approach to combine a projector with such a shader is the way to go, I'd like to know whether there is any shader you can share that allows me to project an unlit texture with transparency and its own color such as the following example:


texts:
I'm working on a simple game, and I need to calculate the position to aim.

Since my math days are a bit behind me, I put together a simple example to illustrate:

So given that I know the position of the two objects, and the velocity, how do I calculate the point at which they intersect (i.e. the point to aim for)?

EDIT: To clarify, the cannon is fired at time 0, there is no waiting.


texts: LibGDX - Rendering things in different classes

texts:
thanks for your time!

I'm really new to LibGDX (and Java itself).

Which approach should I use to render my different game parts?
I want to show a background, the main character, a bunch of enemies and an HUD. The playable area will be bigger than the screen so the camera has to move following the main character (top view).
Also everything has to be procedurally generated.

For example, I have the code to generate the map (background) but I don't know how to render it if it's in another class (not the core entry point one).
I can think of calling a custom background.draw() method from my main.render() class and pass a batch to draw onto but probably there are better ways.
I've tried to use Stages (scene2D) aswell but I can't get my camera to move (are they mostly made for UI?).

I'd like to be pointed towards the best solution performance-wise since it's gonna be called every frame :P


texts:
Instead of spam the same hard question like my previous one that Is difficult to get a minimum verifiable example for, I have decided to rework my path-finding and I can fix a lot of my issues with an oct-tree, not a true one but rather just subdividing my world into 8 or however many i specific in the function as this is all thats needed.

I already know what i need to do the stage after this, but I'm a not sure the best way to approach the subdivision so i get the right vector points of the subdivided cubes.

div = the number of cubes I want to create.

If I already have my 8 points,

    worldspace(Vector3 origind, float sized)
{
    //  face1
    ca = Vector3{ origin.GetX() + sized,origin.GetY() + sized, origin.GetZ() - sized };
    cb = Vector3{ origin.GetX() + sized,origin.GetY() - sized, origin.GetZ() - sized };
    //-----------------------------------------------------------------------------
    cc = Vector3{ origin.GetX() - sized,origin.GetY() - sized, origin.GetZ() - sized };
    cd = Vector3{ origin.GetX() - sized,origin.GetY() + sized, origin.GetZ() - sized };
    //  face 2
    ce = Vector3{ origin.GetX() + sized,origin.GetY() + sized, origin.GetZ() + sized };
    cf = Vector3{ origin.GetX() + sized,origin.GetY() - sized, origin.GetZ() + sized };
    //-----------------------------------------------------------------------------
    cg = Vector3{ origin.GetX() - sized,origin.GetY() - sized, origin.GetZ() + sized };
    ch = Vector3{ origin.GetX() - sized,origin.GetY() + sized, origin.GetZ() + sized };
};
~worldspace();

I can define my worldspace as worldspace(0,0,0,25) so thats a cube of 25 units, but then I want to divide it in the most efficient way into 8 = cubes lets say or so and make them into a vector.

I'd like the function to be able to specify how many subdivisions i want, I don't want a dynamic one, so I think. So I'm thinking I could do something along the lines of

semi pseudocode

createoct(div)
int divisions = div
for (int i = 1; i =< div; i++)
{
  dist of ca to cb / div ?
  store the new point
  do the same for the other points ?
}

Am I going about this the right way ? what would be the best way to calculate the subdivisions and store their 4 seperate points as one object ? perhaps a new class ?


texts: Fixed distance increments between two Vector3 positions

texts:
I have two Vector3 positions:

 Vector3 start = new Vector3(1f, 1f, 1f);
 Vector3 target = new Vector3(5f, 5f, 5f);

How do I transform gameobjects a fixed amount from start to target, say .1f?

This is easily done with percentages, because you can do:

var dist = target - start;
 var d = 5f; // 5 increments
 var step = dist / d;

 while (start != target) {
     start += step;
 }

How do you do this with Fixed, not percentage steps. Say I want to increment .1f in some direction:

 var dist = target - start;
 var step = new Vector3(.1f, .1f, .1f); //How do I determine the direction of the increment?

 while (start != target) {
      start += step;
  }

Thanks


texts: How should one design an analytics system for an online multiplayer game?

texts:
For my simple MMO, the MySQL database stores things like user experience, user level, user coins, health points, etc.

We wanna have an analytics system that can show me trends through daily averages, medians, totals of different stats and actions of the game's user base.

Some answers that need to be answered by this analytics system:

Average health points over time
How many users are what level over time
How many quests were started by users over time vs how many were completed
Cohort analysis on certain groups of users

I was looking into BI systems and thought maybe building an OLAP database with a star schema might be appropriate. But I'm not sure what are good dimensions to use for this and how to deal with changes to the transactional database over time. And it seems like a lot of work to build out a ETL and reporting system as well.

Anything else that's simpler and yet still robust? Are key-value datastores a good option?
What are some commonly used systems for doing this type of analytics?


texts: WebGL - two different approaches to Point Light: what is the difference?

texts:
So I'm studying Webgl and after directional light I'm approaching point light.

So I've seen two different approaches:

Take the directional light (diffuse and specular components) and multiply them by a falloff attenuation, for example with the attenuation function is by Tom Madams that anyway take in account the distance from the fragment surface point to the light point. This approach is spotted in this webgl light walkthrough tutorial, and I find it easier to understand. Seems also the same approach from this OpenGL tutorial (in the section Point Light)
The other approach listed here does not involve a light attenuation falloff but calculate the light direction from any fragment position and the light point source. It seems a little bit more complicated to me.

Is there something that I have totally misunderstood? What is the difference between this two approaches? When to use the first and when to use the second?

Thanks!


texts:
I'm looking for an algorithm that can clip a text ( GUI Mesh text ) when it's length is over 20 characters. The problem is I have one background image(textured plane) (orthographic), where I want to put a Gui mesh text on it, it happens that sometimes the text is larger in length than the supposed background image, and it gets out of the background mesh boundary.

Is it possible to fit that gui mesh into the boundary of the background plane mesh ?


texts: Assets from Tiled background layer not appearing in Cocos2d-x

texts:
I'm running into an issue with a Tiled map used as a background image for a scrolling scene. I'm using two sprite sheets to provide assets for a background layer. In Tiled, all of these assets appear correctly, but in cocos2d-x, the assets from WorldSelectBG01.png do not appear. Any thoughts on what might be going on here?

Here's what the TMX file looks like:

<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" tiledversion="1.0.3" orientation="orthogonal" renderorder="right-down" width="1" height="10" tilewidth="640" tileheight="640" nextobjectid="15">
 <tileset firstgid="1" name="WorldSelectBG01" tilewidth="640" tileheight="640" tilecount="6" columns="3">
  <image source="WorldSelectBG01.png" width="1920" height="1280"/>
 </tileset>
 <tileset firstgid="7" name="WorldSelectBG02" tilewidth="640" tileheight="640" tilecount="6" columns="3">
  <image source="WorldSelectBG02.png" width="1920" height="1280"/>
 </tileset>
 <layer name="Background" width="1" height="10">
  <data encoding="csv">
1,
2,
3,
4,
5,
7,
8,
9,
10,
11
</data>
 </layer>
 <objectgroup name="GameSelectButtons">
  <object id="1" name="gd0" x="394" y="6308"/>
  <object id="5" name="gd1" x="251" y="6253"/>
  <object id="6" name="gd2" x="140" y="6113"/>
  <object id="7" name="gd3" x="227" y="5972"/>
  <object id="8" name="gd4" x="362" y="5907"/>
  <object id="9" name="gd5" x="499" y="5806"/>
  <object id="10" name="gd6" x="458" y="5651"/>
  <object id="11" name="gd7" x="336" y="5583"/>
  <object id="12" name="gd8" x="241" y="5477"/>
  <object id="13" name="gd9" x="294" y="5365"/>
  <object id="14" name="gd10" x="322" y="5213"/>
 </objectgroup>
</map>

And in cocos2d-x, I'm reading it like this:

void ABTScene::AddBackgroundTileMap(const std::string& backgroundTiledMapFilename)
{
    if (backgroundTiledMapFilename.empty())
    {
        return;
    }

    const cocos2d::Size visibleSize{ cocos2d::Director::getInstance()->getVisibleSize() };
    const cocos2d::Vec2 origin{ cocos2d::Director::getInstance()->getVisibleOrigin() };

    _backgroundTiledMap = cocos2d::TMXTiledMap::create(backgroundTiledMapFilename);
    CC_ASSERT(_backgroundTiledMap);
    if (_backgroundTiledMap)
    {
        CCLOG("Background tile map read from resource file: %s", _backgroundTiledMap->getResourceFile().c_str());
        cocos2d::Vector<cocos2d::TMXObjectGroup*>& objectGroups{ _backgroundTiledMap->getObjectGroups() };
        for (const cocos2d::TMXObjectGroup* objectGroup : objectGroups)
        {
            CCLOG("Object group found in tilemap: %s", objectGroup->getGroupName().c_str());
        }

        // all tiles are aliased by default, let's set them anti-aliased
        for (const auto& child : _backgroundTiledMap->getChildren())
        {
            static_cast<cocos2d::SpriteBatchNode*>(child)->getTexture()->setAntiAliasTexParameters();
        }

        _backgroundTiledMap->setAnchorPoint(cocos2d::Vec2(0.0f, 0.0f));
        _backgroundTiledMap->setPosition(origin);
        const float bgImageScaleFactor = visibleSize.width / _backgroundTiledMap->getContentSize().width;
        _backgroundTiledMap->setScale(bgImageScaleFactor);

        this->addChild(_backgroundTiledMap, -1);
    }
}


texts: Why a method call in OnStateEnter and OnStateExit do not invoke in the correct order?

texts:
I have a class that extends from StateMachineBehaviour. All I want to do is invoke some code in a specific state's first frame and the last frame to trigger some action in the game. But method calls in OnStateEnter and OnStateExit invoke inaccurately like below. And I saw a couple of articles in the Unity forum about how inaccurate StateMachineBehaviour works. Is there something I should pay attention to or any suggestion on how to invoke some code in the specific frame?
Here is the code


texts: Rotation of a matrix with unequal rows and columns

texts:
I have this simple matrix class which has a char** array for storing the data. The data array gets initialized like this:

data = new char*[cols];
  for (int x = 0; x < cols; x++)
    data[x] = new char[rows];

Is it possible to rotate this kind of matrix when its let's say 3x2?
So that the rotation will result in this (or counter clockwise works as well)

a b
c d    ->    e c a
e f          f d b

Got some kind of atable here which shows where certain elements move when the matrix is rotated, but cannot get it working in code (those numbers around a&b are the x and y indexes):

  0                               0
0 a              0 1            0 b
1 b     ->     0 b a     ->     1 a
   (0,0)->(1,0)     (0,0)->(0,0)
   (1,0)->(0,0)     (1,0)->(0,1)

I'm currently rotating with these methods (they rotate clockwise):

void Matrix::reverseCols() {
  for (int x = 0; x < cols; x++)
    for (int y = 0, i = cols - 1; y < i; y++, i--)
      std::swap(data[y][x], data[i][x]);
}

void Matrix::transpose() {
  for (int y = 0; y < rows; y++)
    for (int x = y; x < cols; x++)
      std::swap(data[y][x], data[x][y]);
}

Should I keep it like this or should I go with a one-dimensional array and calculate the index when accessing the data by a method? And should I initialize the data array by columns (like I'm doing right now) or rows?

Wouldn't really bother doing this, but while learning C++ I want to build an console window engine and test it with a Tetris clone.

Thanks!


texts: Game Development AI, NPC & Entities Definition using Scripting Languages

texts:
i am developing a Multiplayer(actually MMORPG) architecture for learning purpose.

I do have some game developement background, but all my engines were very rigid and completly developed for the game itself.

That being said, i wanted to experiment so i designed a generic Entity/Component Model Architecture where i would like to extend the game logic, npc, ai, entities and game objects definition(monsters, characters, weapons, items, etc...) using a Scripting language for Code-Reuse and Hot Load/Reload purpose.

My questions are as follow: Considering that i want a scripting language with the best performance possible and that it need to be actually compatible with both .NET/Mono, what are my options? What would you suggest? I know Lua and Javascript are common, but how about performances? What would be my other options? What managed interpreter library would you use?

How would you proceed to implement such scripting language support in an engine? I plan to actually update the server-side simulation about 10 times per second.

Thanks in advance! ;)


texts: Is it okay to release a playable, but not graphical, game to the Android Marketplace?

texts:
I'm working on my first simple game for release. I'm going to have it to a point of being playable, interface complete, but very few if any graphics, and no overall style aside from the basic Android white text on black. Should I go ahead and release this game, with a graphics upgrade to come in the next week or two, or should I just wait until I have the better graphics?

The name doesn't require any graphics to play, it's a simple causal type. The graphics won't matter really for play, but will include things like a logo, screen when you die, enhanced opening screen, etc.


texts: What technical specifications should be set out for music?

texts:
I'm writing the music for a video game. At some point, I'm going to need to work with the programmers to determine the technical specifications for the audio files I'm going to hand over to them. What kinds of details are we going to need to talk about?

For example, a few questions I think we might need to work out are:

What format should the audio files be in?

Uncompressed? Lossless? Compressed?
What's the balance between high-quality audio and small files sizes?

How loud should the music be?

What should be the average volume level of each track?
What should be the loudest volume level?

What should be the frequency distribution?

For example, should I make a point of writing music that doesn't have much bass so that low-pitched foley can be easily heard?

Are the questions I thought of important ones to ask? Are there any other questions we should discuss?


texts: How do I make a character capable of walking on walls?

texts:
I am trying to get a character to move like a spider: Given a rising slope which a ball would normally not be able to roll up, the spider would slowly crawl up.

Similarly, given a mid-air rectangular platform, instead of falling down when reaching the edge, the spider would continue, wrapping over the edge and continue down the side and then underside of the platform (eventually walking around the perimeter of the platform).

I've looked into various Unity 2D components, with little success. :(

Most of my world's collision boundaries are marked by Collider 2D components (which work great with a simple ball affected by gravity, but less so with this spider character).


texts: How do I rotate a sphere so that a position on it comes to a specific location?

texts:
Sorry for my english. I added a picture to explain what i want.
I want rotate Big Sphere to make the black point locate in front of camera. (to the white point's position)
not black point moving, whole sphere moving.

or is it better to move camera to black point?

which API should i use?


texts: How to properly resize canvas according to screen size? (Javascript)

texts:
So, as the question says I need to resize the canvas according to screen size. However the thing is that that's not it. I also need to have the mouse coordinates updated proportionally. Seems like I made a fatal mistake of not considering screen sizes from the start since this is my first proper game. I made the game on basis of my 1080p screen. Things like positioning stuff and checking mouse coordinates are all based on a 1920x1080 canvas. Please help!

Github links:

Main game, will work but size will depend on your screen: https://proqbr.github.io/powerdown/
all the files(only 15MB in case you'd like to see by downloading): https://github.com/proqbr/powerdown
sketch.js (pretty much main file regarding this): https://github.com/proqbr/powerdown/blob/master/sketch.js

Main thing is in sketch.js, On lines 260-263 are some createCanvas lines in function setup(), the uncommented one is createCanvas(1920,1080); as it's what i was working with. And on lines 302-314 are a bunch of camera.zoom lines, uncommented one is camera.zoom = 1; since on my screen there was no required zoom for the main menu.

Line 352 onwards is some code on knowing where the player clicked, the problem is this. I do know how to make the canvas's contents look properly resized on all screens by using windowWidth & windowHeight however it's the incorrect mouse coordinates which causes the problem. It would be great if someone could help.

In case there's some problem with the game on your side, here's a quick second video how the game menu works, although it's pretty straightforward anyways: https://youtu.be/eZZw5CmOXEE


texts: Problem with loading models with different shaders

texts:
I am lerning opengl programming from http: //learnopengl.com .And i can load any model which i want.But if i want to load two models with different shaders,a problem occurs.
For example:
First i draw two models with same shader and there is no problem.

Model1.Draw(shader);
Model2.Draw(shader);

Then if i do this:

Model1.Draw(shader);
Model2.Draw(otherShader);

The first model is not drown.Only the second model is drown.
Here is my Model.h code and Mesh.h code:

Model.h: Model.h

Mesh.h Mesh.h

And if you want, these are my vertex and fragment shaders:

Shaders: http: //pastebin.com/d0v3Y4vU

Thank you for help!


texts: How should I implement basic spaceship physics?

texts:
I am new to 2D game development.

I've made several games, but they've made almost no use of physics. Now I want to try making a game that uses some basic physics to look more realistic.

The game involves spaceships battling in space. I'm ignoring gravity. Each spaceship can move up, down, left, right or any of the 4 diagonals.

I want each spaceship to accelerate when moved (up to some threshold speed) and gradually slow to a stop otherwise.

I'm planning to give each spaceship a velocity and acceleration attribute.

The acceleration is set to some constant value. For example, 5.

When the spaceship starts moving, the velocity is set to some initial value. Then every period of time as long as it should be moving (for example every 30 milliseconds), the acceleration value is added to it.

When the user stops moving the ship, the reverse process happens: the acceleration value is decreased from velocity until velocity equals 0.

I have two questions regarding this:

Is this general type of physics realistic and/or common in games? Is this the right direction? Am I forgetting some factor or anything to be considered?
Regarding the specific implementation I'm planning: Is the right way to accelerate is add a constant value to the speed of the object? Or do I need to gradually increase the value added to the speed, thus increasing the acceleration?


texts: How does the Unity3D entity system work?

texts:
I saw the Java Artemis Entity Component System and thought of the entity system in Unity3D.

In Artemis for example you can only add one component type to each entity and the logic is not in the component.

In Unity3D it's completely different.
Can someone explain me how the entity system in unity 3d works?

I mean, is Unity3D a real entity system, or is it something else?


texts: How can I change the background color of the image?

texts:
I'm trying to change my background image color, but somehow it doesn't work.
I have provided my code below and hope you will be able to tell me how I should do this, and why my code didn't work.
import pygame

class Wooden_Boy:

    def __init__(self, win_game):

        self.screen = win_game.screen
        self.screen_rect = win_game.screen.get_rect()

        self.image = pygame.image.load("alien_invasion/images/wooden_boy.png").convert()
        self.image.set_colorkey((0, 0, 255))
        self.rect = self.image.get_rect()

        self.rect.center = self.screen_rect.center

    def blitme(self):
        self.screen.blit(self.image, self.rect)

This is my second code which is connected with wooden boy:
import sys
import pygame
from wooden_boy import Wooden_Boy

class Window:

    def __init__(self):

        pygame.init()

        self.screen = pygame.display.set_mode((1200, 800))
        pygame.display.set_caption("Pygame Window")

        self.boy = Wooden_Boy(self)

        self.bg_color = (0, 0, 255)

    def run_window(self):
        while True:
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    sys.exit()

            self.screen.fill(self.bg_color)
            self.boy.blitme()

            pygame.display.flip()

if __name__ == "__main__":
    win = Window()
    win.run_window()


texts: How do I create logic that mirrors the visual state of the game without tying the logic to the animation?

texts:
I'm implementing a type of action that depends on the completion of an animation; specifically, a character throwing a grenade should, at the end of the animation, spawn a grenade.  This seems to imply that I should be creating code that reacts to the completion of the animation, code that depends on the framerate: when the last frame is displayed, or immediately after, the processes that spawn a grenade should run.

I've been reading around and it seems that the consensus is that tying physics to the animation is bad practice.  I can code some workarounds that decouples the animation from the logic.  I am thinking that I can add an observer to the mix that pings all interested pieces of code that "the animation finished", or the like, so the animation doesn't know anything about the logic, and vice versa.

I can code workarounds, but they're that, workarounds.  They're code that's trying to detach logic from the event that triggers it, but they're inherently bound together; a grenade should spawn after a character throws it.  If animation and logic are to run separately, how should I implement a grenade spawning system that doesn't take the character animation frames into account?


texts: Xna 4 Model Rotation with inertia not working as expected with variable updates

texts:
I am trying to rotate a model with inertia damping with the keyboard.
The code works great with a fixed time step but it doesn't behave the same with a variable update frequency.

Update method:

protected override void Update(GameTime gameTime)
{
    base.Update(gameTime);

    float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
    const float rotationPerSecond = 0.25f;
    const float decayPerSecond = 0.5f;

    KeyboardState kb = Keyboard.GetState();

    if (kb.IsKeyDown(Keys.Left))
    {
        m_velocity += rotationPerSecond * elapsed;
    }
    else if (kb.IsKeyDown(Keys.Right))
    {
        m_velocity -= rotationPerSecond * elapsed;
    }
    else
    {
        if (Math.Abs(m_velocity) < 0.01f)
        {
            m_velocity = 0;
        }
        else if (m_velocity > 0)
        {
            m_velocity -= decayPerSecond * elapsed;
        }
        else if (m_velocity < 0)
        {
            m_velocity += decayPerSecond * elapsed;
        }
    }

    m_rotationAngle += m_velocity;
}

Draw method:

Matrix rot = Matrix.CreateWorld(new Vector3(0, 0, 0), Vector3.Forward, Vector3.Up) *
                         Matrix.CreateRotationY(MathHelper.ToRadians(m_rotationAngle));

I am changing the time step with

IsFixedTimeStep = true;
graphics.SynchronizeWithVerticalRetrace = true;

and

IsFixedTimeStep = false;
graphics.SynchronizeWithVerticalRetrace = false;

Rotation speed and damping is completely different with different update frequencies.
Any ideas what i am doing wrong?
i have timed the code with a stopwatch, and it does work ok if you fake the keyboard input to be always on (remove the keyboard if()) and just do:

m_velocity += rotationPerSecond * elapsed;

Full Solution can be found here testproject


texts:
Had plans to follow GPU Gems to gain knowledge in Shaders - but my journey came to an abrupt end.

float Wave(x, y, t){
  float w = 2 / _Wavelength;
  float phase = _Speed * w;
  return float(_Amplitude * sin(dot(_Direction.xz, float2(x, y)) * w + t * phase);
}

...
o.vertex.y += Wave(v.vertex.x, v.vertex.z, _Time.y);

Offsetting the vertices was no issue, but then I met partial derivatives to solve the normal for each vertex. Starting at equation 4a to equation 7.

I assumed looking at equation 7 that one didn't have to fully grasp derivatives seeing as the last step

Equation 7:
$$\sum(w_i * D_i \cdot x * A_i * cos(D_i \cdot (x, y) * w_i + t * \varphi_i))$$

So I tried to update the normal (well actually color, but just to visualize) using this function;

float3 normal(float x, float y, float t){
  float w = 2 / _Wavelength;
  float phase = _Speed * w;
  return float3(
    w * dot(_Direction.xz, float2(x, 0)) * _Amplitude * cos(dot(_Direction.xz, float2(x, y)) * w + t * phase),
    1,
    w * dot(_Direction.xz, float2(0, y)) * _Amplitude * cos(dot(_Direction.xz, float2(x, y)) * w + t * phase)
  )
}

...
o.color.xyz = normalize(normal(v.vertex.x, v.vertex.z, _Time.y));

It does however not seem to display what I would describe as good normals for the wave surface. So obviously I'm doing something wrong.

Ignoring the green channel here using the full code pasted below.

Would expect the colors to blend more smoothly and uniformly. Seeing I only got one wave this far.

What I am wondering is how to get the normals one would expect or if this is the expected result following the math (or rather what I could make of it) in GPU Gems.

Note: I am attemping this in Unity, so I did adapt what I assumed to be Z-up to Y-up from the GPU Gem book.

Paste to current code

GPU Gems Chapter 1


texts:
I'm using Farseer physics engine.

I have a simple rectangle body and would like it to split into two pieces given a starting coordinate (where the bullet enters the object) and ending coordinate (where it exits).


texts:
I have a regular 3D polygon and I'd like to display 2D slices of it.

What is the best way to achieve this? (Preferrably in OpenGL, but a general algorithm/tecnique would be good as well).

I've already tried by using a camera with narrow z-near/z-far values, but that doesn't seem like a good solution. I don't know if this could be implemented with a custom shader.

Edit: An example of what I'd like to do:

Kind of the opposite of what is commonly known as 'Volume Rendering'.

Here's an older example: http://answers.unity3d.com/questions/941826/2d-slice-from-a-3d-cross-section-slice.html


texts:
I was wondering if anyone has released or tried to release on Steam and how much time it took Steam to respond to your game submissions, I cant find any info about it on their website and its been over a month now since I have submitted and have yet to even get a confirmation email.

Is this to be expected from sources such as these? Ive sent them two emails so far at 3 weeks apart and have to make a decision on what to do with the game and can not wait much longer.


texts: Godot 3: How to add images without creating scenes?

texts:
To add images, as far as I know you create a sprite in godot, but I don't want to do that, I'd like to do it pro grammatically using arrays, the reason is I'm creating a card game and I don't want to add 52 scenes and then attach 52 sprites.

Isn't there  a smarter way to do it? I haven't found anything. What I'm doing now  is I have a card scene and then I inherit from it the other cards scenes and attach sprites to them and add them to a 2d array but I'd like another way of doing that


texts:
I need the rendered dimensions of a sprite, I'm calling Draw in the class below:
public class Ship
{
    public Ship(Texture2D texture)
    {
        Width = texture.Width;
        Height = texture.Height;

        Texture = texture;
    }

    public int Width { get; set; }

    public int Height { get; set; }

    public float Scale { get; set; }

    public Vector2 Position { get; set; }

    public Texture2D Texture { get; }

    public Rectangle Rectangle => new Rectangle((int)Position.X, (int) Position.Y, Width, Height);

    public void Draw(SpriteBatch batch)
    {
        var origin = new Vector2(Texture.Width / 2, Texture.Height / 2);
        var scale = new Vector2(Scale, Scale);
        var rotation = GetRotationInRadians();

        batch.Draw(Texture, Position, null, Color.White,
            rotation,
            origin,
            scale,
            SpriteEffects.None, 0f);
    }
}

The problem is Width and Height are based off the source (see the constructor) Texture size, so after drawing they are not actual dimensions. Is there away to determine the scaled sprite size?
Side note: I'm using these dimension to detect if an sprite was clicked on by the mouse. Maybe there is a better way to detect clicks?


texts:
I'm looking into designing and implementing an online RPG (or more accurately, redesigning an existing piece of server software).

One of the problems is that of managing visibility. Update data for other players should only be sent to a game client if their player is near the other players (i.e. you shouldn't get health updates for people you can't see on the other side of the map). The main problem is that if you had to compare all the players every time an update is sent, it would just take way too long as the number of players scales (think up to a few thousand players per map and each of them updating up to 3-5 times a second).

If the players are in a 2D space (it's 3D but the z difference shouldn't affect visibility) what is the best way to manage the visibility of other players?

My idea is to have a separate thread that compares the space difference of all the players every few seconds or so and stores references to all nearby players in the player's object for easy access when an update needs to be broadcasted.

The existing system uses grids to organize players, and only uses only players in the current and neighbouring grids to do updates. There are some problems with the system though, as it isn't that efficient (besides knowing which grid they are in, no other caching) and sometimes visibility limits should extend beyond 2 grids of distance.

Is there a better or easier way? If it can be multithreaded that would obviously be better, and the less main-thread calculation the better.

(For anyone wondering, the project is in C++).


texts: Jump height being affected by the duration of how long jump button is pressed

texts:
So I've been trying to implement a controlled jump the way the title proclaims to make the game easier to play and having the ability to make harder challenges in each level. I have noticed how there are already posts regarding this subject so I have read each individual post trying to implement it by myself. I do think I managed to come up with something good but it is not working properly (this script is placed inside the Players Update method):

timer += (float)gameTime.ElapsedGameTime.TotalSeconds;

        if ((InputManager.pad.IsButtonDown(Buttons.A) && InputManager.lastPad.IsButtonUp(Buttons.A) ||
            InputManager.keys.IsKeyDown(Keys.Up) && InputManager.lastKeys.IsKeyUp(Keys.Up)) ||
            (jumpTime < 0 && !isGrounded && !isJumping))
        {
            if (jumpTime < 0)
            {
                speed.Y = -jumpTime * speed.Y;
                jumpTime += timer;
            }

            else if (isGrounded)
            {
                speed.Y = -8.5f;
                jumpTime = 7.0f;
                speed.Y = jumpTime * speed.Y;
                isGrounded = false;
            }
            else if (!isJumping)
            {
                speed.Y = -8.5f;
                jumpTime = -6.0f;
                speed.Y = -jumpTime * speed.Y;
                isJumping = true;
            }

            else if (jumpTime > 0)
            {
                speed.Y = jumpTime * speed.Y;
                jumpTime -= timer;
            }
        }
        else
        {
            jumpTime = 0;
        }

Basically, the problem with it is the player jumps infinitely and never stops once the button is pressed. I would take a guess that the if-statement has some errors, but I could be wrong. Could I get some advice of what I've done wrong here exactly?

I want to mention too that it's going to be a double jump mechanic, where the double jump is also affected by the duration of how long the jump key is pressed.


texts: After onPause is called for the GLSurfaceView the rendering surface is destroyed, along with all the textures, shaders and the like.  On onResume() should the surface not be recreated and GLRenderer onSurfaceCreated called? However that is never called. I am using render when dirty.


texts: Pinch Gesture for Function Other than Zooming- Unity

texts:
I'm working on a game in which I want to pinch outwards on a character, which causes the character to split into 2 smaller copies of itself.
The method I'm thinking about using is to have the "pinch out" gesture destroy the game object and simultaneously create two instances of the smaller game object, and have them follow the fingers that pinch out. The action would also be reversible with the "pinch in" function.
My idea would be to do a raycast to detect the two-finger touch on the object (would I need a collider for that?), then use the beginning and ending touch points to determine if it is pinching out or in.
The problem is I am brand new to Unity and C# and have no idea how to write all of this. All of the tutorials for multi-touch gestures have to do with camera zoom, which is not what I am going for.
Can anyone tell me if I'm on the right track with my logic and provide some guidance on writing the code?


texts: When updating app from Google Play will the app data be deleted?

texts:
My question is pretty simple.

I developed a game, uploaded it on the store. In order to keep player level record and UI prefs it writes an ini file.

When the next update is up on the store and the users will update will they lose their progress? Will the file be deleted?

Thanks


texts: Bullet Physics Step Simulation Crash when maxSubSteps is not 0

texts:
I am using Bullet physics along with Irrlicht. My program consistently crashes when maxSubSteps is not set to zero when calling stepSimulation. I believe it has something to do with the time between the stepSimulation calls because when I stopped Irrlicht from drawing the scene, Bullet worked perfectly fine. Here is my stepSimulation call:

dynamics_world->stepSimulation(frame_delta_time, 0);

The segfault crashing does not occur when the maxSubSteps is zero. I would like to find a better solution to this as I have read that disabling substepping is experimental. Does anyone know how to fix this?

The parameters I am using when calling bullet's stepSimulation() are:

const irr::u32 then = device->getTimer()->getTime();
...
const irr::u32 now = device->getTimer()->getTime();
const irr::f32 frame_delta_time = (irr::f32)(now-then)/1000.f;

The value of frame_delta_time when the program crashes is 0.009.
fixedTimeStep is the default 1/60.

Values other than 0 I have set maxSubSteps to are 1 (the default), 10 and 100.

The gdb stack trace indicates the program is crashing at releasePredivtiveContacts():

Program received signal SIGSEGV, Segmentation fault.

#0  0x000055555557463b in btDiscreteDynamicsWorld::releasePredictiveContacts() ()
#1  0x00005555555746fc in btDiscreteDynamicsWorld::createPredictiveContacts(double) ()
#2  0x0000555555573c8f in btDiscreteDynamicsWorld::internalSingleStepSimulation(double) ()
#3  0x0000555555575335 in btDiscreteDynamicsWorld::stepSimulation(double, int, double) ()

Edit:
The full code is on Github: https://github.com/morgenm/PMC-Game/tree/master/src


texts:
I'm using the KeyboardState state way (if there are any others) of handling key presses for a PC game. It has been working fine for single key presses but now I am trying to handle multiple key presses at once.

I have it grab the newState at the top and then save it to the oldState at the bottom. I've tried it this way:

if (newState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D2) && newState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftAlt))
{
    if (equipment_accessory2 != null)
        UseItem(equipment_accessory2, "Accessory 2");
}

And I've also tried:

Microsoft.Xna.Framework.Input.Keys[] currentPressedKeys = newState.GetPressedKeys();
bool altPressed = false, twoPressed = false;
for (int i = 0; i < currentPressedKeys.Length; i++)
{
    if (currentPressedKeys[i] == Microsoft.Xna.Framework.Input.Keys.LeftAlt)
                altPressed = true;
    else if (currentPressedKeys[i] == Microsoft.Xna.Framework.Input.Keys.D2)
                twoPressed = true;
}

...

if (altPressed)
{
    if (equipment_accessory2 != null && twoPressed)
        UseItem(equipment_accessory2, "Accessory 2");
}

Both ways work to a certain degree. The end result is that you're able to press alt and then a key between 1 and 5 to quick use a consumable. Normally you have skills in those slots so holding down alt makes the skills you have bound disappear and instead shows your quick use items.

The problem I'm having is that no matter what I have tried, the only way it works is that you have to hold 2 then hold alt. If you hold alt first and press/hold 2 it does nothing and doesn't work. I have spent 4 or 5 hours trying to figure out why it only works when you hold down 2 and then press alt. The problem with having it only work this way is if they have a skill bound to 2 then they're going to use the skill so the system is supposed to be to hold down left alt to swap the skill bar to the quick use bar.

I can't figure out why both ways I've tried doing multi key input aren't working when I press alt first.

EDIT: ok it must be something with my keyboard because alt+1 works but 2, 3, 4, and 5 don't work.
EDIT2: restarted and 2-5 work now too, was something with my keyboard apparently.


texts: Games where the story continues via progeny

texts:
In Phantasy Star III: Generations of Doom for the Sega Genesis you periodically marry and then the story carries on through your sons/daughters. In Rogue Legacy when you die you again play on through your decendents (IIRC).

I am working on an RPG and am thinking about a similar concept for a death mechanic. I want dying to cause some of your loot/skills to pass on to your progeny, who can then pick up where you left off (more or less). What are some potential design pitfalls in implementing such a mechanic? One that I already see is that if I make it too punishing, players will revert to last save, not punishing enough and they'll die on purpose.

Bonus points for referencing existing games (other than the two I mentioned).


texts:
I use this code

    public static Ray CalculateRay(Vector2 mouseLocation, Matrix view, Matrix projection, Viewport viewport)
    {
        Vector3 nearPoint = viewport.Unproject(new Vector3(mouseLocation.X,
                mouseLocation.Y, 0.0f),
                projection,
                view,
                Matrix.Identity);

        Vector3 farPoint = viewport.Unproject(new Vector3(mouseLocation.X,
                mouseLocation.Y, 1.0f),
                projection,
                view,
                Matrix.Identity);

        Vector3 direction = farPoint - nearPoint;
        direction.Normalize();

        return new Ray(nearPoint, direction);
    }

to calculate a ray for mouse position x;y.
But the result is everytime again NaN..
If I try it with .99f it works but the collision detection is not exact..
How can I determine whether the cursor hits and model in 3d space?


texts: OcclusionQuery: how to ignore some objects?

texts:
I'm trying to make a LensFlare effect when the player watch the sun in my XNA 4.0 Game.

To do this, I use OcclusionQuery, here's my code:

http://pastebin.com/meAkdwmD

I also have some models, a terrain and a skybox.

Here's my main Draw code:

terrain.Draw();
model1.Draw();
model2.Draw();
skybox.Draw();
lensFlare.UpdateOcclusion();
lensFlare.Draw();

The problem is that the occlusion considers the sun to be behind the skybox, and the lensFlare wasn't showing up.

So I moved lensFlare.UpdateOcclusion() before the drawing of the Skybox, and now the lensFlare appears, but my skybox is blinking (it's like it disappear and reappear at each frames...)

How do I ignore the skybox in the occlusion?


texts: How can I make alternate fragments drop (or make them black) based on a checkerboard texture?

texts:
How can I make alternate fragments drop(or make them black) based on a checkerboard texture in a Unity fragment shader?

I am using forward path rendering in my shader passes for lighting and shadows for every object in the scene.

Now,I need a shader (or something) that drops alternate pixels from the overall screen space after everything is rendered. How can I achieve this effect?


texts:
Solved! I was not applying the transformations in the proper order.

I am working on a simulation that requires me to have several objects moving around in 3D space (text output of their current position on the grid and heading is fine, I do not need graphics), and I am having some trouble getting objects to move along their relative headings.

I have a basic understanding of vectors and matrices. I am using a vector to represent their position, and I am also using Euler Angles. I can translate one of my entities with a matrix along whatever axis, and I can alter their heading.

For example, if I have an entity at  (order is XYZ) 1, 1, 1, with a heading of 0, I can apply a translation matrix to get them to talk to 1, 1, 2 fine. However, if I change their heading to 270, they still walk to 1, 1, 3, instead of 2, 1, 2 as I desire.

I have a feeling that my problem lies in not translating my matrix from world space to object space, but I am not sure how to go about that. How can I do this?

Addition:
I am using 3D vectors to represent their current position and their heading (using the three euler angles).

For now, all I want to do is have an entity walk in a square, reporting their current position at each step. So, assuming it starts at 10, 10, 10 I want it to walk as follows:

10,10,10 -> 10, 10, 15
10, 10, 15 -> 5, 10, 15
5, 10, 15 -> 5, 10, 10
5, 10, 10 -> 10, 10, 10

My 1 Z unit translation matrix is as follows:

[1 0 0 0]
[0 1 0 0]
[0 0 1 1]
[0 0 0 1]

My rotation matrix is as follows:

[0 0 1 0]
[0 1 0 0]
[-1 0 0 0]
[0 0 0 1]


texts:
I like to generate some planets like Kerbal Space Program does. By some videos of the developers I know that they use a quadsphere, which consists of six “entities” as a minimum. These are all plane meshes, which get subdivided the closer you get. This allows a ground to orbit level of detail. However, I have some problems understanding this subdivision algorithm:

Since I have six separate meshes, how do I know where I have to subdivide them, if they are all separate?
If I always just subdivide the quad the camera is over and I end up with something like this:

even though I want something like:

.

So how can I ensure a sense full 2:1 subdivision with neighbour quads?


texts: Multiplayer first person camera gone after restart

texts:
I have a main camera in a multiplayer scene and when a player joins he owns that camera so there is always a single camera.

Now when i click "disconnect" and connect again, there is no camera left in the scene because it gets "destroyed" with the players prefab.

How can i catch the "client disconnect" on client side to clear the cameras parent so that it still remains in the scene?