texts: Nothing drawn in Window, not even the clear color

texts:
A few years ago I have followed RasterTek's Direct3D11 tutorials to create a simple application in C++. I'm not trying to convert this very simple sample to C# using SharpDX.

I've got the Window (which I create natively, exactly as in the tutorial) and message loop all set-up. Everything seems to be working. If I make the window's background gray I even see it being gray for a split second, before DirectX takes ownership of it and makes the Window contents black.

So it seems I've done something right, but not everything. Nothing is rendered to the window, not even the clear color. I've compared my code multiple times to my own C++ implementation (which works) and the tutorial's code, but there seems to be a bug in my implementation. Its probably related to how SharpDx wraps the Direct3D library. Maybe I've missed something?

Below are (what I believe to be) the bare essentials. Anyone spot the error? (Or alternatively anyone who can direct me to a good starters tutorial which covers the nuances of SharpDx?)

    private readonly SwapChain SwapChain; private readonly RenderTargetView RenderTargetView; private readonly Texture2D DepthStencilBuffer;
    private readonly DepthStencilState DepthStencilState; private readonly DepthStencilView DepthStencilView; private readonly RasterizerState RasterState;

    private readonly D3D11.Device Device;private readonly DeviceContext DeviceContext;

    public D3DObject(int screenWidth, int screenHeight, IntPtr hwnd)
    {
        // Set up the swap chain
        var swapChainDescription = new SwapChainDescription()
        {
            BufferCount = 1,
            Flags = SwapChainFlags.None,
            IsWindowed = true,
            ModeDescription = new ModeDescription(screenWidth, screenHeight, new Rational(0, 1), Format.R8G8B8A8_UNorm),
            OutputHandle = hwnd,
            SampleDescription = new SampleDescription(1, 0),
            SwapEffect = SwapEffect.Discard,
            Usage = Usage.RenderTargetOutput,
        };

        D3D11.Device.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.Debug, swapChainDescription, out this.Device, out this.SwapChain);
        this.DeviceContext = new DeviceContext(this.Device);

        // Get the backbuffer from the swap chain
        var backBuffer = this.SwapChain.GetBackBuffer<D3D11.Resource>(0);

        // Create a view of this backbuffer
        this.RenderTargetView = new RenderTargetView(this.Device, backBuffer);

        // Set the render target on the window
        this.DeviceContext.OutputMerger.SetRenderTargets(this.RenderTargetView);

        // Set-up the rasterizer
        var rasterizerStateDescription = new RasterizerStateDescription()
        {
            CullMode = CullMode.Back,
            DepthBias = 0,
            DepthBiasClamp = 0.0f,
            FillMode = FillMode.Solid,
            IsAntialiasedLineEnabled = false,
            IsDepthClipEnabled = true,
            IsFrontCounterClockwise = false,
            IsMultisampleEnabled = false,
            IsScissorEnabled = false,
            SlopeScaledDepthBias = 0.0f
        };

        this.RasterState = new RasterizerState(this.Device, rasterizerStateDescription);

        this.DeviceContext.Rasterizer.State = this.RasterState;
        this.DeviceContext.Rasterizer.SetViewport(0, 0, screenWidth, screenHeight);
    }

    // Called at the start of rendering
    public void BeginScene(Color4 color) // Color is CornFlowerBlue: {Alpha:1 Red:0,3921569 Green:0,5843138 Blue:0,9294118}
    {
        this.DeviceContext.ClearRenderTargetView(this.RenderTargetView, color);
    }

    // Note: nothing is rendered in between

    // Called at the end of rendering
    public void EndScene()
    {
        this.SwapChain.Present(0, PresentFlags.None);
    }

Note: I create the device with the DebugFlag, but I also see no debug overlay.


texts: How should a hive AI distribute tasks between worker drones?

texts:
I've been studying AI design—things like behavior trees and FSMs. They make sense from the perspective of deciding a specific entity's goal and action.

However, the AI in my game is very hive-like; multiple drones share the same knowledge and desires. What a particular drone can do is unimportant, as each can do any task. Instead, it's a question of which drone would be the best choice for a particular task, given the list of tasks to be done.

For example: The AI decides it wants a particular resource type gathered. Different resource types are available at various locations across the map. Which drone should it send to gather the resource? All are capable, but some might be further away from the resource. Some might already be gathering a different resource. Some might be performing tasks that the player is actively waiting on, or that strongly affect the player's success.

To decide, the AI would need to evaluate various factors and continually re-evaluate as the game progresses, without stepping on it's own toes and continually reassigning jobs to the same drones.

Is there a field of AI suited to this sort of task distribution that I can look into?


texts: How do I implement side scrolling in a javascript platformer?

texts:
I'm building a side scrolling platformer with Javascript and the canvas element for a school project. I have the character all sorted out. He runs left and right, and has a different sprite set for standing still. The game has gravity, and I can jump. Now what I can't get my head around is how to implement side scrolling.

The game world will be tile based. Each tile will be 20x20 pixels. When the character gets to the edge of the screen, it should scroll with the character to explore the level further.

Can anyone point me in the right direction to a resource that explains how to programmatically do this? Language specific to Javascript would be good, but anything would be a help.


texts: Is there a command line ATI texture compression tool?

texts:
Is there a command line tool that can convert PNG and JPG files to ATITC compressed textures?

I have my own export pipeline that converts all textures to PVRTC, ATITC, and DXT, so I have no use for a GUI-based tool like the Compressonator. Also, I'm running on Linux (although Wine might be able to handle simple conversion tools).


texts:
My perception of scene nodes is that they are just containers for Mesh objects with transformations.

After viewing some open sources graphics APIs (e.g Irrlicht), I noticed they call many not-to-be-rendered related objects (such as LightSceneNode, CameraSceneNode, etc) scene nodes, having them inherit SceneNode properties as well. Why is that?

Also, why in Irrlicht is it possible to call sceneNode->setMaterialTexture() and other material related methods? I thought that materials are property of Mesh objects and not SceneNode objects.


texts: How can I load a scene when starting a new game if the loading scene have a Main Camera?

texts:
The problem is that if I turn the camera on enabled in the editor it will show part of the scene mixed with the main menu scene. And if the loading scene main camera is enabled off I will get error Display 1 No cameras rendering.

I have two scenes in the Hierarchy.
The first is Main Menu. The main menu have a camera.

Now I did that when I click on the button START A NEW GAME
It will load another scene:

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

public class NewGame : MonoBehaviour
{
    public void StartNewGame(int SceneIndex)
    {
        SceneManager.LoadScene(SceneIndex);
    }
}

In this screenshot you can see in the Inspector I'm calling the method StartNewGame and the index 1. Index 1 present the second scene that should be load: The Space Station

Now in the scene: The Space Station I have also a MainCamera under Player. The MainCamera is turned off in the editor. And I need somehow to switch between the Main Menu scene camera and the The Space Station scene camera.

If I will turn on the MainCamera in the inspector I will see some objects of the first scene and the second scene and then the game will start without the main menu and the player will fall down.

If I start the game when the MainCamera is turned off I will the Main Menu but then when I click on START A NEW GAME it will show me the message Display 1 No cameras rendering.

The last screenshot is of the Build Settings: Edit > Build Settings...
I added the two scenes to the build. The first scene at index 0 is the Main Menu the second scene at index 1 is The Space Station:


texts: How to stop Objects with Rigidbodies from explosion when dragging

texts:
I have a sequence of capsules linked with fixed join and each capsule have a Rigidbody and a cube collider (the picture bellow shows how it's look like)

and this is the drag script I applied on it

public class MouseDrag : MonoBehaviour
{
Vector3 screenPoint;
Vector3 offset;

bool dragging = false;

Rigidbody rigid;

void Awake()
{
    rigid = GetComponent<Rigidbody>();
}

void OnMouseDown()
{
    screenPoint = Camera.main.WorldToScreenPoint(transform.position);
    offset = transform.position - Camera.main.ScreenToWorldPoint(
        new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));

    dragging = true;
}

void OnMouseUp()
{
    dragging = false;
}

void FixedUpdate()
{
    if (dragging)
    {
        Vector3 point = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
        Vector3 dest = Camera.main.ScreenToWorldPoint(point) + offset;

        rigid.AddForce((dest - rigid.position) * 200f);
        rigid.velocity *= 0.8f;
    }
}}

it works but at some point of the drag all the capsules explode and all the other components do the same thing

after some research I found some people says that the Rigidbody did the problem but I couldn't understand why or how it did the problem ?

Here is a link to a small video of the problem :
https://drive.google.com/file/d/1Ia3X356L_VaIGIrDAdLyZHG9K5k71S1j/view?usp=sharing


texts: Can I accept unicoins for micro-payments in my game?

texts:
I'm developing a free-to-play game on Android and iOS and Facebook. I see that Unicoins can be purchased in many ways, a lot more that I'll ever be able to implement myself (Paypal, Bitcoins, Gold, Reddit karma! I mean: wow!).

Is there a way I can accept them as micro-payments and then turn them back into real money?


texts:
I'm trying to write an easy to use and extremely modifiable game engine in C++. I was thinking about using a tree to store game data. All objects would inherit a from the Node class and would have parents and children. For example to access an object you could make a request the tree for game.workspace.player or game.devices.controller. I've seen this done in other games and it seems to work well.

Is this worth implementing? Would it affect the performance of my engine? -- I'm just looking for the best way to organize game data. Any critique or insight is greatly welcomed!


texts: How to use blender files in your own engine?

texts: It is not trivial to use your own shader on blender, so I've created a good-looking webgl shader. Now, what do I need to use the things I made in blender on it? An obvious first idea would be to parse the blender format. For that, I need to know it's specification: what does it include? Meshes? Bones? Animations? Vertex colors? What else? But I guess there could be easier paths, though. Maybe an exporter from Blender to an easy-to-understand JSON format exists? So that is my question, what is the fastest path to use blender files with my webgl renderer?


texts: FMod, Multisound Module not looping in game

texts:
I am currently trying to implement a simple soundtrack in the Unity3D Angry Bots Demo using FMod. I created an event with a Multisound Event, containing 2 loops a 16 Bars. The event is 16bars long and inside a Loop Region. I set the the Module to loop (not the individual loops) and the Playlist mode to random. When I trigger the the event from inside Unity3D using .play() the event plays, but after 32 bars there's silence. After a while the module starts playing again. I Believe the module waits a couple of bars before it triggers another loop. I have Quantization set to tempo (though I think that makes no difference in my case).

Are Multisound events the right way to go - or am I missing something else?


texts: XNA : Character walking on tiles and getting stuck

texts:
I develop games for my own pleasure and also to share experiences with my kids learning coding.

Lately I have been working on a classic retro platform game using XNA and Farseer.

One issue I am having is that my characters sometimes get stuck while walking on tiles.
These tiles are blocks put next to each other.
It seems that sometimes when reaching the edge of the next tile, character get stuck.

I have read several solutions over the internet:

Make a weldjoint - did not fix my issue
Use an edgeshape - haven't found out how to do this yet
Make one big shape out of my several tiles (the background floor for example) - haven't found out how to do this yet

A video can be seen here. You'll see that I have sometime to jump in order to be able to move on, otherwise I simply get stuck. I also commented and shared my sources here.

For now, as a nasty trick, I create circle bodies rather than rectangles. It does reduce the issue but not completely and I feel this is an ugly workaround anyway.

Would any one be so kind as to point me in the right direction or provide me an example? I write in VB.NET but can adapt a C# example if needed.


texts:
Say I have a set of .fbx files which contain all my bones, meshes and animations. I want to make use of these in the finished application i.e. rather than converting them all to .xnb I just want to load the .fbx files at runtime. I've got AssImp importing them, MonoGame.Framework.Content.Pipeline processing them, but now I have a ModelContent object which is not usable as a Model (unless I'm missing something obvious).

Can I convert these to Model without passing them to a ContentWriter/ContentReader?


texts:
I've just written my first successful collision detection code, and it works great for a small scene of actors (player + 4-5 obstacles).

However, I realize that since it checks every possible collision for each actor in the scene, it checks each possible collision in the scene twice (Does A collide with B? Does B collide with A?).

With a small number of objects that may be colliding, this is not a problem, but it seems to me that it could slow things down in a very busy scene if every collision is checked twice.

Should I go ahead and rewrite it to check each collision once, or would that be a premature optimization?


texts: How do I calculate a line segment that is a certain number of degrees from another line segment?

texts: I have a line segment that is at an arbitrary angle in 3D space. I want to (in code) draw another line that shares an end point with the first line and has an angle of arbitrary degrees between them. The second line will partially overlap the first in the XZ plane.


texts: Unity3D: 'Physics' does not contain a definition for 'Raycast'

texts:
I'm a complete beginner in Unity 3D, and I'm following a video training. In the video the instructor uses the following code to open a door using raycast:

using UnityEngine;
using System.Collections;

public class HelloRaycasting : MonoBehaviour {

    bool doorClosed = true;

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {

        Vector3 backward = new Vector3 ( 0, 0, -1);
        Vector3 origin = this.gameObject.transform.position;

        if (Physics.Raycast( origin, backward, 1f) && doorClosed) {
            doorClosed = false;
            GameObject.Find ("Left_Quad").transform.Translate ( new Vector3(-.8f, 0, 0));
            GameObject.Find ("Right_Quad").transform.Translate ( new Vector3(.8f, 0, 0));
        }
    }
}

It works just fine for him. But when I try to run this on my computer I get this error:

  Assets/HelloRaycasting.cs(20,29): error CS0117: 'Physics' does not
  contain a definition for 'Raycast'

In the end I'm not able to access none of the properties and methods of the Physics class.

I'm using Unity 5.3.2f1 (64-bit). What am I doing wrong?


texts: Should larger Unity Projects use Visual Studio

texts:
I've worked with several engines and I'm most comfortable with a mature engine, world editor and C++ codebase.

I'm now looking at Unity as a side-project and have mostly been working in Javascript.

Has anyone done a large scale project with Unity and does it require Visual Studio or is sticking to the Javascript approach best?

Are there any big pitfalls with large scale Unity projects or with working with Visual Studio?

Most the stuff I've seen has been focused at smaller Indies or people with little experience.

I should have phrased this as an external IDE, Visual Studio is just my IDE of choice


texts:
I am trying to write a shader that takes multiple colors and applies them to a B&W texture. Now, 3 colors works just fine, but i will need 6 in order for this to function. If somebody could please explain how adding more colors would work or refer me to some documentation that would be appreciated!

What i have so far is the following (tex = B&W texture, _Middle = 0.5):

fixed4 c = lerp(_ColorA, _ColorB, tex.y / _Middle) * step(tex.y, _Middle);
c += lerp(_ColorB, _ColorC, (tex.y - _Middle) / (1 - _Middle)) * step(_Middle, tex.y);

Source: http://answers.unity3d.com/questions/1108472/3-color-linear-gradient-shader.html


texts: How to add clickable text link in Game Maker Studio 2?

texts: I was wondering if anybody knew how to add text, that when clicked, would take you to another website in Game Maker Studio 2.


texts: What is an OpenGL equivalent to ID3DXSprite?

texts: As a Direct3D developer I can use the ID3DXSprite class (in D3DX library) for drawing 2D graphics. What's the best way to implement this functionality in OpenGL?


texts: How do I make an object face the mouse position, but only on one plane?

texts:
I want a game object to turn and look towards where the mouse was clicked (in world space).  It works well when considering all 3 dimensions, but I really only care for the plane formed by the x and z axis, not the y.

I've tried to fix this by setting the y of the directionTarget to the y of the object's position, but that gives weird results.

My code looks like this:

Quaternion rotationTarget;
    float rotationLerpProgress;
    float rotationLerpDuration = 1f;

    // Use this for initialization
    void Start ()
    {

    }

    // Update is called once per frame
    void Update ()
    {
            if (Input.GetMouseButtonDown (0)) {
                    var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
                    RaycastHit rayHit;
                    if (Physics.Raycast (ray, out rayHit)) {
                            var rayHitPoint = rayHit.point;
                            var rotationDirection = transform.position - rayHitPoint;
                            rotationDirection.Normalize ();
                            //rotationDirection.y = transform.position.y;
                            rotationTarget = Quaternion.LookRotation (rotationDirection);
                            rotationLerpProgress = Time.deltaTime;
                    }
                    //targetPosition = Camera.main.ScreenToWorldPoint (Input.mousePosition);
            }

            if (rotationTarget != transform.rotation) {

                    transform.rotation = Quaternion.Lerp (transform.rotation, rotationTarget, rotationLerpProgress / rotationLerpDuration);
                    rotationLerpProgress += Time.deltaTime;

                    if (rotationLerpProgress >= rotationLerpDuration) {

                            transform.rotation = rotationTarget;
                    }

            }

    }

I must be missing something. How do I do this right?


texts: ForceMode in AddTorque in Unity game development

texts:
In UNITY game development platform while programming in C# I came across a method to add torque to component: public void AddTorque(float x, float y, float z, ForceMode mode = ForceMode.Force);
In this Function what is meant by ForceMode?


texts:
I started on my first game; and now im confused how to handle the player SaveGames. I use google-play-services to persist the user's save games across devices, and I am keeping a local save too.

So the problem is how do I manage conflicts (server vs local).
I have attached Save DateTime on he file and there is general data included.

So this is what im doing right now :

I check the number of coins and gems, the level the player has and if all those are greater than or equal to the other save, i take the first save;
In all other cases i ask the player what copy to keep; displaying the infos in each save file;

I would like to minimize asking the player which file to keep;
(These problem arises only if the player uses multiple devices; Or sometimes he plays locally for a while; and signs in to his acc which already has a save file)

I think you get the idea. I would like to automate everything and dont want the user to go sad just because he misclicked on the local-copy when he had awesome stuff in the server-copy.

I need the idea please :)


texts: do games use multiple threads to play music?

texts:
Do games use multiple threads to play music and other operations besides things like server connections and sockets?

And is that why when the game freezes (for any reason) the music can sometimes keep playing, because only the game thread is slowing down?


texts: Android Opengl: Alternate values for gl_FragColor

texts:
I'm writing an Android application that utilizes opengl to perform some changes to the camera output.  I've written my code in such a way that I finally figured out what is causing the performance issue.

#extension GL_OES_EGL_image_external : require
precision mediump float;
uniform samplerExternalOES sTexture;
uniform vec4 vColor;
const int MAX_COLORS = 6;
uniform float vHues[MAX_COLORS];
uniform float vOffsets[MAX_COLORS];
varying vec2 v_CamTexCoordinate;

float rgb2hue(vec4 c) {
    vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
    vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
    vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));

    float d = q.x - min(q.w, q.y);
    float e = 1.0e-10;
    return abs(q.z + (q.w - q.y) / (6.0 * d + e));
}

bool isInRange(float a1,float a2, float vOffset) {
    if(a2 < 0.0) {
        return false;
    } else if(abs(a1-a2) < vOffset) {
        return true;
    } else if( a1 > a2) {
        return (1.0 - a1 + a2) < vOffset;
    } else {
        return (1.0 + a1 - a2) < vOffset;
    }
}

vec4 getGrey(vec4 c) {
    float grey = (c.r + c.g + c.b) / 3.0;
    return vec4(grey, grey, grey, c.a);
}

void main() {
    vec4 c = texture2D(sTexture, v_CamTexCoordinate);
    bool hasColor = vHues[0] >= 0.0;
    float hue = rgb2hue(c);
    vec4 test = getGrey(c);
    for(int i=0; i < MAX_COLORS; i++) {
       if(isInRange(hue, vHues[i], vOffsets[i])) {
          //If I uncomment this line the performance gets terrible
          //test = c;
       }
    }
    gl_FragColor = test;
}

There is a significant hit to performance (a lot of frames are skipped) when I uncomment the line above.  I basically want to use the original color sometimes and a different color depending on some condition.  It works but is there a more efficient way to do this?  Also, why does this perform so poorly?


texts:
Currently I have a working 2D SAT collision system with only boxes, but works with static rotations as well, leaving room for triangles. One of the issues I've been able to resolve was tunnelling, thanks to this thread's psuedocode that I got working for myself.

Problem is, this doesn't support moving rotations like a system using a minimum-translation-vector. If I rotate alongside the side of an object, the system will fail even if I'm not moving.

My first thought in solving this was to use the longest line you can draw in a square (that being the points on either side of a square) and comparing the length of that to whatever side on any axis, but even squares have different sizes on any given rotation projected onto an axis.

The system also doesn't work with multiple objects, because - while you can use the algorithm on a group of objects and find the shortest distance out of all of them - if I conserve my velocity relative to the colliding axis, diving into the crest of 2 objects means I will phase through one of them not beyond a 45 degree angle.

Is there an effective way to resolve collisions on rotations and groups of objects, while using this anti-tunnelling algorithm? I don't care if it's expensive, I'll take whatever you can think of.


texts: How do I know when a player has crossed a point threshold?

texts:
I’m needing help figuring out logic when adding a time bonus to my game.

I only want to reward the player with extra time if they level up.

Currently when the player’s score is less than 100 no bonus is given. If the player’s score reaches 200 I want to reward the player with some bonus time.

My issue is if the score is 190 and then jumps to 210, the 200 level mark is passed and the player isn't rewarded.

If I turn on the logic to say if the score is between 190 and 210, it could reward the player at the 190, 200, 210 mark or skip from 180 to 220, bypassing the reward altogether. I have tinkered with the idea of setting a bool BonusFlag, but the same issue arises, when I set the flag.

Can anyone help provide some logic on how to overcome this obstacle?


texts:
I'm trying to give shapes in my physics engine roundness/ curvature.

I am aware of various methods for mathematically defining curves; such as bezier-cruves, ellipses, etc. However I am not sure which methods would be most appropriate for use in my physics engine, because speed, feasibility of construction, and flexibility of each method must be considered. I want a system in which a user can easily form fairly complex curves, but still make the intersection calculations simple and fast.

My physics engine is also purely continuous, which means I must be able to calculate the time in which curves will collide with other curves and lines based on a constant linear/angular velocity.

What techniques are there for mathematically defining a 2D curve?
What are the advantages/disatvantages of each in terms of speed, flexibility, and  simplicity of construction?
Is the technique feasible for an engine where predictability of shape intersection is crucial?


texts: Synchronizing mob states in online multiplayer game

texts:
I'm developing an exploration-based platform game in which from the start there were plans about including local multiplayer support, but recently I've been considering an online multiplayer mode, mainly because in local multiplayer, because I think it'd make players loose too much visibility to be worth it, I don't want to split the screen between players. It'd be akin to Spelunky.

But I really want for players to be able to explore rooms independently just as much as cooperatively (in the style of Kirby & the Amazing Mirror, for GBA), and online multiplayer would solve this problem of local multiplayer, but I've been wondering what exactly I could do about synchronizing the states of mob between the clients whenever the players are in different rooms. For example, what do I do when a player enters a room in which players were already meddling with the monsters and the evironment, how do I update him with everyone's states?

This question and its answers suggest that I keep a host which is constantly updating the various rooms with players and from them I can provide each client with only the significant data, but what significant data do I need to send my players? Before multiple rooms all that I needed to send was input and random numbers (not much, my game has fixed timesteps), but now I need to send the whole data of entities? After all, each creature has plenty of variables that influence in its AI and physics, as I'm dealing with a platformer.

What are the alternatives?


texts:
Are there any good IDE's for linux that lets us edit GLSL shaders and visualize their effect?

Note : Shader Designer By Typhoon Labs is a good option but I am looking for alternatives as this software has some issues with Ubuntu 11.10


texts: Which is the best method implementing a background scrolling for game in libgdx?

texts:
My question is very simple I am new to libgdx development, which is the best approach implementing a background that is to make the background move in y direction

1)My First approach is drawing the background image 10 times towards positive y direction using camera.translate(x,y) function to move camera from bottom to top
2)second approach is to make the camera still while making the background scroll ie drawing the background frame by frame updating the position each time

Can you please suggest which is the best approach?


texts: How to simulate backspin or topspin in a box2d billiard game?

texts:
I am designing a simple billiard game with box2d. I think I can easily simulate hitting left or right side of a ball. Since box2d is not 3D, however, I am not sure how to simulate hitting upper or lower part of ball with a cue.

In case you are not familiar with the game. If the ball is hit on its upper part, it's still going forward after hitting another ball. But when cue hit on its lower part, it should backspin as soon as striking another ball.

Is this simulation possible with box2d? If so, a hint or reference will be appreciated.


texts: Want to create pokemon fan-game, need advice on copyright

texts:
I want to create a pokemon text game. Obviously I will use various stuff that belongs to Nintendo, like pokemon, professor, region names and sprites from the games. Can Nintendo sue me or take down my game and for what? What are the possibilities?
I think it's important to note that:

It is a text adventure game that lacks any mechanics of known official games
It is going to be absolutely non-profit, I won't accept any money, including donations, for my creation
It is going to be based on a website
I'm not expecting more than 1000 users per day to visit it
To sum up, the IP of Nintendo I want to use are pokemon sprites and various names, copyrighted by Nintendo
There are a lot of pokemon web-games operating like neopets that weren't currently shut down

I would be very thankful for any advice or help!
p.s. Sorry for my bad English, that's not my mother tongue. :^)


texts: Is using sprite sheets and drawing specific part the way to go?

texts:
I'm programming in Java.

I have more than 200 MB of images used in my games, something like 100000 40x40ish images. I initially wanted to load them all during app initialization but it took like 2 minutes to do so.

Since I do not need them all at the same time I may load the ones I need before entering a new game state (quick loading screen), but there is still a delta time that I can't afford, so I was wondering if it wouldn't be better to gather them into larger images (sprite sheets) to reduce the cost of I/O. But here I am : if I do so, what is the best approach for rendering : splitting these big images back into smaller ones, or keeping the sprite sheets in memory and rendering the needed parts of these sheets directly using Graphics#drawImage?

I will test a simple game loop using the second option to see what happens performance-wise, and come back to compare with what you advice me to do.

I hope I was clear, don't hesitate to ask me to reword an incomprehensible of mine.

EDIT: I just tested loading using sprite sheets and I was able to do load my 200 MB in less than 10 seconds, which means that if rendering little parts of an image can be done at high rate my problem is solved.


texts: What knowledge would I need to make a good simulation game

texts:
I have an idea for a game like theme park but don't know how simulation games are made.

I am not on my first game so I would appreciate constructive answers instead of "its hard, don't do it".

What I want is to know how simulation game mechanics are put together. I figure it would be heaver on the AI than normal games and not knowing much about AI would like to know some programming techniques I should look into for this style game.

Specific techniques please not just a book on AI.

What sort of architecture would be used? I guess it would have some sort of probability engine with pre designed events that are triggered based on the AI state.

Would it use a Finite State Machine (FSM) or be purely event driven?

Any information on how a sims game functions would be cool.


texts:
I've been trying to build upon a blog post on Gamasutra http://www.gamasutra.com/blogs/DarrelCusey/20130221/187128/Unity_Networking_Sample_Using_One_NetworkView.php
In this I would like to spawn a sphere on the server and move it about and when it moves have the movement sent to the clients. On the GUI on the server I just want 3 buttons, spawn sphere, move left and move right. Ive been able to get the sphere to spawn fine, but when I press the button to have it move left or right nothing happens. Have I thought about this too simply? Where have I went wrong or what have I not included?

//***New Code***
        if(GUILayout.Button ("Spawn sphere"))
        {
            Instantiate(spawnedSphere);
            Debug.Log("sphere spawned");
        }
        if(GUILayout.Button ("Move Sphere Left"))
        {
            spawnedSphere.rigidbody.AddForce(new Vector3(-5000, 0, 0));
            Debug.Log("Sphere went left");
        }
        if(GUILayout.Button ("Move Sphere Right"))
        {
            spawnedSphere.rigidbody.AddForce(new Vector3(5000, 0, 0));
            Debug.Log("Sphere went right");
        }

        //***End New Code***


texts: What causes SDL2 error 0xc00007b when running my game on other people's computers?

texts:
I made a game using SDL2 and made it available for download.
However, I first tried to install and play it on a different computer, to no avail. I made sure to copy all the .dlls and install all the runtimes, yet I still get error 0xc00007b.

Am I doing something wrong?


texts: Best way to store player actions and movements and repeat them

texts:
I am developing a tile based game to help improve my skills, there will be an entity spawning and following the player, to get around the various obstacles around the map i think that the best way would be for the entity to simply shadow the players movements.

What is the best way to store the players action e.g. jump, move left/right etc.

Would there be an alternative better way for the entity to hunt down the player?


texts: If I release code under GPLv3, can I specify what parts of users' code can be released under a new license?

texts:
I have a few questions about what users of my engine could copyright in their own project. The way the engine would work would be that it would be a standalone program in Java that would load all of the scripts/assets/data from a folder that the game takes place in. The code could be written in Python or compiled to Java.

Onto my questions, the code that they write would access some parts of my engine through Jython, and so I assume those would have to be released under the GPL. But what about the rest of the game other than the code? Like could they copyright their own art?

I guess what I really want is that modifications of the code of the engine must be released under the GPL, but projects created using my engine can be released under any copyright, as long as they obey they distribute the engine itself under the GPL.


texts:
What are some open source AI Bot interfaces?  Similar to Pogamut 3 GameBots2004 for custom Unreal Tournament bots or Brood Wars API for Starcraft bots etc.

If you could please post one AI bot interface per answer (make sure to provide a link) and give a brief summary as to the content of the blog posts.

Please include what type of bot interface structure it is, client/server, server/server, etc

e.g. BWAPI is client/server which emulates a real player


texts:
I have created a gorilla and its animations in Blender, exported the file as an FBX file and then imported it in Unity. The animations works fine in Blender, the loop is perfect for the walking animation. When I play the animations in Unity (in the animation preview and in game) it glitches at the moment where it loops, the arms make a really strange quick move. Is there anything special to do to export Blender animations ? Tell me if you need more informations.

Here is the link to my blender file, if you want to try exporting it and import it in Unity.


texts: How to avoid position increment by velocity multiplied by delta time even the body is not moving?

texts:
In the below image, the character texture is properly sync to body even moving on free space.

In the below image, the character is moving downward. But the texture got a span or not sync properly, when there is an obstacle or a wall.

The systems I've use for the data logic (ECS)

class MovementSystem extends IteratingSystem {

      @Override
      public void processEntity(Entity entity, float deltaTime) {
            PositionComponent position = ...
            VelocityComponent velocity = ...

            position.x = velocity.x * deltaTime;
            position.y = velocity.y * deltaTime;
      }

}

class PhysicsSystem extends IteratingSystems {

      @Override
      public void processEntity(Entity entity, float deltaTime) {
           PositionComponent position ...
           BodyComponent body...

           position.set(body.getPosition());
      }

}

class RenderingSystem extends IteratingSystem {

      @Override
      public void processEntity(Entity entity, float deltaTime) {
           PositionComponent position ...
           SpriteComponent sprite ...

           batch.draw(sprite.texture, position...);
      }

}

I know the problem is in the part of MovementSystem positioning, the position is still incremented by velocity multiplied by delta time even the body is not moving while pressing move button.


texts: SDL2 - Ignoring repeated key input until key is released

texts:
I'm currently using SDL_GetKeyboardState to capture key states once per frame. This works great for input that I want to handle for as long as a key is pressed (i.e character movement) but creates a real problem when I want to respond to a key press only once while the key is held down. Currently, even a rapid key press+release occurs over 2-3 frames, meaning the input is handled that many times instead of just once.

In short, is there a simple way to handle input once when a key is pressed, and then ignore that key until it's released and pressed again?

Just to mention, I've already looked at using event.key.repeat to see if a key has been repeated, but this only seems to work when the key has been pressed for a certain period of time (in my case 10+ frames)

Thanks in advance


texts:
I am building a gaming system where many players can play together some sort of table game. There could be hundreds of game tables at the same time. The system consists of several components where main components are gaming servers and DBworker and in between there is rabbitMQ. DBWorker is something that takes care about databases.

So, I need to make sure that each game has unique ID to properly track results of the games. I would love to have some sort of auto-increment solution. Of course I can do some sort of sequence in PostgreSQL DB and pull new ID every time but for me it seems as an obvious bottleneck (I don't want to be linked to DB all the time. In case DB goes down show must go on while our engineers recover DB).

So, any ideas or personal experience of implementing something similar?

p.s. I am thinking about timestamp as ID but real ID would be better. Cannot figure out why - if I am wrong, please correct me.

Thank in advance for everyone!


texts: How does the render performance of Magicavoxel objects compare to standard Cube objects?

texts:
What would be easier to render by the computer:-
1) an obj made in magicavoxel of 50*100*1.
2)an cube in unity with same dimensions with any material or an png image.


texts: What games benefit strongly from using motion controls?

texts:
A lot of games use motion controls, be it Wii, Kinect or otherwise, but for most of them, this control scheme seems forced. What are the games that benefited the most from using motion controls (as in, if they were to be controlled by a traditional controller, it would detract from the experience)? Having such examples could help one make the decision of whether those controls are beneficial for what they are developing

For example, Super Mario Galaxy is a great game, but its use of shaking the remote to jump is quite arbitrary and does not add to the experience. On the other hand, Flower uses sixaxis in such a way as to make it part of a great experience.

(I know this question borderlines Gaming SE, but their FAQ prohibits "Catalogues". I decided to put it on this SE, as having good examples of how to do things well is a valuable resource for anyone hoping to achieve similar greatness.)


texts: MonoGame/XNA 3D fbx model produces strange rendering output

texts:
The Problem:

I have been making a model of a Steampunk-themed street light in Blender for use in my MonoGame/XNA Game. To test it I exported it to the *.fbx file format using the fbx export plugin for Blender.

After setting everything up in the code and starting the game, that was the result:

As you can see some of the triangles are missing or their vertices are connected in a wrong way. In addition to this you can recognise two additional faces on the top that were not intended to be there.

I am using a pretty standard code to render my model with a BasicEffect:

        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (ModelMeshPart part in mesh.MeshParts)
            {
                part.Effect = effect;
            }
            mesh.Draw();
        }

What I tried so far to solve the issue:

Searching on Stackexchange, no result
Asking Google, no result
Playing arround with the GraphicsDevice settings was either not solving the problem

    gDevice.RasterizerState.CullMode = CullMode.None;
    gDevice.DepthStencilState = DepthStencilState.Default;
    gDevice.BlendState = BlendState.Opaque;

Downloading the latest Blender version and exporting again did not solve anything despite the fbx plugin was updated
I also suspected a problem with the normals so I recalculated them in Blender but it did not help too

What software/hardware did I use?

Surface Pro 2 (intel core i5 with intel hd 4400 graphics)
Blender 2.75a
Visual Studio Express 2013
MonoGame Framework(I believe its version 3.4)

So here are my questions:

What is causing this result? Could it be a problem with MonoGame/XNA or a problem with Blender/the fbx exporter (or my export settings?)?

Did maybe one of you had such issues with fbx models and MonoGame/XNA?

I would very appreciate any guesses, help or solutions from you. If you need more Information, just ask for it. Thanks in advance.


texts: Unity3D - How to make partially selected EditorGUI.Toggle?

texts:
I have nested group of toggles created with EditorGUILayout.ToggleLeft().

I want to change state of the parent toggle to partial check if child toggles have mixed states, like here:

But EditorGUILayout.ToggleLeft value is a boolean value, so how can I do that?


texts: What does a "video system not initialised" error in pygame mean?

texts:
I'm trying to play music when a key is pressed in pygame, then print a message.

When I run this script:

import pygame
import time

pressedkeys = pygame.key.get_pressed()

pygame.init()                      #initialize pygame
pygame.mixer.pre_init(44100, -16, 2, 2048) # setup mixer to avoid sound lag

try:
    firstMusic = pygame.mixer.Sound("C:\(pathForMyMusicFile).wav")  #load sound
    secondMusic = pygame.mixer.Sound("C:\(pathForMy2ndMusicFile).wav")  #load sound

except:
    raise UserWarning, "could not load or play soundfiles"

if pressedkeys[pygame.K_SPACE]:
    firstMusic.play(-1)
    time.sleep(2)

I get this error:

pressedkeys = pygame.key.get_pressed()
pygame.error: video system not initialised
Script terminated.

What am I doing wrong?

I'm using Stani's Python Editor.


texts: How to convert velocity (Vector) to m/s (Scalar)

texts: I have a variable called velocity which I get from a dynamic body in Box2D. It is the velocity of a pirate ship and when I add torque to the ship I want that to be proportional to the speed (m/s - 10px = 1m). My problem is that I can't divide/multiply a float (proportionalTorque) by the Vector2 quantity of the velocity so what I need is a way of getting the speed (m/s) from the velocity or if there's any other way of multiplying a float by a vector that'd be useful too.


texts: So I've set up my program, know how to get everything going except for one thing: indices. I've been stumped as to how I retrieve that set of data. Does anyone know what I function I need to get them? Thanks in advance!


texts: Unreal Engine 4: Referencing an asset with asset user data instead of a class?

texts:
I created a subclass of Uassetuserdata, creating a new type of asset. Now I can reference this new class in the user asset data section of my skeletal mesh. I noticed that I could create a blueprint subclass of this new class, blueprint that I can put anywhere in my project and call from the user data section of my mesh.
Now I'm wondering, is it possible to call an asset belonging to my new class and not the class directly in the user data asset section? An asset that wouldn't be a blueprint. I did create a new factory for my new class so that I can spawn assets of it in my project, but I can't call them in the asset user data section of my mesh, only the class itself. I'm pretty sure I saw someone do it once but I can't remember how. Do you have any ideas? Thank you!


texts: What's the performance benefit of saving all logged in characters in MMOs in regular intervals?

texts: The majority of MMORPGS have a Worldsave system that will save all the characters once every X hours. I guess the reason is performance. So why is this better, performance wise, than saving a character on disconnection?


texts:
I'm working on a pretty basic 2D platformer and I'm wondering if I could get advice on an issue I've run into. To keep collision detection simple I'm using AABBs and separating axis tests for collision detection and this works fine for most cases. The problem is that when something is moving too fast my algorithm gets confused and returns a bad correction.

For example; the hero stands at the very edge of a platform (1-5px from the edge) and jumps. When the hero falls back down to the platform he travels through the platform (> 5 pixels) and then my collision detection moves him beside the platform and the hero falls to his doom. I understand the reason - being on the edge of the platform the hero is penetrating the object more on the y-axis as it its the x-axis and I'm choosing the smaller distance to correct by.

The immediate answer is to change my movement code so it does multiple tests for a few locations between the objects start and end position but the OCD bit of my brain complains about wasted cycles, etc...

Before I start gutting my code I was wondering if there was a more elegant way to solve this problem? Am I wrong in my assumptions? Have I managed to bugger up AABB SAT tests? Should I use a different algorithm?


texts:
How do I keep the sprites in my game nicely pixelated on screens of all sizes and resolutions? I use nearest-neighbor texture filtering when resizing pixels, but this works well only at really high magnifications, otherwise the pixels get distorted and uneven.

I understand the limits of nearest-neighbor scaling and I wouldn't be asking this except there are so many games that use pixel art without this problem, so I figure there is some trick I don't know about.


texts: Multiple images written and read from one meta-file?

texts:
Short version:

I need a way to store multiple image files in one bigger file, to be used using C#, preferably easily compatible with XNA. The files will be read, written to, but also adaitional files will be added during run-time.Is there an easy way to do that?

Long version:

I'm currently working on a small student project. It's a top down RPG-strategy and we decided to make the map dynamic, meaning that portions of it will be loaded/unloaded in the background while the player character moves around.

I reckon the best way to do this is to load/generate chunks as the player comes close to them and unload them when the player goes farther. I reckon the best way to do this is to save chunk as raster graphics and then use the colour information (RGBA) to store information.

The problem is that I want certain chunks to be saved once generated so I need a way to save images, in the same way I read them, but preferably all in a single file, so as not to have the folder bloat in size with a lot of files.


texts: What files can I delete from my project folder?

texts: I have a large Unity project and I want to put the source code online. I tried to do it in GitHub but I am out of quota for LFS, so I decided to just zip the project folder and put it on the cloud. Before I do this, I would like to make the folder as small as possible. What files can I delete from the project folder, such that anyone who downloads the remaining files will be able to use my project?


texts: How do I make an entity move in a direction?

texts:
I have an Entity instance which is updated every game tick. Let's just assume that entity moves forward constantly. I'd like to be able to give the entity's angle to a function that makes it move in that direction:

moveForward(90); should make them move to the right. If I declared my rotation as a global int, then doing

moveForward(rotation);
rotation++;

would make it trace a small circle with its movement.

How can I do this? I assume this involves vector math; I don't know any, so a brief explanation would be nice.


texts: How to make a video game map that can be used by Android?

texts: I am interested in developing games for the Android OS. I have played Replica Island and I have browsed over the source. I found that the levels/maps were in a .bin format. I could execute them because they were in an Android format. So how could I make a game map/level that could be used in my game? What program would I use? How could I load the map in Java (for Android)?


texts: lerp vector2 to target vector2 at constant rate

texts:
I am struggling to figure out how to lerp one vector2 to a target vector2 at a constant rate. I can do it as a percentage of the total x, y distance like so:

lerp(start, current, target, pctSpeed) {
  return current + pctSpeed * (target - start);
}

calling it as such:

speed = .02

// game loop
Update(timestamp) {
  x = lerp(startX, x, targetX, speed)
  y = lerp(startY, y, targetY, speed)
  resultingVector2 = {x: x, y: y}
}

which correctly lerps x and y by 2% of the distance between the start and target vector2 each frame. How do you do this at a constant rate, i.e instead of 2% a value of 2 or .2 or 3, etc. Thanks


texts: How can I retrieve the outer most points on a 2d graph?

texts:
I have a 2d graph which has some points plotted on it.

What I need to do is get only the outer most points so that I can connect them up (isn't really relevant).

What I can't seem to wrap my head around is the algorithm that I need to use in order to do this?

I think this might help you understand what I want to achieve:

o o o
o x o
o o o

All the o's I want to get and the x I want to ignore. Also, the points can be in any position and any shape but I still want to only grab the outer most points.

Any ideas? Thanks.


texts: Creating a static background when using camera transforms in Allegro 5

texts:
How can I draw a static bitmap for the background of an Allegro 5 graphics window, if I'm using camera transformations to apply perspective to bitmaps in front of the background so it appears that they're otherwise in a 3D space?

If I try simply drawing a bitmap to the backbuffer without any transforms applied, and then call al_use_transform on a perspective transform when drawing the other objects, the "background" moves along with the transform.


texts: Where do I have to put actions when the game state changes

texts:
I’ve just started to learn Unreal Engine implementing a clone version of Atari’s Pong game.
I’m thinking about where to put the code to change the state of the game. I have an enum in the GameState class to manage when the game hasn’t started, or when we are playing the game. In case when someone scores I decided that I have to stop the ball and move it to its initial position.
My problem comes here because I don’t know where to put the code to do that: on GameMode class or on GameState class.
Where do I have to put that code?


texts: Minecraft Forge setTextureName method not working

texts:
I am attempting to make an item using the latest version of Forge. For some reason, the setTextureName method gives me an error that says:

  The method setTextureName(String) is undefined for the type ItemKey

I have been trying to fix this for a while, and notice that when I remove the quotation marks from the colon the error for setTextureName disappears, but I get an error on the colon that says:

  Syntax error on token ":", delete this token

an error on the + sign that says

  The operator + is undefined for the argument type(s) String

and finally an error on "key" that says

  The method setTextureName(String) is undefined for the type ItemKey

This is my first time trying to make an item, so help would be greatly appreciated.

EDIT: I just figured out that if I change MODID to modid in the setTextureName method I stop getting an error message for setTextureName but instead get an error for modid saying that

  modid cannot be resolved or is not a field

package com.arti.artismod;

import net.minecraft.item.Item;
import net.minecraft.creativetab.CreativeTabs;

public class ItemKey extends Item {
    private String name = "key";
    public ItemKey() {
        setUnlocalizedName(ArtisMod.MODID + "_" + "key");
        setTextureName(ArtisMod.MODID + ":" + "key");
        setCreativeTab(CreativeTabs.tabMisc);
    }
}


texts: Percentage of object inside a moving rect

texts:
The idea is that I want to get a percentage of the position of Rect2 in relation to Rect1. In the picture, it would be about 75/80%. Rect2 never leaves Rect1. I move Rect1 around all the time, so it should work regardless of Rect1's position.

I had something like this, but it didn't work as intended:
((Rect2.X + Rect1.X) / (Rect1.Width + Rect1.X)) * 100

Rect1.X would work as an offset so the calculation would "ignore" the moving around of Rect1. Or that was the idea...


texts:
I am having a problem drawing the "Game Over!" text once the user is on the last tile.

This is what I have:

The Update and drawText methods are in a class named turtle:

public void Update(float scalingFactor, int[,] map, SpriteBatch batch, SpriteFont font)
{
    if (isMovable(mapX, mapY - 1, map))
    {
        position.Y = position.Y - (int)scalingFactor;
        angle = 0.0f;
        Program.form.direction = "";

        if (mapX == 17 && mapY == 1)// This is the last tile(Tested)
        {
            Program.form.BackColor = System.Drawing.Color.Red;
            drawText(batch, font);
        }
    }
}

public void drawText(SpriteBatch spritebatch, SpriteFont spriteFont)
{
    textPosition.X = 200; // a vector2
    textPosition.Y = 200;
    spritebatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
    spritebatch.DrawString(spriteFont, "Game Over!!!", textPosition, Color.Red);
    spritebatch.End();
}

This update is in the Game1 class:

protected override void Update(GameTime gameTime)
{
    // Allows the game to exit
    if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
        this.Exit();

    turtle.Update(scalingFactor, map, spriteBatch, font);

    base.Update(gameTime);
}

I have also added the font content to LoadContent:

font = Content.Load<SpriteFont>("fontType");

What am I doing wrong? Why does the text not want to show on game completion? If I call the turtle.draw() in the main Draw method. The "Game Over" text stays on screen from the beggining. What am I missing?

Thanks


texts: (Unity Engine) Is it possible to make 2d animation bones perfectly straight within the sprite editor

texts: I am experimenting with pixel perfect camera and 2d animation. I noticed in the skinning editor that there is no option to edit bone coordinates. When I make an ik it extended the arm making it noticeable  that the bones weren’t perfectly aligned. so im wondering if it is possible to make a bone perfectly vertical/horizontal within the skinning editor.


texts:
My game does not exit entirely even after calling dispose() method. It loads a black screen when I launch it for the second time and works well if I kill the game manually and restart it.

I get an error that says buffer not allocated with newUnsafeByteBuffer or already disposed when I try to dispose off the SpriteBatch object. This is were I suspect the problem to be. But not able to fix it entirely. Please help!

Here is how I have built it (I have put the sample code here just to show you guys that there are no visible loop backs in dispose function, please correct me if I'm wrong)-
In game screen,

public void dispose() {
  AssetLoader.dispose();
  render.dispose();
  Gdx.app.exit(); }

Under class AssetLoader-

public void dispose(){
  Texture.dispose();
  sound.dispose();
}

Under game render class -

public void dispose(){
  spritebatch.dispose(); //throws an error when I GameScreen.dispose is called
  font.dispose();
  shaperender.dispose();
}

I believe that my spritebatch isn't disposing which is causing the black screen but I cannot find a way to dispose it off successfully. Any help would be greatly appreciated.


texts:
Im making c++ && sfml game for my teacher.
I need to make game class naturaly I make constructor and destructor, but I cant figure out what methods should game class contain.
curently it has these : init() - init all variables and other stuff
(before I moved to c++  I was making games in HTML,JS but I never used OOP there. So I have no exp. doing games like this)


texts: Understanding the Microsoft Permissive License

texts: I want to use certain parts of the Game State Management Example in a game I'm making, but I'm not sure how to do this legally. It says in the license that I'm supposed to include a copy of the license with it. So if I make a Visual Studio Solution, I just add the license.txt to the solution? Also, if I use a class and change it, do I have to keep the license info at the top or add that I changed it or what?


texts:
i'm doing a simple game/application with some minimal 2d graphics: png textures and ploygons with standard glVertex calls

my setting:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, w, 0, h);
glMatrixMode(GL_MODELVIEW);

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

code for textures:

texture = glGenTextures(1)
glBindTexture(GL_TEXTURE_2D, texture)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA,     GL_UNSIGNED_BYTE, textureData )
newList = glGenLists(1)
glNewList(newList,GL_COMPILE);
glBindTexture(GL_TEXTURE_2D, texture)
glBegin(GL_QUADS)
glTexCoord2f(0, 0); glVertex2f(0, 0)
glTexCoord2f(0, 1); glVertex2f(0, height)
glTexCoord2f(1, 1); glVertex2f( width,  height)
glTexCoord2f(1, 0); glVertex2f(width, 0)
glEnd()
glEndList()

...

glCallList(newList)

i've found this code here: http://disruption.ca/gutil/introduction.html

if i render any texture with glCallList i no more visualize plygons! what could it be? i'm stucking with some combinations of glBlendFunc but i'm getting nothing goos..


texts: How to calculate the Screen Position of a bounding sphere/box?

texts:
Synopsis:  What I have is an object rendered on the screen.  I need to calculate the top-left / bottom-right of it's location on the screen in Screen Coordinates.

Explanation:  The object is basically a box that I'm trying to draw sprite textures into at specific locations, but due to the screen resolution being a variable (dependent on player settings), I can't hard-code in these translations.  So what I need to do is find out what the bounding box of the object is in Screen-Coordinates.  Once I know the bounding box, I can calculate the offsets to the positions within it.

I can calculate the center position of the box already with a function I scavenged:

public Vector2 GetScreenPoint(Matrix objMatrix)
{
    Matrix mat = objMatrix * mCamera.mViewMatrix * mCamera.mProjMatrix;
    Vector4 v4 = Vector4.Transform(new Vector3(0, 0, 0), mat);
    return new Vector2((int)((v4.X / v4.W + 1) *
        (pGame.GraphicsDevice.PresentationParameters.BackBufferWidth / 2)),
        (int)((1 - v4.Y / v4.W) *
        (pGame.GraphicsDevice.PresentationParameters.BackBufferHeight / 2)));
}

But now I need to go from that to the actual extents of the bounding box.  I've tried converting the BoundingSphere of the model into a BoundingBox and then translating the object matrix by the BoundingBox.Min values, but I'm nowhere near the left side of the object.

Am I going about this backwards, or what am I not seeing?  This would seem a simple enough thing to do, but I just can't figure it out.  Or is there a complete different way I should be approaching this?


texts: A* Pathfinding Finding One of Many Goals

texts:
I have my A* pathfinding algorithm right now working such that given a graph it can find the route from one starting node to one goal node.

This works well for many problems, but sometimes I find that multiple goal nodes are valid.

For example, in a game, an NPC might have to go to a switch to shut a door. If there are multiple switches that shut the door in question, it doesn't matter which switch it goes to - it just needs to go to one of them.

How can I augment my pathfinding algorithm to find the path to the best goal (the shortest path)? As in, the algorithm searches for multiple goals and when it finds just one, it returns the path to that one.

One solution would be to run the algorithm as many times as there are valid goals, but you can guess why that might be inefficient.


texts: How to make a GameObject ignore a camera effect?

texts: I have a 2D game and I wanted to apply bloom to the main GameObjects so I attached the effect onto the main camera, however the background also gets affected by the bloom and it gets all shiny. How can I make it ignore the bloom effect?


texts: I have a Minecraft like world where I statically create one instance of each tile type, and then place it around the world. However, I don't know how to actually change individual attributes for each tile. For instance, I need to change the lighting per tile, but if I do, it'll change the color of ever single tile. I was thinking about storing two arrays per chunk, one for the tiles and one for the light, and when I want to change the lighting, I can just change the value in the lighting array that coincides with the position in the tile array. However, this will mean I'll have to have store twice as much data per chunk, but is it something I have to accept?


texts: How to draw a diagonal sine wave line renderer

texts:
I'm trying to use a LineRenderer component to draw a sine wave from point A to B and I'm using mouse position. However what I did so far is not working as expected, it just draws a sine wave along the x-axis and it's not diagonal.

private void Update()
{
    if (Input.GetMouseButtonDown(0))
    {
        Vector3 newPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        newPos.z = 0;
        CreatePointMarker(newPos);
        GenerateNewLine();
    }
}

private void CreatePointMarker(Vector3 pointPosition)
{
    Instantiate(linePointPrefab, pointPosition, Quaternion.identity);
}

private void GenerateNewLine()
{
    GameObject[] allPoints = GameObject.FindGameObjectsWithTag("PointMarker");
    Vector3[] allPointPositions = new Vector3[allPoints.Length];
    var pointList = new List<Vector3>();
    for (int i = 0; i < 50; i ++)
    {
        var dir = allPoints[0].transform.position - allPoints[1].transform.position;
        float x = dir.x * i;
        float y = Mathf.Sin(x * Time.time);
        var sine = new Vector3(x, y, 0f);
        var tangentLine = allPoints[0].transform.position + sine;
        pointList.Add(tangentLine);
    }
    SpawnLineGenerator(pointList.ToArray());
}
private void SpawnLineGenerator(Vector3[] linePoints)
{
    GameObject newLineGen = Instantiate(lineGeneratorPrefab);
    LineRenderer lRend = newLineGen.GetComponent<LineRenderer>();

    lRend.positionCount = linePoints.Length;
    lRend.SetPositions(linePoints);
}


texts: Is dynamic casting Entities A good design?

texts:
For my game,

Everything inherits from Entity, then other things like Player, PhysicsObject, etc, inherit from Entity. The physics engine sends collision callbacks which has an Entity* to the B that A collided on. Then, lets say A is a Bullet, A tries to cast the entity as a player, if it succeeds, it reduces the player's health.

Is this a good design?

The problem I have with a message system is that I'd need messages for everything, like:
entity.sendMessage(SET_PLAYER_HEALTH,16);

So that's why I think casting is cleaner.


texts: Button mapping of an Xbox 360 controller for windows

texts:
I can't get a clear answer on the rest of the internet. What are the joystick buttons for left and right triggers?

I'm on Windows, if it matters.


texts: Multithreading for a mixed-genre game in Python?

texts: So here's the situation.  I'm making a game that mixes two genres; arcade shooter and puzzler.  They don't intertwine TOO much; all the interaction that really goes on is that every time an enemy is destroyed, a block is created.   The blocks aren't even a part of the main collision detection system; they have their own more suited to their needs.  What I want to ask is this; might it be a good idea to have the arcade shooter portion run on one thread, and the puzzle game portion run on another?


texts:
Regarding the code shown in this video at 13:50:
When I try: surface = GetComponent (); surface.Bake();
I am getting the following error message:

UnityEngine.AI.NavMeshSurface does not contain a definition for bake
and no extension method Bake of type UnityEngine.AI.NavMeshSurface
could not be found "are you missing an assembly reference

I am struggling to get the dynamic navmesh working with Unity 2017.1.


texts: What is a good way to test demand for a new game platform?

texts:
I'm working on a game platform that turns your iPhone, android or iPad into a steering wheel, for racing games (like need for speed and dirt 3) and flight simulators for example.

I'd love to figure out smart ways to figure out whether gamers would like something like this.

I originally asked this question over on the gaming SE and it was for getflypad.com. A lot of the tech is built and most of it is doable - the question here is how to test demand and know whether gamers actually want this.


texts: Using one GLSL shader program for textured and untextured rendering?

texts:
Rather than have two separate shaders in my OpenGL code (one for when a texture is bound, one for when none is bound) I usually go for one shader program which handles both.  This is my usual fragment shader:

#version 330

uniform bool textured;
uniform sampler2D sampler;

in vec4 fColor;
in vec2 tCoord;

out vec4 final_color;

void main()
{
    vec4 texel = vec4(1.0, 1.0, 1.0, 1.0);
    if (textured)
        texel = texture(sampler, tCoord);
    final_color = fColor * texel;
}

In a modern OpenGL profile, this compiled but did not output anything but black pixels (alternatively in LWJGL legacy profile, it outputted regular colors if textured == false and textured if textured == true).  I don't see any reason that this wouldn't work, but what is a method which would work for both textured and untextured fragments?

EDIT:

My Shader Class
My Main CPP File


texts: I'm using UE4 and blender. I was wondering what the process is of preparing in the 3D software and then making a head burst animation upon headshot. I don't want to do destructible meshes because they are sharp jagged fragments... I want it to literally burst and splash blood. How can I do this? Any support is appreciated.


texts: Does TCP slow down server and other clients for MMO game

texts:
hi guys i made a server and client for mmorpg game of course very amateurish. i am using UDP to send coordinates if the packet is lost doesnt matter i am already sending 10 times in a second. UDP doesn't slow down server and server doesn't slow down other clients. But i also want to use TCP for ID PW and attack skill because when i use attack skill he needs to go absolutely to server. If i use TCP for them, Will client1 slow down Server ? or Will Server slow down other clients ?

i am using c++,opengl,SDL 1.2 and SDL_net 1.2

I will be grateful for your help :)

EDIT I ADD VIDEO :D : youtu.be/J7Ulh4vUBu0 when only udp server loop 658982 in a second like at the end of the video if i add tcp this valuse slow down ?


texts:
So I have four "boards" made of 16 sprites (4x4). Each board is parented to an empty GameObject. I would like to randomly generate their positions but I am not sure how. However, they should still be generated at the middle of the screen not like anywhere off. So basically each board can be placed at any position but must touch at least one of the boards. The sprite of one board should line up with the sprite of the other board. For example:

So yeah any help is appreciated!


texts: Unsure where to right click to delete Unreal C++ class

texts: Trying to delete a c++ class (this should not be this difficult!) and I have deleted the .h, .cpp, and binaries.  Next everybody says "now, right click on your .uproject file and select Generate Visual Studio files."  Where do i right click it?  I can't find the file in Visual Studio, and it doesn't give the option to generate the files in my file browser.  Sorry about the noob question, but I 've google searched to no avail.  thnx.


texts: DirectWrite and Set Character Spacing - Trouble using extended DW functionality

texts:
I'm having a hard time grasping the problem getting the newer/extended functions in dwrite_1.h to work with my existing code and hope that someone here can shed some light.
This is my existing set up...
 // HEADER
IDWriteFactory* pDWriteFactory_ = nullptr;
IDWriteTextFormat* pTextFormat_ = nullptr;
IDWriteTextLayout* pTextLayout_ = nullptr;
IDWriteTextRenderer* pTextRenderer_ = nullptr;

//CPP File in my PrepareText() Fcuntion.
hr = pDWriteFactory_->CreateTextLayout(
    str.c_str(),
    str.size(),
    pTextFormat_,
    gfx.GetWindowWidth(),
    gfx.GetWindowHeight(),
    &pTextLayout_);

I would like to be able to use the IDWriteTextLayout1::SetCharacterSpacing function outlined here :
MSDN Link
However if I change my IDWriteTextLayout* to be IDWriteTextLayout1* I get an error as  pDWriteFactory_ cannot be initialised with an IDWriteTextLayout1 as an argument. This error occurs if I change IDWriteFactory* to an IDWriteFactory1* also.
What am I missing? Many thanks!


texts: How can I deal with tilemap position in the editor?

texts:
Right now it is quite hard in Unity 2017.2 to track where is the (0, 0) coordinate in the tilemap editor, when painting. I tend to use a displayable dummy game object as a marker.

I'd like to also edit two different sets of tilemaps. One set* of tilemaps is located at (0, 0, 0) absolute position, and another set of tilemaps in, say, (32, 0, 0) position. However it is quite confusing to me (perhaps there is an option, but I can't find it) when trying to guess where is the internal center of the currently focused tilemap, to start painting. If somehow I had to paint several different tilemaps (more than two sets, say), I'd get easily dazed by the tool.

(* A set of tilemaps is not any kind of special objects, but just a concept embracing several tilemaps in the same position).

Question: Does Unity provide a way in the editor/UI to know the place of the (0, 0) coordinate inside the tilemap (when editing and focusing a specific tilemap)?


texts: What is the purpose of a "press start" screen?

texts:
A lot of games start with their intros and vendor videos, and then show a "Press Start" screen before the actual main menu.

I never quite figures out the purpose of this. Why not go to the main menu directly? The only possible explanation that made sense to me is that when multiple controllers are connected it allows to identify the one that the player wants to use.


texts: Rigidbody2D moves on x axis without adding force

texts:
I'm currently trying to learn some Physics2D in Unity. Now, I've created a Ball (sprite) and added a RigidBody2D and a CircleCollider2D on it.

The RigidBody2D has the following settings:

Bodytype: Dynamic
Simulated: true
Use Auto Mass: false
Mass: 1
Linear Drag: 0
Angular Drag: 0
Gravity Scale: 25
Collision Detection: Continous
Sleeping Mode: Start Awake
Interpolate: None

Now, when I start the scene, the ball drops as expected. However, it's also moving on the x-axis by ~83 pixels, which I don't want. The movement on the x-axis stops once it reached that ~83 pixels point.

If I freeze the x-position in the Rigidbody2D-Settings I get the intended behaviour (ball just dropping on y-axis), but I feel like that would be a hack instead of fixing the actual problem.

What could cause this? I expected the ball to just drop, if I have no drag, a certain mass and gravity enabled.


texts: World War Game units and resources mechanics

texts:
I'm currently building a world war game with a timeline between the first world war up to current days. In the game there will be many fighting units with a diversified range of classes and sub-classes. Also there will be around 5 to 6 resources where the player will have to manage because every equipment will have a different trend on cost. Some examples that I have in mind for resources:

Money (Main resource. Used to build buildings and fund researches);
Manpower (Used mainly to make disposable infantry units);
Steel (Used everywhere in fighting units. Used a lot in armored units);
Oil (The heavier, the costlier);
Rare Materials (Used in... I'm not really sure where);
Electronics (Used in modern units);

Here are some examples of fighting units:

Early Anti-Tank Gun

Class: Anti-Tank
Sub-class: Stationary

Self-propelled artillery

Class: Artillery
Sub-class: Self-propelled

Motorized Rocket artillery

Class: Rocket Artillery
Sub-class: Motorized

Machine Gun

Class: Infantry
Sub-class: Machine Gun

And I'm currently facing two problems:

There will be many fighting units and as time passes the player will have to retire some of its older equipment. And the problem is that warfare and the purpose for each war equipment changes through time, so: how do I classify all these fighting units from a very broad timeline?
Also I'm trying to make the player have a very balanced army. If he decides to go full on planes he will soon lack some resource that is crucial to building planes. Or if he spams cheap infantry he will run out of manpower, so: How do I balance the player resources? Which ones should I use? (This can also be manipulated so that in the future I can have a world map where the player plays as a certain country that has a higher production of a given resource in a way that he can play/is forced to play with a certain army configuration)

I'm currently making this system of units and resources to later have many playing modes like world conquest, survive waves of incoming enemy units, missions with rewards, and many others.

Two sources I'm currently using: Wikipedia (for information on technologies used during a given time and trying to make a classification system) and Hearts of Iron 4 (the resources system). My game will be played on the browser (until I change my mind), so It can't be very calculation-intensive such as HoI4. Current prototype is in pure JavaScript that simulates a very simple the battle.

This is my very first game that is more than a couple of source files long and that will probably require a lot more thinking than coding at first.
I'm currently very lost. I feel like if I go head-on making the game and the user interface I will eventually hit a wall because "I haven't thought enough" about how the game mechanics.

Edit:

The battle mechanics is almost done. If needed, I can describe it how it is, but think of it as a very simple one, like machine guns and artillery are good against infantry, anti-tank... well..., planes are good against bombers, CAS against land units and so on. Also there will be ships and submarines...


texts: I am using photon unity networking right now to make a multiplayer game. When I publish to windows the build works fine, but when I change unitys build settings from windows to webgl it gives my a invaliduriexception. It also does not work when I publish it to webgl. I tried looking for a answer on google but it does not seem like anyone else has had this problem.


texts: Unity Animator default values overwriten

texts:
I have created a project to reproduce the problem I'm currently facing.
I'm running a simple unity animation that moves a game object and expect to be able to reset the gameobject position. This can be done by adding an empty animation, that (since it does not change anything) simply writes the default values, thus returning our gameobject to its original position.

But here is where things get complicated: if the animator gameobject is set inactive while the animation is running, new incorrect defaults values will be saved when gameobject is activated, and I am unable to reset my gameobject position.

To reproduce this issue, run the attached project:
(Download from here)

Change the stop method to "PlayEmpty"
Hit Start Animation and watch the left "Hello world" text travel.
While it is traveling, click Disable Text GO. The left text disappears.
Click Enable Text GO and see the text comes back at its last location.
Click Start Animation and watch the left "Hello world" text travel.
Click Stop Animation - the text is returned to the position where it was when enabling the gameobject, rather than its original position.

Any help is welcome, suggestions on how to change the code to make the above scenario work.

Thanks,
Yaniv


texts: What's the name of the rendering problem I describe here?

texts:
I don't remember how is it called that rendering problem that you have when you get fast movements (a sprite moves fast for example from right to left) and you have half of the image in a position and half in another for a given frame (for example the top left of the sprite moves correctly but the bottom half of the same sprite is lagging back).

In particular I'm using SFML2 but this is kinda a Library-Agnostic question.

And what are the most common methods to fix it?


texts:
I'm building a physics engine in OpenGL, and I'm a little bit confused on how framerate independence is achieved.

At the moment I'm using glutTimerFunc to cap the framerate at 30 FPS. Is there a way to do this without capping it but not have my objects running around like crazy when I run the application at a higher framerate?

I'm thinking that I need some sort of measure of distance relative to the rendering speed. Are there any articles/tutorials you may know that would help me out?


texts: Develop a Wii U game without official dev kit

texts:
I was looking for unity for Wii U game development. But it seems that I need the approval of Nintendo to have the software (and special hardware) (ref: https://wiiu-developers.nintendo.com).

Is there a way to have the software and to replace the hard with an emulator ?

I just want to make a game for fun, I can't afford the official SDK (Rumors says it about $5000)

If it is possible, I would love to have some ressources (I couldn't find anything...)

Thanks :-)


texts: What's a viable way to get public properties from child objects?

texts:
I have a GameObject (RoomOrganizer in the picture below) with a "RoomManager" script, and one or more child objects, each with a 'HasParallelagram' component attached, likeso:

I've also got the following in the aforementioned "RoomManager"

void Awake ()
{
    Rect tempRect;
    HasParallelogram tempsc;

    foreach (Transform child in transform)
    {
        try
        {
            tempsc = child.GetComponent<HasParallelogram>();
            tempRect = tempsc.myRect;

            blockedZoneList.Add(new Parallelogram(tempRect));
            Debug.Log(tempRect.ToString());
        }
        catch( System.NullReferenceException)
        {
            Debug.Log("Null Reference Caught");
        }
    }
}

HasParallelgram is an empty script with a public Rect set in the editor and nothing else.

Unfortunately, attempting to assign tempRect = tempsc.myRect causes a null pointer at run time.

I've done some more digging, and the reason for the null pointer is relatively simple - the RoomManager script gets woken ("Awake") before the HasParallelagram script gets instantiated ("Start").

It's an issue of timing - I need to wait until all objects have been instantiated before calling the RoomManager. Does Unity support a means of doing that?

What's the proper way to get a child's component?


texts: Unity's rendering statistics window applied to mobile phones

texts:
Unity has the ability to display in game statistics to help developers via the rendering statistics windows. This information shows information such as triangles and verts being rendered, audio level, fps, main and render thread operations time, etc.

I understand the importance of this information yet I'm still struggling to apply it into mobile phones. In this case I want to know how this information can be tied to mobile phones so that I can easily adjust my game to be suitable for low end phones as well as doing the opposite case.

For example, I want to make a big scene for the player, yet I need to keep an eye out on the triangles being drawn, however I don't know a numeric range to keep this triangles in between for the execution of the game.

¿Is there a way to calculate the maximum values that a phone can handle based on the phone's specs? ¿Should I just keep everything at the lowest, sacrificing graphics for better performance? ¿Or should I just do a trial and error on several phones until I find an equilibrium point between graphics and performance?


texts: Hello I have a pretty simple question, I'm new to jmonkey and I want to add a .jpg file to the /assets/textures folder and dragging and dropping the file doesn't appear to work for me.


texts: Why are all my brushes black when I test the level I built with Hammer?

texts:
In Valve's map-making tool Hammer, I have created several brushes which I use as walls, ceilings, and floors. I've added textures to them, and I have a light entity on the ceiling. all the props and entities in the game are textured and visible.

Unfortunately, when I try to play the map, all the brushes are black. There are no textures or colors besides black on the brushes.

What could be causing this issue? I have tried compiling the map with HDR off, and HDR on, but receive the same effect.


texts: Frame Buffer couldn't be constructed: incomplete attachment error on nexus 7

texts:
So I am running into an issue where I cannot load my game onto the nexus 7 because of the error stated previously. I read online that this is because the device can't use the Format class or something like that but I find this funny because I ran the game on the device with the framebuffer earlier without any problems. The game runs perfectly fine on the nexus 5.

EDIT

Code breaks here in the initialization process.

buffer = new FrameBuffer(Format.RGBA8888, (int) gameWidth, (int) gameHeight, false);

Here is a part of the stacktrace

java.lang.IllegalStateException: frame buffer couldn't be contructed: incomplete attachment.
at com.badlogic.gdx.graphics.glutils.Framebuffer.build(FrameBuffer.java:171)

Here is the Framebuffer:171 code

if (result == GL20.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT)
throw new IllegalStateException("frame buffer couldn't be constructed: incomplete attachment");


texts: Axis Aligned Spatial Division : Divide space into random rectangles?

texts:
I need a method to divide 3d space into random axis aligned box shapes. For now
I am currently dividing the 2d space for testing purposes. The most immediate approach I came up with was to define a rectangle of size (1, 1) and then recursively split all existing rectangles to two uneven rectangles alternating between axis X and Y.

The problem here is obvious. This approach results in long stretching lines (marked in red)

What I would like is something more organic looking (I included an example)

See, no long straight lines from top to bottom or left to right.

The only constraint is that I may wish to limit the minimal size of the rectangle without affecting the granularity of the sizes. i.e. if the smallest rect is 1 square centimeters than the seconds smallest room should not be 2 square units.

So ideally the algorithm should meet all three following constraints:

Rectangles are not infinitesimally small.
Rect sizes aren't discrete multiplication of the smallest rect size. i.e. if the smallest rect is 3 square unit than larger rects are not constrained to be 6, 9, 12 and so forth square units and instead could be 3.2 or 4.7 for that matter).
The algorithm runs in polynomial time (needs to compute fast).


texts: Collisions between moving ball and polygons

texts:
I know this is a very typical problem and that there area a lot of similar questions, but I have been looking for a while and I have not found anything that fits what I want.

I am developing a 2D game in which I need to perform collisions between a ball and simple polygons. The polygons are defined as an array of vertices.

I have implemented the collisions with the bounding boxes of the polygons (that was easy) and I need to refine that collision in the cases where the ball collides with the bounding box. The ball can move quite fast and the polygons are not too big so I need to perform continuous collisions.

I am looking for a method that allows me to detect if the ball collides with a polygon and, at the same time, calculate the new direction for the ball after bouncing in the polygon.

(I am using XNA, in case that helps)


texts: Is it possible to give an animated GIF a transparent background?

texts:
I'm making a Fire Emblem-esque game. There are very cute 2D frames I made for each character, and, like a game like Fire Emblem, I want these characters to animate constantly.

To circumvent the graphics programming involved I came up with a novel idea! I would make each character an animated gif, and only in special conditions ever halt their constant movement - in that case just change what image is being displayed.

Simple enough.  But I have a dilemma - I want the background of my .gifs to be transparent (so that the "grass" behind each character naturally shows, as per the screenshot - which has them as still images with transparent backgrounds). I know how to make a background transparent in numerous tools (GIMP, Photoshop). But it seems every .gif creator replaces the transparent background with something and I can't edit it back to transparent.

Is it possible to have a .gif with a transparent "background"? Perhaps my knowledge of file formats is limiting me here.


texts:
I have the following simple patch function in DX11, but I keep getting rips, and when I look at the wireframe its clear that adjacent edges are not getting the same tessellation factor. The CalcTessFactor() function just does a distance from the camera to the point passed, so should always give the same value for the same edge center that I pass in.

PatchTess patchFunction_Far(InputPatch<VertexToPixel_Far, 3> patch, uint patchID : SV_PrimitiveID)
 {
  PatchTess pt;

 // Compute midpoint on edges, and patch center
  float3 e0 = 0.5f*(patch[0].WorldPosition + patch[1].WorldPosition);
  float3 e1 = 0.5f*(patch[1].WorldPosition + patch[2].WorldPosition);
  float3 e2 = 0.5f*(patch[2].WorldPosition + patch[0].WorldPosition);
  float3  c = (patch[0].WorldPosition + patch[1].WorldPosition + patch[2].WorldPosition) / 3.0f;

 pt.EdgeTess[0] = CalcTessFactor(e0);
  pt.EdgeTess[1] = CalcTessFactor(e1);
  pt.EdgeTess[2] = CalcTessFactor(e2);

 pt.InsideTess = CalcTessFactor©;

 return pt;
 }

My patches are triangles.

Is there something I'm doing trivially wrong here (like assuming that EdgeTess[0] is correctly assumed to be edge 0-1, rather than edge 2->0 for instance ? - its a wild guess..


texts: How do I make my prefabs spawn behind the UI?

texts: I'm making a game where three characters spawn in specific locations. I made three gameobjects called stations so I could take the transform positions and spawn the three caracters there. And I have a UI element that is supposed to stay in front of everything. But the problem is that when I hit play, the three characters spawn in front of the UI element. I already checked the positions related to the camera but it doesn't seem to be it. Does anyone know how to help me?


texts: How to create multiple balloon bodies in Box2D?

texts: In Box2D, how would I go about making a body that's being lifted by multiple "balloons"?  These balloons would have to be able to be destroyed (for example, by a bow and arrow).


texts:
I've been planning an indie game project for a while now. I'll summarise it for you so I can get right to the question.

It's done entirely using the latest version of XNA through Visual Studio. Hoping to put it on 360 and PC, but am only really looking for a PC-oriented solution at this stage.

It's a 2D side-scrolling shooter (think Metroidvania-style, or even Terraria). It will eventually include an in-game map editor with maps being tile-based (16x16). There will be upwards and downwards scrolling. I'm hoping to implement tile layers in the dev map editor (reason for a dev map editor is it's going to be heavily leaning towards a content-focus, so there will be a lot of maps).

Physical tiles will be very simple with only two major types. Block tiles, which are just a solid tile, and angled tiles, which are tiles with an incline that characters can walk on. I'm strongly considering abandoning angled tiles entirely, but not sure yet.

The character/NPC movement will be simple. Moving side-to-side, jumping, falling, flying (with appropriate items/situations), teleporting. All very static, no dynamic physics necessary. Only basic gravity. When a character steps off the edge of a tile, it falls. When it jumps and a tile is above it, it stops short and falls back down. When it reaches a protruding tile/wall, it can't move further unless it jumps over or flies. All the basic stuff.

Projectiles can be affected by gravity as well, and some situations may arise where a projectile may be manipulated mid-flight, but nothing requiring heavy physics. Some projectiles will move characters as well (think a simple "pushing" mechanic).

So here's the question: I'm at the stage where I'm starting to work on movement and collision-detection but I just can't set myself on a way to go about them. I need ways to determine when character, tiles, and projectiles collide. Given what I've said about the style I'm going for and the tile-based system I'm using, can I get some recommendations+links to some tried and true collision detection methods others have used in similar situations, and maybe an example of a game using a similar approach? What I need more than anything else is inspiration.

And just a quick note, I have several years of experience as a programmer, so I'm not a total newbie :)


texts:
I have a component called "ReflectOffCollision". This component should obviously not need to be aware of specific details about the game such as tags. The problem is, I want to apply this script to an object that reflects off of only some collisions.

I could check the tag of the collision, but this will destroy the generality of the component. It will only work on collisions with this tag. I could have the script take a white list or black list of tags, but this is awkward to do.

My other option is to inherit from the component and make a more specific version. This seems like overkill, though.

How should I deal with tags in components? I see this problem anywhere that there are collisions. Am I using tags incorrectly, or misunderstanding them?


texts: How to implement a property with a base value and a changed value?

texts:
I have a number of stats and effects in game that are subject to change, they have some kind of base value and the current value. For stats, I implemented this in a dynamic way, but for less important things, like buffs that is too much work. For buffs I have 2 properties - current and base value. For example, the shield buff action takes the base value and copies it into the current value at the start of each turn.

What is a good way to implement having the current value and base value for effects?

Right now I have a base property defined along with the modified value.

+(BuffBase*)buffWithEffectType:(kEffectType)effectType intensity:(int)intensity
{
    BuffBase* buff = [[BuffBase alloc] init];
    buff.intensity = intensity;
    buff.baseIntensity = intensity;

    return buff;
}

Should I refactor such code early on and replace it with some kind of tuple, like EffectValue(current,Base) where x is current and y is base?

+(BuffBase*)buffWithEffectType:(kEffectType)effectType intensity:(int)intensity
{
    BuffBase* buff = [[BuffBase alloc] init];
    buff.intensityTuple = EffectValue(intensity, intensity);
    return buff;
}

Or should I start with a dictionary/map right from the start? This seems to be the easiest to expand later on, although I have to remember string keys:

+(BuffBase*)buffWithEffectType:(kEffectType)effectType intensity:(int)intensity
{
    BuffBase* buff = [[BuffBase alloc] init];
    NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] init];
    [dictionary setObject:@(intensity) forKey:@"base"];
    [dictionary setObject:@(intensity) forKey:@"current"];

    //optional parameters for potential future expansion
    [dictionary setObject:@(1) forKey:@"decay"];
    [dictionary setObject:@(4) forKey:@"maxHitsBlocked"];
    buff.valueDictionary = dictionary;

    return buff;
}


texts:
I'm trying to have my virtual update method set up so it can return in case the mouse is over a UI object.

The thing is, if it returns, the method that override it and uses "base.Update()" still keeps running, as the override also override the original return.

This is the rough code:

Level.cs (for example)

protected virtual void Update () {
    if (EventSystem.current.IsPointerOverGameObject())
        return;
}

Level1.cs (for example)

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

    // Code that I don't want to run in case the original method returned
}

Thank you so much.


texts: OnCollisionEnter only triggering if colliding object starts inside collider

texts:
Despite the absurdly high number of "OnCollisionEnter not working" threads around the internet, no one else seems to have had this specific problem.

To start off with, I have a spherical "shield" object around my ship, which has a shader designed to give off impact effects when hit by an object. To trigger the shader impact effect, you need to give it the position from which do the effect. So, the easiest way to do this is to give the shield a Collider and, whenever OnCollisionEnter is called, it sends the contact.point details to the shader. That's not the difficult part. The part that isn't working is that OnCollisionEnter is not being called when the laser bolt fired at the shield actually collides with the shield.

Both the shield and the laser bolt have Sphere colliders, both are not triggers. Only the shield has a rigidbody, which is not kinematic.

void OnCollisionEnter (Collision collision) {
    Debug.Log (Time.time);
    if (collision.transform.tag == "Impact") {
        Debug.Log ("go");
        //Does the shader stuff
        }
    }
}

That script is attached to the shield object. Not only is "go" never being logged, but neither is the Time, so OnCollisionEnter is not being called.

The odd thing about this scenario is that, OnCollisionEnter will be called by objects that begin inside the shield's collider - so if I start the laser bolt inside the shield, then the function gets called as usual. But when I start the laser outside the shield and Translate it into the shield, nothing happens. For the life of me, I can not work out what's going wrong with it.