texts:
Currently, I have a script; more specifically for weapons. It handles animations, and the animations are being played and then stopped (once they're finished) by co-routines. I have variables for how long certain animations are (in frames), which are designated at the beginning of the script. I then take that and divide it by the frame rate they were animated in, for the co-routine's waitForSeconds. The problem is that for each weapon, I have to manually input how long each of their usually 13 animations is in the inspector.

It'd be a lot easier if I could take the animation component that is being played, and have the script figure out how long it is, convert it to an integer, and use that for the waitForSeconds. I've looked around for this before (and just did again), but nothing has worked. If anyone needs me to clarify something, please let me know.


texts: How can I solve the "Unable to find back camera" error?

texts:
I'm trying to run a script that will display video from my webcam on my computer, but when I run it the error unable to find back camera pops up.

My webcam is hooked up and working, so as my other script, but this one doesn't do what I need it to do.

How can I fix this?

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

public class MainCam : MonoBehaviour
{
    private bool camAvailable;
    private WebCamTexture backCam;
    private Texture defaultBackground;

    public RawImage background;
    public AspectRatioFitter fit;

    private void Start()
    {
        defaultBackground = background.texture;
        WebCamDevice[] devices = WebCamTexture.devices;

        if (devices.Length == 0)
        {
            Debug.Log("No camera detected");
            camAvailable = false;
            return;
        }

        for (int i = 0; i < devices.Length; i++)
        {
            if (!devices[i].isFrontFacing)
            {
                backCam = new WebCamTexture(devices[i].name, Screen.width, Screen.height);
            }
        }

        if (backCam == null)
        {
            Debug.Log("Unable to find back camera");
            return;
        }

        backCam.Play();
        background.texture = backCam;

        camAvailable = true;
    }

    private void Update()
    {
        if (!camAvailable)
            return;

        float ratio = (float)backCam.width / (float)backCam.height;
        fit.aspectRatio = ratio;

        float scaleY = backCam.videoVerticallyMirrored ? -1f: 1f;
        background.rectTransform.localScale = new Vector3(1f, scaleY, 1f);

        int orient = -backCam.videoRotationAngle;
        background.rectTransform.localEulerAngles = new Vector3(0, 0, orient);
    }
}


texts: LIBGDX fadeout, hide and remove action not triggered

texts:
I try to execute an sequence of actions, but fadeout and following are not working for me. I can see the actor moving to the desired point, but after that it just stays there.

My code. personActor is an Actor of a list in my mainactor:

    SequenceAction sequence = new SequenceAction();
    sequence.addAction(Actions.moveTo(0, 300));
    sequence.addAction(Actions.moveTo(1000, 300,3f));
    sequence.addAction(Actions.fadeOut(0.5f));
    sequence.addAction(Actions.hide());
    sequence.addAction(Actions.removeActor());

    personActor.addAction(sequence);

The main actor loops through the list of childactors:

@Override
public void draw(Batch batch, float parentAlpha) {
    super.draw(batch, parentAlpha);
    for(PersonActor personActor : personenActors){
        personActor.draw(batch,parentAlpha);
    }
}

Do someone see, whats wrong here ?


texts: LWJGL glRotatef() without rotating axes?

texts:
Okay so, I noticed when you rotate around an axis, say you do this:

glRotatef(90.0f, 1.0f, 0.0f, 0.0f);

That will rotate things 90 degrees around the x-axis. However, it also sort of rotates the y and z axes as well. So now the y-axis is pointing in and out of the screen, instead of up and down. So when I try to do stuff like this:

glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
glRotatef(whatever, 0.0f, 1.0f, 0.0f);
glRotatef(whatever2, 0.0f, 0.0f, 1.0f);

The rotations around the y and z-axes end up not how I want them. I was wondering if there is any way I can sort of rotate just the axes back to their initial position after using glRotatef(), without rotating the object back. Or something like that, just so that when I rotate around the y-axis, it rotates around a vertical axis.

EDIT: After further research, it appears I will have to learn quaternions.
EDIT2: Wait, I don't think that's right. Does anyone know? I saw this thread on another site: http://java-gaming.org/index.php?topic=24177.0 but I don't understand what he did.


texts: How to draw a mini map OpenGL & OpenGL ES?

texts:
I'm trying to draw a mini map. Succeeded to put current screen to smaller screen (mini map) via FBO.

But I do not know how to make the mini screen brighter when hover. You can imagine that, the real screen is very large, and you have a mini screen in the left bottom (like StarCraft), and when you hover on it, it's brighter than others.

I'm trying to use multiple attachment in FBO but it doesn't work. In fact that I don't know how does multiple attachment work, how is it used for?.

My way, draw map with  attachment_0 first, draw a hovering rectangle with attachment_1. Bind then draw all of the attachment textures in legal sequence (NOT WORKED).

I mean, the first draws a mini "large screen".

The second draws a brighter rectangle when hover.

Can anyone lead me how to do this or give me any suggestion?

Thank you very much!


texts: Why does the player jump every time it touches the ground in my JavaScript game?

texts:
I am making a javascript game where the player jumps over oncoming cars, but after the first jump every time the player hits the ground they jump again automatically. I believe the problem is because I am resetting the jumping variable to false when it hits the ground yet it is still going through the initial jump() function so it sees it as false and makes it jump again. Is there any way to fix this?

this.isJumping = function(){
  var y=player.y;
  var jumping;

  if (y=area.canvas.height - 200){
    player.image.src="man.png";
  }
  else{
    jumping=true;
    player.image.src="man2.png";
  }
  return jumping;
}

(And later in the code)

function jump() {
  if (!player.isJumping() && area.frameNo>0) {
    player.speedY = -20;
    jumping=true;
  }
}


texts: How do you create multiple blocks with minecraft addons?

texts:
I've seen a question like this and I followed the directions they gave (Adding a blocks folder into behavior pack etc.), but I can't seem to get a result, it could be because I want to make 2 blocks (slime_cyan and  slime_purple), OR it could also be because they weren't doing the right version because they said to add the component: "Register To Creative Menu" and on bridge it doesn't even suggest that component (I know I said bridge but I'm not looking for a bridge tutorial).
I just want to create 2 new blocks for Minecraft bedrock with only add-ons, no special modding app, could anyone help me with this?

I'm on Windows 10 edition.
I'm using Minecraft Bedrock 1.16


texts: XNA C# Making the game scaleable for different resolutions

texts: I am currently developing a game in C# and XNA, and I want it to look right at all resolutions. How would I get started with doing that?


texts: How do I set the center of a fixture/body consisting of multiple shapes (triangles)?


texts: How can i add mobile camera feed to unity?

texts: I want to take my mobile camera's feed to unity , where if the target image is found , some action should happen ( may be like a cuboid appears on the target image). I thought of using ip webcam app which generates ip address , through browser i was able to see the camera feed. I want the feed from camera but the action must be in my laptop.


texts: How can I get a pointer to ID3DX11EffectShaderVariable from ID3DX11Effect

texts: I'm using the DirectX Effects framework and I want to create an input layout automatically when compiling an effect. I've tried to call ID3DX11Effect->GetVariableByName() with the shader's name, to obtain a pointer to a ID3DX11EffectVariable interface, then doing ID3DX11EffectVariable->AsShader() to obtain a pointer to a ID3DX11EffectShaderVariable interface. The problem is that the pointer returned by ID3DX11Effect->GetVariableByName() is not valid (the IsValid() method returns false). So how can I get a pointer to the shaders of an effect file ?


texts: CreateShaderResourceView fails because of plane slice

texts:
I'm trying to write a wrapper for the CreateShaderResourceView method inside my Texture class, which shouldn't be any problem at all since everything was working fine outside the class. But the debug layer reports an error when assertion is called at the creation of the pipeline state:

D3D12 ERROR: ID3D12Device::CreateShaderResourceView: The PlaneSlice -858993460 is invalid when the resource format is B8G8R8A8_UNORM and the view format is B8G8R8A8_UNORM.  Only Plane Slice 0 is valid when creating a view on a non-planar format. [ STATE_CREATION ERROR #344: CREATEUNORDEREDACCESSVIEW_INVALIDPLANESLICE]
D3D12 ERROR: ID3D12Device::CreateShaderResourceView: The Dimensions of the View are invalid due to at least one of the following conditions. MostDetailedMip (value = -858993460) must be between 0 and MipLevels-1 of the Texture Resource, 0, inclusively. With the current MostDetailedMip, MipLevels (value = 1) must be between 1 and 0, inclusively, or -1 to default to all mips from MostDetailedMip, in order that the View fit on the Texture. [ STATE_CREATION ERROR #31: CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS]
D3D12: Removing Device.

The wrapper function is simple and operates on a map:

void Texture::CreateSRVFromTexture(const Textures::ID & id, CD3DX12_CPU_DESCRIPTOR_HANDLE & cpuHandle)
{
    auto found = m_textures.find(id);

    //Create SRV with the CPU handle
    D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc;
    srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
    srvDesc.Format = found->second.textureDesc.Format;
    srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
    srvDesc.Texture2D.MipLevels = 1;
    m_device->CreateShaderResourceView(found->second.textureBuffer, &srvDesc, cpuHandle);
}

And calling this function looks like this:

CD3DX12_CPU_DESCRIPTOR_HANDLE srvHandle1(m_textureDescriptorHeap->GetCPUDescriptorHandleForHeapStart(), 0,
        m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV));
m_texture->CreateSRVFromTexture(Textures::ID::Fatboy, srvHandle1);

Now I don't understand why it worked perfectly fine before (no errors reported) when I didn't have the wrapper method and simply accessed the texture with a Get method. What could be the cause of this, since the error message is a bit vague and doesn't help very much?


texts:
I'm new to OpenGL, so please excuse my brevity and/or lack of technical knowledge of the subject.

I need some help with rendering a polygon on an OpenGL canvas (using C# w/ Tao). I understand that I will need to tessellate the polygon points so it'll draw correctly, but technicality aside, what's the best method to get usable XY points from the image below so I can draw the polygon shape?


texts: I am trying to implement collisions using the separating axis theorem. However All I have ever used in terms of polygons is the Rectangle class included in XNA already. How can I make multi-sided polygons?


texts:
I am making a Top-Down shooter in Godot 3.0 on Linux.

I would like to have my character rotate to face the mouse-pointer at a constant speed, and have rotation speed power-ups that allow the player turn faster.

So far, this is done by having a Position2D object called "Center" share the same position (but not be a child of) the player (below just called "Sprite"). The center always looks to the mouse, and the Sprite rotates with linear interpolation to eventually reach the same rotation as the "Center".

The weight of linear interpolation is calculated by dividing the difference in rotation (in radians) by an arbitrary constant speed.

Problem: The speed of rotation increases as rotation occurs, or more specifically, the time it takes to reach the same rotation (a rotational difference of zero) becomes shorter over time.

I have the following code:

extends Sprite

onready var center = get_parent().get_node("Center")

var current_time = 0
var total_time = 0
var start_rot = 0
var end_rot = 0

func _process(delta):
    center.look_at(get_global_mouse_position())
    var amt = 0
    var theta = abs(self.rotation - center.rotation)
    var speed = 0.05

    total_time = theta/speed

    start_rot = get_rotation()
    end_rot = center.rotation

    if not total_time == 0:
        amt = current_time/total_time

    current_time += delta
    amt = clamp(amt,0,1)
    var rot = lerp(start_rot,end_rot,amt)
    center.rotation = fmod(rot,(PI*2))
    set_rotation(fmod(rot,(PI*2)))

    get_parent().get_node("Control/rotation").text = str(int(self.rotation_degrees))
    get_parent().get_node("Control/theta").text = str(theta)
    get_parent().get_node("Control/time").text = str(total_time)

What am I doing wrong?


texts: Should the objective of a game be obvious to the player?

texts:
Watching game dev talks and reading articles about 'good' game design, it seems consesus a game should always make the objective obvious to the player, making clear what 'skill check' is being made and what to do to advance in the game.

Thinking about this, I don't agree. Figuring out what the game wants you to do was an important aspect of older games like e.g. Silent Hill or Castlevania: Symphony of the Night.

In Silent Hill you have a map with marker notes on it, which add up progressing the story. These notes are more a 'log' of what happened, than a 'to do list'.
Newer games, instead of kindly pointing the player to another part of the level, tend to be too helpfull, providing specific instructions on where to go and what to do there.

Is this type of challenge deprecated? In order to increase the market penetration of games? Or are there objective reasons to abandon this approach to game design? What are alternatives to this kind of challenge?


texts:
I'm currently making a matching game where the player is given a color or image type and the player has to click on all of the matching colors of images as fast as possible. My problem is how would I go about making a difficulty curve instead of just randomly generating what the next situation will be.

There's a link down below to show the first version of the game I made a while ago. As you can see the new scenario is chosen randomly and one scenario can be harder than the other with no thought of progression. What I want this time is for the game to progress over-time. So, the more of these "scenarios" a player does the more difficult it will get.

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


texts: Workflow for creating spherical heightmaps

texts:
I'm wondering how I can create a spherical heightmap.

In my ideal workflow, you'd see a 3D sphere that you can edit using procedural terrain techniques (like World Creator) and that spherical terrain can be exported into six seamless images based on what layout you want your images to fold up into a cube in-game to create your planet.

Another option would be if you can at least tell the program you want specific images to tile with other images, such as the designated 'front, right, back, left' images tile with each other and the 'up, down' images seamlessly.

Specifically, I'm making planets for a game that wraps six images into a cube and 'inflates' them into a planetary terrain.

I've made a few basic heightmap sets in a program called Scape, and flipped them so at least four of the images mirror each other, then I edited the interior of those maps to all be different so the landscape isn't repetitive. However, manually editing the top and bottom maps is very daunting to get perfect, and I'm creating a dozen or more planets.

I'd like to know how to make 'front, right, back, left' images tile with 'up and down' images and I can edit the interiors of the images in a 3D program of choice. I've been directed to this site from search queries many times, but I'm a newbie to all things code so I have no clue how to use things such as the Diamond-Square method or any algorithms to achieve seamless textures (what program do you actually use, literally a python script you write in Notepad++ or something?).


texts: How to give a certain scene different preference settings then other scenes unity

texts:
In my unity game that I am creating there are 4 scenes. 3 of those scenes rely on a backdrop because they are the main menu, death screen and the escape screen(for when you escape the place). Therefore they need a high resolution image. However, the other scene (the main game scene) is incredibly laggy when the quality setting for the texture quality isn't "eighth res". How can I make it so that the texture quality for only my game scene is eighth res and the rest is normal res? This might help: my build order value is the main menu is 0, my game is 1, my death scene is 2 and my escape scene is 3.
thanks in advance


texts: Normal map causing abrupt change in shading across UV islands

texts:
As you can see in the image above, there is a big change in shading past the uv island on the end. i have no idea what caused this, but I can reproduce my steps as best i can.

Model high poly in zbrush
Duplicate and decimate the duplicate
Export both to 3ds max and align them
UV the low
make a cage by duplicating the low and adding a push modifier
export the low, high and cage
bake in xnormal
add material in max with 100% normal strength plugged into a normal bump with the source linked to the texture
Change viewport to realistic materials with maps

No idea why this is happening. I used tangent space any ideas?


texts: Can I make a "fan game" with characters of one game that already exists?

texts:
(I'm sorry about my english, I'm from Chile)

Hi!
I'm making a game based on Alone In The Dark, and the history would happen before the events on the game of PS1. However, I would like to make a game with the character Aline, but with 10 years old. The game mechanism would be the same, and the name of a lot of characters and places. I don't really want to make any money, I just want to make a good game, I love the AiTD game. Can I do that or I can be on jail because of that? Thanks!


texts: Trying to understand 3D transforms by making an aircraft control script. How would you implement 3D transforms correctly in this example?

texts:
I'm struggling to understand 3D transforms in Godot. (I know, I know...)
I'm trying my best to implement an aircraft control script, and I've gotten myself into gimbal lock hell. My controls work pretty well until the Y direction decides to flip, and now my controls to pull up make the plane go down, etc...
I've read the godot 3D transform documentation, but I still find myself looking for an "Aha!" moment.
I figured a good way for me to learn would be to post what code I have and see how others would implement the movement code using transforms correctly.
Thanks for any help in advance.
extends Spatial

# Declare member variables here. Examples:
# var a = 2
# var b = "text"
onready var camera = $Camera
const SPEED = 7
const ROTATE_SPEED = 1.25
const MIN = 0.9
var rx = 0
var ry = 0
var rz = 0
# Called when the node enters the scene tree for the first time.
func _ready():
    pass

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
    self.transform.basis = Basis()
    if Input.is_action_pressed("movement_forward"):
        ry -= 1
    if Input.is_action_pressed("movement_backward"):
        ry += 1
    if Input.is_action_pressed("movement_left"):
        rx += 1
    if Input.is_action_pressed("movement_right"):
        rx -= 1
    if Input.is_action_pressed("rotate_left"):
        rz += 1
    if Input.is_action_pressed("rotate_right"):
        rz -= 1
    self.transform.orthonormalized()

    self.rotate_z(deg2rad(rz))
    self.rotate_x(deg2rad(ry))
    self.rotate_y(deg2rad(rx))
    self.transform.origin += -self.transform.basis.z * SPEED * delta
```


texts: Checking Collisions In 2D Platformer With Tiles

texts:
My team and I are developing a 2D platformer with C++/SDL/OpenGL, and we already defined a collision system, but we have a problem checking collisions with the tilemap.

The tiles of the tilemap are 32x32, so we try to define that the max speed in X and Y of the player it's less than 32 because in this case we found the problem that if the speed it's bigger than the tile size, when checking the collisions the position it's updated with the speed which it's more than 32, so in that case, the position skip a tile which causes a huge problem for verification, so at the momento we limit the X and Y speed to 30, but we don't know how make the speed bigger than the tile size without losing the complete collision detection with some possible tiles that may be skiped.

Thanks a lot


texts: How do I implement a 2D camera in JPanel?

texts:
I'm trying to create a mario-esque game in Java and am at the point of implementing a camera.

Following normalocity's example, I understand the difference between the GameWorld and the Camera that follows that objects within the context of the world.

From a technical perspective,

I have JFrame that adds GamePanel (extends JPanel) and sets its size to 500,500 (that's the window size that I see pop up when I run the program).

Before learning about GameWorlds and such... I was using GamePanel as a generic JPanel to paint my objects and to implement boundary rules, timer, paintComponent, scoring, keyboard input, collision check... All painted objects are placed and shown relative to GamePanel's coordinates/size.

Now I'm trying to implement a Camera...

Is Camera a smaller JPanel added to the GamePanel? How do I make my GamePanel more like a GameWorld with a huge size (10,000 x 10,000 px), and only render everything on that GamePanel through the Camera JPanel?

From the GamePanel, I've tried altering the coordinates of the Camera using arrow keys... the camera coordinates of course change, but the objects painted on the GamePanel do not move with respect to the coordinates of the Camera.

EDIT: I'm using JPanel because that's what I'm familiar with. If you have a better suggestion on game dev in Java, please let me know!


texts:
My model must support transfer textures but I can't do this using mesh + modelBuilder.part
Opacity is tested correctly on only half of the model.
BlendingAttribute blendingAttribute = new BlendingAttribute();
        blendingAttribute.opacity = 1.0f;

        modelBuilder = new ModelBuilder();
        modelBuilder.begin();
        modelBuilder.part("minecraft:loading_model", mesh, 4, new Material(TextureAttribute.createDiffuse(atlas), blendingAttribute));
        modelInstance = new ModelInstance(modelBuilder.end());


texts: Do "write once run anywhere" engines require platform specific code for multiplayer?

texts:
I've been investigating the myriad selection of mobile game dev engines that allow compilation of your code onto multiple target platforms, but, something I can't seem to figure out is if multi-platform "write it once" development is possible when you bring multiplayer into the equation.

I've looked at Unity and Monkey mostly, so far, but aside from seeing threads on the Monkey forum such as "I've developed such and such networking library for Monkey"... I can't find a definitive answer. That example is one of many that causes me concern.

Is it the case that if you used a cross platform engine, you'd have to write platform specific code for the networking portion of your game/app? (Even if the rest of the game did work on your target platforms with no/minimal platform-specific "jiggery".

I'm not talking about cross-platform multiplayer, but I do presume that'd be a happy by-product of a write-once-deploy-anywhere (within reason) networking solution.


texts: How does the SAT collision detection algorithm work

texts:
There are a lot of tutorials and sample code available showing how to implement the SAT collision detection algorithm.

But can someone explain, without math or code, what are  the general principls behind this technique.


texts:
I'm planing to develop a puzzle like mobile game (android/ios) with a different logic for each puzzle. Say, for example one puzzle could be a Rubik's cube and another one a ball maze. Many more new puzzles will appear during the life of the game, and I want the users to be able to play those new puzzles.

The standard way for managing this would be through application updates. Each time a new puzzle or bunch of puzzles appear, create a new update for the app that the user can download.
However, I would like to do it in a more transparent way. When a new puzzle appears, the basic info of the puzzle would be displayed in the app menu, and the user would be able to play it by just clicking it.

What comes to my mind is that the app would automatically download a .dll or .jar and inject it in the application at runtime.
Is that even possible? Are there any restrictions from the OS? Is there a better way for solving it?

Thanks alot


texts:
So my problem is that the color of the sprite should only change if the Boolean is true. My theory is that the Boolean isn't being update. So how do I update the Boolean the whole time and see if it is getting changed.

Thanks Guys,

 public class controlborder : MonoBehaviour
    {
        private SpriteRenderer m_spriteRenderer;
        public float loopdelay = 2f;
        public static bool startstop;
        public void Start()
        {
            m_spriteRenderer = GetComponent<SpriteRenderer>();
            StartCoroutine(Changecolor(2f));
        }
        public void Update()
        {
        }
        private IEnumerator Changecolor(float loopdelay)
        {
            while (true)
            {
                startstop = control.changecolorborder; <== this bool
                Debug.Log(startstop);

                while (startstop)
                {
                    yield return new WaitForSeconds(1F);
                    int random = Random.Range(1, 4);
                    if (random == 1)
                    {
                        m_spriteRenderer.color = Color.blue;
                    }
                    else if (random == 2)
                    {
                        m_spriteRenderer.color = Color.red;
                    }
                    else if (random == 3)
                    {
                        m_spriteRenderer.color = Color.green;
                    }
                    else
                    {
                        m_spriteRenderer.color = Color.yellow;
                    }

                }
            }
        }
    }


texts: Can a user / a game developer get their credit back in dollars? If yes, at what cost?

texts:
You can find every information about how to give money to facebook, but when it comes to take it back…

If I give credits to a user, can he get it back in dollars?

If a user gives me credits, can I turn it into dollars?

If so, how much does it cost?


texts: Draw line around mesh with defined width at cut plane

texts:
I want to display a solid line around mesh with a defined width at a cut plane. Currently I realized that using the same method as gl_ClipDistance works using dot() operation. However, the output is not what I want since the line width changes depending on angle between the current triangle and the plane. There are also some bad aliasing effects. My guess is that the abs(factor) < 0.1 is wrong here but I also dont know any other alternative. I'm fairly new to shaders...

How can I solve that issue?

Current output:

It should look similar to that output:

Fragment-Shader:

#version 330 core

out vec4 fragColor;

in vec3 Normal;
in vec3 FragPos;

uniform vec4 clipPlane0;

void main() {
  float factor = dot(vec4(FragPos, 1.0), clipPlane0);
  if (abs(factor) < 0.1) {
    fragColor.rgb = vec3(1, 0, 0);
  } else {
    fragColor.rgb = vec3(0, 1, 0);
  }
}


texts:
I'm trying in my game to have camera rotation speed idependent of fps. For keyboard it works without problems but not for mouse movoment. At 60 fps it works good but at 200 for example rotation is to slow.

mouse_dif is difference since last frame in pixels. Maybe thats a problem too, bigger screen resolution will rotate faster then smaller.

My code:

const float rot_speed = u.GetRotationSpeed(); // returns 5.f
float val = 0;

if(allow_input == ALLOW_INPUT || allow_input == ALLOW_MOUSE)
    val += float(mouse_dif.x)/200;

if(val > rot_speed*dt)
    val = rot_speed*dt;
else if(val < -rot_speed*dt)
    val = -rot_speed*dt;
u.rot += val;

How can I make it fps independent?


texts: Autoscroll a TextArea to youngest/freshest row/line

texts:
I want to use a TextArea UI widget as a UI integrated Logger.
Therefore the TextArea should always show the youngest message.

I browsed the whole API to find the proper method but could not find any.
TextArea$setCursorPosition while passing TextArea$getLines as its parameter did not worked as intended.

I read about TextArea$setPrefRows and used it with getLines but also no luck.

How can I use TextArea to get autoscroll behaviour down to the most recent line?


texts: Elegantly exposing properties in Unity inspector

texts:
There are various game objects in my scene that share some common characteristics, so I created an interface, like so:

public interface IHasLimitedRangeOfMotionAlongZAxis
{
    float MinimumZ { get; }
    float MaximumZ { get; }
}

For certain types that implement this interface, I would like MinimumZ and MaximumZ to be publicly assignable in the Unity inspector. Therefore, I would like to be able to expose these properties in Unity.

I am aware that one approach is to write C# scripts in the Editor folder to implement an ExposePropertyAttribute (see here).

However, this approach is unsatisfactory for two reasons:

My solution is not co-located with my Assets folder. I write my code in a separate solution, and then use pdb2mdb.exe to import my scripts into my Unity scenes. (The reason for doing this is to avail myself of C# language features introduced beyond C# 4.0, which nonetheless target .NET Framework 3.5.)
I shall have to create a custom editor for every single type that implements the interface with publicly assignable properties. This leads to a lot of boilerplate code.

Is there a more elegant approach than adding private backing fields with the SerializeField attribute for all of my public properties?


texts: What exactly are smart material packs on Quixel Mixer?

texts:
Not sure if this is a good spot to ask this, but I'm using this for Unreal, so I figure it probably is?  If not, please comment instead of downvoting.
When prompted to select the packs I wanted on the installer, I left it at the default which was only Smart Material Pack 5, mainly because it made it a 3 gb download instead of a 20 gb download.  This leads me to wonder what exactly these packs do, and what I will be missing by not downloading all of them?  Will I still get all of Mixers features?  Are they just materials with settings already set up?  Thanks.


texts: Drawing visibility polygons in Unity (for vision cones with occlusion)

texts:
I'm currently trying to create an effect like the one displayed below in Unity:

However, it seems that I can't do this with any of Unity's built-in light objects, and I simply cannot find anything online that talks about this. Is there a way to achieve this in Unity? 2D or 3D solutions are fine, as I'm sure that they're both very similar to each other,


texts: which is better performance, using a disposable local variable or reusing a global one?

texts:
This is for an android game.
Suppose I have a function that is called several times for second and do some calculations involving an arraylist (or any other complex objects for what matter).
Which approach would be preffered?

local:

private void doStuff(){
    ArrayList<Type> XList = new ArrayList<Type>();
    // do stuff with list
}

global:

private ArrayList<Type> XList = new ArrayList<Type>();
private void doStuff(){
    XList.clear();
    // do stuff with list
}


texts: How to store an iOS game save file in multiple devices? (Without remote servers)

texts:
I've been developing an iOS game for iPhone. My game saves the progress as a couple of .plist documents in the device.

I have come to realize that when I install a game in my iPhone, this same game is installed in my iPad. And then it struck me: how would I manage save files? I mean, I'd like the player to be able to continue playing from where they left no matter what device are they using... without using remote servers.

What have you done to address this issue?


texts: How do I run an iPhone GameSalad App on an iOS Device?

texts:
I have made a simple game application with GameSalad . It runs fine in the iPhone simulator after loading the GameSalad Viewer but doesn't work in the device as it gives a code signing error. If I change the IPA according to the device then the GameSalad Viewer crashes and the app does not run.

Does anyone have a solution for this?


texts: Scripting: Loading all scripts at runtime vs loading scripts when needed

texts:
I'm using Boo as a scripting language in my C#/.NET game via the in memory compiler with it and I really love it, however I'm having trouble deciding when I should load my scripts.

This is my first time using a scripting language with a game and my first time implementing one into anything.

Currently I load scripts as needed - this works well. However I end up with a lot of assemblies loaded(one per file currently, as I'm just loading each when it is needed) and realized as my game expands this could turn into a large number of assemblies - is this bad? I guess I could get around this by managing appdomains and loading/unloading after scripts haven't been used for a long time. I currently don't use any appdomains for my scripts at all so I end up with a lot of appdomains due to them getting recompiled while working on them.

Loading all scripts at the same time would be a big overhead when loading as my loading times are quite fast right now, rather big memory usage due to them all being loaded at the same time, and if I want to dynamically recompile scripts when they're changed while the game is running I have to recompile all of them. Currently I can just recompile them one file at a time. The benefits of this is that I obviously have a lot less assemblies loaded.

I guess my real question is having a lot of small assemblies loaded in C# a bad thing compared to one large assembly, and compiling scripts during gameplay vs a big loading screen?


texts: Shader which supports vertex colors and pixel lights?

texts:
From my question at Unity Answers:

Hello everyone, I'm facing a bit of a problem here: I need a shader which has the ability to colour individual vertices and be lit pixel by pixel. Until recently, I was planning to use just vertex shading, since I couldn't find any info about this. The thing, it looks like this: Bad shading 1 and Bad shading 2.
As you can see, it is horrendously bizarre and even glitchy. Here is the shader I'm using right now (ShaderLab syntax):

Shader "Alpha/VertexLit Colored" {
    Properties {
        _Color ("Main Color", Color) = (1,1,1,1)
        _SpecColor ("Spec Color", Color) = (1,1,1,0)
        _Emission ("Emmisive Color", Color) = (0,0,0,0)
        _Shininess ("Shininess", Range (0.01, 1)) = 0.7
        _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
    }

    SubShader {
        //ZWrite Off
        Alphatest Greater 0
        Tags {Queue=Transparent}
        Blend SrcAlpha OneMinusSrcAlpha
        ColorMask RGB
        Pass {
            Material {
                Shininess [_Shininess]
                Specular [_SpecColor]
                Emission [_Emission]
            }
            ColorMaterial AmbientAndDiffuse
            Lighting On
            SeparateSpecular On
            SetTexture [_MainTex] {
                Combine texture * primary, texture * primary
            }
            SetTexture [_MainTex] {
                constantColor [_Color]
                Combine previous * constant DOUBLE, previous * constant
            }
        }
    }
    Fallback "Alpha/VertexLit", 1
}

I searched around on the Unity forums, wiki and also on Google, but I found no resources for this. I really need the vertex colours here, it's a crucial element of the graphic style of my game, and is the simplest way to do what I want. Any help is immensely appreciated. Does anyone know if such kind of shader exists?


texts: C++: Checking if an object faces a point (within a certain range)

texts:
I have been working on a shooter game in C++, and am trying to add a feature whereby missiles shot must be within 90 degrees (PI/2 radians) of the direction the ship is facing. The missiles will be shot towards the mouse. My idea is that the ship's angle of rotation is compared with the angle between the ship and the mouse (std::atan2(mouseY - shipY, mouseX - shipX)), and if the difference is less than PI/4 (45 degrees) then the missile can be fired. However, I can't seem to get this to work.
The ship's angle of rotation is increased and decreased with the A and D keys, so it is possible that it isn't between 0 and 2*PI, hence the use of fmod() below.

Code:

float userRotation = std::fmod(user->Angle(), 6.28318f);
if (std::abs(userRotation - missileAngle) > 0.78f) return;

Any help would be appreciated. Thanks!


texts: What is the formula or algorithm used in libgdx delta time?

texts: I'm studying time stepping algorithm and I need to know how delta time works in libgdx, because I think delta time uses some kind of time stepping algorithm.


texts:
I'm trying to implement a rain effect using shader, I use godot 3-alpha, which uses a simplified GLSL 3.0 language. But I'm just finding very complex examples for me, I understand little about shaders, I wanted to achieve something very basic even to be able to walk. I thought of doing the following, moving the texture with just a few painted pixels. Yet I still do not know where to start.

I found this code, I really wanted to understand what is done in it:

http://www.glslsandbox.com/e#36547.0

I managed to translate the code for godot 3, but it does not work very well, I believe this line is to blame:

p=0.5+0.35*sin(11.0*fract(sin((s+p+scale)*mat2(vec2(7,3),vec2(6,5)))*5.0))-f;

What really is done that line? I can not understand what he does.

I did so:

shader_type canvas_item;

uniform float direction;
uniform float velocity = 1.0;
uniform float intensity;

float snow(vec2 uv, float scale, float time)
{
    float w = smoothstep(1.0,0.0,-uv.y*(scale/10.0));
    if(w<0.1){return 0.0;}
    uv+=time/scale;
    uv.y-=time*velocity/scale; //VELOCITY
    uv.x+=sin(uv.y+time*0.5)/scale;
    uv*=scale;
    vec2 s=floor(uv);
    vec2 f=fract(uv);
    vec2 p;
    float k=3.0;
    float d;
    vec2 t = (s*p*vec2(scale))*mat2(vec2(7.0, 3.0), vec2(6.0,5.0));
    p.y=-(0.5+0.35*sin(11.0*fract(sin((s.y+p.y+scale)*t.y)*5.0))-f.y);
    p.x = f.x;

    d=length(p);
    k=min(d,k);
    k=smoothstep(0.0,k,sin(f.x+f.y)*0.01);
    return k*w;
}

void fragment(){
    vec2 uv=(COLOR.xy*2.0-SCREEN_UV.xy)/min(SCREEN_UV.x,SCREEN_UV.y);
    float c=smoothstep(1.0,0.3,clamp(uv.y*0.3+0.8,0.0,0.75));
    c+=snow(uv, 30.0, TIME)*0.3;
    c+=snow(uv, 20.0, TIME)*0.5;
    c+=snow(uv, 15.0, TIME)*0.8;
    c+=snow(uv, 10.0, TIME);
    c+=snow(uv, 8.0, TIME);
    c+=snow(uv, 6.0, TIME);
    c+=snow(uv, 5.0, TIME);
    c+=snow(uv, 2.0, TIME);
    COLOR = vec4(vec3(c),0.5);

}

and this happens:

I have discovered that by decreasing the value I am passing to the scale, it increases the "particles", I mean how octaves in a noise, the smaller the number last, the greater the peaos generated. But my screen seems to be divided in two, cut by a diagonal line, I do not understand much because. I realize that here is the problem:

vec2 uv=(COLOR.xy*2.0-SCREEN_UV.xy)/min(SCREEN_UV.x,SCREEN_UV.y);

  Up 1:

I managed to improve with this:

vec2 uv= UV;

now it's like this:

but what he wanted was to be able to pass three uniforms, direction, velocity and intensity, and to be able to control the direction (right equer), the speed with which they fall, the intensity (higher or lower particles, more or less drops). But I still do not understand how well it is done to do that. Even more that what I will do is rain, I have to understand what is done with the colors to get the idea of rain and not snow.

  Up 2:

I was stirring here and the velocity, intensity and direction I was able to configure passing a uniform. But I can not change the color of the drops, it always comes out black and white. How would you put a blue color for example?

I try to change the color to red for example using the mix() function:

vec3 col2 = vec3(1.0, 0.0, 0.0);
vec3 resultColor= mix(vec3(c), col2, 0.7);
COLOR = vec4(vec3(resultColor),0.3);

and I get this:

I wanted to change only the color of the drops?

R= I got it like this:

 COLOR = vec4(vec3(0.3, 0.3, c),0.5);

but I'm not very fond of the result, it's very bright, and my breasts are too big, I'll fix it.


texts: Parallax background in with depth in Phaser 3

texts:
I'm working on a 2D space shooter type of game in typescript using Phaser 3 and am trying to get a parallax background with different depths going. But I'm having trouble getting the math right.

You can see my work in progress here: https://www.youtube.com/watch?v=Pea9yVbTD64

As stated in the video everything works if the players x and y are positive, but breaks when they are negative, and I can't figure out what I am doing wrong. Any help would be greatly appreciated. Or perhaps there is a better way to accomplish this?

What I'm doing is randomly generating out a bunch of the Sprites, storing them in an Array, and then updating their position with this code.

_Nebulas: is an Array<NebulaParticle>.
p.distance: is a number between 1 and 5 to signify how far away the sprite is and is used to make them move slower when they are
furher away.
_Width and _Height are both arbitrary numbers to signify how big the area is that the parallax should cover, in the video they are
both set to 80.
OriginalOffsetX/Y is the original random position the Sprite was given.

(this line is here because the below code formatting wont work otherwise.)

public update(delta: number, playerx: number, playery: number) {
    console.log(playerx + ", " + playery );
    for (let i = 0; i < this._Nebulas.length; i++) {
        let p = this._Nebulas[i];
        p._Sprite.x = (playerx + (this._Width / 2)) - (((playerx / p.distance) + p.OriginalOffsetX) % this._Width);
        p._Sprite.y = (playery + (this._Width / 2)) - (((playery / p.distance) + p.OriginalOffsetY) % this._Height);
    }
}

class NebulaParticle {
    public _Sprite: Phaser.GameObjects.Sprite;
    public OriginalOffsetX: number;
    public OriginalOffsetY: number;
    public distance: number;
}


texts: Does fixed time step deltaTime get higher if the computer can't handle it?

texts: If you use fixed time step and set it to for example 0.0166667 does it ever go up if the computer can't handle 60 updates/ticks per second?


texts: Can I build cross platform executables with Unity?

texts:
If I create a C# console application in Monodevelop and build it I can run it by typing:

  ./executableName.exe

or using Wine. (I am using Ubuntu Linux)

I assume that this means that C# .exe files are cross-platform.

If so can I build a cross-platform Unity executable?

UPDATE:

Here is this program:

using System;

namespace MyConsoleApp
{
class MainClass
{
    public static void Main (string[] args)
    {
        Console.WriteLine ("This will run on Linux and Windows (I
think).");
    }
}
}

When I build it I get this:

I can either run this file (MyConsoleApp.exe) by double clicking it which will open it in Wine:

Or by typing ./MyConsoleApp.exe    :

This is why I think that C# programs are cross platform and wonder if I can build cross platform executables with Unity.


texts: How to create a color grading LUT for Unity URP?

texts:
I'm watching a movie, and I would like to achieve the same colors in my game.

I think I have to use a Color Grading lookup table to achieve this in Unity with URP.

The best example I found example deals with Photoshop, but it didn't include any information or description, it was just a raw screen capture which I didn't really understand.

How can I create a LUT?


texts: How would I apply my isometric art onto isometric CSS with correct Z-indexing

texts:
I have been trying to wrap my head around how to apply my isometric art

into an array like so with correct z-indexing

In the long run I want to be able to select a specific tile and depending on what tile it is I can choose a different function via drop down.

I'd appreciate any help. Even links to isometric documentation on putting images onto tiles. Or even how to successfully put an isometric tile onto a div without it being selectable on the transparent parts of the tile.

Sorry if this was hard to understand.


texts: Slick2D: Changing an Image's colour to Color.white

texts:
I am working on a game where we would like the enemies to flash white when hit by a bullet. Ideally, we would like to use the same mechanism to render an Image in any colour. Our Images are all png files with transparent backgrounds and these transparent areas must exist in the coloured version of the Image.

Testing shows that Image.draw(x, y, filter) does not change the appearance of the image when given Color.white

Testing has also shown that Graphics.drawImage(Image, x, y, color) has no affect when color is set to Color.white

Is there a way to change an Image to white using existing Slick2D functionality? Failing that, is there an easy way to use LWJGL to perform the colouring that can be easily incorporated into a Slick2D project?

NB Answers that allow an Image to be rendered in an arbitrary colour will be preferred over answers that are specific to Color.white


texts: Is grass object amount limited in Unity?

texts:
I'm using Unity 2019.3.7f1 free version to create a small game project. I have a large terrain which I want to fill with grass. To achieve that I'm using the grass brush tool provided with the terrain.
However I cannot put more than, say 10'000 grass items (arbitrary, I don't know the real limit). Exceeding this amount, the grass objects contained in the first area I filled are removed, one by one, for a reason I cannot figure out. It's like there is a max limit of grass object I cannot exceed, and this is true for both grass textures and detail meshes.
On the other hand the amount of tree seems unlimited, which is puzzling me.
So my questions are:

Is there a limited amount of grass objects available in Unity?
If yes, how many grass objects are available, and may I increase this limit?
Is it a known bug, or a known limitation of the Unity free version?
May grass impact the global performances of the game? (I feel that my game is significantly more slow after I added the grass...)


texts: Tangent space - Lengyel vs ShaderX5 - difference

texts:
I have been studiing tangent space calculations and came across two solutions

E. Lengyel - http://www.terathon.com/code/tangent.html

ShaderX5 solution - (solution is also desribed here http://www.thetenthplanet.de/archives/1180)

What is the difference between tangent computed one or another way? Lengyel solution seems "easier" but I am no quite sure of its orthogonality to the normal vector of the tangent plane.


texts: After building a .exe file game view does not show whole viewport

texts:
So, I went to build a game today in a .exe, and when I build it, it doesn't show the whole viewport as it does in the unity engine itself. So the game is cut off. It does this no matter what I do.

What I see in Unity:

What I get running the exe:

Anyone know what's causing this?


texts:
I am using Java and libgdx to create a game and have decided to go a data driven approaching with Jython for this refactoring (just picked up Jython, have used Java for a while). The game is a turn/tile based game where each ability will store prototype values and references to other scripts to actually execute the mechanics. I am hardcoding basic mechanics such as changing health, moving units between tiles, placing (de)buffs on units/tiles, and turn order. Everything else will be handled in softcode like deciding where to actually deal damage for aoe, how much damage to deal, what the buff behavior is, etc. I understand ideally I would script the entire game, except for things like rendering and I/O. But this is a solo project, and I don't really care.

Previously in development I hardcoded all the abilities. When an ability was casted it would call a function with the targeted tile and the entire gameboard. The function would then find the proper locations/objects on the gameboard and manipulate their state directly. However, I recognize this is terrible design. I figure some sort of API system would be better. But I am unsure how to design it.

API gives references to the objects on gameboard and gamestate variables directly. Scripts can manipulate the objects. Seems straightforward, but unsafe with possible illegal operations like moving a piece to a location that does not exist. Scripts could also be written to error check, but that seems counter productive to the idea of scripting.
APIs only give values of objects and gamestates. This may cause the script to need many variables that are normally grouped into one object, or to reconstruct the object. Also API could pass a purely data object. API calls are then also used back to the hardcode to manipulate the object. Safer as hardcode could easier contain illegal operation checking and debugging. But I guess I should learn debugging in Jython also. Also seems like a high memory overhead and extra API calls.
A mix of 1 and 2. The APIs give scripts references to the objects directly, but the scripts can only get data out of the objects. Any manipulation must be done through an API call. So scripts could use getHealth(), but not setHealth(var). I have no idea of this is even possible. I like this solution the best, but it seems a little convoluted.


texts: Which is worst: Too many VertexShader instructions, or FragmentShader instructions?

texts:
I want to have a better understanding of how to create shaders with optimal performance and realize where some bottlenecks can occur.

Is it usually favorable (when possible) to delegate most of the work to the VertexShader since in certain situations it may only need to process a few vertices vs. having the Fragment process the same thing potentially on thousands of pixels?

For example, if I have scrolling UV values for a texture, is it best that I pass this scroll amount in the Vertex-Shader so that it adjusts the start UV + scroll UV to a Variant register for the Fragment to read, or to just use a Fragment Constant with the scroll UV amount stored in it which will be added with the start UV's read from a Variant register?

Is passing values to one kind of Constant register (Vertex vs. Fragment) faster than the other?


texts: Changing default folder structure of New Project in Unreal Engine?

texts:
I wonder is there a config option to change the default folder structure of a new project.

So for example when I create a new project there is already a folder for 'Blueprints', 'Maps', 'Audio' and 'FBX' sitting in my Content folder.

The reason I ask is it's usually the first thing i do after i create a new project.


texts:
I'm doing a simple grid based game, where the player should only be able to move on the grey cells. It works quite ok, but in this simple scenario, the player is able to walk through Wall(1), although there is a collider on it and I'm checking with a raycast before moving.
When removing the (nonblocking) pickup, the collider works.
I'm assuming, the raycast is hitting the collider of the pickup, when the player is on that position and therefor misses the collision with the wall.
What is a good practice to handle this issue?


texts: Porting SDL OpenGL Game to Android and IOS

texts:
I am currently learning OpenGL (3.0+) with C++. I am using SDL for input handling, window creation, etc., GLEW to use OpenGL and call OpenGL Functions, and GLM for OpenGL Math stuff.

If I fully finish a Windows game, how can I port my game with the setup above to Android, IOS, and maybe even other platforms (but my main focus is Android and IOS). I do not want to use any Game Engines.

What I am looking for is a program that could just make my game run on android and IOS. If there is a way to optimize my game using the tools listed above a little bit and change some code to make my game run on android and IOS, I am okay with that (if that is the case, please provide resources).

I have heard of OpenGL Es, not quite sure what that is, but I do not want to use it if it is a completely different library and if I have to rewrite the entirety of my game rendering engine. I also want my app to run without the user having to download any libraries such as SDL, so please make sure that my app can just run as an .apk file or whatever format that I can just tap on and it will open.

I also want my app to run on most smartphones (Android and IOS), so please be sure that what you are suggesting is not only available to a limited amount of smartphones. Another thing that I want is optimal performance. No emulators or simulators from .exe to .apk that run very slowly. It should run as fast as other apps and run at probably the same speed as my windows version. Also point out any mistakes that I may have made (for example, maybe I am just crazy thinking that smartphones use OpenGL).


texts: How can I implement versioning into a save system?

texts:
I currently have a crude save system in my game.

When my game is first launched after download, it checks for three directories in a certain location on the client computer, user://save1, user://save2, and users://save3.

If these directories don't exist, they are created with some empty files player_data.save, level_data.save, persistence_data.save and meta_data.save.

Then, at periodic points in my game, these files are updated. (Which base directory is used depends on which save slot the player chose when they selected a new game, or loaded.)

I have read a lot  about  the importance of versioning to protect compatibility with saves (for example, here and here).

So,  how I can implement versioning into this save system to protect myself from incompatibilities when I inevitably release updates and patches to the game?

For example, is it advisable to create different save directories per game version, so that on boot you check if you have a save directory corresponding to your current game version? Or is it advisable to just have a single save directory and merely save a text file with the version number in the sub directories?

A structure like:

version_1_saves
    save1
    save2
    save3

version_2_saves
    save1
    save2
    save3

Or a structure like:

saves
    save1
        version.txt
    save2
        version.txt
    save3
        version.txt

And what do the checks look like when you do release an update and need to check for compatibility when a player boots the game or tries to load an old save?


texts: How can I accommodate custom pronouns in voice acting?

texts:
I am currently developing an RPG in which, during character creation, players may choose their pronouns as he/him/his, she/her/hers, or a custom entry based on their own text input. Whenever characters refer to them in dialogue, they will use the pronouns listed as they were typed into the character creation.
To head off some objections that have been raised in comments: this game isn't a hardline historical fiction, it's a video game RPG. My setting is what I write it to be, and in my game I want people to be able to make the character they want.
The trouble I've arrived at is that I will eventually be getting dialogue voice acted, and I am not sure how to account for these voice lines. Say for example a character set their name as Pete and pronouns as he/him/his, the dialogue might appear on screen as:

Hey! This is my friend [Pete]! [He] is new in town, want to help me show [him] around?

Under normal circumstances with a male/female only option, I could simply record two lines which omit the name, such that the line sounds like this in voice:

Hey! This is my friend! He is new in town, want to help me show him around?

Pronouns, however, cannot simply be omitted from speech.
What ways can I account for this in the voice acting of my game? Do there exist examples of voice acted games with custom pronouns that get around this issue?
Solutions I have come up with thus far:

Write the story such a way that pronouns simply aren't used in dialogue, only e.g. in UI

This is doable from a writing perspective but doesn't feel right because it makes the pronoun selection feel completely meaningless. I would like players to feel like the gender represented by their pronouns, so a completely pronoun-neutral dialogue would feel weak to me.

In voice acting, use a generic "they/them/their" pronouns and display the custom pronouns in text

Players will notice this, and it will feel out of place. Playing as a "he/him/his" or "she/her/hers" will probably seem confusing when they hear their "common" pronoun replaced with a neutral variant. Also, some consider "they/them/theirs" to be grammatically incorrect.

In voice acting, record three lines: "he/him/his", "she/her/hers", and "they/them/theirs" used for any custom pronouns

This is the solution I'm currently leaning towards, but it still feels dirty. Like I'm offering token representation but then reducing it to an "other".


texts: Performant Fog-of-War With Sight Blocking in Unity

texts:
In games like Command & Conquer or Age of Empires, players can't see all of the map.  Terrain and enemies are revealed only when the player has soldiers nearby.

As I understand it, the most performant way of doing this is by representing map visibility as a grid of cells.  When a unit moves into a new cell it updates all cells within a circle shape around the unit.

However, I would like to know how to integrate sight blocking.  What I mean by this, is that if a cell is occupied by something which a unit can't see past (like a wall) all cells behind the wall are covered by fog-of-war.

Here's a YouTube video of what it should look like.  The author doesn't go into how they did it, aside from mentioning "brute force shadow casting".


texts: Applying Angular Acceleration in a Basic Physics Model

texts:
I'm attempting to use a basic physics system to create an arcade flight model. So far I have managed to get the aircraft moving forward, apply gravity, etc. However, after trying to implement torque I noticed some interesting behaviour in the flight model. When turning after a while the controls appear to reverse, sometimes, the controls for the different movements (pitch, roll, yaw) also seem to change. I was hoping that someone may be able to advise me as to what I should check next. I have included my source code in case anyone spots any glaring mistakes! I have listed some of the variables below to show their data types:

Quaternion rotation = Quaternion.Identity;
Quaternion newRotation = Quaternion.Identity;
Vector3 rotationChange = Vector3.Zero;
Vector3 rotVec = Vector3.Zero;

Below is the update logic for the rotational forces:

dt = (float)gameTime.ElapsedGameTime.TotalSeconds;
if (dt > 1.0f / 60.0f)
{
    dt = 1.0f / 60.0f;
}

Vector3 newRotationChange = rotationChange + dt * angularAcceleration;
Vector3 newRotVec = rotVec + dt * newRotationChange;

rotationChange = newRotationChange;
rotVec = newRotVec;

Vector3 rotAxis = rotVec;
rotAxis.Normalize();

if (rotVec.Length() < 0.001f)
{
    rotVec = Vector3.Zero;
    newRotation = Quaternion.CreateFromAxisAngle(forwardVector, 0.0f);
}
else
{
    float angle = rotVec.Length();
    newRotation = Quaternion.CreateFromAxisAngle(rotAxis, angle);
}

if (rotationChange.Length() < 0.001f)
{
    rotationChange = Vector3.Zero;
}

rotation = newRotation;
angularAcceleration = Vector3.Zero;

My method for creating the torque:

/// <summary>
/// Creates a rotational force for an object
/// </summary>
/// <param name="pointOfAction">Point the force is being applied on the object
/// </param>
/// <param name="forceAmount">Magnitude of the force being applied</param>
/// <param name="forceDir">Direction of the force being applied</param>
public void CreateTorque(Vector3 pointOfAction, float forceAmount, Vector3
        forceDir)
{
    // Vector from position to pointOfAction
    Vector3 r = pointOfAction - position;

    // Create the force
    Vector3 force = forceDir * forceAmount;

    // Create the torque force
    torque = Vector3.Cross(r, force);

    angularAcceleration += torque;
}

Sorry for the massive code block and thanks in advance for any help you can give.


texts: Creating a simple ripple propagation with variable resolution

texts:
I am trying to do a simple simulation of a ripple propagating through a medium. I do not have a physics engine at my disposal so setting up a complicated set of spring constraints doesn't seem to be like the way to go.
In the past when I have done this the simulation has been resolution dependent. Which means that because on each step each unit of the simulation only samples things one unit around them that if the resolution is high waves propagate slowly. Similarly if the resolution is low they travel quite quickly.
I need to figure out a sampling method other than just the nearest neighbor that can make it so I can up the resolution of the simulation without majorly changing the sense of propagation speed. Are there any solutions to this kind of situation?


texts:
Suppose I wanted to code a game grid in java. Not an abstract text one but an actual grid with graphics and 'cells'. Would I have to draw line by line or is there a more efficient way? Also how would I go moving units (objects) around the grid, moving them and repainting their positions?

  public static int [] [] map = {{2,0,1,0,0}, // e.g. 2 is base
                                   {1,0,0,0,0},
                                   {0,0,0,0,0},  //1 is unit
                                   {0,0,0,0,0},
                                   {0,0,0,0,2}};

I still wonder if there is a resemblance between 2D arrays and actual game grids as I can just paint coordinates and lines. However I feel there is a better way and want to implement a structure like above (the code) to emulate a map like this:


texts:
I'm getting an annoying NullReferenceException error. Can anyone help? This is the function, and below you can see how it is called:
Error message:

NullReferenceException: Object reference not set to an instance of an object
BotController.Start () (at Assets/Scripts/BotController.cs:64)

void Start()
{
    InvokeRepeating("RandomMove", 0f, waitTime);
}

function:
    void RandomMove()
    {
        float behaviour = Random.Range(0,3);
        switch(behaviour)
        {
            //0: move left, 1: stop, 2: move right //
            case 0: rb.velocity = new Vector2(-moveSpeed, rb.velocity.y);
            movingRight = false;
            break;
            case 1: rb.velocity = new Vector2(0f, 0f);
            break;
            case 2: rb.velocity = new Vector2(moveSpeed, rb.velocity.y);
            movingRight = true;
            break;
        }
        return;
    }

the console shows the error on this line:
 case 0: rb.velocity = new Vector2(-moveSpeed, rb.velocity.y);

Edit: I've just changed the function to this:
void RandomMove()
    {
        float behaviour = Random.Range(0,3);
        switch(behaviour)
        {
            //0: move left, 1: stop, 2: move right //
            case 0: movingRight = false;
            break;
            case 1: rb.velocity = new Vector2(0f, 0f);
            break;
            case 2: movingRight = true;
            break;
        }
        return;
    }

and I've put an initial speed inside the Start() function like this:
        rb.velocity = new Vector2(moveSpeed, rb.velocity.y);

Now it shows the error exactly on this line. I think something's up with either Rigidbody or the vectors. I'm using the same rigidbody inside the same script with no issues.


texts: With Cardboard, reorient player to direction of gaze

texts:
This may be a little hard to follow. I have a script set up in Unity, and attached to my CardboardMain object that allows a user to press the button on a Cardboard headset to move in the direction of their gaze. They move only when the button is pressed. Since this game is a seated experience, I want the "virtual seat" to gradually reorient itself in the direction of the user's gaze, in the same way a pilot's seat, and plane would reorient with a turn. This way, whichever direction the user is traveling, it always becomes forward in the game, and reality. The idea is that the user's body can remain facing in it's starting orientation, while being able to freely look - and travel around. I'm new to C# and Unity, but I've made enough progress on this project that I cannot give up.

I'm using head.Gaze.direction to drive movement, and it looks like rotating CarboardMain will rotate everything inside of it. The hierarchy looks like this:

CardboardMain > Head > Main Camera

So, I think I could apply the needed rotation to the CardboardMain object, right?

This is the code so far, but I'm not sure where to go from here. My first thought was to rotate the scene, but that seems like it could complicate things as the project continues to develop.

public class movementScript : MonoBehaviour {
public float sub_speed = 0.03f;

private CardboardHead head;
// Use this for initialization
void Start()
{
    head = Camera.main.GetComponent<StereoController>().Head;
}

void Update() {
    int fingerCount = 0;
    foreach (Touch touch in Input.touches) {
        if (touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled)
            fingerCount++;

    }
    if (fingerCount > 0)
        transform.position += sub_speed * head.Gaze.direction;

}

}


texts: Replacing client side vertex arrays with glBufferData

texts:
I need to replace client side vertex arrays in order to upgrade to a new version of OpenGL but I'm not sure what the best way to buffer data is now.

What I have is a 2D sprite engine which is using batching to push as many vertices to the GPU (using fixed pipeline functions glVertexPointer etc...) but frequently the batch is only a single quad. Because of how sorting works the buffer needs to be updated every frame (or more).

I need to use glBufferData/glVertexAttribPointer now so what is the best way to handle this case? I can allocate the buffer for glBufferData large enough to hold the maximum size of a batch (which is more than maybe 5000 vertices) so should I just push the old vertex array to glBufferData every frame or use another method? Maybe calling glVertexPointer/glBufferData has the same costs associated with them to copy memory to the GPU so I don't need to worry about it but I'd like to know since I'm still pretty new to OpenGL.

CONCLUSION:

In my simple tests I found calling glBufferData every frame with all vertices (OpenGL 4.1) actually slightly faster than client side vertex arrays (OpenGL 2.1).

Thanks.


texts: XNA: Networking gone totally out of sync

texts:
I'm creating a multiplayer interface for a game in 2D some of my friends made, and I'm stuck with a huge latency or sync problem.

I started by adapting my game to the msdn xna network tutorial and right now when  I join a SystemLink network session (1 host on PC and 1 client on Xbox) I can move two players, everything is ok, but few minutes later the two machines start being totally out of synchronization. When I move one player it takes 10 or 20 seconds (increasing with TIME) to take effect on the second machine.

I've tried to :

Create a thread which calls NetworkSession.Update() continuously as suggested on this forum, didn't worked.

Call the Send() method one frame on 10, and the receive() method at each frame, didn't worked either.

I've cleaned my code, flushed all buffers at each call and switched the host and client but the problem still
remain...

I hope you have a solution because I'm running out of ideas...

Thanks

SendPackets() code :

    protected override void SendPackets()
    {
        if ((NetworkSessionState)m_networkSession.SessionState == NetworkSessionState.Playing) //Only while playing
        {
            //Write in the packet manager
            m_packetWriter.Write(m_packetManager.PacketToSend.ToArray(), 0, (int)m_packetManager.PacketToSend.Position);
            m_packetManager.ResetPacket(); //flush

            //Sends the packets to all remote gamers
            foreach (NetworkGamer l_netGamer in m_networkSession.RemoteGamers)
            {
                if (m_packetWriter.Length != 0)
                {
                    FirstLocalNetGamer.SendData(m_packetWriter, SendDataOptions.None, l_netGamer);
                }
                }
            m_packetWriter.Flush();//m
            m_packetWriter.Seek(0, 0);
        }
    }

ReceivePackets() code :

    public override void ReceivePackets()
    {
        base.ReceivePackets();

        if ((NetworkSessionState)m_networkSession.SessionState == NetworkSessionState.Playing) //Only while playing
        {
            if (m_networkSession.LocalGamers.Count > 0) //Verify that there's at least one local gamer
            {
                foreach (LocalNetworkGamer l_localGamer in m_networkSession.LocalGamers)
                { //every LocalNetworkGamer must read to flush their stream
                    // Keep reading while packets are available.
                    NetworkGamer l_oldSender = null;
                    while (l_localGamer.IsDataAvailable)
                    {
                        // Read a single packet, even if we are the host, we must read to clear the queue
                        NetworkGamer l_newSender;
                        l_localGamer.ReceiveData(m_packetReader, out l_newSender);
                        if (l_newSender != l_oldSender)
                        {
                            if ((!l_newSender.IsLocal) && (l_localGamer == FirstLocalNetGamer))
                            {
                                //Parsing PacketReader to MemoryStream

                                m_packetManager.Receive(new MemoryStream(m_packetReader.ReadBytes(m_packetReader.Length)));
                            }
                        }
                        l_oldSender = l_newSender;
                        m_packetReader.BaseStream.Flush();
                        m_packetReader.BaseStream.Seek(0, SeekOrigin.Begin);
                    }
                }
                m_packetManager.ParsePackets();
            }
        }
    }


texts: Would directly modifying vertex array be a good idea in 2D?

texts: I'm currently using opengl es 1.1 for simple 2D drawing and I was wondering if it would actually be inefficient to use the opengl transform functions (since using matrix operations to move a square seems like unnecessary work), and if directly modifying the vertex array would be a better idea.


texts:
In my slick-based game, I have 4 states - introState, gameState, pauseState and menuState.

From the gameState, I want player to go to either menuState or pauseState.
To do that, I did this in gameState:-

public void changeState(GameContainer gc, StateBasedGame sbg)
{
    Input input = gc.getInput();
    if(input.isKeyPressed(Keyboard.KEY_ESCAPE))
    {
        sbg.enterState(2);
    }
    else if(input.isKeyPressed(Keyboard.KEY_SPACE))
    {
        sbg.enterState(3);
    }
}

To return from pauseState to gameState, I did this in pauseState:-

public void changeState(GameContainer gc, StateBasedGame sbg)
{
    Input input = gc.getInput();
    if(input.isKeyPressed(Keyboard.KEY_ESCAPE))
    {
        sbg.enterState(1);
    }
}

To return from menuState to gameState, I did this in menuState:-

public void changeState(GameContainer gc, StateBasedGame sbg)
{
    Input input = gc.getInput();
    if(input.isKeyPressed(Keyboard.KEY_SPACE))
    {
        sbg.enterState(1);
    }
}

As you can see, I want player to go to either pauseState or menuState from the gameState and not from pauseState to menuState or vice-versa.

Unfortunately, due to some unknown reason, when i press escape, it enters pauseState correctly but then if i press spacebar and then press enter, instead of going to gameState it goes to menuState. Any idea why is that happening?


texts:
I am building out my first android game, after some utility app development.

I want to be sure I am not moving into a direction that is not a best practice, so please (constructively) criticize my plan.

My game will have many NPCs that will be added often (>150) in increments of 10-15. Each will have their own stats associated with them and the user will have a unique interaction with each.

Is it possible to put all of the NPC character information into a MySql database and have my app download the new information when it understands that the servers contain new information (via C2DM). Including a link to a file I will host containing the png files for each NPC. This way when there are new NPCs to be added to the game, the user doesn't have to grab an update from the market/Google Play.

Furthermore is sqlite/MySql a preferable method to save the user's game state. I want to be able to save it locally so that it can be loaded without a network connection. And periodically updated on the server to allow the user to play the same game both on a phone and tablet for example.

If I sound like I'm on the right track with my plan, what opensource projects exists from which I can learn/analyse the methods they use to accomplish a similar task? I have been unable to find anything like this as of yet.

EDIT: by >250NPCs I mean that the game will start out with perhaps ten enemies. Each has their own stats (health, strength, magic etc). And since I plan on adding more than 150 types of enemies, I'd like the game to be able to update at run time rather than require an update with Google Play - since many users simply do not update their software on a timely basis, they will be missing out on the added value.

The reason I favor SQL is so that I can easily view my game characters and modify their stats/qualities on the fly should I see the game become unbalanced.


texts:
Possible Duplicate:
  Voice input in games beyond voip chat

I recently made a game  where you say something into the microphone, and the computer repeats it, but I was wondering how to make voice commands, where if you say a certain thing it does something. For example:

I say "Blue" and the background color changes to blue.
I say "Red" and the background color changes to red.


texts:
Note, this is repost from stackoverflow - I have only just discovered this site :)

I need to split a string in Unrealscript, in the same way that Java's split function works.

For instance - return the string "foo" as an array of char.

I have tried to use the SplitString function:

  array SplitString( string Source, optional string Delimiter=",", optional bool bCullEmpty ) Wrapper for splitting a string into an array of strings using a single expression.

as found at http://udn.epicgames.com/Three/UnrealScriptFunctions.html but it returns the entire String.

simulated function wordDraw() {

local String inputString;
inputString = "trolls";
local string whatwillitbe;
local int b;
local int x;
local array<String> letterArray;

letterArray = SplitString(inputString,, false);
for (x = 0; x < letterArray.Length; x++)
{
        whatwillitbe = letterArray[x];
        `log('it will be '@whatwillitbe);
        b = letterarray.Length;
        `log('letterarray length is '@b);
        `log('letter number '@x);
}

}

Output is:

b returns:

  1

whatwillitbe returns:

  trolls

However I would like b to return 6 and whatwillitbe to return each character individually.

I have had a few answers proposed, however, I would still like to properly understand how the SplitString function works. For instance, if the Delimiter parameter is optional, what does the function use as a delimiter by default?


texts: 3D Binary Space Partitioning with solid/empty leaves

texts:
I've recently started looking into BSPs for real-time collision detection, and I'm now looking into improving the performance of my solution.

The system that I've implemented is rather similar to the solution found on wikipedia (https://en.wikipedia.org/wiki/Binary_space_partitioning), where each node contains triangles found located on the node's hyperplane, and references to two nodes found on each side of the hyperplane.

BSP generation pseudocode:

Node generate_bsp(Trimesh mesh)
Trimesh back, front
Node node(mesh[0]) // Generates the plane position and normal of the node
loop (Triangle tri : mesh)
   if (onPlane(tri, node))
      node.triangles.add(tri)
   else if (inFront(tri, node))
      front.add(tri)
   else if (Behind(tri, node))
      back.add(tri)
   // Not fully in front or behind means that the triangle is found on both sides
   // and needs to be split
   else
      Triangle[] trisSplit = tri.split(node)
      loop (tri2 : trisSplit)
         if (inFront(tri2, node))
            front.add(tri)
         else if (Behind(tri2, node))
            back.add(tri)

node.nodeBack = generate_bsp(back)
node.nodeFront = generate_bsp(front)

return node

This means that for a raycast, I iterate over the hyperplanes sorted from front to back, and determine if my ray hits any of the triangles found on each hyperplane.

BSP raycast pseudocode:

Bool ray_intersect_bsp(Vector rayPos, Vector rayDir, Node* BSP)
if (BSP == null)
   return false

if (onPlane(rayPos, node))
   if (ray_intersect_triangles(rayPos, rayDir, BSP->triangles))
      return true
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeFront))
      return true
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeBack))
      return true
else if (inFront(rayPos, node))
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeFront))
      return true
   if (ray_intersect_triangles(rayPos, rayDir, BSP->triangles))
      return true
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeBack))
      return true
else
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeBack))
      return true
   if (ray_intersect_triangles(rayPos, rayDir, BSP->triangles))
      return true
   if (ray_intersect_bsp(rayPos, rayDir, BSP->nodeFront))
      return true

return false

This system however demands using ray-triangle intersection determination, which is a costly procedure. What makes matters worse is that there's a high chance that the triangles you iterate on are missed by the ray, which results in a relatively large amount of costly raycasts that need to be performed before finding the closest hit on the trimesh.

What methods can I use to optimize my BSP structure and traversal?


texts:
Sorry if the title is too broad, I'll try to explain this in a more specific way down here.

We need to create a board-game in Java for an University project and we have to use the mvc pattern for it.

We found helpful to view this board game as a Finite State Machine, so we implemented a slight variation of the State pattern, where the context is the Controller and each state manipulates the model in different ways using commands from the Command pattern.

The states are also responsible to get the user input needed to perform their logic from the view, by displaying widgets and getting the user selection.

So for now, the Model is just a "box", a stateless container of data without any game-logic in it. We had a discussion with our tutor and he frowned us upon because he said we were deviating from the OOP approach.
For example, we have cards in the game which give different effects; in our implementation, we have an "Effect State" which is handling the different effects by controlling their type:

if (effect.type == RESOURCE){
    Command c = new GiveResources(player, effect.resources);
    c.execute();
}else if (effect.type == BONUS_ACTION){
    controller.state = BONUS_STATE;
}...

Whereas he would so something like:

effect.execute(controller);

By passing the controller as a "callback" (forgive me the improper usage) to get inside the effect the input needed to perform its execution.

Now, I understand that our approach is violating in some way the Separations of Concerns principle, by putting game logic in the controller and outside the effects. But, considering that the set of effects is limited (that's why we chose the enum approach), isn't going back and forth between model and controller introducing way too much overhead? Or should the model "own" the game-logic (relating to this question, substituting the boolean with a State field) and call the Controller every time it needs user input?


texts: Any open source editor to make video games online without programming knowledge?

texts:
With Scratch we can create video games online, from its web platform, and publish them on the same web. I could download its source code and use it, as many others already did (see Scratch modifications). Unfortunately, we need programming knowledge to use it. Actually, Scratch is mainly for teaching kids to code.

I also found editors like Construct 2, GameSalad Creator and many others (just type on Google: create a video game without programming). With those editors we can create video games without coding. Unfortunately they are neither open source nor web platform. They need to be installed on Windows or Mac.

Do you know some editor like Construct 2 or GameSalad Creator but open source and executable from a web server? Maybe some HTML5 game engine can do it?


texts:
I'm trying to code a conveyor belt for a project made with LibGDX and Box2D and I would like to make it like this one from Bomberman Land Touch.

As you can see, the entities standing on it should be able to go in the opposite direction moving slower, the ones not moving should just be transported towards the direction of the belt, and the ones going along its direction should go faster.

For a single direction belt I first detect when the center of an entity's body is inside the block, and then with body.applyLinearImpulse(direction) I move the body. This is working fine because it's applying a lower impulse than the one that the player uses to move and by checking the center of the entity instead of relying on the collide event, when the body is between two belts, it doesn't receive two impulses. This is the outcome:

I see two problems with that: the obvious one is that since it's checking the center of the body, as soon as it's in a belt with a different direction, it instantly changes direction without going to the center of the block. The other one is that while going backwards in a turn, it does a little "jump" due to the previous impulse.

I also tried to replicate the Bomberman mechanism by diving the corners into two fixtures but the result is quite the same (except a bug where the player doesn't move, probably because the center doesn't touch the next half of the block):

How can I mitigate these two problems or how can I rethink the whole structure/mechanism of the block?

Edit:
I tried to implement the first part of @Theraot answer with this code:

if (active) {
        for (Entity e : entities) {
            // Check if the origin of the entity is inside the block
            if (getBody().getFixtureList().get(0).testPoint(e.getOrigin())) {
                // Take the x of the entity center if the inputDirection is horizontal, y otherwise
                float entityAxis = inputDirection.y == 0 ? e.getOrigin().x : e.getOrigin().y;
                // Same for the conveyor block
                float blockAxis = inputDirection.y == 0 ? getOrigin().x : getOrigin().y;
                Vector2 impulse = null;
                // If they are really close
                if (Math.abs(blockAxis - entityAxis) < 0.1f) {
                    impulse = outputDirection;
                }
                else {
                    impulse = inputDirection;
                }
                // Apply the impulse
                e.getBody().applyLinearImpulse(impulse, e.getBody().getWorldCenter(), true);
            }
        }
    }

and this is the result.


texts: How irregularly shaped rooms should be placed in a dungeon

texts:
I have made a procedurally generated dungeon that places every room successfully so it is accessible via at least one other room. A 'successfully' placed room is a room who's wall cells are right net to another room's wall cells. This is because there are no corridors in my dungeon, but doorways, 2 cells thick:

       ###########
       #.........#     // Where '[]' is the Doorway.
########.........#
#.....[].........#
#.....############
#.....#
#######

However I have now moved on to procedurally generate irregular shaped rooms, such as 'L' shaped rooms, 'T' shaped rooms, and so on.

I am wondering how I can place, for example, a square room next to an 'L' shaped room, without wasting any space: i.e.:

     ##########
     #........#
######........#
#...[]........#
#...###########
#...#
#...#######
#.........#
#.........#
###########

This is not possible with my previous algorithm because it only took into account the room's bounds, where as now an 'L' shaped room's bounds contains empty space that a square room could possibly fit.


texts: how to store game state for a multiplayer board game eg. poker

texts:
First Approach: Store the state in database and play with database queries. Could a database handle the load, as poker is quite fast paced, and I have to query/update database for each player move.

Second Approach: Store the state in memory. What kind of architecture/implementation is needed to achieve this?

What are the pros/cons of each approach, what other options do I have?

What is the best fit for poker, and/or chess?


texts: How does braking assist of car racing games work?

texts:
There are a lot of PC car racing games around which have this unique driving assist which helps brake your car so that you can safely turn it. While in some games it just an 'assist', it will just help your car brake but won't ensure a safe turn. While in others, the braking assist will help you get a safe turn. I was wondering on what could be the algorithm that is followed to achieve it.

A very basic algorithm I could think of was,

Pre-determine the braking distance of an ideal car for every turn of the track, depending on the radius of the turn, and then start braking the car accordingly. For example, for a turn of less than 90o, the car would start braking automatically at 50m distance from the start of the turn.

A more advanced algorithm, which would ensure a safe turn, could be

Pre-determine the speed of the car at the start of each turn, individually for each track, turn and car. Also, pre-determine the deceleration rate of each car individually, which varies because of the car's performance.
The braking assist would keep recording the speed of the car at a certain instant of time.
Start braking the car appropriately so that the car gets to the exact speed needed at the start of the turn.
For example, let the speed of a particular car at the start of a turn 43m in radius, be 120km/h. Let the deceleration rate of the car be 200km/h2. If, at some instant of time, the speed of the car is 200km/h, then the car would automatically start braking at 400m from the start of the turn.


texts:
I'm making an Arkanoid or Brick Breaker game, but I got confused when I wanted to implement power-ups. The idea is that when you destroy a brick, a powerup-block falls down, and if you catch it you'll get the powerup.  -for example:

Wider Paddle (change dimensions of the quad)
Change ball speed (variable)
Ball goes through blocks (no reflection on hittest)
Shoot lasers from the paddle (change in input handling)

Now I pretty much know how to affect the code to achieve these effects, however not in a clean, flexible way. I have my ie my ball and paddle hard-coded in java (GameObjects), and my Levels/BlockTypes in xml.

One terrible way to do it is to have like a flag telling which powerup is active, and by that alter the code with loads of if- statements.

Could anyone help me with how this is done?


texts: Rendering 10M point that changing position (individualy) at 30Hz

texts:
i'm able with openTk (vb.net) to draw 10M of points adn rendering it.
The problem is that the bind operation take 114mS on every frame refresh.
I need to refresh the position at 30 Hz , so what can i use for speeder this operation.


texts: How do you fully publish a game under your name, under 18?

texts:
This has been a week of stress in trying to get things done correctly. It's all tied with keeping things legal and making sure I don't lose out on benefits of any kid. I have just recently finished up a game and now adding the final touches into it so I can make some sort of income.

I am incredibly sorry if I asked this on the wrong site. I felt that this is still relative to game development because it is the final step of developing your game: preparing yourself for distribution. If there is a better site to ask, or if some one has experience in this field please notify me.

Problems I am having:

I do not own a company, but just about every service I am trying to make use of is asking for a company name:

I do not know where I can find straight facts about owning, buying, or even keeping up with a name.
I am using my full name to publish my works because I read that in similar words, every one was born with a trade-mark known as their name.
I can not afford a company in the first place, I read some where that this can cost from 150 and higher. I have no income like said before and the only way I can think about making money as of this time is through my games which apparently requires me to already have at least a couple hundred dollars or more.

I don't know the most efficient and cheapest way to acquire a Tax ID

I don't know where I can read up on this subject, and apparently I am finding that I need an actual company name again - and I'm not entirely sure I can just use my name.
I'm not sure if there is an age limit on this, and as I currently stand I don't even have a documented signature.
This also costs a couple hundred dollars as I have read and I have no money.

I have no a clue what steps I should be taking for any of this.

I just want to publish games I make without feeling like I'm losing my hard worked time.
I want to be able to publish games without feeling I did something illegal.
I'd like to be able to have advertisers host on my game so I can make little revenue from people who can't afford buying full games.

Edit - In Detail:

I am currently trying to publish games to the google play store for android entertainment applications.
I am trying to use the advertisement service known as "mopub" : http://www.mopub.com/.
This is more like a linker than a direct advertiser that way you can get more benefits of multiple advertisers through your game.
I am living in the U.S

I don't want to quit making games because of issues like so. I can't publish my games right now if I don't have a legal representative name or a way to make money and not have others steal my rights of owner ship to the games I create.


texts: How to use Resources.Load with an AudioClip in Unity?

texts:
I'm trying to load an audio clip that's in my assets directory and play it. Here is my C# script:

if (Input.GetKeyDown(KeyCode.X))
 {
     audioSource = gameObject.GetComponent<AudioSource>();
     Debug.Log((audioSource == null) ? "Audio source is null" : "Audio Source is not null");
     string path = "Sounds/Aurora/Aurora_IGSSin";
     Debug.Log(path);
     sound = (AudioClip)Resources.Load(path, typeof(AudioClip)) ;
     Debug.Log((sound == null) ? "Sound is null" : "Sound is not null");
 }

//Output:
//Audio source is not null
//Sounds/Aurora/Aurora_IGSSin
//Sound is null

There is an AudioSource component attached to this object, as proved by the first Debug.Log(). Attached is a picture of my folder, proving that the file path is correct. I've seen 90 different posts and tried this 81 different ways, including using the file extension in the path, omitting the directory and only including the file name, omitting (AudioClip) before Resources.Load(), using as AudioClip rather than typeof(AudioClip) and none of it has worked.

Please, someone help me before I pull my hair out over this. I'm incredibly flustered over being stuck on something that should be so simple, and I'd like to get on with my project.

My Project Directory:


texts:
I'm making a billiard game and I wanna implement multiplayer in it. Since updating the movement in every frame is inefficient and laggy, I thought I could remake the events in game happen in all clients but for some reason they differ from one another.

The direction that the ball launches is correct but it starts to differ for different users when it collides with other balls(if it collides only with the wall it's fine). Technically this shouldn't happen IMO.

This is the code I use to add force to the player ball:

I use this to launch the player ball

photonView.RPC("FireBall", PhotonTargets.All, storedDirection, power);

This is the function that adds the force to the player ball.

[PunRPC]
    public void FireBall(Vector3 stordDir , float poww)
    {
        rigidbody.AddForce(stordDir.normalized * poww, ForceMode.Impulse);
    }

I use this function to get the desired direction of the player.

public void UpdateStickPosition()
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask))
        {
            if (Input.GetKeyDown(KeyCode.Mouse0)
            {
                storedDirection = hit.point - transform.position;
            }
        }

    }

I appreciate all help given, don't hesitate to ask me any questions.


texts: Unity: From "Normal mode" to "VR mode" back to "Normal mode"

texts:
I want to change my unity application per runtime to a "Vr-Mode" and then switch it back.
Since the VR-Mode changed the camera behaviour and messes with the system i want to use i can not start my program with "project settings" where VR is not active.

Is this even possible?

Is there some kind of a "magic bool" somewhere which toggles the vr on / off?


texts: Which type of Xbox console should I get to begin developing games on it?

texts:
If I want to start developing small indie-like games with XNA on Xbox (I don't think any game I'd make would need more than 100, maybe 200 megabytes), will the 4gb Slim (I want to get a slim version because of the wi-fi) version of the console be enough, or should I get the 250 gb version? I don't really plan to play actively on the console as I'm more interested in developing on it. Also, will a console and a verified student XBLIG account be enough to set up everything I need to run and debug my game on the console?
Thank you.


texts: Restricting character movement to "rails"

texts:
I'm building a Pacman clone in Unity 3D and am now thinking about how to restrict the movement of the player to the hallways that the map is made up of.

Basically, the player is only allowed to change direction at an intersection. When he is not at an intersection, he can only continue to move in the same direction, or reverse by 180°.

The simplest idea I have come up with so far is, to have little un-rendered Boxes with Colliders at every intersection, and when the player collides with one of those, the collider knows which directions the player can go from there.

This seems easy, but a lot of work. Is there an easier way to restrict the movement of the player to given track (as in a railroad), but allow him to change "onto" a different "track" at given points (those would be the intersections)?


texts: How do I scale a rectangle image while retaining its border thickness?

texts:
I want to create a programmatically scalable image like this:  scales to .

Both have a one pixel border. If I scaled from the first to the second in Paint.NET, there would be a two pixel horizontal border, but I want it to keep it single-pixel.


texts:
I am looking for literature - or a simple explanation - on how the Farseer (and for that reason, the Box2D) collision detection system works - specifically the logic that comes after the broadphase culling:

What data structure does it use?
How does it use that data structure to determine if a collision has occurred?
How does it calculate the response normals?

NB: I am not asking how to use it, I merely want to know how it works as a matter of personal enlightenment.


texts: Maya - Black triangles when viewing model from a distance

texts:
Everything was fine while working on a model in Maya, until randomly, numerous black triangles started appearing all over my model. They seem to go away when I zoom in closely with the camera:

This issue seems to be associated with my particular project, I am able to open and view my other models without any problems. Opening this file on another machine has an error message in the Output Window:
"Maya binary file parse error:  : (6) corrupted file structure"

I've tried Googling around and tried (without success):

Normals -> Set To Face
Normals -> Unlock
Normals -> Reverse
Changing various renderer settings

Here's a download link to my .mb:
http://www.filedropper.com/herocharacter

Thanks in advance!