texts:
I am using a retained mode renderer similar to the display lists in Flash. In other words, I have a scene graph data structure called the Stage to which I add the graphical primitives I would like to see rendered, such as images, animations, text. For simplicity I'll refer to them as Sprites.

Now I'm implementing an architecture which is becoming very similar to MVC, but I feel that that instead of having to create View classes, that the sprites already behave pretty much like Views (except for not being explicitly connected to the Model). And since the Model is only changed through the Controller, I could simply update the view together with the Model in the controller, as in the example below:

Example 1

class Controller
{
    Model model;
    Sprite view;
    void TeleportTo(Vector2 position) { model.Position = view.Position = position; }
}

The alternative, I think, would be to create View classes that wrap the sprites, make the model observable, and make the view react to changes on the model. This seems like a lot of extra work and boilerplate code, and I'm not seeing the benefits if I'm just going to have one view per controller.

Example 2

class Controller
{
    Model model;
    View view;
    void TeleportTo(Vector2 position) { model.Position = position; }
}

class View
{
    Model model;
    Sprite sprite;
    View() { model.PropertyChanged += UpdateView; }
    void UpdateView() { sprite.Position = model.Position; }
}

So, how is MVC or more specifically, the View, usually implemented when using a retained-mode renderer? And is there any reason why I shouldn't stick with example 1?


texts: Collision between UI element and GameObject

texts:
When I first started to develop in Unity I followed the Unity Tutorial for the Space Shooter 2D game and used the knowledge from that to create something myself. Looking at it now it may not have been the best idea.

Currently my game is 2D but in a 3D environment where the camera is top down and I am trying to figure out how I can detect a collision between a UI Image and my Player GameObject.

Any help will be extremely appreciated!


texts: What are the document grid settings in inkscape for making an isometric tilemap for tiled?

texts: I am using inkscape to create a isometric tilemap.  What settings do I need on the grid in document properties in inkscape to make it match up to a 64 x 32 grid in tiled?


texts: Mix multisample and non multisample rendering in Directx11

texts:
is there a way to mix multisample and non multisample rendering in Directx11?
It seems that when I create a multisampled render target I always get a multisampled rendering, regardless of the value of the MultisampleEnabled flag of the RasterizerDescription.

Microsoft says:

"To use multisampling, set the enable field in the rasterization description, create a multisampled render target, and either read the render target with a shader to resolve the samples into a single pixel color or call ID3D11DeviceContext::ResolveSubresource to resolve the samples using the video card."

and also

"There are no restrictions for mixing multisampled and non-multisampled rendering within a single render target."

But then in the rasterizer description page it says:

"
 For feature levels 10.1 and higher, the setting of MultisampleEnable has no effect on points and triangles with regard to MSAA and impacts only the selection of the line-rendering algorithm as shown in this table...

"

So, how can I temporarily turn multisampling off on a multisampled render target, in order to draw part of the scene without multisampling?


texts:
I'm following the book Introduction to 3D Game Programming with DirectX 11 by Frank Luna (link) and I'm trying to make the empty project in Chapter 4 (don't worry, I don't expect you to read the book)

I'm getting to the point in code where I need to create the Direct3D device context. My code looks at this so far:

#include <Windows.h>
#include <D3D11.h>
#include <D3Dcompiler.h>

UINT createDeviceFlags = 0;

#ifdef DEBUG
    createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif

D3D_FEATURE_LEVEL featureLevel;
ID3D11Device* md3dDevice;
ID3D11DeviceContext* md3dImmediateContext;
HRESULT hr = D3D11CreateDevice(0, D3D_DRIVER_TYPE_HARDWARE, 0, createDeviceFlags, 0, 0, D3D11_SDK_VERSION, &md3dDevice, &featureLevel, &md3dImmediateContext);

if (FAILED(hr)) {
    MessageBox(0, L"D3D11CreateDevice Failed", 0, 0);
}

// I added this as the entrypoint for the program - copied directly from microsoft's website
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, INT nCmdShow)
{
    return 0;
}

The problem is that I'm getting some errors that make no sense at all. Take a look (by the way, I'm using Visual Studio Community 2015):

Code    Description                                              File       Line
C2059   syntax error: 'if'                                       main.cpp   16
C2143   syntax error: missing ';' before '{'                     main.cpp   16
C2447   '{': missing function header (old-style formal list?)    main.cpp   16

Any help would be greatly appreciated!


texts: What is the difference between Constant Vertex Attributes and Uniforms?

texts:
According to the OpenGL ES 2.0 Programming Guide:

A constant vertex attribute is the same for all vertices of a primitive, and
therefore only one value needs to be specified for all the vertices of a
primitive.

For uniforms the book states:

...any parameter to a shader that is constant across either all vertices or
fragments (but that is not known at compile time) should be passed in as
a uniform.

I've always used uniforms for data that is constant for a primitive but now it appears that attributes can also be used in the same way. Is there more to constant vertex attribute than simply 'they are the same as uniforms'?


texts: What record stores the inventory in a Skyrim savegame file?

texts:
For The Elder Scrolls V: Skyrim, I'm looking for a way to read the player's inventory without having to go into the game to do it.

I've scoured the pages from the UESP wiki on save file format but I couldn't find where the player's inventory is, even after writing a crude REFR change form reader. The wiki has a lot of information on many structures, but none are clearly identified as the player's inventory.

So, does anyone know where the inventory (RefID and count) is in the savegame file?


texts: What platform should educational games target?

texts:
Should educational games target the PC or mobile market? My professional development experience has been with the PC, but I'm wondering if mobile (iOS, Android, etc.) has a better market for educational games (elementary/middle). Has anyone been in this market and have a good idea?

This article says

  “Mobile educational games are now outselling PC educational games,” he said. “And the entrepreneurs are incredibly passionate about what they are doing. What we find interesting is the interest among investors in mobile.”


texts: D3D11 Deferred Context CommandList Reset

texts:
a rather quick question, I am starting on implementing rendering with deferred context into my game engine, and came across a heavy memory leak when recording command lists on my deferred contexts. Because every frame I would go like this: DeferredContext[THREAD]->FinishCommandList( 0,&commandLists[THREAD] ), it would eat up RAM, so I Release them every time, like:

if(commandLists[THREAD]){
 commandLists[THREAD]->Release();
 commandLists[THREAD] = NULL;
}

I previously only released objects when they wouldn't be used any more, so I thought there would be a more optimized way of handling this? (Like mapping dynamic *ID3D11Buffers for example?)


texts: Unity3D in WebGL the Player doesn't have animations

texts:
I using Unity 2019.2.14f1 to create a simple 3D game.

I want to build the project for WebGL, but, even though the player has animations on Unity, in the web the Player doesn't have animations even though it jumps and moves around [as you can see here].

For the Player, I am using the ThridPersonController from on Standard Assets  - but I have hidden Ethan and added my own character/avatar.

And this is the inspector of the avatar:

What am I missing here?


texts: How to add a UI Text for keeping Score in Unity 5

texts:
My Problem is simple I want to show scores on my game. The examples on internet are good but in Unity 5 there are no GUI elements but instead these are now UI elements. I was following this example: https://unity3d.com/learn/tutorials/projects/space-shooter/counting-points but it didn't work.
I followed the code and added a new UI text to the scene as in the picture.

After adding the script to a .cs file and declaring public GUIText scoreText; and making this text as prefab when I drag it to the inspector panel it didn't get attached.

and it gave this error:

The variable scoreText of Fruits has not been assigned.
You probably need to assign the scoreText variable of the Fruits script in the inspector.

Fruit is a projectile and every time this projectile hits the container it should add the score. So how to do this in Unity 5. I've seen in one example online that on previous versions of unity there was this option of adding GUI Text in GameObject.


texts: Is there any way to get the HWND from a window in LWJGL?

texts: I've started some experimentation in Java and LWJGL (via Slick), and it seems very solid. However, I have some legacy code that requires a HWND integer as a parameter. I'm not sure how I'd be able to get this, or if LWJGL would be able to report this for me. Any help?


texts: Is it dramatically more efficient to have less BoxCollider2D's (for raycasting/custom physics)?

texts:
I have a temporary tile system for my platformer where I simply duplicate the same tiny box sprite with a BoxCollider2Don it over and over again. Like I said this is a temporary procedure for design testing before I choose something for practical, I don't need it to be the most efficient.

That being said, I'm curious: when using BoxCollider2D's and detecting them with a custom ray-cast script is it much less efficient than having a few larger colliders? How much less efficient?

Please back up answers with explanations of source code if possible.


texts:
I'm a one man developer company. I'm working on a game for which I need some variety of sounds. I searched online stock music and it does not give me what I'm exactly looking for.

As a desperate and unsatisfied enthusiast and low-budget game maker, I would like to give a try to compose sound myself.

Is there any sound composing software for games available(with some instruments) ?
I believe I have some good music taste. but, it needs some time to achieve what I need. I'm willing to put this much for my super game.


texts: I'm creating a top-down rpg (no tile-based) using libgdx. Now I need to make enemies move on map with obstacles. What is the best approach to realize that? A*(I think, if enemy see player, he should turn to Pursue+Raycasting, because A* is bad for following moving targets) or just combining steering behaviors Seek+Raycasting?


texts: Understanding callbacks for connecting/disconnecting controller

texts:
I am using glfw and let's say I track controllers with a simple struct:

struct Controller {
  int id;
  std::vector<InputListener> listeners;
}
std::vector<Controller> controllers;

And I have setup a callback to detect connection and disconnection events with glfwSetJoystickCallback.

Now every frame I iterate over the controllers and poll their input states to detect button presses etc. But when the GLFW_DISCONNECTED event is triggered, and I try to remove the controller from the vector of controllers, the iteration loop crashes as the iterator becomes invalid.

for(auto it = controllers.begin(); it != controllers.end(); ++it){
  // Poll inputs...
}

void joystick_callback(int joy, int event)
{
    if (event == GLFW_CONNECTED)
    {
        // The joystick was connected
    }
    else if (event == GLFW_DISCONNECTED)
    {
        for(auto it = controllers.begin(); it != controllers.end();){
          if((*it).id == joy){
            it = controllers.erase(it);
            return;
          }
          ++it;
        }
    }
}

I tried protecting controllers with a mutex, but on disconnection, locking the mutex throws an exception because it's double locking, which leads me to believe it's on the same thread.

So how does this execution work then? Does the original loop pause, while the callback takes over, then after it's done the loop resumes execution?

I was able to fix it by adding a disconnected flag to the Controller struct, and then test for it in the loop, which will then remove the controller.


texts: Pass-through pixel shader not displaying properly

texts:
I'm new to shaders, HLSL and XNA in general. I'm trying to write a pass-through pixel shader but I'm experiencing some odd behaviour. I created a simple texture, shown below:

Here's what I see when I run my game:

Drawing the texture without passing effect in spriteBatch.Begin() works fine, for instance:

Drawing the texture at (40, 10) instead of (0, 0) gives different results, too (the green stripe isn't as thick):

My shader file:

sampler input;

float4 PixelShaderFunction(float2 coords: TEXCOORD0) : COLOR0
{
    float4 color = tex2D(input, coords);
    return color;
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_4_0_level_9_1 PixelShaderFunction();
    }
}

My game code:

public class Game1 : Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    Texture2D tex;
    Effect effect;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
    }

    protected override void Initialize()
    {
        base.Initialize();
    }

    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);

        tex = Content.Load<Texture2D>("tex");
        effect = Content.Load<Effect>("effect");
    }

    protected override void Update(GameTime gameTime)
    {
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            Exit();

        base.Update(gameTime);
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        spriteBatch.Begin(sortMode: SpriteSortMode.Immediate, effect: effect);
        spriteBatch.Draw(tex, new Vector2(0, 0), Color.White);
        spriteBatch.End();

        base.Draw(gameTime);
    }
}

What am I doing wrong? I'm expecting my pass-through shader to simply draw the texture on the screen as-is (appearing as in the second screenshot above), but it looks totally wrong. (For what it's worth, I was trying to follow this tutorial: http://blog.josack.com/2011/07/my-first-2d-pixel-shaders-part-1.html)


texts: How to store Unity Component after destroying a GameObject

texts:
I have a collectible item, which I can put into the inventory. Its GameObject has a InventoryItem script attached in which I want to set all parameters needed for correct display in the inventory. Here is the C# code:

InventoryItem.cs

public class InventoryItem : MonoBehaviour {
    public bool collectible = true;
    public string name;
    public Sprite sprite;
}

Part of ItemCollectingController.cs responsible of passing data to InventoryController

if (Input.GetButtonDown("Use")) {
    InventoryController inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent<InventoryController>();
    inventory.AddItem(target.GetComponent<InventoryItem>());
    Destroy(target);
    Debug.Log("Added to inventory");
}

And the important part of InventoryController.cs

public List<InventoryItem> items;
public void AddItem(InventoryItem item) {
    items.Add(item);
}

When collecting the item, the GameObject is destroyed and so is the reference in the InventoryController. The items List keeps a missing component. What can I do about that?


texts: Do I need to create my own or use a commercial server for the features and matchmaking options I want my game to support?

texts:
So I'm developing an indie turn-based game for iOS and, in coding up a Game Center matchmaking class, I'm starting to question whether Game Center is even the best choice for what I want this game to do.  I need to figure out whether I need to create my own server, invest in a preexisting client or server service, or if I even need to use a server at all.  If I do need to use a ready-made service other than Game Center, which server would accomodate my game's needs best?  I have limited resources and funds.  Here is the list of features I want my game to support, ideally:

Turn-based gameplay (a la "with Friends" and "with Buddies" games)
Smart matchmaking (matching users up with other players of comparable skill/achievements)
Random matchmaking
Facebook matchmaking
Specific username matchmaking
Contact list matchmaking
A way to select what "type" of match you want to challenge an opponent to.  (In random, smart, and Facebook matchmaking, there will be different "wagers" the player can make. [e.g. "I wanna play a random opponent for 1000 points.  Now, I wanna play my Facebook buddy for 1,000,000 points."]  There will be a predetermined range of amounts you can play for.  It won't be customizable.)
Buddies list capability (Game-buddies, as opposed to contacts and Facebook)
A higher concurrent game cap than Game Center offers (which I still can't really find a straight answer on)
Scalability (it should support 2 or 20,000,000 players)
Objective-C compatibility
Flexibility (for all the stuff I haven't thought of yet)

Am I dreaming, here?  Is there even a service that can handle all of these features?  Do I need to invest months in learning a networking language to build my own?  If so, how much would I need to spend on hardware?

I've been looking around all morning and, so far, the only seemingly viable option is SmartFox.  Under "Everything and the kitchen sink" section here, it says they support "virtual world with Zones, Rooms and RoomGroups, create complex game challenges, send invitations, manage buddy lists, create custom permission profiles, oversee the security aspects and tons more."

http://www.smartfoxserver.com/overview/platform

Is there an option that Im just overlooking?  Thanks for any help anyone can provide.  Sorry for the long poast.

One last question:  Does anyone know which server Dice with Buddies uses?  I was experimenting with how many concurrent games I could get going and my ADHD kicked in at about 80 games.  80 concurrent games would be great for my game, but again, I need the other features I mentioned too.  Thanks again.


texts:
I know that the I can allow the user to draw curves in game by line tracer.

if I want to interpret it, I could use handwritten text recognizer.

But what if I had to interpret a curve, where the user draws a symbol that has no literal meaning, only an in-game meaning, and interpret the meaning of the symbol as I define it?

Can I define my own way of interpreting the symbols?


texts: Coordinate System - Movement from A to B

texts:
I've got the following code snipped :

 var distanceFromDestinationSquared = (
                    Math.pow(this.orders.to.x - this.x, 2) +
                    Math.pow(this.orders.to.y - this.y, 2));
                if (distanceFromDestinationSquared < Math.pow(this.radius / game.gridSize, 2)) {
                    this.orders = { type: "float" };
                } else {
                    this.moveTo(this.orders.to);
                }

Summary :

x and y are always integers (-1, 0, 1, 2, .. )
The x and y coordinates of the destination and starting point get subtracted from each other, then the square number is taken and eventually those results are added to each other.
this.radius / game.gridSize gives you the equalent size related the coordinate system.

e.g game.gridSize = 20px - thus one field in the coordinate system is equalent to 20x20px

I've used this formula with the example of (2/2) as destination and (4/4) as starting point. As result I end up at the line if (distanceFromDestinationSquared < Math.pow(this.radius / game.gridSize, 2)) with 8 < (18 / 20)² = 8 < 0.81

What's the reason behind this apperently trivial formula of movement? Why is it important to take square number of the delta of x and y and add it together?

On one hand it avoides negative values but there would be other ways to deal more efficient with that issue.

Can someone point me to an explanation of this mathematical formula?


texts: What web technology could I use which would support a decision tree?

texts:
I am a big game development fan but I haven't done any commercial work in the past. I have been asked by a non-profit to look at developing a game similar to the award-winning www.playspent.org

They want the following features:

support 5 scenarios
mobile isn't important but compatibility with older browsers would be a big bonus
they want it to be visual and audible
bonus is to have it easily modifiable
support 4 languages

I don't have much knowledge of Flash and would rather avoid using it as a solution. I started breaking down the problem into segments that I will need to examine, they are as follows:

ability to read the game flow from a file that they can produce (xml, etc.)
db design to store decision tree
language challenge
browser compatibility

I am leaning towards an Google app engine/GWT solution but I am not sure what technology is best for this.

I am really hoping to get your opinion/recommendation on my approach and on what technology is best. A special thanks (and beer if you live in Toronto) will be awarded to anyone who can help give me a ballpark estimate on how much such a game should go for. I know it's tough to estimate but any rough figure will help (how much would you charge for building something like playspent.org?)

Thanks in advance


texts: How is the default value of ContactFilter2D.isFiltering true?

texts:
I have a static ContactFilter2D like so:

protected static ContactFilter2D contact_filter;
protected float self_destruct_timer;
protected Vector3 direction;
private float xward;

protected virtual void Start ()
{    phys.velocity = transform.right * speed * xward;
     self_destruct_timer = Time.time + life_time;

     if (!contact_filter.isFiltering) contact_filter.layerMask = Public_Const.Solid;
     contact_filter.useLayerMask = true;
     ...
}

Every isFiltering_____ variable (i.e. isFilteringLayerMask) is set to false by default, therefore there should be no way that isFiltering should return a true value.
The whole point of checking to see if isFiltering is true is to check to see if the contact filter has already been initialized, so why won't it work?


texts:
I would like to apply a constant-speed everlasting translation to a game object (e.g a background) in Unity. Without physics.

What is the best way to achieve that?


texts: What do I provide to SDL_LockTexture **pixels?

texts:
All I'm trying to do is write random data to an array, then display that array to a window. But I can't get SDL_LockTexture to cooperate, it keeps complaining that I'm using the wrong argument. I've tried &pixels, **pixels, and now this weird proxy void construction. None of it works, of course. What is the correct way of doing this?

// gcc C11

#include <stdio.h>
#include <omp.h>
#include <stdlib.h>
#include <SDL2/SDL.h>
#include <stdint.h>

int main(int argc, char *argv[])
{
    if (argc != 3){
        printf("Wrong amount of args given: expected width, height.\n");
        return 1;
    }

    int w = atoi(argv[1]);
    int h = atoi(argv[2]);

    int pixels[w][h];

    uint8_t r,g,b;

    int pitch = w*4;

    void * pixelpointer = &pixels;

    if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {
        fprintf(stderr, "SDL_Init Error: %s\n", SDL_GetError());
        return EXIT_FAILURE;
    }

    SDL_Window *window;
    SDL_Renderer *renderer;
    SDL_CreateWindowAndRenderer(w, h, 0, &window, &renderer);

    SDL_Texture* buffer = SDL_CreateTexture(renderer,
                          SDL_PIXELFORMAT_RGBA8888,
                          SDL_TEXTUREACCESS_STREAMING,
                          w,
                          h);

    SDL_LockTexture(buffer,
                    NULL,      // NULL means the *whole texture* here.
                    *pixelpointer,
                    &pitch);

    printf("\nStarting render...\n\nWidth:  %d\nHeight: %d\n", w, h);

    #pragma omp parallel for
    for (int y = 0; y < h; ++y){
        for (int x = 0; x < w; ++x){
            r = rand();
            g = rand();
            b = rand();
            pixels[x][y] = r & g>>8 & b>>16 & 0x000000FF;
        }
    }

    printf("parallel for ends.\n");

    SDL_UnlockTexture(buffer);
    SDL_RenderCopy(renderer, buffer, NULL, NULL);

    SDL_Delay(2000);

    SDL_DestroyRenderer(renderer);
    SDL_DestroyWindow(window);
    SDL_Quit();

    return 0;
}
```


texts: Is there any other way to animate 2d spritesheet without Animator Component in unity?

texts: Is there any easy way exists that animates frames without using Animator component?


texts:
I am trying to make the age-old version of pacman. And only then that I realized that I need to spend a heck lot of time for making the tile matrix itself. It gets messy more and more.

I've also heard of this thing called level editors; Are there any of these kind for flash based games. If so, do write it down one line at a time. Thank You.


texts: Collision Detection - point hitting a rotating rectangle

texts:
Im developing a game which has a flying chopper and an enemy firing bullets at it.
Whats the best way to detect when the bullet hits the bounds of the chopper. The chopper is placed to the left of screen, continously rotating around its center. Bullet is fired from the right, always in a straight line. Im using Marix post rotate and translate for the choppers rotation.To make it simpler, I just want to consider the chopper to be a rectangle. Lets say im not bothered about any more precision in terms of specific hit points.


texts: How do I add a gameobject to a prefab's script's public gameobject field in Unity?

texts:
Okay, I have a prefab with a script. It has the public field gameobject, and I see that in the inspector. When I try to drag an object from the scene into that slot, I'm simply unable to. No error or anything, just acts like it's any other part of the screen.

Is there a type mismatch here? How do I drag something from the hierarchy?


texts: Why is my CameraCrop script blurring the screen slightly in Unity?

texts:
I've been trying to enforce a 4:3 aspect ratio in my Unity game, in order to give a nostalgia feeling to it. But whenever I add this script to my camera and compile my game, it blurs slightly. I am using a 4:3 aspect ratio in the game view and have Fullscreen Window chosen in my Window Option and in Supported Resolutions I have only 4:3 ticked. Also, I am used Pixel Perfect Camera with Pixel Snapping enabled.
Here's what my game looks like without the CameraCrop script added:

And here is what it looks like when the script is added:

Here's the script I add to my camera:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

// Requires that the camera component is on the GameObject
[RequireComponent(typeof(Camera))]
public class CameraCrop : MonoBehaviour
{

    // Sets the aspect ratio to whatever you want
    public Vector2 targetAspect = new Vector2(4, 3);
    Camera _camera;

    void Start()
    {
        _camera = GetComponent<Camera>();
        UpdateCrop();
    }

    // Call this method if your window size or target aspect change.
    public void UpdateCrop()
    {
        // Determine ratios of screen/window & target, respectively.
        float screenRatio = Screen.width / (float)Screen.height;
        float targetRatio = targetAspect.x / targetAspect.y;

        if (Mathf.Approximately(screenRatio, targetRatio))
        {
            // Screen or window is the target aspect ratio: use the whole area.
            _camera.rect = new Rect(0, 0, 1, 1);
        }
        else if (screenRatio > targetRatio)
        {
            // Screen or window is wider than the target: pillarbox.
            float normalizedWidth = targetRatio / screenRatio;
            float barThickness = (1f - normalizedWidth) / 2f;
            _camera.rect = new Rect(barThickness, 0, normalizedWidth, 1);
        }
        else
        {
            // Screen or window is narrower than the target: letterbox.
            float normalizedHeight = screenRatio / targetRatio;
            float barThickness = (1f - normalizedHeight) / 2f;
            _camera.rect = new Rect(0, barThickness, 1, normalizedHeight);
        }
    }
}

I am using Unity 2019.4.17f LTS and using Windows 10.


texts:
I'm working on generating terrain on already generated landmass. The landmass and ocean around it consist of hexagons. Hexagons aren't really a concern for me, because I can always interpolate the values algorithms generates with the vertices on the grid. As you can see on the image below, blue is ocean, brown is land.

Problem is, I need the shore to have 0 height, can it even be done with diamond square algorithm?


texts: How can I fix the turret is facing the opposite direction of the target?

texts:
This script is attached to the turret parent.
The object that rotate on X and Y is the child Cube of the Cylinder.
The target is the Sphere.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TurretAI : MonoBehaviour
{
    [SerializeField]
    private float turnRateRadians = 2 * Mathf.PI;

    [SerializeField]
    private Transform turretTop; // the gun part that rotates

    [SerializeField]
    private Transform bulletSpawnPoint;

    [SerializeField]
    public GameObject target;

    void Update()
    {

        TargetEnemy();
    }

    void TargetEnemy()
    {
        if (target != null)
        {
            Vector3 targetDir = target.transform.position - transform.position;
            // Rotating in 2D Plane...
            //targetDir.y = 0.0f;
            //targetDir = targetDir.normalized;

            Vector3 currentDir = turretTop.forward;

            currentDir = Vector3.RotateTowards(currentDir, targetDir, turnRateRadians * Time.deltaTime, 1.0f);

            Quaternion qDir = new Quaternion();
            qDir.SetLookRotation(currentDir, Vector3.up);
            turretTop.rotation = qDir;
        }
    }
}

This is a screenshot of the parent turret that I set to be static so it will not rotate too and the script attached to it :

This is a screenshot of the Cube that rotate on X and Y and should be facing the target :

And the missels :

And last when running the game you can see the Sphere target position and the turret is facing the opposite direction. If I will drag and move the Sphere the turret will rotate to it but with the missels back instead with the missels front side :


texts: The right way to add images to Monogame/Windows

texts:
I'm starting out with MonoGame. For now, I'm only targeting Windows (desktop -- not Windows 8 specifically).

I've used a couple of XNA products in the past (raw XNA, FlatRedBall, SilverSprite), so I may have a misunderstanding about how I should add images to my content.

How do I add images to my project?

Currently, I created a new Monogame project, added a folder called "Content," and added images under there; the only caveat is that I need to set the Copy to Output Directory action to one of the Copy ones.

It seems strange, because my "raw" XNA project just last week had a Content project in it (XNA Framework Content Pipeline, according to VS2010), which compiled my images to XNB (I think). It seems like Monogame doesn't use the same content pipeline, but I'm not sure.

Edit: My question is not about "how do I get the XNA content pipeline to work with Monogame." My question is "why would I want to use the XNA content pipeline in Monogame?"

Because there are (at least) two solutions (that I see today):

Add the images to the Monogame project and set the Copy to Output Directory options to copy.
Add a XNA content pipeline project and add my images to that instead; reference it from my MOnogame project.

Which solution should I use, and why? I currently have a working version with the first option.


texts: Real Time Physics Based Mesh Deformation

texts: I'm working on a game through unity that draws one of is essential elements from traditional tool forging techniques for building tools and such. I want the feel of the game to be able to create a tool that is truly yours and slowly make it better in both design and functionality over time. One major thing I cant't seem to figure out is to be able to take a mesh (in this case a hot piece of meta) and deform it in such a way that you aren't loosing any of the mesh, its just being shifted slightly with each hit of a hammer (or in my testing case click of a mouse). I have looked all over youtube and various forums and I can't seem to find an efficient way of going about it. Any thoughts?


texts: How do I load textures with SFML for OpenGL?

texts:
I'm looking at NeHe's texture mapping tutorial. It looks overly complicated for just loading a texture.

Is there a way to load a texture in SFML and then use it in Open GL? I use SFML for my windowing.


texts: Log in by pressing enter while password text is in focus

texts:
I have a very simple script which is supposed to Check if the return key is pressed while the password text is in focus.
The issue is that I've tried all 3 methods Input.GetKeyUp, Input.GetKeyDown and Input.GetKey and they all work when the user presses the Return key 2 times at least. I need to be able to log in on one press of the return key. Here is the code I'm using:

InputField _input;
bool focused;
public System.Action Callback = () => { };
void Awake()
{
    _input = GetComponent<InputField>();
}

void Update()
{
    focused = _input.isFocused;
    if (focused)
    {
        Debug.Log("Passowrd field is in focus");
        if (Input.GetKey(KeyCode.Return))
        {
            Debug.Log("ENTER KEY PRESSED via getkey");
            Callback();
        }
    }
}


texts: Is there a problem with using a 2D square grid for your world map?

texts:
I'm making a game with a 2D square grid for my world map. It wraps around, so when you reach all the way north you start out in the south again, and when you go all the way east you wind up in the west, etc.

Would this method have any flaws? I'm under the impression there might be flaws around e.g. fast travel.


texts:
There is an fantastic answer by DMGregory here where he explains how to calculate and generate the vertices of an UV Sphere: OpenGL calculate UV sphere vertices

Based on his code, how can we change the "altitude" of each individual vertex?

To create something like this:


texts: How do I implement real-time mesh deformation, with regards to environmental damage?

texts:
I would like to be able to add the following feature to my tech demo: at the moment bullets hit the walls, little pieces fly out of them, as well as decals appearing on the walls. Computing power is good enough, now, so that many games have destructible environments.

I would like bullets to shatter small surface segments off the wall, ideally the segments that fly off would directly relate to the hole that is left, though I don't even know if this is how it's done in commercial games.

How is this done? Are there simply a number of different meshes that are swapped out as, and when, objects are hit? I assumed that this would not be an accurate enough solution. Is real-time mesh deformation feasible. and if so, how is it done?


texts: How to write a transparent shader for a sprite that ignores transparent sprites behind it?

texts:
I have multiple UI Sprites that have their alpha set so you can see what's behind them.  I would like to make these UI Sprites ignore other UI Sprites.

So take this first picture.  There are 4 UI Sprites that overlay over a part of each other.

Note:  These sprites can appear in a random location and the number is unknown, so I thought a Shader would make sense for this.

I would like to still adjust their alpha, but I would like them to ignore each other so that they appear to be 1 image like below.

I tried modifying a Shader, but I couldn't work it out.

// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)

Shader "UI/Default"
{
    Properties
    {
        [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
        _Color ("Tint", Color) = (1,1,1,1)

        _StencilComp ("Stencil Comparison", Float) = 8
        _Stencil ("Stencil ID", Float) = 0
        _StencilOp ("Stencil Operation", Float) = 0
        _StencilWriteMask ("Stencil Write Mask", Float) = 255
        _StencilReadMask ("Stencil Read Mask", Float) = 255

        _ColorMask ("Color Mask", Float) = 15

        [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
    }

    SubShader
    {
        Tags
        {
            "Queue"="Transparent"
            "IgnoreProjector"="True"
            "RenderType"="Transparent"
            "PreviewType"="Plane"
            "CanUseSpriteAtlas"="True"
        }

        Stencil
        {
            Ref [_Stencil]
            Comp [_StencilComp]
            Pass [_StencilOp]
            ReadMask [_StencilReadMask]
            WriteMask [_StencilWriteMask]
        }

        Cull Off
        Lighting Off
        ZWrite Off
        ZTest [unity_GUIZTestMode]
        Blend SrcAlpha OneMinusSrcAlpha
        ColorMask [_ColorMask]

        Pass
        {
            Name "Default"
        CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #pragma target 2.0

            #include "UnityCG.cginc"
            #include "UnityUI.cginc"

            #pragma multi_compile __ UNITY_UI_CLIP_RECT
            #pragma multi_compile __ UNITY_UI_ALPHACLIP

            struct appdata_t
            {
                float4 vertex   : POSITION;
                float4 color    : COLOR;
                float2 texcoord : TEXCOORD0;
                UNITY_VERTEX_INPUT_INSTANCE_ID
            };

            struct v2f
            {
                float4 vertex   : SV_POSITION;
                fixed4 color    : COLOR;
                float2 texcoord  : TEXCOORD0;
                float4 worldPosition : TEXCOORD1;
                UNITY_VERTEX_OUTPUT_STEREO
            };

            fixed4 _Color;
            fixed4 _TextureSampleAdd;
            float4 _ClipRect;

            v2f vert(appdata_t v)
            {
                v2f OUT;
                UNITY_SETUP_INSTANCE_ID(v);
                UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
                OUT.worldPosition = v.vertex;
                OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);

                OUT.texcoord = v.texcoord;

                OUT.color = v.color * _Color;
                return OUT;
            }

            sampler2D _MainTex;

            fixed4 frag(v2f IN) : SV_Target
            {
                half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;

                #ifdef UNITY_UI_CLIP_RECT
                color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
                #endif

                #ifdef UNITY_UI_ALPHACLIP
                clip (color.a - 0.001);
                #endif

                return color;
            }
        ENDCG
        }
    }
}


texts: Bullet Physics ignore collision from bottom

texts:
I'm currently using BulletSharp a wrapper for Bullet physics.
I'm using Bullet Physics for a 2D project.

Many platform games allow the player to pass through a platform as they jump upwards, and then have it magically become solid so they can stand on it from above.

Can this be done in Bullet Physics? In pre solve or something?


texts:
What is an example of efficient sprite batching in XNA?

I don't know when (if ever) I would do something like this:

spriteBatch.Begin()
DrawSprite1();
spriteBatch.End();

spriteBatch.Begin();
DrawSprite2();
spriteBatch.End();

Is there any time within a draw method that I would separate drawing calls like this?

Thanks!


texts: Separating axis theorem with multiple polygons?

texts:
I am attempting to implement the separating axis theorem in C#. I have a function that can calculate the minimum translation vector between two polygons. However, I can't seem to create a function that calculates the minimum translation vector between one polygon and multiple other polygons. Honestly, I've been working on this for months and am no closer to a solution and have not been able to find a solution online. There's always a few edge cases that do not return the correct result, leading to high priority bugs in my game.

Here are common edge cases that do not work correctly:

Is there a well-known solution for this problem? All I can find is people saying "just perform the SAT on each polygon" but this rarely produces the minimum translation vector.

Any help would be highly appreciated.


texts:
I've got a Scrollbar with a dynamically generated number of entries, and I'm trying to figure out how to get it to act so that there's a lead-in of the first 3 items (example number based on the size of my scroll area) where the area won't move. This then leaves the current selected item as the one in the centre of the area, and the content should move up so that the selection remains in the centre until the last 3 are visible, when the selection continues down to the bottom.

My efforts so far have varied from calculate the percentage through the content (currentSelected / numItems) & assign the scrollbar.value, to putting that percentage through an AnimationCurve, which gives me the "dead zones" at the beginning & end, but introduces unpleasant skipping & doesn't centre the selected item.

Also, this is intended to be for navigating through discrete objects using a gamepad.


texts: What is the proper way to handle data between scenes?

texts:
I am developing my first 2D game in Unity and I have come across what seems an important question.

How do I handle data between scenes?

There seems to be different answers to this:

Someone mention using PlayerPrefs, while other people told me this should be used to store other things like screen brightness and so on.
Someone told me that the best way was to make sure to write everything into a savegame everytime that I changed scenes, and to make sure that when the new scene loads, get the info from the savegame again. This seemed to me wasteful in performance. Was I wrong?
The other solution, which is the one I have implemented so far is to have a global game object that isn't destroyed between scenes, handling all the data between scenes. So when the game starts, I load a Start Scene where this object is loaded. After this ends, it loads the first real game scene, usually a main menu.

This is my implementation:

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

public class GameController : MonoBehaviour {

    // Make global
    public static GameController Instance {
        get;
        set;
    }

    void Awake () {
        DontDestroyOnLoad (transform.gameObject);
        Instance = this;
    }

    void Start() {
        //Load first game scene (probably main menu)
        Application.LoadLevel(2);
    }

    // Data persisted between scenes
    public int exp = 0;
    public int armor = 0;
    public int weapon = 0;
    //...
}

This object can be handled on my other classes like this:

private GameController gameController = GameController.Instance;

While this has worked so far, it presents me with one big problem: If I want to load directly a scene, let's say for instance the final level of the game, I can't load it directly, since that scene does not contain this global game object.

Am I handling this problem the wrong way? Are there better practices for this kind of challenge? I would love to hear your opinions, thoughts and suggestions on this issue.

Thanks


texts:
I am having problems with layers detection using raycasts.

Context: I created a grid to use in a pathfinding algorithm on a 2D plane. I want to implement now different weights according to the layer each node of the grid is in e.g. a node in a normal terrain will have a "terrainPenalty" of 1 and more difficult terrains 2 or more. In order to detect the terrain type on the 2D plane, I am shooting a raycast on the node position for each node previously considered "walkable". The problem comes up now, because I observed that the paths created are neglecting such values, this is the slice of code which is giving me problems:

            if (walkable)
            {
                Ray ray = new Ray(worldPoint + Vector3.back * 10, Vector3.forward);//PROBLEM HERE (NOT DETECTING PENALTIES)
                RaycastHit hit;
                walkableMask = ~walkableMask;
                if (Physics.Raycast(ray, out hit, 100, walkableMask))
                {
                    walkableRegionsDictionary.TryGetValue(hit.collider.gameObject.layer, out terrainPenalty );
                }
            }

At first I thought that the problem was how the layers were called, because I created a LayerMask combining 2 layers using the bitwise OR operator, but then I tried to play around with all the layers (hence why there is walkableMask = ~walkableMask; now). The result was always a false output for Physics.Raycast(ray, out hit, 100, walkableMask).

I thought that maybe I was getting the wrong coordinates for the ray, but I created some gizmos to actually check that the ray was piercing perpendicularly my plane and it did, as well as trying to change layers to see if anything worked, but the output is always false. What am I getting wrong? Here is the rest of the function, if needed I can upload the whole script as well:

    void CreateGrid()
{
    grid = new Node1[gridSizeX, gridSizeY];
    Vector3 worldBottomLeft = transform.position - Vector3.right * gridWorldSize.x / 2 - Vector3.up * gridWorldSize.y / 2;

    for (int x = 0; x < gridSizeX; x++)
    {
        for (int y = 0; y < gridSizeY; y++)
        {
            Vector3 worldPoint = worldBottomLeft + Vector3.right * (x * nodeDiameter + nodeRadius) + Vector3.up * (y * nodeDiameter + nodeRadius);
            bool walkable = !(Physics2D.OverlapCircle(new Vector2(worldPoint.x, worldPoint.y), nodeRadius, unwalkableMask));
            //bool walkable = !(Physics.CheckSphere(worldPoint, nodeRadius));

            int terrainPenalty = 0;

            if (walkable)
            {
                Ray ray = new Ray(worldPoint + Vector3.back * 10, Vector3.forward);//PROBLEM HERE (NOT DETECTING PENALTIES)
                RaycastHit hit;
                walkableMask = ~walkableMask;
                if (Physics.Raycast(ray, out hit, 100, walkableMask))
                {
                    walkableRegionsDictionary.TryGetValue(hit.collider.gameObject.layer, out terrainPenalty );
                }
            }

            grid[x, y] = new Node1(walkable, worldPoint, x, y, terrainPenalty);
        }
    }
}

EDIT : Here is how I create the layerMask:

        foreach (TerrainType region in walkableRegions)
    {
        walkableMask.value |= region.terrainMask.value; // | is the bitwise OR operation, I could have simplified by writing " --- |= ---; "
        walkableRegionsDictionary.Add((int)Mathf.Log(region.terrainMask.value, 2), region.terrainPenalty);
    }

Where TerrainType is the following class:

    [System.Serializable]
public class TerrainType
{
    public LayerMask terrainMask;
    public int terrainPenalty;
}

I basically create an array of TerrainType objects that will store their layerMask and penalty and then upon positive output from the raycast I access the dictionary to retrieve the terrain penalty. For the terrain and obstacles I am using a 2D BoxCollider and 2D PolygonCollider respectively, they do not interact with any other layer.

Thanks for any possible hints, I don't know what else to try :\ .


texts: Having issue's with a confusing access violation? - C , OpenGL 3.3+ , SDL 2.0+

texts:
Hello this code seems so well done and yet I'm getting this weird access violation error when I use anything but 0 in glShaderSources 2nd argument :

glShaderSource( fragshader, 0, fragfilebuff, NULL );

If I use lenofstr or any other number then 0 it calls up an error like this :

I have no idea for the life of me why this is happpening
I've updated my drivers , I've even tried messing around with glewInit();
too see if it's something to do with that but no luck what so ever.

This nvidia dll has some problem with my code and I don't know why?...

void LoadShaders(const char *fragshaderfn, const char *vertshaderfn)
{
    FILE *fragfile;
    const GLchar *fragfilebuff[256] = { 0 };
    fopen_s(&fragfile, fragshaderfn, "r");

    fread(fragfilebuff, sizeof(char), sizeof(char) * 256, fragfile);
    printf(fragfilebuff);

    GLsizei lenofstr = strlen(fragfilebuff);
    printf("this is the length -> %d", lenofstr);

    GLuint fragshader = glCreateShader(GL_FRAGMENT_SHADER);

    glShaderSource(fragshader, 0,
        fragfilebuff, NULL);

    glCompileShader(fragshader);

};

Here's the complete source :

#include <SDL.h>
#include <GL/glew.h>
#include <SDL_opengl.h>
#include <stdio.h>
#include <conio.h>

#define SCREEN_HEIGHT 480
#define SCREEN_WIDTH 640

SDL_Renderer *mainrenderer;
SDL_Window *mainwindow;
SDL_Event event;
bool running = true;

void LoadShaders(const char *fragshaderfn, const char *vertshaderfn)
{
    FILE *fragfile;
    const GLchar *fragfilebuff[256] = { 0 };
    fopen_s(&fragfile, fragshaderfn, "r");

    fread(fragfilebuff, sizeof(char), sizeof(char) * 256, fragfile);
    printf(fragfilebuff);

    GLsizei lenofstr = strlen(fragfilebuff);
    printf("this is the length -> %d", lenofstr);

    GLuint fragshader = glCreateShader(GL_FRAGMENT_SHADER);

    glShaderSource(fragshader, lenofstr,
        fragfilebuff, NULL);

    glCompileShader(fragshader);

};

int main(int argc , char **argv)
{
    SDL_Init(SDL_INIT_EVERYTHING);

    mainwindow = SDL_CreateWindow(
        "C OpenGL Engine",
        300, 300, 640, 480,
        SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL );

    SDL_GLContext maincontext = SDL_GL_CreateContext(mainwindow);
    SDL_GL_MakeCurrent(mainwindow, maincontext);

    glewExperimental = GL_TRUE;
    GLenum err = glewInit();

    if (GLEW_OK != err)
    {
        /* Problem: glewInit failed, something is seriously wrong. */
        fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
    }
    fprintf(stdout, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));

    if (SDL_GL_SetSwapInterval(1) < 0)
    {
        printf("Warning: Unable to set VSync! SDL Error: %s\n", SDL_GetError());
    }

    LoadShaders("ffile.frag", "");

    glClearColor(0.0, 0.0, 0.0, 1.0);

    while (running == true)
    {
        while (SDL_PollEvent(&event))
        {
            switch (event.type)
            {
                case SDL_QUIT:
                    SDL_GL_DeleteContext(maincontext);
                    SDL_Quit();

                    return 0;
                break;
            }
        }

        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

        SDL_GL_SwapWindow(mainwindow);
    }

    SDL_GL_DeleteContext(maincontext);
    SDL_DestroyWindow(mainwindow);
    SDL_Quit();
    return 0;
}

All help would be appreciated I am using C , SDL 2.0 and OpenGL 3.3+ ,
MSVC 2015 , Win10 64bit


texts:
Why and in which way should I incorporate console logging into my small sized games? I use Java and C++.

With console logging I mean things like this:


texts: I'm looking for a paper from Teknikus.dk

texts:
I'm looking for this great paper about Verlet integration: http://www.teknikus.dk/tj/gdc2001.htm

I've found this link on many websites, forums, blogs, everyone is recommending it !

The website is down for more than one week.


texts: Dynamically change shader syntax with the help of C++

texts:
I'm starting with the programmable pipeline and the shaders in C++ for OpenGL 3.0+, i would love to be able to change some settings on the fly, for example replacing a function with another function, supposing that i have a shader with an operation like

var = A + B

my goal is replacing + with any other operation on the fly with my C++ program, maybe with a GUI, but in general terms with C++, the problem is that until now i'm able to run a shader only after compiling it, so i have something like a static approach.

The same goal applies to the values of the vars that i would also like to change through C++.

It's possible with a programmable pipeline? I'm not interested in performance, just if is possible for the C++ to dynamically communicate and exchange data with the OpenGL pipeline.


texts: Texturing a mesh generated from voxel data

texts:
I have implemented the Marching Cubes algorithm to display an isosurface based on voxel data. Currently, it is displayed with triplanar texturing. I'm working with unity, so I have a material with the triplanar shader attached. Now, the whole isosurface is rendered using this material.
And thats my problem: I want the texture to represent the voxel data. I'm storing a material value for every point in the grid, and based on this value, I want the texture of the isosurface to change. Sadly, I have no clue how to do this. So if the voxel is sand, I want sand to be displayed; if it's stone, then there should be stone. Right now, everything is displayed as sand. Thanks in advance!


texts:
I am creating an FPS game in local multiplayer. One player creates the hot-spot game, and the other one connects through WiFi network and plays the game.

I want to find all of the player objects on the network that have a specific layer name, and store them into an array when the player spawns on the network. I've been able to add the object to the array, but I can't find the layer's objects with what I found with Google searches.

LayerMask.NameToLayer("LayerName");

LayerMask.LayerToName(8);

This returns the name of layer and layer index. How can I get the objects using a specific layer name, and also store it in to an array?


texts: What does Skyrim Creation Kit's NPC class do?

texts:
I'm trying to change it with the setclass console command Based on the UESP wiki it looks like it just governs stat gain for leveling, but based on the Elder Scrolls wiki it seems to only control their combat AI.

Obviously it does at least one or both of those - what does it actually do, and does it do anything else? __ Ex: if change Lydia from warrior1handed to vigilantcombat1h with the console command 000A2C94.setclass 0010bfef will it have any unintended side effects that aren't immediately apparent other than letting her use the alteration and healing spells I just gave her with console and setting her stats in a way that works for that?

Will it do something weird like mess with her factions or ability to join as my follower? Or mess with her health scaling as she levels? Something hard to notice until alot of time went by?

@desaivv* I was trying to do it with 000A2C94.setclass 0010bfef wasn't sure if it'd cause hidden issues only showing after hours of play or if i made a new character with the same bat file. but the creation kit sounds like an idea too, i'll have to see how complicated it is. it might just show what it'd do or have some easier way to change her behavior to add spells. I'll try it and see if anything obvious shows up short term just wasn't sure if it had known long term problems


texts: 2D Top Down: Can't follow the path accurately

texts:
In my game, there are many agents. Agents request a path, then after attaining a path to "goal" they follow the path. However player and many other things in the world can impact their position by pushing them or pulling them.

When agents get pushed and they happen to advance forward closer to "goal", I want them to smartly follow the previously given path.

I have pictures below to enhance your understanding of my situation.

I COULD recalculate path every a few seconds or when agent gets out of path BUT I have DOZENS of these little agents. I don't want to do path finding for DOZENS of agents again, again, again, and again whenever they walk out of the path.


texts: What makes Minecraft so CPU intensive, and what could be done to improve it?

texts:
Recently I've been searching for VPSes that allow Minecraft servers to be hosted, and surprisingly very few do. Most allow for games - but Minecraft in specific is disallowed by many.

Now it's fairly obvious why this is - it's very CPU intensive, and fairly ram hungry... But why? The answer I've gotten a lot through googling is "It's written in Java", or "Java's memory management is bad", but those aren't really answers - they're cheap cop outs.

What I really want to know, what I want to track down - is what exactly is eating up so much processing power? And given the desire to do so, what could be done to fix those issues.

I'm not looking to start a discussion on the merits of Java, or how well written Minecraft is - I'm curious if there's an actual answer, actual sections of code or ways things are done that are causing such high CPU usage, and ideally what could, theoretically, be done to fix them.


texts: Is Universal Scene Description (USD) suitable for games?

texts:
I've been reading about Pixar's Universal Scene Description (USD) system after seeing it in the package list inside Unity. All the material that I've read is within the context of the Film/Vfx industry with lots of focus on different teams working in the same larger scene.
From what I've seen the USD system has all the information that is commonly used in games but with the focus on film the frame budgets that these are designed to work with are huge when compared to games (minutes, hours and days vs milliseconds) which means that there are a lot of files and bits that make up a scene rather than the singular files that popular engines use (thinking of Unity and Unreal).
Ultimately I'm wondering if there is any reference material for how well this system works for games (with game industry practices and workflows) or if there are any engines which have support for USD as a primary means of representing a scene?
edit - to better specify what my question is
So from the Pixar documentation I've read that there was a design decision that favours Low memory footprint (which is always good) but results in high latency data access and since they specify that there are no GUIDs but rather namespaced access to elements which means a lot of recursive child.child style searching for data (in my mind at least, I'm sure once you get into it there are some optimisations you can make).
Since games defiantly need low latency data access to function well and low memory is a plus I'm asking if there are any known example implementations/strategies that work around this issue to provide an implementation that works for high performance games (thinking PC/Console rather than mobile)?
Or if the best solution to get around this is to perform a build step between the level editing stage and the runtime game engine that flattens the USD structure into something that is more typical of a game engine scene, which would work but make incremental changes more difficult to see in game as there could potentially be a lot of time between making a change and the build step completing.


texts: How to playlay multiple Particle Systems when colliding with multiple obstacles using object pooling?

texts:
I have two types of particle, one for each player:

Player 1 (Red Particle)
Player 2 (Blue Particle)

When player 1 collides with an obstacle then I want to play the red particle system, and when player 2 collides with an obstacle then I want to play the blue particle system.

Code:

TouchControll.cs

 public GameObject PlayersPartical;

  void OnTriggerEnter2D(Collider2D other)  //here my player collided with obstacle
    {
        foreach (Transform child in transform)
        {
            if (child.tag == "point")
            {

                //GameObject partical = Instantiate(twopartical[Random.Range(0,1)], transform.position, transform.rotation);
                //ParticleSystem heal = partical.GetComponent<ParticleSystem>();
                //heal.Play();
                GameObject partical = Instantiate(PlayersPartical, transform.position, transform.rotation);
                ParticleSystem heal = partical.GetComponent<ParticleSystem>();
                heal.Play();

                ObjectPooler.Instance.SpawnFromPool("redandbluepartical", transform.position, Quaternion.identity);
            }
        }
     }

ObjectPooler.cs

    public static ObjectPooler Instance;

    public void Awake()
    {
        Instance = this;
    }

    [System.Serializable]
    public class Pool
    {
        public string tag;
        public GameObject prefab1;
        public GameObject prefab2;
        public int size;
    }

    public List<Pool> pools;

    public Dictionary<string, Queue<GameObject>> pooldictionary;//which gameobject you should be pool

    void Start () {

        pooldictionary = new Dictionary<string, Queue<GameObject>>();

        foreach(Pool pool in pools) //add a pool in list
        {
            Queue<GameObject> objectpool = new Queue<GameObject>();

            for(int i=0;i<pool.size;i++)
            {
                GameObject obj =  Instantiate(pool.prefab1);
                GameObject obj1 = Instantiate(pool.prefab2);
                obj.SetActive(false);
                obj1.SetActive(false);

                //objectpool.Enqueue(obj);
            }

            pooldictionary.Add(pool.tag, objectpool);
        }
    }

   public GameObject SpawnFromPool(string tag,Vector3 position,Quaternion rotation)  //two tag red and blue partical
    {
        if(!pooldictionary.ContainsKey(tag))
        {
            Debug.Log("doesnot exist" + tag);
            return null;
        }

        GameObject objecttospawn =  pooldictionary[tag].Dequeue();

        //here how to call my trigger

        objecttospawn.SetActive(true);
        objecttospawn.transform.position = position; //pos
        objecttospawn.transform.rotation = rotation; //rotation

        pooldictionary[tag].Enqueue(objecttospawn);
        return objecttospawn;
    }

Image1:

Image2:

How do I call these particles?


texts: How can I disable an NGUI button when I pause my game?

texts:
There is an NGUI button in my game, which when pressed increases the player's power.

When I press the escape key, my game pauses completely. But the button still functions normally. Here's how I check for pausing:

void Update ()
{
    if(Input.GetKeyDown("escape"))
    {
        if(isPaused && Time.timeScale == 1.0f){
            Time.timeScale = 0.0f;
            AudioListener.volume = 1;
        }
        else
        {
            Time.timeScale = 1.0f;
            AudioListener.volume = 0;
        }
    }
}

I'd like the button to be deactivated when the game is paused. It should be visible, but not be clickable or anything. How can I achieve that?


texts: Disable depth testing for only some faces

texts:
I have some meshes and I need to be able to draw some part of them without depth test. Is it possible to turn off depth testing from within shader, wo that some parts will be rendered no matter what depth is in z-buffer ?

Or transform Z, W somehow to fake this ?


texts: what kind of technique is used in android game rendering like Pou

texts:
Hi I want to create a game which is graphicaly similar like Pou, I just do not know how is is rendered, if it is using opengl or just bitmaps at canvas? I want nothing serious, so i think opengl is to heavy tool for that. Just some animal, with moving eye and mounth... http://developer.android.com/training/building-graphics.html -- is where i am looking for the answer.

thanks


texts: How to colour blend between two materials?

texts:
I've been trying to get a material (with an image texture) to animate towards a colour mix with transparency, but either I'm attempting something the wrong way, or unable to find the right keyword to find about similar examples.
What I'm trying to accomplish is to make a 3D character blush; I have the face area on it's own material, with textures set, but that's where my problem is. If it was animating between two colours, I would simply use Color.Lerp, but since textures are included, that makes me think I have to somehow have a colour mix option for this.
I've also tried to just use the built-in animator to see if Unity would blend between the colours of two different materials, but after all it turned out to be an instant change on the new keyframe; which leaves me to think so far my only exit could be to manually create several keyframes, and create several materials to get it close to acceptable.
Although my knowledge about it is close to zero, is this after all only possible with a custom fragment shader? I don't know if there's a suitable package, or built-in Unity feature that makes something like this possible, or if at all I'm approaching this problem the right way...
Update: This is the shader I'm using right now, from 魔王. It might be a little confusing since inputs are all abbreviated, so here are some example files that are being used.


texts:
I've been trying to understand how I can use matrix to implement a smooth tile scrolling system but I fail miserably.

So I have a pretty big world stored in a multi-dimensional array which is drawn like this :

 for (int i = 0; i < screenHeight / 32; i++)
            for (int j = 0; j < screenWidth  / 32; j++)
               spriteBatch.Draw( texture[i + offsetY][j + offsetX] , screenRectangle[i + offsetY][j + offsetX] , Color.White );

Can somebody give me some tips on what to do or at least explain the logic behind the matrix translation?
Thank you.


texts:
I created a simple sprite rig using the skinning editor provided by the new 2D Animation V2 package. But it causes a huge FPS drop when added to the scene.

Methods such as SpriteSkin.LateUpdate generates significant amount of garbage as shown in the picture: See the spike shown on the CPU profiler when the rig is being enabled:

The rig is not even animated.  I also checked the other sample rigs provided by Unity and they also performed in a similar fashion.

Is this normal? I'm targeting mobile, so anything that can be done to avoid or improve the situation will be helpful.

I'm using 2d-animation-v2 2.0.0-preview.2 in Unity 2018.3.8f


texts: Using a single square sprite to create tetris-like objects

texts:
I'm currently working on a project in XNA, Visual Studio, where it is crucial I can create the classic tetris figures solely based on one square sprite (So I can return to each individual square at a later point, as I need individual squares highlighted at another point in the game).

I tried loading my square into my code, then use a matrix(Texture2D 2d-array) to draw one of my pieces:

centerPiece = new Texture2D[,] { { null, Content.Load<Texture2D>("square"), null }, { Content.Load<Texture2D>("square"), Content.Load<Texture2D>("square"), Content.Load<Texture2D>("square") }, { null, Content.Load<Texture2D>("square"), null } };

At first glance it seemed fine, but when I try to actually draw it using this method:

spriteBatch.Draw(centerPiece[,], screenView(), null, Color.White, 0f, IMGCenter(), 1f, SpriteEffects.None, 0f);

It can't draw it as an 2D array, or normal array for that matter. Neither is it able to draw the "nulls" I use in my first method, which also denies me of drawing it by the use of a nested for loop.

Am I completely on the wrong track, or am I just missing a slight detail?


texts: Why are all OpenGL function calls prefixed with "q" in the Doom 3 source code?

texts: Why is every OpenGL call prefixed with a "q" in the Doom 3 source code? Are they custom functions or a different library, and if so, why use that over OpenGL? Any Google search comes up with the Qt OpenGL module, which I assume has nothing to do with it.


texts: What is the purpose of multi-staged levels in mobile games?

texts:
In most recent mobile games like Grass Cut, FireBalls 3D, Twist Hit! or Snow Drift! I see the same level structure where you need to finish 3-4 mini-levels / stages in order to really finish the level.

For example, in Grass Cut average time to finish a full level that consists from 4 mini-levels / stages is 4 minutes. That's a very long play session as to mobile. What's the purpose of those stages? Why can't they just create a full-featured levels from those stages like in Color Bump 3D?


texts:
While programming a game with LibGDX, I came across a problem. My OrthographicCamera wasn't centering in the right place. I was trying to center the camera by using the line of code:

gameCam.position.set(gamePort.getScreenWidth() / 2, gamePort.getScreenHeight() / 2, 0);

But that centered the camera at (0, 0) so that you could see all four quadrants of the coordinate table.

Here is the image:

NOTE: I am using a FitViewport that was initialized like gamePort = new FitViewport(MarioBros.V_WIDTH, MarioBros.V_HEIGHT, gameCam);

Also: public static final int V_WIDTH = 400;
    public static final int V_HEIGHT = 208; (in the MarioBros class)

But after some fiddling with the code, I changed the line of code to this:

gameCam.position.set(gamePort.getWorldWidth() / 2, gamePort.getWorldHeight() / 2, 0);
I changed it from ScreenSize to WorldSize and got this result:

I'm still unsure of what using WorldSize changed.

What's the difference between the two?. Also, why did one work while the other didn't?


texts: Optimising the modelview transformation in GLSL for 2D

texts:
So, the standard way to transform vertices and then pass to the fragment shader in GLSL is something like this:

uniform mat4 u_modelview;
attribute vec4 a_position;

void main() {
    gl_Position = u_modelview * a_position;
}

However, I am working in 2D so there is redundancy in the 4x4 matrix. Would it be more efficient for me to do this?

uniform mat3 u_modelview;
attribute vec3 a_position;

void main() {
    gl_Position = vec4(u_modelview * a_position, 1.0);
}

gl_Position requires a 4 component vector so an extra operation is required at output. However the matrix multiplication is for 9 elements instead of 16. Can I do any better?


texts: Does anything need to be done to support variable refresh rate?

texts: Does anything have to be done in order for my game to take advantage of variable refresh rate technology supported by some displays, such as G-SYNC and FreeSync?


texts: Selecting/Hiding is broken for Perspective but works for Orphographics views. Why?

texts:
I'm learning Unreal4. Got a problem with selecting, focusing and hiding objects.

Focusing Issue: Focusing have to be done separatly for perspective view and ortho view. Why it is so?

Example: If I select an object in perspective view and focus on it (key F) everything works only for perspective view, but at the same time in ortho view no focusing occurs. So inorder to focus on the object in the ortho plales too I have repeat the whole process again: find object in orpho plane, select it, click F and only then focusing happens in all ortho view planes.

In perspective view "Show only selected" does not work, but works in ortho views
The same issue with "Show all actors".

Please, I need help. Thnaks.
P.S. Damn, it looks like I'm in some kind of a mode (for the lack of a better word). I mean in my clicking around, i've clicked ON some mode and now this selection\hiding thing works buggy...


texts:
I am wondering how one could implement "paint" in games. As a reference, I have two games I am specifically thinking about which are Super Mario Sunshine with its "goo" and Splatoon.

I'm wondering how I could replicate that kind of paint effect, where paint can be sprayed on to both the walls and floors of the environment, and on to objects.


texts: How to handle (0,0) in 2D game quad tree?

texts:
I am not sure how to handle situation when out objects (player) is in center (0,0) point of game which is crossing of four quads. How to handle that case?
This image shows problem:

Red rectangle is player BoundingBox, he is at center, he not fully contain in any quad but he partially belongs to four quads, so we should get content of those 4 green quads or whole pranet quad?


texts:
I read in this QA that NPOT will take memory as much as next POT sized texture. It means it doesn't give any benefit than POT texture with proper management. (maybe even worse because NPOT should be slower!)

Is this true? Does NPOT texture take and waste same memory like POT texture? I am considering NPOT texture for post-processing, so if it doesn't give memory space benefit, using of NPOT texture is meaningless to me.

Maybe answer can be different for each platforms. I am targeting mobile devices. Such as iPhone or Androids. Does NPOT texture takes same amount of memory on mobile GPUs?


texts: Player & Level class structure in 2D python console game?

texts:
I'm trying to create a 2D console game, where I have a player who can freely move around in a level (~map, but map is a reserved keyword) and interfere with other objects.
Levels construct out of multiple Blocks, such as player(s), rocks, etc.

Here's the Block class:

class Block(object):
    def __init__(self, x=0, y=0, char=' ', solid=False):
        self.x = x
        self.y = y
        self.char = char
        self.solid = solid

As you see, each block has a position (x, y) and a character to represent the block when it's printed. Each block also has a solid attribute, defining whether it can overlap with other solids or not. (Two solid blocks cannot overlap)

I've now created few subclasses from Block (Rock might be useless for now)

class Rock(Block):
    def __init__(self, x=0, y=0):
        super(Rock, self).__init__(x, y, 'x', True)

class Player(Block):
    def __init__(self, x=0, y=0):
        super(Player, self).__init__(x, y, 'i', True)

    def move_left(self, x=1):
        ... # How do I make sure Player wont overlap with rocks?
        self.x -= x

And here's the Level class:

class Level(object):
    def __init__(self, name='', blocks=None):
        self.name = name
        self.blocks = blocks or []

Only way I can think of is to store a Player instance into Level's attributes (self.player=Player(), or so) and then give Level a method:

def player_move_left(self):
    for block in self.blocks:
        if block.x == self.player.x - 1 and block.solid:
            return False

But this doesn't really make any sense, why have a Player class if it can't even be moved without Level? Imo. player should be moved by a method inside Player.

Am I wrong at something here, if not, how could I implement such behavior?


texts: Game only runs at 60fps in windowed mode with a 120hz monitor?

texts: In fullscreen the game will run at 120fps fine, the correct refresh rate for the monitor, but in windowed mode it only runs at 60fps.  If I disable VSync then it runs at thounsands of fps so it's not a case of a lack of performance.  I've correctly set the refresh rate in the ModeDescription.


texts:
I want to split a long png from my artist into vertical chunks that I can load into my code for a side scroller.

Is there a tool that will help do that or do I have to do it manually?


texts: Freeing texture memory in SharpDX - what am I missing?

texts:
I'm having a torrid time trying to resolve an issue whereby my total GPU memory consumption keeps rising throughout the course of my application, until the application fails with a DX out of memory exception.

I frequently load large textures, split into texture arrays (of type Texture2D). These are freed using .Dispose() before the next one is loaded, but memory is not seen to be freed when using Process Monitor (specifically, the "Committed GPU Memory" keeps rising with each new allocation).

I freely admit that I do not really know what the Committed GPU Memory metric in Process Monitor is telling me, but it is the case that the application will eventually fail through lack of memory - so the memory leak is real (and always when the memory hits the same amount in PM).
I do have object tracking enabled, and am able to see that no objects remain unaccounted for when the application closes normally (including after a number of texture loads).
I have created a synthetic example which simply allocates a texture and immediately calls Dispose() on a button click. This demonstrates the problem - memory usage increases until the application fails with an out of memory exception.

    public void d()
{
    texture = new Texture2D(Renderer.Device, new Texture2DDescription()
    {
        Width = 1024,
        Height = 1024,
        MipLevels = 1,
        Format = Format.R8_UNorm,
        BindFlags = BindFlags.ShaderResource,
        Usage = ResourceUsage.Default,
        CpuAccessFlags = CpuAccessFlags.None,
        OptionFlags = ResourceOptionFlags.None,
        ArraySize = 100,
        SampleDescription = new SampleDescription(1, 0)
    });
    texture.Dispose();
}

I did read somewhere on this forum that calling Flush on the context might have an effect, and in my synthetic example it does stop the memory build up - but not in my real app (?).

System is Windows 8.1, SharpDX 2.6.3.

Am I missing something really obvious here? I've Googled extensively but I can't find anything that suggests more than a Dispose is required when freeing textures.

thanks,
Matt


texts: ELO algorithm for handling people who don't play often

texts:
I'm using the ELO algorithm to rank players in an ongoing pong competition. Most players play every day, but we've got one player who hasn't played in a month. My algorithm currently only tracks scores over the last 30 days, and as a result, this player is rapidly rising through the ranks, despite having never played. He lost a bunch of his first games, but won most of his last few games, which means that his losses are dropping off the charts and his score is going up as a result.

Obviously, my plan to drop off scores after 30 days isn't working. What other methods can I use to penalize players for not playing often?

The only thing I've come up with thus far is to reduce the points based on percentage that is based on the days of inactivity (i.e. if a user hasn't played in a week, his points are only worth 70% of normal, and he would have to play X times to get back up to 100% points).

However, this seems too arbitrary. Does anyone have any better ideas or suggestions for handling inactive players in an otherwise active environment?

Thanks in advance.


texts: What physics engine support force fields and bodies represented as points?

texts:
I need a game engine that supports force fields in 2d or 3d, but suitable for 2d calculations, like bullet.

Each body I want to simulate is represented as a set of points. Each point has positive mass and can accept force. Force field is updated every tick.
Engine should accept force applied to every point and return point speed values and coordinates.
Each body made of particles should move as a whole thing in result, relative position of particles must persist, hence this is a rigid body.
If engine does not support setting body as a set of points it should allow setting density function, or some other means to let have non-uniform density.

Is there any that can do that, preferably cross-platform.


texts: Drawcall Batching with Ambient Occlusion

texts:
I'm creating a low poly 4X game that will likely have upwards of 200 unique hex tile models once everything is said and done. The colour palette consists of 16 different colours. I understand that if I want to reduce the number of draw calls I could simply UV map each individual model to the palette and there wouldn't be a problem.

However, I want to add an ambient occlusion effect which is best achieved by baking it on in Blender. This precludes me from using a single material for all my models since each model will have a different pattern baked onto the palette. I'm going to go out on a limb and say that having a different material for each model could create a pretty severe CPU bottleneck.

So, what would my best solution be? Should I abandon AO altogether? Perhaps I should try lightmapping in Unity (though I've heard AO baking in modelling software yields better effects)?

Any help is appreciated!


texts:
I wouldn't say i'm new to unity or programming in general.. but right now i feel so stupid.

I have a simple enemy script. I instantiate object with another script, calling SettingUpCreep and giving it a list of waypoints. Then happens update object should move from one waypoint to another.
But look at information in Console.

What's wrong with waypoints.Count in Update? Why does it increased?
And it works only if list and nextPos are public. If i set it to private then other methods can't access it. There's nothing in it.

What's happening and why? I can't understand.
Have i've done something wrong or just need more sleep?

List<Vector3> waypoints;
Vector3 nextPos;
int currentPoint = 1;

private void Update()
{
    moveToNextWaypoint();
}

void moveToNextWaypoint()
{
    Debug.Log("Update");
    Debug.Log("WP.count " + waypoints.Count + " NP" + nextPos);

    if (transform.position == nextPos)
    {
        if (currentPoint == waypoints.Count)
        {
            gameObject.SetActive(false);
        }
        else
        {
            currentPoint++;
            nextPos = waypoints[currentPoint];
        }
    }
    transform.position = Vector3.MoveTowards(transform.position, nextPos, 5 * Time.deltaTime);
}

public void SettingUpCreep(List<Vector3> list)
{
    Debug.Log("list.Count " + list.Count);
    List<Vector3> waypoints = new List<Vector3>(list.Count);

    for (int i = 0; i < list.Count; i++)
    {
        waypoints.Add(list[i]);
    }
    nextPos = waypoints[1];
    transform.position = waypoints[0];

    Debug.Log("WP.count " + waypoints.Count + " NP" + nextPos);
}


texts: Is wireframe effect possible without geometry shader?

texts:
I am trying to write a shader that highlight the edge between each pair of vertices, much like the UCLA Wireframe Shader.

All implementations I came across require geometry shader support. I am wondering if this is possible with just vertex and fragment shaders?

(Of course, I can use texture to workaround it; but I am trying to avoid create custom textures for each model that I need this effect. On the other hand, I could just use geometry shader but it presents quite a problem when porting to iOS, which lacks support.)


texts: A system that figure out the fastest (not shortest) navigation method between points for 2D spaceship with 2 axes propulsion

texts:
I am working on a space themed game with space being a 2D pane. The player issue order by clicking on the coordinate for his/her ship to navigate to a certain point on the  pane.
The player ship can:

Propel forward and backward
Strafe starboard and port
Yaw starboard and port

The ship's performance on each direction varies greatly depending on configuration. Some may move faster on sides and back directions than they do forward direction.
I have combined A* and PID control for navigation but couldn't help but noticed that in many occasions where the ship could have accelerate to the full speed and turn towards the target to reach the target faster, it instead turns in place while strafing slowly until it faces the destination before accelerating.
I would like to add another calculation that let the ship knows which navigation approach it should take to minimize the time to reach the target but I have no idea which field of study I should look into or if there is a quick win scenario I could use to achieve an expected outcome.
Please kindly recommend and thank you very much in advance.


texts: Create a game start-up menu screen with Lua/love 2d

texts:
I just got started programming games and decided to try out love2d since I'm learning lua.

I was wondering if anyone knows how I can create just a simple 2-3 button menu when you start up the game.

All I want to do is make a start up menu.

I have 2 files and nothing else:

main.lua, in which I have the game code and the level design
conf.lua, in which I have the title screen code and the icon of the game

I couldn't find any wiki page to help me for coding for the first time a splash screen and a overall game screen !!

now i have only one screen the game screen and i want to have 3 screens :
1 splash screen in wich i want to draw a image background and 3 buttons PLAY,EXIT,TITLE with coding mousepress!
2 game screen!
3 game over screen with an other background image!


texts: How do I move an object in a square pattern?

texts:
I have some bots that can move via setting the x and y. I have already been able to make them move in a circle pattern, but how do I make them rotate around the player in a square pattern? I'm not very good at math, so I'd appreciate some help.

Here is what it looks like now:

here is how I did circle pattern.

var PI2 = 2 * Math.PI, FOLLOWADD = PI2 / 18/*PI2 / 360 * 20*/, BOTSLICE = PI2 / BOTS;

bots.follow = function(id) {
    if (!ppl()[id])
        id = protocol.id; //player is default

    var pos = getPos(id), a, i = BOTS;
    while (i--)
        if (this[i] && !this.busy) {
            a = BOTSLICE * i + f;
          this[i].pos.x = pos.x + (Math.cos(2 * Math.PI / BOTS * i + f) * 3);
            this[i].pos.y = pos.y + (Math.sin(2 * Math.PI / BOTS * i + f) * 3);
        }
    f = (f + FOLLOWADD) % PI2;
}.bind(bots);


texts: How can you run events after a set amount of time in SFML 2.0?

texts:
I've been using SFML 1.6 for a while and recently upgraded to 2.0, apparently there's a new sf::Time type however I'm clueless as to how I can achieve running of a certain function after a set amount of time.

How would you go about doing this? Say you want something to execute after 5 seconds, how would you do it in SFML?


texts: SDL 2.0 setup on code::blocks using gcc(MinGW) on win7

texts:
I have recently installed code::blocks on my system running windows 7 home premium 64-bit, and wanted to start learning SDL. The code::blocks executable is the one installed by the "codeblocks-12.11mingw-setup.exe"- setup wizard, which also installs gcc and MinGW as implied by the name. I proceeded to download the precompiled version of SDL 2.0 development files "SDL2-devel-2.0.0-mingw.tar.gz" from the SDL site, created a new empty project, pointed the compiler to the /include directory and the linker to the /lib directory of the 32-bit version of SDL 2.0 using the project specific search directories and set the IDE to treat the project as a GUI application instead of a console application.
However, trying to build the project always results to a build error of the form:

`SDL_main':
undefined reference to `SDL_Init'
undefined reference to `SDL_Quit'
undefined reference to `WinMain@16'
=== Build finished: 3 errors, 0 warnings (0 minutes, 0 seconds) ===

Which is understandable since I have not specified any linker flags, but adding the flags -lmingw32 -lSDLmain -lSDL to "other linker options" in the IDE results in the error:

ld.exe  cannot find -lSDLmain
ld.exe  cannot find -lSDL
=== Build finished: 2 errors, 0 warnings (0 minutes, 0 seconds) ===

Implying it did indeed recognize the flag -lmingw32.
I tried to copy the appropriate SDL dev files directly to MinGW/include and MinGW/lib, and placed the runtime DLL in the project directory to no avail. Do I have the wrong linker options for SDL 2.0, are they in the wrong order, or am I missing something else?

EDIT: checking all the involved files revealed that libSDLmain.a has been replaced by libSDL2main.a etc. in SDL 2.0. After replacing the linker options with -lmingw32 -lSDL2main -lSDL2 the linker stopped complaining about not finding missing statically linked libraries. However it now again fails to find the definition of the various SDL routines called in the program, giving the same output as stated in the first case (undefined reference to X).

EDIT2: Just found out i'm not alone with this problem, there is an old, unanswered question about the exact same problem on stackoverflow: https://stackoverflow.com/questions/17011028/i-can-compile-with-sdl1-2-but-not-with-sdl2-cb

Source code:

#include <SDL2/SDL.h>

int main(int argc, char* argv[])
{
  SDL_Init(SDL_INIT_EVERYTHING);
  SDL_Quit();
  return 0;
}

Build log from building the project after adding the aforementioned linker options and SDL files directly in MinGW's /include and /lib directiories and removing the search directories from the project's options:

-------------- Build: Debug in newProject(compiler: GNU GCC Compiler)---------------

mingw32-g++.exe  -o bin\Debug\newProject.exe obj\Debug\newProject\newProject\main.o   -lmingw32 -lSDLmain -lSDL   -mwindows
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lSDLmain
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lSDL
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
2 errors, 0 warnings (0 minutes, 0 seconds)


texts: Hex tile systems and the efficient use of classes

texts:
So I've built myself a system of classes for what I think is an efficient way to describe an entity that would live in my game.

Is this an effective approach or am I creating entities that are too large in size? I want the game to be able to run well even with an inane amount of tiles.

I read the post (Map with 20 million tiles makes game run out of memory, how do I avoid it?) about having one million tiles and memory problems and I'm worried that my tile system I've created using the entity system will not be able to handle such large sized maps as there is so much information to be processed.

To give you an idea about what each component of a Hex Entity holds, the sprite comp maintains the following variables: the texture, position, rotation, height and width; while the hex comp of the hex entity maintains: the position, the coordinates on the board, the orientation, and what hex's are adjacent to it. Should i simplify the date types


texts: How to convert non-discreate data for discreate pathfinding?

texts:
I have a list of entities that looks like [{x,y,width,height}, {x,y,width,height}, ...]. This list is non-discreate, It doesn't follow a grid. entities can be positioned at floats like x:2.345

Most path finding solutions I've found like A* expect a discrete grid to perform the calculations.

I've looked at Theta* as a solution it supports non-discreate pathfinding on a navigation mesh.

Either way I need to convert this entity data into a Grid or Navigation Mesh. This is probably a common task but new for me. I'm doing this in Javascript and would appreciate any examples in that language.

also some entities will be moving in realtime and will effect future path generation of other entities.


texts:
In my project, I'm trying to render a map using TileMapRenderer. But it doesn't show anything when I render it. But when I use some other files from a tutorial they are rendered correctly.

When debugging my TileAtlas instance shows the size as 0.

I have used Texture Packer UI for packing the images. Comparing with the tutorial's files, I can see that the index starts from 1 in my file and 0 in the tutorial. But changing it to 0 wouldn't work also.

map.png
format: RGBA8888
filter: Nearest,Nearest
repeat: none
Map
  rotate: false
  xy: 0, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 1
Map
  rotate: false
  xy: 32, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 2
Map
  rotate: false
  xy: 64, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 3
Map
  rotate: false
  xy: 96, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 4
Map
  rotate: false
  xy: 128, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 5

Here is the begining of the tmx file.

<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="20" height="20" tilewidth="32" tileheight="32">
 <tileset firstgid="1" name="a" tilewidth="32" tileheight="32">
  <image source="map.png" width="256" height="32"/>
 </tileset>
 <layer name="Tile Layer 1" width="20" height="20">
  <data>
   <tile gid="2"/>
   <tile gid="2"/>

Apart from that the tutorial files and my files seems to be similar.

Can anyone help me here.


texts:
This is a bit more difficult than it seems and the one other post on here isn't sufficient. You have a row of n items, and each item could be any one of 5 colors. You need to find if there are any runs of 3 or more items together of the same color and destroy them.

Yellow, Red, Blue, Green, Red, Red - destroy nothing

Red, Red, Red, Green, Yellow, Red - destroy the first set of 3 Red, but not the 6th red

Red, Purple, Red, Red, Red, Red - destroy only the set of 4 Red

You can't simply check each item to see if the item previous to it has the same color, and destroy them when that happens twice in a row (meaning 3 matching items), because then you are not accounting for the fact that there could be 4 or more in a row. Are there any robust algorithms out there for this?


texts: (Realtime-) Global Illumination starting point

texts:
What techniques should someone look at when getting into real time global illumination (for dynamic lighting scenarios)?

It's hard to get a real grip on the different mentioned techniques without knowing anything about the subject. If I wanted to incorporate GI into my graphics engine, where should I start reading as a baseline? Which algorithms are implementable in a reasonable timeframe by someone new (i.e. not a highly specialized algorithm that gains minor performance for months of work) and which are not completely outdated by now (i.e. straight up replaced by something simply prettier and faster)?

Photon mapping seems to come up a lot, and I've read about things like voxel cone tracing and more specific algorithms, e.g. this technique used in CryEngine 3. However, knowing next to nothing about the field it's hard to decide where to start.

What general techniques are worth looking into?


texts: Prevent keyframe interpolation in imported model animation in Unity

texts:
I made first person model in blender. It also has animations in it.

Most of animation works fine, but in some cases, Unity's keyframe interpolation makes wrong result.

Note that animation was made by 60 frames per second in Blender.

To explain my problem, you have to see my model:

As you can see there are two magazines. Each named Mag1 and Mag2 and Mag1 is the magazine that attached to the gun.

Mag2 is always located very bottom of the screen so that it is impossible to see, except reloading animation.

While reloading, first pull out the mag1 from the gun and put in the mag2 to the gun. And here is the trick, after mag2 is attached to a gun, hand put the mag1 somewhere, maybe magazine pouch.

Anyway as soon as mag1 disappeared from the screen, it switches mag1 and mag2 immediately at only single frame. So mag1 is now move back to the gun and mag2 is also reloated to bottom.

In Blender, it seems nothing wrong but in Unity is quite different. As soon as mag1 disappeared, it doesn't switched immediately and it moves smoothly animated so I can see that magazines were moved. I'm pretty sure that this happens maybe Unity interpolates keyframes.

I already turned off Animation Compression option and resample curves, but still won't worked.

This is the video that I made to explain my situation:
https://www.youtube.com/watch?v=7aew959ejL4&feature=youtu.be

Is there a way to "turn off" that interpolation? I want to disable it only that frame. Unity doesn't allow me to edit animation clip, so I just duplicate animation clip and change the option(I don't know what it called) to "Flat" and use that clip instead, but still have same problem. (Note that it wasn't easy because Unity doesn't show me the animation if I duplicate and modify it)

I struggled this issue almost a year and still figuring out how to fix it, and I think it's time to solve it. Any advice will very appreciate it.


texts:
Possible Duplicate:
  Is learning OpenGL 2.1 useless today?

This question was asked around 2 years ago and i have well read the answers to it, but that was 2 years ago, i would like to know if it's a bad idea for me to learn OpenGL2.1 today.

I bought the OpenGL superbible (4th edition) and not the 5th because some user in the ratings said that it was much better and i believed him. But now i'm affraid that was a long time ago.

Thanks for all your feedback!


texts: Success checks for client-side javascript mini-game embedded within a server-side browser game

texts:
Disclaimer: I know that client-side is always to be held with suspicion, but I'm trying to conceive of a way to verify the success or failure of javascript-based mini-games.

Mini-games to add fun to client-side game

Here is an example scenario:

I implement a javascript-dependent picture-sliding game for various pictures.
You know the type:

So that would be a javascript game that would be served from my website.

How to check success

I then want to set up a verification scheme to verify that the game has been completed, the browser would ping the website with a verification code or scheme to say "hey, I'm done, and the javascript mini-game is complete".

There are two ways that I can think of to make the verification work.

One is a "replay" scheme, e.g. each
of the moves that the user does
would be concatenated and sent to
the server, which would have a
system for verifying that the end
result was indeed a valid solved
state.
The other is a "summary"
verification code, for example if
each of the numbers is assigned a
random letter client-side, the final sliding puzzle state
would result in a word-code like
asdfaseasewadsfwef when read from left to right, top to bottom, which can be
sent to the server upon completion
to receive a pass/fail grade of
success.  Obviously that isn't
checking the intermediary steps,
just the final result, but it'd
probably be a lot faster and less
resource-intensive, and would probably prevent a bit more abuse than just a GET request with a "go" parameter.

I don't have a huge, high bar for 100% secure communication in this case because I just want to add fun, and give some minor/non-overwhelming benefits from the mini-games, not build a fort-knox system.  And if someone is smart enough to hack up a solution to the mini-games to automate them, I won't be excessively broken up about it.

Techniques?

So with that in mind, are these two approaches valid?  Are there other approaches to try with this?  Any examples in the wild that I could learn from?