texts: How to optimize pathfinding on a very large dynamic 2d grid?

texts:
I have a large 2d tilemap, ranging anywhere from hundreds to thousands in size. The map is formed by 8x8 chunks. I am currently using A* but it isn't quite efficient because I may have as many as a hundred objects pathfinding simultaneously. The path doesn't have to be the absolute shortest, but a certain degree of shortness is expected.

I've looked here and saw that HPA* might work for me since my map is broken into smaller chunks. However, because the map is highly dynamic (let's assume that at least two chunks are modified per second) it seems there may be better alternatives.

Also, D*/Lite (mentioned in the link) might work, but how can it be optimized for a chunk based grid?

My question isn't particularly about HPA* or D*, but rather about finding an optimal algorithm for a large and dynamic, chunk-based, tilemap.

EDIT: The chunks contain procedurally generated content. Most of the time this will mean that the chunk is empty except for about 10-20% of its tiles, however sometimes this number can go up to 90% (that is in the case of generated "blobs"). The chunks will contain near-arbitrary data, and two chunks will rarely be the same.

Furthermore, each agent will have an independent path, however because the map is dynamic, it may contain man-made corridors and long passage ways that might result in them being shared often by many agents.

Most goals will be arbitrarily located, however there will be some predefined goals (locations) as well. For those predefined locations, I am considering using a vector field (sort of like a heat map) that can be used to approach it. However, doing this for every goal would be terribly inefficient especially since I would use the generated field only once (or in better cases, maybe a few times).


texts: Should I use Box2D for collision-detection only (not simulating physics)?

texts:
I'm using Box2D only to check collisions and for no physical simulation. I create bodies (and shapes for them) and use my own code to move them, by setting their velocities and positions every frame. I only fetch collision data from the Box2D world.

Is this a good idea? For example, can it cause undefined behaviour from Box2D? Is there a more performance friendly way of dealing with different shape collision detections?

Do better methods exist for this?


texts: Zoom to Mouse on a Globe using a Perspective Projection

texts:
I am trying to create a strategy game that takes place on a globe (i.e. a textured sphere). I would like to be able to zoom to mouse like on google maps. My camera always points towards the center of the globe, and its position is defined in spherical coordinates. I have implemented zoom to mouse using an orthographic projection (technically scaling) which is easier since screen distance corresponds to world distance. I would like to be able to use a perspective projection, but the math seems to be a bit beyond me.

So far I am able to determine what point on screen my mouse is on my globe by ray-casting, however I am not sure how far my camera should be moving in order to keep that point fixed on screen while still having the camera point towards the center of the globe. I know that the basics of zoom to mouse involve translating to the position of the mouse, zooming, and then translating back, however being on a sphere with perspective introduces lots of distortion when translating.

Has anyone had any luck implementing zoom to mouse on a globe using a perspective projection? Or is this an exercise in futility...


texts: In the C++ Visual Studio installer, there is an option Game Development With Unity. However, after selecting that, I didn't find any changes to regular Visual Studio. So I looked it up, and found no results regarding C++. How can I use Unity with Visual Studio for C++?


texts: Google play game services and Facebook integration in one game

texts:
We are creating a cross platform game for iOS and Android. We have thought about how and with which services we should integrate achievements and scoreboards with.

For the iOS part, we are pretty sure that this how we want to do, in order from when the user opens the app for the first time:

Connect with Game Center (Should be automatic, the user shouldn't even notice?) We will also get the players nickname for public scoreboards here.
Ask if the user wants to connect with Facebook so that we can compare the players highscores with their friends.

We could add Google play game services there as well, but I don't feel like that adds anything to the experience for the end user.

Now comes the tricky part: Android

We thought that we could do just like for iOS, except that we replace Game Center with Google Play Game Services. However, unlike Game Center, Game Services will ask the user to log in to their Google+ account and allow us to access their account. So now, what we have is a double login, first with Google+ and then with Facebook. What will users think about that? Should we scrap Play Services entirely and just ask the user for a nickname within our app and user Facebook for achievements?


texts: "SetSelectedGameobject" only highlights button on second try (Unity 2017.3)

texts:
To support the use of a gamepad in the options menu I set SetSelectedGameObject and firstSelectedGameObject (which doesn't seem to do anything) to the button in the upper left, so it's highlighted. This works fine in my pause and option menus (panels that are enabled/disabled) but there's also a third panel that displays the controls as an image. On this screen the first button is set as selected but it doesn't get highlighted until I go back to the pause menu and then open the "controls" screen again.

The Hierarchy:

The ControlsPanel looks like this: click

All 4 buttons are set to "automatic" and they're all accessible to the gamepad but, like I said, the first one ("Keyboard") doesn't light up the very first time I access the panel. It should be like this:

Click on "Controls" in the pause menu
ControlsPanel is enabled
"Keyboard" button is highlighted
Pressing right on the gamepad highlights the next button ("Controller")

What actually happens:

Click on "Controls" in the pause menu
ControlsPanel is enabled
"Keyboard" button is still grey
Pressing right on the gamepad highlights the next button ("Controller")
Press the "Back" button ("ControlsPanel" is disabled and "PausePanel" enabled)
Click on "Controls" again
This time the "Keyboard" button is highlighted

The "ControlsPanel" script:

public Image pic;
public GameObject controllerChoicePanel;
public GameObject firstControls;
private String controls;
private bool windows;

void Start() {
    controls = GetControls();
    windows = GetOS();
    pic.sprite = Resources.Load<Sprite>(controls);

    if(windows) {
        controllerChoicePanel.SetActive(true);
        EventSystem es = EventSystem.current;
        es.firstSelectedGameObject = firstControls;
        es.SetSelectedGameObject(firstControls);
    }
}

Any idea why it would work fine in my pause/options menu but not in the "Controls" one, even though I'm doing the same thing?


texts: What is the signifigance of the Dot Product in World to Local Transformations?

texts:
Looking for help understanding why this World to Local Space function works.

I'm working my way through Buckland's Programming Game AI By Example The following function is used in the book to convert a point from world space to an agent's local coordinate space (its i hat and j hat are AgentHeading and AgentSide respectively)

    inline Vector2D PointToLocalSpace(const Vector2D &point,
                             Vector2D &AgentHeading,
                             Vector2D &AgentSide,
                              Vector2D &AgentPosition)
{

    //make a copy of the point
  Vector2D TransPoint = point;

  //create a transformation matrix
    C2DMatrix matTransform;

  double Tx = -AgentPosition.Dot(AgentHeading);
  double Ty = -AgentPosition.Dot(AgentSide);

  //create the transformation matrix
  matTransform._11(AgentHeading.x); matTransform._12(AgentSide.x);
  matTransform._21(AgentHeading.y); matTransform._22(AgentSide.y);
  matTransform._31(Tx);           matTransform._32(Ty);

  //now transform the vertices
  matTransform.TransformVector2Ds(TransPoint);

  return TransPoint;
}

I've been learning about vectors and matrices for the last three weeks and still I'm having a lot of trouble understanding why this works in terms of vectors and matrices. What is the reason for using a a dot product in the translation coordinates? Why is it the dot product of the agent's position and its heading? What does this dot product correspond to geometrically?

Why not just translate by the Agent's position?

Are there any simpler ways of representing this algorithm?


texts: OpenGL height map accuracy for planetary rendering

texts:
I am trying to implement planetary rendering and I am trying to use OpenGL tessellation to model the terrain. Here is an overview picture using cube faces projected onto a sphere:

If I use the following code for the tessellation evaluation shader, I get a smooth sphere even when rendering a near view.
#version 410 core
layout(quads, equal_spacing, ccw) in;
in mediump vec2 texcoord_tes[];
out mediump vec2 texcoord_geo;
uniform mat4 projection;
uniform mat4 transform;
void main()
{
  vec2 c = mix(texcoord_tes[0], texcoord_tes[1], gl_TessCoord.x);
  vec2 d = mix(texcoord_tes[3], texcoord_tes[2], gl_TessCoord.x);
  texcoord_geo = mix(c, d, gl_TessCoord.y);
  vec4 a = mix(gl_in[0].gl_Position, gl_in[1].gl_Position, gl_TessCoord.x);
  vec4 b = mix(gl_in[3].gl_Position, gl_in[2].gl_Position, gl_TessCoord.x);
  vec4 p = mix(a, b, gl_TessCoord.y);
  float s = 1.0 / sqrt(p.x * p.x + p.y * p.y + p.z * p.z);
  gl_Position = projection * transform * vec4(p.xyz * s * 6388000, 1);
}

Here is a near view using the computed scaling factor (float s = 1.0 / sqrt(p.x ...)):

However if I take the scale factors from a floating-point texture, I can see quantisation artifacts.
The scale factors (or heightmap values) are extracted from the texture using float s = texture(hf, texcoord_geo).r. The code for the tessellation evaluation shader in this case is as follows:
#version 410 core
layout(quads, equal_spacing, ccw) in;
in mediump vec2 texcoord_tes[];
out mediump vec2 texcoord_geo;
uniform sampler2D hf;
uniform mat4 projection;
uniform mat4 transform;
void main()
{
  vec2 c = mix(texcoord_tes[0], texcoord_tes[1], gl_TessCoord.x);
  vec2 d = mix(texcoord_tes[3], texcoord_tes[2], gl_TessCoord.x);
  texcoord_geo = mix(c, d, gl_TessCoord.y);
  float s = texture(hf, texcoord_geo).r;
  vec4 a = mix(gl_in[0].gl_Position, gl_in[1].gl_Position, gl_TessCoord.x);
  vec4 b = mix(gl_in[3].gl_Position, gl_in[2].gl_Position, gl_TessCoord.x);
  vec4 p = mix(a, b, gl_TessCoord.y);
  gl_Position = projection * transform * vec4(p.xyz * s * 6388000, 1);
}

In this case the near view looks like this and shows artifacts:

My question is, what am I doing wrong?
Or is it normal that OpenGL textures are less accurate than 4-byte floating point numbers?
Any help is appreciated.


texts:
I'm trying to animate a player object in my 2D grid when the user clicks somewhere in the screen.

I got the following 4 variables:

oX (Current player position X)
oY (Current player position Y)
dX (Destination X)
dY (Destination Y)

How can I make sure the player moves in a straight line to the new XY coordinates. The way I'm doing it now is really awfull and causes the player to first move along x axis, and finally in y axis.

Can someone give me some guidance with the involved math cause I'm really not sure on how to accomplish this.

Thank you for your time.
Kind regards,
Mark

Update: It's working now but whats the right way to check if the current positions are equal to the target position?

    private static void MovePlayer(double x2, double y2, int duration)
{
    double hX = x2 - m_PlayerPosition.X;
    double hY = y2 - m_PlayerPosition.Y;

    double Length = Math.Sqrt(Math.Pow(hX, 2) + Math.Pow(hY, 2));
    hX = hX / Length;
    hY = hY / Length;

    while (m_PlayerPosition.X != Convert.ToInt32(x2) || m_PlayerPosition.Y != Convert.ToInt32(y2))
    {
        m_PlayerPosition.X += Convert.ToInt32(hX * 1);
        m_PlayerPosition.Y += Convert.ToInt32(hY * 1);

        UpdatePlayerLocation();
    }
}


texts: Artifacts on top of platform sprite only when moving

texts:
I made a floating platform in Unity which has a propeller movement animation. I attached a script I wrote to the game object that adds slight vertical and horizontal movement using the game object transform.position. This is creating some weird artifacts at the top of the sprite, but only when the movement code is active. When I don't move the platform and just leave it still to animate there are no artifacts.

Gameplay:

Sprite Import Settings:

Sprite Renderer:

Camera Settings:

Resolution:


texts: How does the camera/UI know who the player is?

texts:
I'm in a bit of a dilemma regarding how certain engine components — like camera and UI — know who to follow, whose health and other attributes to represent on the screen.

How do you architect a system where does communication between those components and the entities take place? I could have a separate entity that represents the player, but that seems a bit 'hard-coded'. What if I want to pan the camera? What if the player starts controlling another entity?

In other words, how do I abstract away the data sources for components like the camera and UI, such that they don't care what entity they represent?

An event system will do for a lot of cases, but that is more suited for propagating information that changes or is generated 'rarely' (like the death of the player). For something like entity health and position — which need to be known every frame — an event system isn't well suited.


texts:
Which is the most efficient way to animate an HTML  element in vanilla javascript so that it jumps and falls back with acceleration.
Edit:
Im adding source code
index.html

<!doctype html>

    <title>T-rex Runner by Gyan Prakash</title>

Ah, Can you tell me who in this universe can expect to play a web based game with a browser not running javascript?

main.js

var dino = document.getElementById("dino");
var level = document.getElementById("level");
var cac1 = document.getElementById("cacti1");
var cac2 = document.getElementById("cacti2");
var vol = document.getElementById("volcano");
var shield = document.getElementById("shield");
var wings = document.getElementById("wings");
dino.style.position = "absolute";
level.style.position = "absolute";
cac1.style.position = "absolute";
cac2.style.position = "absolute";
vol.style.position = "absolute";
shield.style.position = "absolute";
wings.style.position = "absolute";
level.style.top = "160px";
dino.style.top = "100px";
var pos = 100;
function jump() {
function up() {
if (pos < 50) {
    clearInterval(upt);
    } else {
pos--;
dino.style.top = pos + "px";
}
}
var upt = setInterval(up, 10);
}


texts: Math behind drawing one game object relative to another?

texts:
Let's say I have a square (a) and I want to draw another square (b) that stays on one corner of the square (a).

Square (a) can rotate and move around the game world, what math would be used to keep square (b) on the same relative point on square (a) ?

My current thought process would be:

You give Square b an offset from square a, which would be a distance and an angle.

Then using trigonometry you could update the location of square b to stay in the correct location.


texts: I'd like to know if and how it is possible for me to play a video in my Godot game. Specifically I'd like to know what video file format I need to use and what code I have to write to play that video back fullscreen.


texts:
I've recently starting with Direct X;
I've been using Rasertek's tutorials, and Frank Luna's book. One thing thats just out of this world to me is how much effort it is to initialize DX11: the swap chain and everything.

So...maybe to give myself a little bit of peace, is it mostly always going to be the same? I mean in Rasertek's tutorials it's like 8 different files, while nicely laid out seems to be a bit much; but I guess is it just required? It just seems a little long and hard to understand (the swap chain and everything).....but I guess my questions are:

Why is it so long, unlike OpenGL's initialization to start drawing which is 1/100th the size (it seems like)?
Is it basically going to be the same (Swap Chain, Message Handlers, etc) for all DX APIs (I'm working with DX11)?


texts: How to connect multiple Godot 3.1 clients to a websockets server?

texts:
I'm trying to connect multiple players ( godot clients) to 1 nodejs server and it's  the second client would not connect. The first client connects, not the second.

All the relevant tutorials and projects that I found are written for Godot 3.0, therefore they are useless in 3.1 since 3.0 did not have support for websockets.

Any minimal multiplayer web sockets tutorial / code snippet or project, written for godot 3.1? Could you share minimal code?

Something like this won't work

extends Node

var ws = null

func _ready():
    ws = WebSocketClient.new()
    ws.connect("connection_established", self, "_connection_established")
    ws.connect("connection_closed", self, "_connection_closed")
    ws.connect("connection_error", self, "_connection_error")

    var url = "ws://localhost:8080"
    print("Connecting to " + url)
    ws.connect_to_url(url)

func _connection_established(protocol):
    print("Connection established with protocol: ", protocol)

func _connection_closed():
    print("Connection closed")

func _connection_error():
    print("Connection error")

func _process(delta):
    if ws.get_connection_status() == ws.CONNECTION_CONNECTING || ws.get_connection_status() == ws.CONNECTION_CONNECTED:
        ws.poll()
    if ws.get_peer(1).is_connected_to_host():
        ws.get_peer(1).put_var("HI")
        if ws.get_peer(1).get_available_packet_count() > 0 :
            var test = ws.get_peer(1).get_var()
            print('recieve %s' % test)


texts: Adventure Games - When and how to start mapping?

texts:
I've created a playable oblique-styled adventure game in HTML5, using Tiled for tilemapping. I have a storyline set up, and am ready to make my final draft map.

The game world will be loosely based on areas of East Asia.

The issue is, my game is more dependent on player interacting with NPCs than on locations. How do you go about designing a map? Should I throw down the loose representation of a city, and then fit my game into it?

I guess I'm not sure how you'd go about creating a meaningful map for an adventure game or of any special considerations.

While I'm looking for an objective answer, opinions can help a lot too.


texts: Lunar Lander calculating gravity, acceleration and collision in GameMaker

texts:
I've already asked this on the GameMaker forums but had no response so far.

I'm making a little Lunar Lander game as my first foray in to GameMaker, I'm wanting to have the ship land and take off again too.  I'm new to scripting and programming in general and I'm having trouble with acceleration, in particular with gravity.

Basically I need to:

Be constantly pulled downwards to simulate gravity up to a maximum speed (terminal velocity)
Activate thrusters to accelerate my ship towards its current direction
Turn the ship left and right, therefore adjusting my current direction
Land on surfaces (I've been accomplishing the collision by setting my gravity to 0) and then take off again (thereby activating gravity again)

The problem:

I can't figure out a natural, correct way to accelerate the ship with gravity up to its terminal velocity
I also can't figure out how to add the ship's thrust to gravity (i.e. if I'm facing downwards and firing the thrusters I should be going faster than if I wasn't firing the thrusters). As gravity is only pulling me down in the y direction and the thrust of the ship could be a force pushing me in any direction (according to my ship's angle) this is tricky (for me...).
The whole thing doesn't feel like particularly smooth motion

An example of my code is as follows:

direction = image_angle

fallSpeed += grav

if fallSpeed > 2
{
fallSpeed = 2
}

y += fallSpeed

motion_add(direction,shipThrust)

if keyboard_check(ord('W')) and speed < maxSpeed
{
   shipThrust += 2/room_speed
}
else
{
    shipThrust -= 2/room_speed
}

if shipThrust > 20/room_speed
{
shipThrust = 20/room_speed
}

if shipThrust < 0
{
shipThrust = 0
}

if place_meeting(x,y,oGround)
{
    fallSpeed = 0
    grav = 0
}
else
{
    grav = 0.2
}

if keyboard_check(ord('A'))
{
    image_angle += 3
}

if keyboard_check(ord('D'))
{
    image_angle -= 3
}

speed = max(speed -0.1,0)

Some of that code is probably (read: clearly...) wrong and I figure I need an overall 'speed' value of the ship that I then affect with my two forces (gravity and thrust) but I can't for the life of me figure out how to do it.  Any help is appreciated, thanks! :)


texts: Game Design Patterns ( think GOF ) literature?

texts:
Possible Duplicate:
  What are some programming design patterns that are useful in game development?

Is there any literature on game design patterns? I'm taking a software design class and would like to learn how some of these design patterns would apply to game development.


texts: Physics or Time-Based Animation In Corona SDK (iOS) Using Box2D

texts:
I am part way through creating a Doodle Jump clone for iOS using Corona SDK. I'm currently using the physics engine (box 2D). It's not a straight clone, but I need the basic principles in place to progress to the next stage of development.

I have encountered a problem that is prohibiting me to carry on, and I'm wondering whether it's worth re-writing the game using time based animations rather than the physics engine, as it could give me more flexibility.

The problem I'm faced with involves moving the platforms down and the character's height. If you play Doodle Jump and watch how the character behaves you'll see that he doesn't EVER go any higher than a certain point, no matter what height the platform he came off was. The higher he appears to jump is actually the platforms moving down faster. The character also jumps for the same duration every time. If you look at his position on the screen, he may only move up by a few pixels, but he'll appear to be jumping for a lot longer, the same length of time for each jump.

I cannot grasp how this could have been achieved using the physics engine. I am currently moving the platforms down at the same speed as the character moves up - but this doesn't stop him gaining height, and doesn't mean his height on the screen is fixed.

I have an idea how to do it in the physics engine, but it seems VERY complicated for something so simple. It would involve working out a calculation for his current height and then manipulate the gravity and his density so that he always jumps the same height for the same length of time. This would be a trial and error scenario, and to be honest, it's clutching at straws.

My question is, has anyone achieved this behaviour already, know how it has been achieved, or can shed any light on it? Would I be better with the physics engine, or with time-based animation (using timers to manually track the ball's position and use easing libraries to mimic basic physics)?

Here is a link to a YouTube gameplay video of Doodle Jump, hopefully you'll see what I mean - it's a difficult concept to describe in text.
http://www.youtube.com/watch?v=kIqG2ICUS-c


texts: Help understanding HLSL - newbie questions

texts:
Just starting out with HLSL, please bare with me :)

There are times I'm a little confused by the syntax for instance in the pixel shader of an example I am following we have the following input and output:

struct VertexShaderOutput
{
    float4 Position : POSITION0;
    float2 Depth : TEXCOORD0;
    float3 Normal : TEXCOORD1;
};

struct PixelShaderOutput
{
    float4 Normal : COLOR0;
    float4 Depth : COLOR1;
};

PixelShaderOutput PixelShaderFunction(VertexShaderOutput input)
{
    PixelShaderOutput output;

    // Depth is stored as distance from camera / far plane distance
    // to get value between 0 and 1
    output.Depth = input.Depth.x / input.Depth.y;

    // Normal map simply stores X, Y and Z components of normal
    // shifted from (-1 to 1) range to (0 to 1) range
    output.Normal.xyz = (normalize(input.Normal).xyz / 2) + .5;

    // Other components must be initialized to compile
    output.Depth.a = 1;
    output.Normal.a = 1;
    return output;
}

Now one of the parts that confuses me is

output.Depth = input.Depth.x / input.Depth.y;

I'm confused because I thought Depth is a float4, which to my understanding is a 4-component vector. Doesn't input.Depth.x / input.Depth.y return a scalar value? What is happening in this assignment?

Secondly, and similarly

output.Normal.xyz = (normalize(input.Normal).xyz / 2) + .5;

Wouldn't normalize(input.Normal).xyz / 2 return a 3-component vector, with each element divided by 2? What does it mean then to add that 3-component vector to a scalar .5?

I feel like I'm missing something obvious here that I'll probably slap my forehead when someone points it out.

Also one more question - by the time the float4 Position arrives at the pixel shader from the vertex shader output, at this point are the coordinates in clip-space [-1,1] or are they still in camera-coordinates but with the homogeneous w-component (eg before the perspective divide) ? Is the w-component usually equal to the z-component?


texts: TextMeshPro Shader choices difference (when to use)

texts:
Actually I can see the visual difference that

bitmap/sprite shows blurry text like this:

pink distance field seems like missing texture:

distance field surface grey:

and lastly distance field masking/overlay seems to show the correct/expected result:

so what's the difference between those two? (masking/overlay)


texts: Generating and rendering not point-like particles on GPU

texts:
Specifically I'm talking about particles as seen (for example) in the UE4 dev video here. They're not just points and seem to have a nice shape to them that seems to follow their movement.

Is it possible to create these kinds of particles (efficiently) completely on the GPU (perhaps through something like motion? Or is the only (or most efficient) way to just create a small particle texture and render small quads for each particle?


texts:
I am planning to make a 2d tile based platformer with big world like in terraria.

I have some questions to ask on how to manage this big world in Unity3D.

The Scenario

World Size = 1000 x 1000  = 1 Million Tiles

Tiles Viewable in Camera = 32 x 24

Chunk Size = 32 x 24

There will 9 Chunks present in the scene at  one time ( Center,Left,Right,Top,Bottom and 4 diagonal), total tiles present at one time 6912

Questions

Every tile is a gameObect with a box collider on it, a script containing the tile information(health,type), wouldn't this take a lot of memory and processing because there are 6912 tiles present in the scene all the time?

If I generate a mesh of chunk, how will the collision be handled(Considering every tile is destructible)? Will I have to redraw the mesh even if a single tile is destroyed? Won't this be less optimized as compared to the tile based approach?

I'd really like to if anyone here has done this in unity and will be really thankful if you share your approach of handling big world. Thanks!


texts: What is the standard way of delivering HTML5 games to portals and such?

texts:
Let me explain what I mean by "standard way of delivering"...

Think about Flash games sites. Flash games can be delivered as a single file, either hosted by the site, or, I guess, provided by someone else.

HTML5 games, on the other hand, don't have something so standard. Usually, they have their own page, and portals just link to that page. I think that it greatly hinders the purpose of that portal, because, well, you want people to stay on your site and look for other games.

Now, I think that a some kind of iframe way of delivering games would help solve this problem greatly. I saw some games doing that, and they were often included on tutorial sites to show a live example, which is obviously a great thing.

So, is there a standard at all? Any suggestions? Can you create a game that just preloads itself in an iframe (I heard something about a "single document" or something)?


texts: How to make it clear that a game is in Beta?

texts:
I develop games on ROBLOX which is a site full of user-generated games that are typically free for other users to enjoy. Many users have studios in which they have a consistent set of playtesters, but I am the only developer in the case of my project. Nonetheless, I still have the need to test my game at times, so I recruit random people from the forums of the site (specifically the site's "Scripters forum"). While recruiting from the forums is a reliable and quick way to get players, it may be hard for them to get over the fact that the game is meant to be unfinished.

ROBLOX has a like and dislike system, and during testing I have already received three likes and one dislike. The dislike concerns me because I feel that someone probably evaluated my game on the notion of "This game should be working for me, but it's not." when those problems are the purpose of why I recruit people to go to the game in the first place. Many users even absurdly evaluated the game on its artistic value  which I believe to be an afterthought in the game development process versus functionality which should be at its core.

For the future, how do I make it clear that the current game should be evaluated for its functionality, and that in the beta phase, it may or may not work for all users?

Side note: I do some preliminary testing before I recruit testers to the game, so it works at the very least on my device, but their own experience varies based upon their quality of connection and device.


texts: Splitting a large number of FLAs into multiple gifs

texts:
I currently have a large number (300 or so) FLAs that I wish to convert to GIFs for a HTML5 game I'm creating.

Each one of these FLAs contains multiple animations in the timeline, and they all have the same basic structure (Animation one in frames 1-25, animation 2 in frames 26-34, etc.)

Is there a way I could automate splitting them up and converting them into the GIFs?

I am on a Mac, but do have access to a Windows machine, so any solution will work, basically. I don't have the Windows version of Flash though, so that is annoying.

Thanks in advance, and if this the wrong StackExchange to ask in, then I apologise in advance.


texts: What version of Java should I target for applets?

texts:
I recently deployed an applet that seems to require Java 6 Update 24. I assume the reason for this requirement is the matching JDK version I used to create the applet (I am new to Java).

The fact that my applet requires a Java download/update for users who already have some version of Java installed is a big concern for me; the applets I'm creating slip into a web comic, so it's very disruptive. Having used the most recent version of Java, it seems as though I am able to assume that most of the readers I get will have to update Java to continue reading/playing.

Is there a best practice concerning which version of Java to use to make the process of using an applet easy for end-users? Any reading material on this would be very helpful. Should I be using an older version of Java if I don't require new features? I am using Slick for 2D games.


texts: Collider inside another collider: Move the brain via mouse while being able the click the spheres

texts:
The spheres have a sphere collider on them and are clickable via this script:Clickable.cs
public class Clickable : MonoBehaviour
{

    void Update()
    {
         ClickDetect();
    }

    void ClickDetect()
    {

        RaycastHit hit;
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit))
        {
            Transform t = hit.collider.transform;

            if (t.name == "Sphere(Clone)")
            {
                if (Input.GetMouseButtonDown(0))
                {
                        hit.collider.gameObject.GetComponent<Light>().color = new Color(1, 0, 0, 0.7f);

                    Debug.Log(t.parent.name + (t.GetSiblingIndex() + 1));
                }
            }
        }
    }
}

and the brain has a box collider on it and is moved by this script RotateonMouse
void Rotation()
{
    if (_isRotating)
    {
        // offset
        _mouseOffset = (Input.mousePosition - _mouseReference);

        // apply rotation
        _rotation.y = -(_mouseOffset.x) * _sensitivity;
        _rotation.x = -(_mouseOffset.y) * _sensitivity;

        // rotate
        transform.eulerAngles += _rotation;

        // store mouse
        _mouseReference = Input.mousePosition;
    }
}

The issue arises when I try to click on the spheres when the box collider on the brain is on.
I end up rotating the brain instead of being able to click the spheres.
Is there a way to be able to click inside the collider while also on the collider to rotate the brain?


texts:
I'm trying to fill a list with objects by using OverlapSphere.
Any Object with tag "enemy" goes in OverlapSphere radius put it in the list. This object goes out remove it from the list.

public GameObject[] listEnemy;

void Update()
{
 Collider[] hitColliders = Physics.OverlapSphere(gameObject.transform.position, 2);
    foreach (Collider hitCol in hitColliders)
    {
        if (hitCol.CompareTag("enemy"))
        {

            //// evey object with tag "enemy" put in the listEnemy.

        }
    }
}


texts:
I took a semester-long course in java but I'm still a beginner in Object-Oriented programming paradigm. Suppose that I want to create a simple game where the player can go to different locations. Each location has its own unique treasure (that has other attributes) and has its own set of different animals. The question: How can I design classes that are not too naive based on the game? (can be too broad) Is my approach below correct or can it be improved? (narrowed)

I was thinking that I should create a Location, treasure, and Animal classes; Each classes declared in its own file.

public class Location {
    // attributes such as treasure and animals
    private ArrayList<Animal> animals;
    private Treasure treasure;
    public Location(String name) {
        // initialization of attributes
        if(name.equals("Jungle")) {
            treasure = new Treasure("Rare Vine");
            animals.add(new Animal("Monkey", 90, 50);
            animals.add(new Animal("Snake", 100, 60);
        }
        else if(name.equals("Valley")){
            // and so on
        }
        // and so forth
    }
}
public class Treasure {
    // attributes such as name and value
    public Treasure(String name, int value) {
        // initialization of attributes
        this.name = name;
        this.value = value;
    }
}
public class Animal {
    // attributes such as name
    public Animal(String name, int encounterRate, int captureRate) {
        // initialization of attributes
        this.name = name;
        this.encounterRate = encounterRate;
        this.captureRate = captureRate;
    }
}

But I doubt that the use of conditional statements in Location class to initialize its attributes makes the method have so many lines and may confuse the developer after some time. what if there are so many attributes per location and there are many locations?

Another approach that I can think of is to create subclasses of Location and put the corresponding values for the location's attributes. For me, I can understand the structure of the game and efficient if the number of location subclasses is small.

I'm new in creating java games so I don't have a solid view in designing game classes. this problem may be broad so I narrowed it down to my code above.


texts: How should I model rotation caused by bounce friction?

texts:
In my Java2D simulation, I have a disc which, when it bounces off the boundary of a 2D region, begins to rotate, as if it had gotten some spin from the wall.

I'm having trouble relating the collision vectors and the angular velocity of the spin that should result.

How should I approach this?


texts: How to handle collision resolution in a top-down car game?

texts:
I have a top-down car game which takes place in an arena. The game is very very light on physics, so I'm not actually using a physics engine. The cars' movement is mostly managed by a struct I called Velocity, which stores a movement vector, an angle and speed. The speed will be mostly at the car's top speed, but there's acceleration involved to make reversing and going forwards again a bit smoother; the angle is increased or decreased depending on player input for turning; and then, the movement vector is updated with the new speed and angle values.

For collision detection, I've opted for SAT and as far as detection goes, it's working well. When it comes to resolution, however, I'm a bit at a loss. Out of the SAT implementation, I can get the MTV, but I feel it doesn't quite work with cars. I was thinking something in terms of maybe using the overlap value of the MTV (to acknowledge how strong was the hit) and the cars' movement vectors to define what's gonna happen to them, but I'm not coming up with anything.

(For completeness' sake, I'm using C++, Marmalade and IwGame, but I think the solution to this problem would be pretty much platform independent.)

Any ideas? Thanks!


texts: Unity 2D launch player towards mouse location

texts:
few notes:

I'm new to game development
I'm not new to developing (1 year of front end web development)

I'm trying to get my character to launch towards mouse left click button (which I understood to be translated into screen onclick once its exported to mobile)
I've got the following code down (used the web for help)

move speed is a float that's equal to 10 in this example

if (Input.GetMouseButton (0)) {
        mousePosition = Camera.main.ScreenToWorldPoint (Input.mousePosition);
        direction = (mousePosition - transform.position).normalized;
        rb.velocity = new Vector2 (direction.x * moveSpeed, direction.y * moveSpeed);
    }

Which works great, but has 2 issues:
If I keep holding leftMouseButton my character is pinned to the cursor
I want a single, gravity affected, launch (jump of sort) towards my mouse button.

This is all under the Update() function.


texts: Filling up the empty blocks when the player touches the safe zone again! using cocos2d

texts:
Hi guys i am stuck with filling up the data of all the blocks which are empty like the ones in the image.
 As you can see there i have a pacman like object where i will be moving around.

But when you are in the empty space where there are no Blue boxes available i should be able to add new blocks in the path of my pacman and when it touches  any other blue boxes like in the below case if my pacman touches the top row of the blue box i should be able to fill all the empty boxed inside the border of the path created by pacman.

For now i am using a 2d bool array to store all the filled boxed info like if there is a box inside i am making that cell in an array as true.

But how to fill the area with blue boxes after player finishes his path ?

Any help would be great thank you.

More info about this problem is here:
filling the empty spaces in a certain region in a grid using c++   Same problem


texts: Drawing 2D Grid in 3D View - Need help with method

texts:
I'm trying to draw a simple 2D grid for an editor, to able to navigate more clearly around the 3D space, but I can't render it:

Grid2D class, creates a grid of a certain size at a location and should just draw lines.

public class Grid2D : IShape
{

    private VertexPositionColor[] _vertices;

    private Vector2 _size;
    private Vector3 _location;

    private int _faces;

    public Grid2D(Vector2 size, Vector3 location, Color color)
    {
        float x = 0, y = 0;

        if (size.X < 1f)
        {
            size.X = 1f;
        }

        if (size.Y < 1f)
        {
            size.Y = 1f;
        }

        _size = size;
        _location = location;

        List<VertexPositionColor> vertices = new List<VertexPositionColor>();
        _faces = 0;

        for (y = -size.Y; y <= size.Y; y++)
        {
            vertices.Add(new VertexPositionColor(location + new Vector3(-size.X, y, 0), color));
            vertices.Add(new VertexPositionColor(location + new Vector3(size.X, y, 0), color));

            _faces++;
        }

        for (x = -size.X; x <= size.X; x++)
        {
            vertices.Add(new VertexPositionColor(location + new Vector3(x, -size.Y, 0), color));
            vertices.Add(new VertexPositionColor(location + new Vector3(x, size.Y, 0), color));

            _faces++;
        }

        _vertices = vertices.ToArray();
    }

    public void Render(GraphicsDevice device)
    {
        device.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineList, _vertices, 0, _faces);
    }

}

Like this:

+----+----+----+----+
|    |    |    |    |
+----+----+----+----+
|    |    |    |    |
+----+----+----+----+
|    |    |    |    |
+----+----+----+----+
|    |    |    |    |
+----+----+----+----+

Anyone knows what I'm doing wrong? If I add a Shape without texture, it's set automatically to VertexColorEnabled and TextureEnabled = false.

This is how I render it:

        foreach (RenderObject render in _renderObjects)
        {
            render.Effect.Projection = projection;
            render.Effect.View = view;
            render.Effect.World = world;

            foreach (EffectPass pass in render.Effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                try
                {
                    // Could be a Grid2D
                    render.Shape.Render(_device);
                }
                catch
                {
                    throw;
                }
            }
        }

Exception is thrown:

The current vertex shader declaration does not include all the elements required by the current Vertex Shader. Normal0 is missing.

Simply put, I can't figure out how to draw a few lines. I want to draw them one at a time and I guess that's the problem I haven't figured out, and even when I tried rendering vertices[i], vertices[i+1] and primitiveCount = 1, vertices = 2, and so on it didn't work either.

Any suggestions?


texts:
I created an enemy class for my game. It works well, except for one dilemma. When I spawn more than one enemy, eventually they begin to "overlap" and look like one enemy. I was wondering if anyone had any ideas on how to create more differences and spontaneity between the enemies. All help would be greatly appreciated.

Here is the class:

using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace Defender
{
public class Enemy
{

    Vector2 Location;
    public static Texture2D texture;

    float rotation;
    Rectangle rectangle;
    int shootTimer = 50;

    public void Draw(SpriteBatch spriteBatch)
    {
        rectangle = new Rectangle((int)Location.X, (int)Location.Y, 32, 32);
        spriteBatch.Draw(texture, Location, null, Color.White, rotation, new Vector2(16, 16), 1, SpriteEffects.None, 0);

    }

    public void Update(GameTime gameTime)
    {
        Rotate();
        Shoot();
        Move(gameTime);

    }

    public void Move(GameTime gameTime)
    {
        if (Vector2.Distance(Location, Game.player.Location) > 75)
        {

                Location.X += findDirection(Game.player.Location).X * (float)(gameTime.ElapsedGameTime.TotalMilliseconds / 20);
                Location.Y += findDirection(Game.player.Location).Y * (float)(gameTime.ElapsedGameTime.TotalMilliseconds / 20);

        }

    }

    private void Rotate()
    {

            float XDistance = Location.X - Game.player.Location.X;
            float YDistance = Location.Y - Game.player.Location.Y;

            rotation = (float)Math.Atan2(YDistance, XDistance);

    }

    private Vector2 findDirection(Vector2 target)
    {

            Vector2 direction = target - Location;
            direction.Normalize();
            return direction;

    }

    public void Shoot()
    {
        if (shootTimer > 0)
        {
            shootTimer--;
        }
        if (shootTimer == 0)
        {

            //find slope

            //create bullet
            Bullet bullet = new Bullet(Location, findDirection(new Vector2(Game.player.Location.X, Game.player.Location.Y)));
            Game.bulletList.Add(bullet);

            //reset timer
            shootTimer = 50;

        }

    }

    public Enemy(Vector2 loc)
    {

        Location = loc;
    }

}

}


texts: Scripting and Cinematics without Threading

texts:
I've been struggling with how to implement scripting in my game engine. I only have a few requirements: It should be intuitive, I don't want to write a custom language, parser and interpreter, and I don't want to use threading. (I'm certain there's a simpler solution; I don't need the hassle of multiple game logic threads.) Here's an example script, in Python (aka pseudocode):

def dramatic_scene(actors):
    alice = actors["alice"]
    bob = actors["bob"]

    alice.walk_to(bob)
    if bob.can_see(alice):
        bob.say("Hello again!")
    else:
        alice.say("Excuse me, Bob?")

That epic piece of storytelling poses implementation problems. I can't just evaluate the whole method at once, because walk_to takes game time. If it returns right away, Alice would start walking up to Bob, and (in the same frame) say hello (or be greeted). But if walk_to is a blocking call that returns when she reaches Bob, then my game gets stuck, because it's blocking the same thread of execution that would make Alice walk.

I considered making each function enqueue an action -- alice.walk_to(bob) would push an object onto a queue, which would get popped off after Alice reached Bob, wherever he was. That's more subtly broken: the if branch is evaluated immediately, so Bob might greet Alice even if his back is turned to her.

How do other engines/people handle scripting without making threads? I'm starting to look in non-game-dev areas, like jQuery animation chains, for ideas. It seems like there should be some good patterns for this sort of problem.


texts:
Problem Description

Basically, I've made a "programming game" in which I've made my own scripting language. It is a completely standard Lunar Lander game, though instead of directly controlling the lander using keyboard input, it instead fires a sequence of commands you have provided through the scripting language I made. This all works, and I've hit a critical problem.

So essentially, using the scripting language, you specify something like After 5 seconds, activate thrust for 10 seconds, and then after 2 seconds, rotate the lander for 4 seconds. The goal is then to chain together a sequence of commands which will get you to land the lander safely.

Of course, this comes with one problem. If you repeat the sequence of commands, each command will have to be fired at exactly the same spot in the level, that is, after x amount of seconds, but also with the lander being in the exact same spot. If you did not use timer-based movement, sure you could indicate that a command should activate after 5 seconds, but the lander moving at 60 FPS would have moved way further than a lander moving at 30 FPS.

Why of course, I thought I would simple just make the lander use timer-based movement so it is independent of FPS (I am using the very standard approach of taking the amount of time passed last frame, and multiplying it to a constant move speed). Then I would count seconds using the system clock. So the after x amount of seconds, the lander would be in the same spot in the level when the command activates.

Unfortunately, this approach do not work. Every time I run a sequence of commands, they will be activated with, sometimes very slight, variations, making it impossible to actually get a consistent and reliable path for the lander.

My Question

So my question is, am I tackling this problem a completely wrong way? What exactly do you do when it is absolutely critical that timed events defined by the user will activate at exactly the same time and spot in a level? I seem to be quite stuck with this question.


texts: Confused About My Code Suggesting The Normal Matrix Is Equivalent To The ModelView Matrix

texts:
I'm learning environment mapping in OpenGL by following this page.

In his vertex shader, the author calculates the vertex normal in eye space with the following code:

nEye = vec3(viewMatrix * modelMatrix * vec4(vertexNormal, 0.0));

This works, but I've fooled around and made modifications to the shader code, so that it calculates the vertex normal with this code:

nEye = vec3(normalMatrix * vec4(vertexNormal, 0.0));

Where normalMatrix is a uniform 4x4 matrix I calculated outside the shader:

objectNormalMatrix = viewMatrix * modelMatrix;
objectNormalMatrix.invert();
objectNormalMatrix.transpose();

(I read from this question that the above is how you are supposed to calculate the normal matrix).

For either method of calculating the vertex normal I use, I get the same (working) graphical result, and this is what is confusing me.

My question is, why is(viewMatrix * modelMatrix) apparently equivalent normalMatrix? In calculating the normal matrix, I invert and transpose, but I do none of that when just multiplying by (viewMatrix * modelMatrix).

Here is some extra info that might be relevant:

The matrix library I use in my application is column major order (same as OpenGL).
When I pass my matrices to GLSL with glUniformMatrix, I have transpose as false.
The view matrix and model matrix in GLSL are uniforms from the application, and they are the exact same view matrix and model matrix matrices I use in my calculation of the normal matrix.


texts: Storing Highscores using PlayerPrefs in Unity

texts:
int highscore = 0;
void Update()
{
    storepoints();
    print(PlayerPrefs.GetInt("highscore", highscore));
}
void storepoints()
{
    if (points>highscore)
    {
        highscore = points;
        PlayerPrefs.SetInt("highscore", highscore);
        PlayerPrefs.Save();
    }

}

Using the following code:

it works first time. But not the second time

so, for e.g, when I play the first time, suppose my score is 2, my high score becomes 2. However when I play the second time, and my score is 1. My high score becomes 1. This shouldn't happen.


texts:
Before Unity Hub, it used to be the case that if you opened up a project that was from an older version, you would be prompted to upgrade the project.

I am now on the latest Unity Hub 2.0.0 and I am trying to open a project that was last saved with 2018.2.1f1 but I am unable to.
From installs, I am able to download and install the closest available version, 2018.2.21f1, but anytime I try to open my project I get the message

  Missing editor version 2018.2.1f1 on this machine. Select another version from the list or install the missing one.

How can I upgrade this project like we did in older versions?


texts:
I'm developing a puzzle with a ball with cracks on it. Inside the ball there's a point light. Its light rays come out of the cracks and hit some platforms (walls/ceiling/floor).

To solve the puzzle the player must rotate the ball to match the light coming out of the cracks with some pre-lit pattern on the platforms.

I don't know how to do the pre-lit pattern. I don't want it to be manually done using a texture editing tool like Photoshop or GIMP. I remembered this could probably be done using light baking. I think what I need is to bake the light from only that point light into a lightmap and use it only on those platforms, but don't know how to do that.

Can someone help me with a solution?


texts: How to add a collision function to a game

texts:
Ive tried a few things but i cant get a working function  if player collides with object set speed to 0( stop moving)

ive tried to use the function under  "game over " and change the things to make speedx=0 and speedy=0 but i couldnt format it correctly.

https://www.w3schools.com/graphics/game_obstacles.asp

my  code:

<meta name="viewport" content="width=device-width, initial-scale=1.0"/>

use the arrow keys on you keyboard to move the red square.

https://jsfiddle.net/tmanrocks999/e6w9br2s/178/

I expect when the player hits the obstacle for them to stop moving. but at the moment they go through it/ i have 1 && that prevents it from going past the x location of obstacle but that doesn't work right


texts: AudioSource.Play() outputs only noise from the sound clip

texts:
I'm trying to reproduce a sound clip on the AudioSource of a game object by using the .Play method. What i'm trying to do is a card game of sorts, but with each card being a different section of a song of a genre. I combine different cards with different genres and when i press play, the combination should start playing, but now when the play button is pressed, only noise comes out. The code for the start method looks like this:

public class AudioStart : MonoBehaviour
{
    AudioSource thisAudioSource;

    // Start is called before the first frame update
    void Start()
    {
        thisAudioSource = this.GetComponent<AudioSource>();
    }

    // Update is called once per frame
    void Update()
    {
        if (playButton.playPressed) {
            thisAudioSource.Play();
        }
        else {
            thisAudioSource.Stop();
        }

    }
}

The way i'm doing it is by having a button that on click changes a bool to true or false depending if there is sound playing (the truth check on the if statement). The AudioSource outputs to an AudioMixer on a specific group under the master group (which group depends on the slot that the card is dropped in). The AudioStart script is attached to different game objects with a different audio clip each. I've also noticed that when i try to reproduce two cards, only one AudioSource gets played. Any help would be appreciated. Thanks!


texts: Find optimal placement for label/sticker on a simple polygon with holes

texts:
I'm working on a real-time archviz renderer and I need to place a label/sticker/decal on walls, which have openings. So one way to think about this is a simple (possibly concave) polygon with holes. So there are two things I need: optimal position, maximum fitting size.

After some research I came to conclusion that I need a solution for maximum inscribed circle in a simple polygon. That will provide both the position and radius.

https://www.sthu.org/blog/14-skeleton-offset-topology/index.html

And couple of other questions, most answered by Stefan Huber, apparently The Authority nowadays regarding this problem. I'm time constrained and looking for plugin solution. So it's either commercial solutions (*Vroni) or CGAL that can at least help me construct straight skeleton. However my environment is JVM, not C++ (yes, I can go the FFI way using JNA).

Can you think of any other solution that I could use to position/scale the labels?


texts: Unity Remote 4 on Galaxy S5 won't connect to Unity 5

texts:
I'm having some trouble connecting Unity Remote 4 to Unity 5. I'm using a Samsung Galaxy S5. I've searched a bit and the other solutions with other phones aren't working for me.

What I've tried so far:

I installed the Android SDK by using Android Studio. I'm not sure if that's part of the problem but either way. I installed the Google USB Driver, the 5.0 (API 21) and 5.1 (API 22) SDKs. My phone is running on Android 5.0. All the SDK tools (Platform tools and build tools) are installed. I set USB Debugging, Stay Awake and Allow Mock Locations in the Developer Options on my phone. I set the Android SDK path in Unity (Program Files/Android/android-sdk) I set, in the Unity Editor Settings, Device to Any Android Device. I made sure my computer sees my phone, which it does. And I tried to open Unity first then the Unity Remote and Unity Remote first then Unity Engine. And set Android as my Platform in Build Settings. And I've tried plugging my phone in a USB 2.0 and a USB 3.0.

All that and each time I press the play button nothing happens in the phone. I have no idea what I'm doing wrong. I tried using Unity 4 and Unity 5.

If my OS is a factor, I'm using Windows 7 Ultimate, 64-bit.

If the following information is needed:

Hardware Version: G900P.04

Model number: SM-G900P

Android version: 5.0

Kernal version: 3.4.0

If any other information is needed I will provide it. Anyone have a solution to my problem? Thank you.


texts: Initialize an object in property drawer based on an int variable in Unity

texts:
I have created following classes for my game in unity:

[System.Serializable]
 public class abstract BaseA {
 }

 [System.Serializable]
 public class DeriveABaseA : BaseA {
 }

 [System.Serializable]
 public class DeriveBBaseA : BaseA {
 }

 [System.Serializable]
 public class abstract BaseB {
     public int Type = 0;
     public int AType;
     public BaseA A;
 }

 [System.Serializable]
 public class DerivedABaseB : BaseB {
     DerivedABaseB() {
         Type = 1;
     }
 }

 [System.Serializable]
 public class DerivedBBaseB : BaseB {
     public DerivedBBaseB() {
         Type = 2;
     }
 }

 [System.Serializable]
 public class ClassC {
     public int BType;
     public BaseB B;
 }

 public class ClassD : MonoBehaviour {
     public List<ClassC> C;
 }

now, I'm trying to add my custom editor for them. this is the first time I'm using editor scripting and I have few question regarding how to add custom editor scripts for my classes:

What is the correct way of adding new element to variable C
How can I call PropertyDrawer for ClassC when I'm drawing C elements?
How to initialize variable B of class ClassC based on the user entered value for variable BType in class ClassC?
How can I call DerivedABaseBPropertyDrawer or DerivedBBaseBPropertyDrawer based on type of variable B in class ClassC?
How to initialize variable A of class ClassB based on the user entered value for variable AType in class ClassB?

This is code code that I was able to get it to work except for 2nd and last question:

[CustomEditor(typeof(ClassD))]
 public class ClassDEditor : Editor {
     ClassD m_target;
     public override void OnInspectorGUI()
     {
         m_target = (ClassD)target;
         if (GUILayout.Button("Add"))
         {
             //Is this the correct way of adding value to this list?
             m_target.C.Add(new ClassC());
         }

         foreach(var c in m_target.C) {
             //How propertydrawer can be called for each element of C?
         }
     }
 }

 [CustomPropertyDrawer(typeof(ClassC))]
 public ClassCPropertyDrawer : PropertyDrawer {
     public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
     {
         //Is the following code valid (it's working) and is there a cleaner/simpler way of doing this?
         object obj = fieldInfo.GetValue(property.serializedObject.targetObject);
         var index = System.Convert.ToInt32(new string(property.propertyPath.Where(c => char.IsDigit(c)).ToArray()));
         ClassC objC = ((List<ClassC>)obj)[index];
         if(objC.BType == 1 && typeof(objC.B) != typeof(DerivedABaseB)) {
             objC.B = new DerivedABaseB();
         } else {
             objC.B = new DerivedBBaseB();
         }
     }
 }

 [CustomPropertyDrawer(typeof(ClassB))]
 public ClassBPropertyDrawer : PropertyDrawer {
     public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
     {
         //How to get access to B instance object
         var type   = property.FindPropertyRelative("Type").intValue;
         var a_type = property.FindPropertyRelative("AType").intValue;
         var drawer = null;

         if(type == 1) {
             drawer = new DerivedABaseBPropertyDrawer();
         } else {
             drawer = new DerivedBBaseBPropertyDrawer();
         }
         if(a_type == 1) {
             //Set A == new DeriveABaseA();
         } else {
             //Set A == new DeriveBBaseA();
         }

     }
 }

 [CustomPropertyDrawer(typeof(DerivedABaseB))]
 public DerivedABaseBPropertyDrawer : PropertyDrawer {
     public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
     {

     }
 }

 [CustomPropertyDrawer(typeof(DerivedBBaseB))]
 public DerivedBBaseBPropertyDrawer : PropertyDrawer {
     public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
     {

     }
 }


texts: Instantiate an object and translate it randomly

texts:
My goal through this code in C # is that each time the player presses the Q I create a cube at a fixed position given by another object, then begin translating it in a random direction. ie.

first press: a cube is created at the spawn point and moves away in direction 1
second press: a cube is created at the spawn point and moves away in direction 2
third press: a cube is created at the spawn point and moves away in direction 3

I don't understand why the code below does not work:

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

public class spawn_random_trajet : MonoBehaviour {

    public GameObject Spawn, Spawn2;
    public Transform origineSpawn;
    public float moveSpeed=5f;

    void Update () {
        if (Input.GetKeyDown (KeyCode.Q)) {
            int random_trajet_x = Random.Range (-10,10);
            int random_trajet_y = Random.Range (-10,10);
            int random_trajet_z = Random.Range (-10,10);

            Spawn2 = Instantiate(
                 Spawn,
                 origineSpawn.position,
                 origineSpawn.rotation
            ) as GameObject;

            transform.Translate (
                 random_trajet_x*Time.deltaTime*moveSpeed,
                 random_trajet_y*Time.deltaTime*moveSpeed,
                 random_trajet_z*Time.deltaTime*moveSpeed
            );
        }
    }
}


texts: How do I make my game connect to a server without real IP address?

texts:
I'm making an XNA game. When I started, I had a broadband connection with real IP, so I could host servers of any kind without any problem, but now I don't have that connection any more and I want to be able to let players from outside my local network connect to my server again. How do I do that? How do big guys at studios do that?

UPD: I guess it isn't fair to ask two questions in one, I just wanted to know if it's still possible for me to host a server on my connection, and if it's not an option, then how to do it without it (my connection). I believe I got my answers, though.

If I had an external dynamic address, I could use dynamic DNS service, but I don't, so I'll have to host my server on another machine (probably rent a server).


texts: How to create Button/Switch-Like Tile where you can step on it and change its value?

texts:
If the player steps on a Button-Tile when its true, it becomes false. If the player steps on a Button-Tile when it is false, it becomes true.

The problem is, when the player stands on (intersects) the Button-Tile, it will keep updating the condition. So, from true, it becomes false. Because its false and the player intersects it, it becomes true again. True-false-true-false and so on.

I use ElapsedGameTime to make the updating process slower, and the player can have a chance to change the Button to true or false.

However, it's not the solution I was looking for. Is there any other way to make it keep in False/True condition while the Player is standing on the Button tile?


texts: How do I make a time lapse in my code so it updates slower?

texts:
I have made some collision if statements, but they didn't work.

            birdbox3.X += 5;
            birdbox3.Y -= 5;

            if (birdbox3.Intersects(Banner1)) {

                birdbox3.Y += 10;

            }
            else if (birdbox3.Intersects(Banner2)) {

                birdbox3.Y = -birdbox3.Y; }

So if we take the first statement, the box is initially on the left down corner.
According to my code, it would ideally be going right+up in my game, once it hits the banner on the extreme top, it should go down+right, thus both the X and the Y positions will increase. But what happens is that is starts bouncing really fast, after debugging I realised it was forever stuck in the first if, it's almost as if it collides 2 times, reverting Y to its initial movement, colliding a 3rd time, and doing the process over and over.

Which brings us to the question, how can I make the Update code run a tad bit slower, or after half a second or such passes, so when it runs, it doesn't misinterpret collisions?


texts: Generate vertices of a sphere by using spherical coordinates

texts:
I'm trying to generate points for a sphere by subdividing the space of spherical coordinate in res sector and res slices.
At first I did my own implementation, but it wasn't working. After a while I looked online and I copied Songho implementation and others as well.
But I still have the same issue:

The points are not evenly spaced in the sphere, creating a strip.
This is the code I'm using to generate the sphere:
   float sectorStep = 2 * PI / res;
    float stackStep = PI / res;
    float sectorAngle, stackAngle;
    for(int i = 0; i <= res; ++i){
        stackAngle = PI / 2 - i * stackStep;
        float xy = r * sinf(stackAngle);
        float z = r * cosf(stackAngle);
        for(int j = 0; j <= res; ++j){
            sectorAngle = j * sectorStep;
            float x = xy * sinf(sectorAngle);
            float y = xy * cosf(sectorAngle);
            vertices.push_back(glm::vec3(x,y,z));
        }
    }
    glGenVertexArrays(1, &VAO);
    glGenBuffers(1, &verticesVBO);
    glBindVertexArray(VAO);
    glBindBuffer(GL_ARRAY_BUFFER, verticesVBO);
    glBufferData(GL_ARRAY_BUFFER, vertices.size(), vertices.data(), GL_STATIC_DRAW);

    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
    glEnableVertexAttribArray(0);
    glBindVertexArray(0);

And here it's how I draw it:
    glm::mat4 projection = glm::perspective(glm::radians(camera.getFOV()), (float) SCR_WIDTH / (float) SCR_HEIGHT, 0.1f, 100.0f);
    glm::mat4 view = camera.getViewMatrix();

    glm::mat4 model = glm::mat4(1.0f);
    shader.use();
    shader.setUniform("projection_view", projection*view);
    shader.setUniform("model", model);
    glBindVertexArray(sphere.VAO);
    glDrawArrays(GL_POINTS, 0, sphere.vertices.size());

I wanted to draw the vertices first and then move to drawing the triangles.
Sorry if this is a stupid question.


texts: Why would I want to use multiple ad providers for my game?

texts:
I have seen mobile games with multiple video and banner ad providers. While Adsense tends to be used for banner ads, anything that takes over the screen (full screen) typically has redundancies (in my experience) in the form of multiple Ad providers.

Why would I want to do this too?


texts: Optimizing texture fetches with higher mip levels

texts:
Let's say I have some shader program in DirectX or OpenGL rendering a full screen quad. And in a pixel/fragment shader I sample some huge textures at random texture coordinates. That is one same texture coordinate for all texture samplings in one shader invocation, but it is various among different shader invocations. These fetch operations produce performance drop, I even think that due to the size of the textures the GPU texture cache is not big enough and is used not efficiently.

Now I have a theoretical question: can I optimize the performance by using some low-resolution like 32x32 mask textures, which are built by mipmapping the large textures, and if a value in a mask texture at given texture coordinate at some higher mip level is not appropriate, then I don't need to perform texture fetches at full-size level 0? Something like this in HLSL (GLSL code is pretty similar, but there is no [branch] attribute):

float2 tc = calculateTexCoordinates();
bool performHeavyComputations = testValue(largeMipmappedTexture.SampleLevel(sampler, tc, 5));

float result = 0;

[branch]
if (performHeavyComputations)
{
    result += largeMipmappedTexture.SampleLevel(sampler, tc, 0);
}

About 50% of texels at mip level 5 will not pass the test. And so a lot of shader invocations should not sample the full-size textures.

But I am introducing branching in the code. May this branching hurt the performance even worse than sampling the full-size texture even if that is not needed? Different GPUs may behave differently, some may not even support branching, will they perform two fetches instead of one?

I can test this code on some machines, but my question is theoretical.

And can you suggest another optimizations, if this won't work properly ?


texts: How to texture a surface generated by marching cubes algorithm?

texts:
I'm working on a voxel game, and I have some problems with texturing. I have read the related questions on this stack exchange, but they seem adressing a generic problem (using triplanar texturing), and I think mine is simpler.

You can see that the resulting geometry contains a limited set of polygons. Last I checked I saw only 44 of them. My idea was to uv map these polygons to a regular texture using a static map table, without having to use any triplanar texturing (currently, every polygon is mapped to the same values, so it's ugly).

My questions :

Is it valid ? It seems much simpler than triplanar texturing, but I can't find a single resource on the subject, so I'm wondering if it's a right approach.
Where can I find / How can I generate a UV map for this kind of geometrical figure ? I have tried to use blender but it seems like my blender-fu is not strong enough. Is there some simpler software to generate UV map with models like this one ?


texts:
I have a problem with AABB collision resolution.

I resolve AABB intersection by resolving the X axis first, then the Y axis.
This is done to prevent this bug: http://i.stack.imgur.com/NLg4j.png

The current method works fine when an object moves into the player and the player has to be pushed horizontally. As you can see in the .gif, the horizontal spikes push the player correctly.

When the vertical spikes move into the player, however, the X axis is still resolved first. This makes "using the spikes as a lift" impossible.

When the player moves into the vertical spikes (affected by gravity, falls into them), he's pushed on the Y axis, because there was no overlap on the X axis to begin with.

Something I tried was the method described in the first answer of this link: 2D rectangular object collision detection

However the spikes and moving objects move by having their position changed, not velocity, and I don't calculate their next predicted position until their Update() method is called.
Needless to say this solution didn't work either. :(

I need to solve AABB collision in a way that both of the cases described above work as intended.

This is my current collision source code: http://pastebin.com/MiCi3nA1

I'd be really grateful if someone could look into this, since this bug has been present in the engine all the way back from the beginning, and I've been struggling to find a good solution, without any success. This is seriously making me spend nights looking at the collision code and preventing me from getting to the "fun part" and coding the game logic :(

I tried implementing the same collision system as in the XNA AppHub platformer demo (by copy-pasting most of the stuff). However the "jumping" bug occurs in my game, while it doesn't occur in the AppHub demo.
[ jumping bug: http://i.stack.imgur.com/NLg4j.png ]

To jump I check if the player is "onGround", then add -5 to Velocity.Y.

Since the player's Velocity.X is higher than Velocity.Y (refer to the fourth panel in the diagram), onGround is set to true when it shouldn't be, and thus lets the player jump in mid-air.

I believe this doesn't happen in the AppHub demo because the player's Velocity.X will never be higher than Velocity.Y, but I may be mistaken.

I solved this before by resolving on the X axis first, then on the Y axis. But that screws up the collision with the spikes as I stated above.


texts: How can I use the Kinect as a microphone in Linux?

texts:
I am using Ubuntu 14.04 LTS, and the Kinect camera has type Microsoft_Xbox_NUI_Sensor_043367545147-02-Sensor.

I can access the Kinect's camera from a Linux program that I'm writing, but I'd also like to use its microphone for voice communication. How can I do that?


texts:
I'm the lead of a small independant team working on a game slated for release next year. Most of the design is collaborative and we are currently investigating copy protection, on which neither of us has previous expertise.

Our artist does not believes in any protection. While the easiest thing to do, I'm not really happy about it since it means that it will be readily available in pirate form (which will get us potential customers according to artist).
Our scripter is the complete opposite and wants us to contract a commercial DRM. This is a major no-go for me, on two aspects : it will be a hassle to our clients (as a player, I personally experienced a false positive with a game using DRM) and it will decrease performance.
My opinion is more nuanced. I've developed a serial key generation algortihm, with verification at the start of the game (only once, if a valid key is entered, it is stored then verified at launch, asked again in case of invalid or banned key). Key verification is only effectued locally (no "phoning home"), as I want to keep client hassle minimal.

As our game is mainly geared towards cooperative LAN play, I proposed that a same key would be able to used several times. Both argued that it will be the same as having no protection. I think it offers the best ratio (incentive to buy)/(customer hassle)

I know that no perfect solution exists and any protection can easily be circumvented. I want to know if any of the community has experience in these matters and share with me his experience or advice : is the described shared serial key economically viable (at least, more than no protection at all) ?


texts:
I work with some friends on a rail shooter game in openGL. For creating our world we are using Blender. Since we want our Tank to follow a path I have started to work with creating bezier curves and exporting them. That works, but takes a lot of time. Is it possible to export the f-curves you use in the graph editor to an obj-file or any other file that can be used to describe the position for a specific point in time?

I would be grateful if someone has an idea that could be helpful.


texts: How can i rotate the FPSController to it's original rotation angle?

texts:
It should be kind of slowly standing effect.
The FPSController is starting at rotation: X = 7 Y = 112 Z = -31

The problem is that i have on the FPSController a script that i use the mouse to rotate the camera around. And i see that when i rotate the camera the center point of the FPSController seems stuck on this angle even if i change the rotation to 0,0,0

If i start the game running it when the rotation of the FPSController is 0,0,0 then it's standing but when i start the game with 7,112,-31 and then moving the mouse it keep be locked on this rotation values. And i want it to slowly return to the original 0,0,0

I tried when the game is running and the fpscontroller rotation set to 7,112,-31 to change it to 0,0,0 but it keep staying at the rotation of 7,112,-31

What i want is that the fpcscontroller to stand. I don't think that i need to change it's position but only the rotation.

In my script i tried this:
At the top:

public FirstPersonController fpc;
public float speed = 10F;

Then in the Update:

void Update()
{
  fpc.transform.rotation = Quaternion.Slerp(fpc.transform.rotation,
  Quaternion.Euler(0, 0, 0), Time.deltaTime * speed);
}

But it didn't return it to the standing position it keep it on the current rotation 7,112,-31


texts:
My camera system has two objects: the isometric camera itself, and an empty object it's attached to which handles both movement and rotation. When the player drags the middle mouse button, the camera (or, rather, the empty object) moves like this:

Vector3 diff = lastFramePosition - currFramePosition;

float xchange = diff.x / 5;
float ychange = diff.y / 5;

//flips the direction of movement if the rotation of the object is a certain way
if (transform.rotation.y == 90 || transform.rotation.y == 180)
                ychange *= -1;

if (transform.rotation.y == 270 || transform.rotation.y == 180)
                xchange *= -1;

Vector3 pos = transform.position;

//moves the camera and restrains it within the limits of the map (core.mapx and core.mapy)
transform.position = new Vector3(Mathf.Clamp(xchange + pos.x, 0, core.mapx), 3, Mathf.Clamp(ychange + pos.z, 0, core.mapy));

It turns out, though, that since it moves the empty object along the X and Y axes, dragging up/down or left/right moves it along those axes instead of actually moving the camera view up/down and left/right. The best way I can describe it is like those old isometric games that do the exact same thing. Is there any way I can get it to move like this?


texts: 3D modeling: how to make a spaceship with interior and exterior

texts: recently i wanted to try and model a spaceship. i want to make one with interior and exterior. (like spaceships in star citizen.) But i dont know how to start working on it. Do i first build the interior and thzn build the exterior around it ? or reversed ? also how does one design interior if there is already an exterior. my goal is to maybe implement this in a game engine so i can walk around inside of it. i tried looking for this on google but i only got results that show how to make a spaceship but withoud interior. or interiors alone. does someone know how to make this ? or does someone have a tutorial i can use to learn from ? thanks in advanced.


texts: SteamVR No Longer Opening With Unity Projects

texts:
I'm trying to get Unity to open/utilize SteamVR for development. Everything was working fine until today, but now Unity does not use SteamVR.
I did not make any changes to SteamVR recently, and I get the same results on multiple projects and Unity installs. I also tried rebooting.
It looks like Windows pushed an update today for KB4023057 but I can't uninstall it. It's not found within uninstall updates, not in add/remove programs, and even using command prompt wusa /uninstall /kb:4023057 results in "KB4023057 is not installed." So it seems I'm stuck with it.
Any other ideas to either try to uninstall the update or else to somehow get SteamVR working in Unity again?


texts: How should I set camera in Blender for example to render a sprite which can be used in an isometric map?

texts:
I am trying to render some 3D model in blender and use them as a texture sprite in a game which uses Apple’s SpriteKit.
I have an isometric map with tiles size : 32 as width and 24 as height, Since I use same size tile whole over the map (isometric) I need to use an orthographic projection I think! please tell me if I am wrong but I was pretty sure! anyway...

I am using Blender to render my sprites (3D models) but I can not set the camera direction to have the rendered image really fit with the map.
The attached picture shows the problem, take a look at the building.

I have also attached the geometric math that I have used to create my render script in Blender.

I found out that if I use a 32,24 tile I need to look at from 29Deg 29Min 28Sec but it seems not alright as the iOS simulator shows!

Can anyone help me on this? How do I have to prepare my sprite to fit well on my isometric map?

Those who have experience with isometric map games are welcome to answer and I really appreciate it.

Here is the code I wrote in python to render the 3D Model, I have also set the camera to Orthographic manually.

import bpy
cam = bpy.data.objects["Camera"]
def look_at(cam, point):
    loc_camera = cam.matrix_world.to_translation()
    direction = point - loc_camera
    # point the cameras '-Z' and use its 'Y' as up
    rot_quat = direction.to_track_quat('-Z', 'Y')
    # assume we're using euler rotation
    cam.rotation_euler = rot_quat.to_euler()
meshObj = bpy.data.objects["plate"]
meshObj.rotation_mode = 'XYZ'
#meshObj.rotation_euler = (0,0,0)
d = meshObj.dimensions
# Finding maximum dim of the object
objectScale = 1
if d[1] >= d[2]:
    objectScale = d[1] / 16
elif d[2] >= d[1]:
    objectScale = d[2] / 16
cam.rotation_mode = 'XYZ'
cam.location = (20.416*objectScale,20.416*objectScale,20.416*objectScale)
#cam.rotation_euler = (0.7853,0.7853,0.5147)
cam.rotation_euler = (0.7853,0.7853,0)
look_at(cam, meshObj.matrix_world.to_translation())
alamp = bpy.data.objects["Lamp"]
alamp.location = (17.416*objectScale/4,17.416*objectScale/4,20*objectScale/4)
print("Scaling ",objectScale)
bpy.context.scene.render.filepath = "/Users/iman/Documents/Render/ISOBUILDING.png"
bpy.ops.render.render(write_still=True, use_viewport=True, scene="Camera”)


texts: How can I perform a deterministic physics simulation?

texts:
I'm creating a physics game involving rigid bodies in which players move pieces and parts to solve a puzzle/map. A hugely important aspect of the game is that when players start a simulation, it runs the same everywhere, regardless of their operating system, processor, etc...

There is room for a lot of complexity, and simulations may run for a long time, so it's important that the physics engine is completely deterministic with regards to its floating point operations, otherwise a solution may appear to "solve" on one player's machine and "fail" on another.

How can I acieve this determinism in my game? I am willing to use a variety of frameworks and languages, including Javascript, C++, Java, Python, and C#.

I have been tempted by Box2D (C++) as well as its equivalents in other languages, as it seems to meet my needs, but it lacks floating point determinism, particularly with trigonometric functions.

The best option I've seen thus far has been Box2D's Java equivalent (JBox2D). It appears to make an attempt at floating point determinism by using StrictMath rather than Math for many operations, but it's unclear whether this engine will guarantee everything I need as I haven't built the game yet.

Is it possible to use or modify an existing engine to suit my needs? Or will I need to build an engine on my own?


texts:
I have many objects with AABBs and a player surrounded in an AABB. If I represent my player with a point everything works smooth with detection and wall sliding as a response (for example what wall sliding is, see this video).

If I represent my player with an AABB I first check if there is any AABB - AABB collision which works fine but I want the same sliding effect with this AABB box. I worked out a little trick to find the normals of both faces that collide but only works when I'm moving in one axis so that shouldn't be how it's done.

Below you'll see my scene. You'll see cubes surrounded with an AABB with a small offset and my camera that is at the center of an AABB (red lines).

How does one provide a good seamless AABB - AABB collision response algorithm that is not too hard to implement (like the one in the youtube video). I couldn't find anything useful on the web.


texts: Difference in glDrawArrays and glDrawElements

texts:
While refreshing my mind on OpenGL ES, I came across glDrawArrays and glDrawElements.

I understand how they are used and sort of understand why they are different.

What I do not seem to understand is that, I fail to see how glDrawElements can save draw calls (saving draw calls is a description that is mentioned by most of the books I have read, hence my mentioning of it here).

Imagine a simple scenario in which I tried to draw a square using 2 triangles.

I would need to have a set of 6 vertices using glDrawArrays while using glDrawElements, I would need only 4 in addition to an index array that has 6 elements.

Given the above, here is what I do not understand:

how could glDrawElements save draw calls, if it still needs to use the index array (6 indices, in case of a square) to index into my vertex array that had 4 elements (6 times)? Other words, does it mean glDrawElements would still need to have a total of 6 draw calls just like glDrawArrays?
how would using glDrawElements save space, if one would still need to have 2 arrays, namely, one for the vertices and one for the indices?
In the case of drawing a square from 2 triangles, for simplicity, how many draw calls does glDrawElements (4 items in vertex array and 6 items in index array) and glDrawArrays (6 items only in vertex array) need, individually?

Thanks.


texts: Why do consoles have so little memory compared to classic computers?

texts:
I remember the Playstation having 2MB ram and 1MB graphic memory.

The Playstation 3 now has only 256MB ram and 256MB graphic memory, and I'm sure that the day the console was released, even laptop's "standard" capacity was at least 1GB.

So why do they put so little memory in their machines, while developers would benefit a lot by having more ? Or is the memory that much faster than desktops and thus more expensive ? Or is it not that much worth it for developers ? What are the Sony/XBox/Nintendo engineers thinking that seems to be the same reason ?


texts: Making dialogue different with each playthrough

texts:
I'm making a little demo game where roughly half of the NPCs in a little town have a profession, as well as a personality. I'm trying to have the game procedurally create dialogue,
so when an NPC is talking about what they do, they describe it with some personality.

So for example, I may have a farmer who's an over achiever. He may have dialogue like this: "I farm from sun up to sun down. And I have the most cows around!"
In another incarnation, a brainiac farmer may say, "Hi, my farm has exactly five cows, and is run very efficiently."

In the demo, the town will be procedurally generated, with a small number of townsfolk (around ten or twelve). Some will be peasants, others will be farmers. One or two will be merchants/shopkeepers. When the player talks to some of these folk, the NPC may greet the player and say something about what they do. Or they may describe themselves, as well as something about their town. On occasion, the NPC will also say something about their family.

I have thought of using a templating system, where it would fill in some of the dialogue. But I would like the sentences to vary with each playthough.
I have also thought of using parts of speech so as to create sentences. The problem with using parts of speech (at least with using NLTK) is that I need some form of grammar to string them all together,
and this is mainly meant for a small demo. Another option is to use a natural language generator (NLG), but that's getting into the realm of advanced AI. And I would like to steer away from that.

So should I use a templating system for the dialogue (I have tried using Rant, but I got into some really complicated syntax with that)? Or, should I use a dialogue system that uses parts of speech, and strings them together with some kind of grammar?

For what it's worth, I'm restricting the NPCs to a group of personalities. Also, some of what they say is based upon their stats. So if their intelligence is low, yet their charisma is high, maybe they'll be a xenophobe, or an over achiever.


texts:
I'm making a game that's pretty simple and I really only need to save one int for when the game is closed (the scene the payer is at), but all the tutorials and guides I've seen haven't been much help so far.

So basically I want a way to either have the game, resume right where I left off when I quit, have it load a specific scene when you resume playing, or have it save that single int. Having it load a specific scene would work best but I can use any of the options stated above.


texts:
To encourage code reuse- i want to import methods and classes defined in my core unityscripts to be imported into other unityscripts. How do i go about this?

Note: An answer here seems too complicated for such a simple thing (i come from Python).


texts: How would joints work in an impulse-based physics engine?

texts:
I want to learn about physics engines, especially impulse-based ones. So I've followed along this tutorial to create some simple rigid-body physics:
http://gamedevelopment.tutsplus.com/tutorials/how-to-create-a-custom-2d-physics-engine-the-basics-and-impulse-resolution--gamedev-6331

I've got this working and it seems pretty solid to me. So I wanted to add revolute (fixed) joints. I've started off with a simple structure:

struct Joint
{
    RigidBody* A;       // One body
    Vec2 AnchorPointA;  // A's anchor point's offset (0,0 if center)
    RigidBody* B;       // The other body
    Vec2 AnchorPointB;  // B's anchor point's offset (0,0 if center)
};

I'm guessing this would do the job. Now... I'm not too good with physics (hence I started to code this) so I started out what I thought would work:

RigidBody* A = joint->A;
RigidBody* B = joint->B;

// Rotate the anchor points based on the body's rotation
Vec2 ancha = A->BodyShape->Transform * joint->AnchorPointA;
Vec2 anchb = B->BodyShape->Transform * joint->AnchorPointB;

// The relative positions of the 2 points
Vec2 relativeVel = (B->Position + B->Velocity + anchb) - (A->Position + A->Velocity + ancha);

// Apply a force towards eachother, pulling at the anchor points
B->ApplyImpulse(-relativeVel, anchb);
A->ApplyImpulse(relativeVel, ancha);

This approach simply pulls the bodies together. And it works... Kind of. After the bodies slide together as the joints are set up, it looks ok, but when the bodies fall they tend to spin away from eachother or start to freak out (keep rotating).
After messing around with the code (which was getting worse and worse as I was changing it) I've tried to look up solutions on the internet or at least some hints. I've found this:
How can I implement revolute (hinge) joints in a 2d physics system?

But this approach does not apply impulses, it fixes position. Wouldn't be an impulse-based system better? How can I fix it? I don't even know how big forces should I apply (I guess it should be based of the distance or something like that and also for the masses of the bodies). Thanks for any help!


texts: How to calculate texture coordinates for a cube?

texts:
I was reading about texture mapping on 3D shapes in javafx where I came across this code,

static TriangleMesh createMesh(float w, float h, float d) {
if (w * h * d == 0) {
return null;
}
float hw = w / 2f;
float hh = h / 2f;
float hd = d / 2f;
float x0 = 0f;
float x1 = 1f / 4f;
float x2 = 2f / 4f;
float x3 = 3f / 4f;
float x4 = 1f;
float y0 = 0f;
float y1 = 1f / 3f;
float y2 = 2f / 3f;
float y3 = 1f;
TriangleMesh mesh = new TriangleMesh();
mesh.getPoints().addAll(
hw, hh, hd, //point A
hw, hh, -hd, //point B
hw, -hh, hd, //point C
hw, -hh, -hd, //point D
-hw, hh, hd, //point E
-hw, hh, -hd, //point F
-hw, -hh, hd, //point G
-hw, -hh, -hd //point H
);

mesh.getTexCoords().addAll(
x1, y0,
x2, y0,
x0, y1,
x1, y1,
x2, y1,
x3, y1,
x4, y1,
x0, y2,
x1, y2,
x2, y2,
x3, y2,
x4, y2,
x1, y3,
x2, y3
);
mesh.getFaces().addAll(
0, 10, 2, 5, 1, 9, //triangle A-C-B
2, 5, 3, 4, 1, 9, //triangle C-D-B
4, 7, 5, 8, 6, 2, //triangle E-F-G
6, 2, 5, 8, 7, 3, //triangle G-F-H
0, 13, 1, 9, 4, 12, //triangle A-B-E
4, 12, 1, 9, 5, 8, //triangle E-B-F
2, 1, 6, 0, 3, 4, //triangle C-G-D
3, 4, 6, 0, 7, 3, //triangle D-G-H
0, 10, 4, 11, 2, 5, //triangle A-E-C
2, 5, 4, 11, 6, 6, //triangle C-E-G
1, 9, 3, 4, 5, 8, //triangle B-D-F
5, 8, 3, 4, 7, 3 //triangle F-D-H
);
mesh.getFaceSmoothingGroups().addAll(
0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5
);
return mesh;
}

How did the calculate and set up the texture coordinates for the cube?


texts: How to make a bitmap font having only a PNG file?

texts:
Is there a way to "convert" an existing PNG file with the characters' images into a bitmap font? Basically, I want to create a FNT file using an image like this...

(source: opengameart.org)
...without the access to a TTF file of the image's characters or any other typical font formats.


texts: How to vertically flip a DDS texture on import?

texts:
I have a program capable of rendering 3D graphics using Direct3D11 and it is currently compatible with two different texture formats, TGA and DDS. The code to read and load a TGA texture in memory I'm using was from Rastertek tutorials here and it handle TGA textures which are upside down by reading their bytes backwards, but the code to read and load a DDS texture I'm using is just D3DX11CreateShaderResourcesViewFromFile function from D3DX11tex.h, and it was good enough for me until a while ago.
Now I'm facing a problem as some of DDS textures I want to use are upside down in a similar way to the TGA textures, so I need somehow a code where I can control how it reads the texture so I can modify it to read the DDS texture upside-down.
I've read this article from Microsoft, but even their simplest code is far more complex than the code from Rastertek to TGA file. It's not clear to me how I can implement a method to read a DDS upside-down.
What I 'think' I understand about TGA's data it that its first 18 bytes are their header and the rest is 4 bytes for each pixel(in a RGBA style), but I really don't understand how DDS works.


texts: Why are my Box2D wheels slipping on ground?

texts:
I have a car, set up in Box2D as a rectangle connected with two wheels using WheelJoints:

The wheels are defined as follows:

    FixtureDef wheelFixtureDef = new FixtureDef();
    wheelFixtureDef.density = 1.f;
    wheelFixtureDef.shape = wheelShape;
    wheelFixtureDef.friction = 0.98f;
    wheelFixtureDef.restitution = 0.3f;

    // wheel joint (only one of the wheels has the motor enabled)
    wheelJointDef.dampingRatio = 0.9f;
    wheelJointDef.frequencyHz = 20.0f;
    wheelJointDef.motorSpeed = 15.4f;
    wheelJointDef.maxMotorTorque = 100.f;

And the ground:

    FixtureDef groundFixtureDef = new FixtureDef();
    groundFixtureDef.density = 0.f;
    groundFixtureDef.friction = 1.0f;

Still, when trying to climb that hill in the picture, the wheels reach a stage where they just keep slipping, and it slides back down.

Why does it slip even though the friction coefficients are set high? How can I make it overcome that hill?


texts: Is Unity NGUI still that usable after Unity has add support for 2D?

texts:
I am tempted to refactor out the existing component which uses NGUI ("Next-Gen UI kit") given that what I needed is only the sprite and texture atlas.

Since in the newer versions of Unity those parts are natively supported, is there any reason I should still keep NGUI?


texts: How to set borders in Rubik's cube using opengl GLSurfaceView

texts:
I'm developing a Rubik's cube game like seen in the picture. But I'm facing problems to set the cube face color with black border.

  public void setupSides() {
int i, j, k;
// Paint back blue
i = 0;
for(j = 0; j < dim; j += 1) {
    for(k = 0; k < dim; k += 1) {
    cubes[i][j][k].setFaceColor(Cube.kBack, colors[faceColors[Cube.kBack][j][k]]);
    }
}

// Paint front green
i = dim - 1;
for(j = 0; j < dim; j += 1) {
    for(k = 0; k < dim; k += 1) {
    cubes[i][j][k].setFaceColor(Cube.kFront, colors[faceColors[Cube.kFront][j][k]]);
    }
}

// Paint right white.
k = dim - 1;
for(i = 0; i < dim; i += 1) {
    for(j = 0; j < dim;j += 1) {
    cubes[i][j][k].setFaceColor(Cube.kRight, colors[faceColors[Cube.kRight][i][j]]);
    }
}

// Paint bottom orange
j = 0;
for(i = 0; i < dim; i += 1) {
    for(j = 0; j < dim;j += 1) {
    cubes[i][j][k].setFaceColor(Cube.kBottom, colors[faceColors[Cube.kBottom][i][k]]);
    }
}

// Paint top red
j = dim - 1;
for(i = 0; i < dim; i += 1) {
    for(j = 0; j < dim;j += 1) {
    cubes[i][j][k].setFaceColor(Cube.kTop, colors[faceColors[Cube.kTop][i][k]]);
    }
}
// Paint left yellow
k = 0;
for(i = 0; i < dim; i += 1) {
    for(j = 0; j < dim;j += 1) {
    cubes[i][j][k].setFaceColor(Cube.kLeft, colors[faceColors[Cube.kLeft][i][j]]);
    }
}
}

This method is used to set the colors in all sides.

My Rubik Cube image is shown which is given below

That image create through my code but i want my rubik cube color with black border like which is given below


texts: What is a good starting platform for a teenage game programmer?

texts:
My son (15) has decided that he wants to pursue a career as a games programmer. I've said that he should get started now with a simple game. He has no programming experience yet, but I am a programmer (business apps, not games) so I can teach him programming, but what would be a good platform for him to start on? Initially I'm looking for something that can provide quick results, to keep his enthusiasm up.

What would you suggest?


texts: Using an object as a model to avoid too many parameters - XNA/C#

texts:
I have 3 classes(Skill,Projectile and Status),Skill has Projectile and Projectile has Status, all of them need to read information from a txt and to avoid open it everytime I want to create an object I want to read all the txt on Skill and pass the information Projectile need as arguments and then on Projectile create Status passing the information needed as arguments too

As Projectile going to create a lot of Status objects it need to receive Projectile's informations and Status's informations from Skill, to avoid too many parameters can I create a Status object on Skill and pass it to Projectile and everytime I need to create another status I use the first one as a model?

As example:

 public class Skill
{
  String skillName,projectileName,statusName;
  int    skillNumber,projectileNumber,statusNumber;
  public Skill(){
      //Code to read txt and fill variables

      //What is happening
      Projectile projec = new Projectile(projectileName,statusName,projectileNumber,statusNumber);

      //To avoid above
      Status status = new Status(statusName,statusNumber);
      Projectile projec = new Projectile(projectileName,projectileNumber,status);

  }
}

And then at Projectile

public class Projectile
{
  //Constructor,variables and methods

  //Method that create Status
   public void Update(){
         if(hitEntity){
          //this status was received from Skills
          Status tempStatus = new Status(status.statusName,status.statusNumber);
          }
   }
}


texts: Rotate the camera around the model in XNA?

texts:
How can I rotate my view around a model? My model has a rotation. If this rotation changed, my view should also change.

The camera should be behind the model everytime.

Thank you very much!