texts: Behavior Trees or GOAP for Rimworld-like game?

texts:
I am currently making a Rimworld-like game. For now, it is identical in appearance, how the map works and how the pawns (colonists) are supposed to function.
Core world-generation logic and A* pathfinding is done, so my next step is to implement AI.
The question - for a game such as Rimworld (since the original author of the game never mentioned what sort of technology he used), is it preferable to use Behavior Trees or Goal Oriented Action Planning AI methods?
I use Unity and have found assets for both of the technologies:
GOAP
Behavior Trees
I am expecting large map sizes, anywhere from 200x200 to 400x400, and an AI agent might have to take a lot of things into consideration (his environment, the position of his allies and enemies, possibly nearby items and structures).
I am leaning towards GOAP because even though it seems harder to implement at first, it seems easier to maintain later, because the agents figure out stuff on their own based on the information they are given, so I won't have to hard-code every single action or pattern (please correct me if this is wrong.) I also have no experience with either of the technologies so this might be something to take into account, but I am willing to learn.
Any suggestions, comments or ideas are much appreciated and I'm open for discussion.


texts: GraphicsAdapter lacks a definition for CheckDeviceMultiSampleType

texts: The MSDN is really confusing about this, with all their different versions of XNA jumbled together for my google results. All I want to do is find out, in XNA 4.0, what antialiasing modes are supported by the display adapter. Supposedly, this involves calling GraphicsAdapter.CheckDeviceMultiSampleType(), but that function isn't defined. What should I be using in its place?


texts:
I need to download audio (OGG, Mp3 or wav) from URL and play it.

In Editor is working fine, and also in stand alone build.

But not in WebGL build.

My Code:

    // Here audio is downloaded based on audioURL
...
      WWW data = new WWW(audioURL); yield return data;
            AudioClip downloadedClip = data.GetAudioClipCompressed(false, AudioType.OGGVORBIS) as AudioClip;
            if (downloadedClip != null)
            {
                _audio.clip = downloadedClip;
            }
...

public void PlayAudio() {
    // Here clip is play
            if (_audio.clip != null && _audio.isPlaying == false)
                _audio.Play();
            else
                Debug.Log("Background music not present!");
            _audio.loop = true;
}

To download clip i've used also (instead first code part):

 using (UnityWebRequest www2 = UnityWebRequestMultimedia.GetAudioClip(audioURL, AudioType.OGGVORBIS))
        {
            yield return www2.SendWebRequest();

            if (www2.isHttpError)
            {
                Debug.Log(www2.error);
                LogAdd(www.error, true);
            }
            else
            {
                AudioClip downloadedClip = DownloadHandlerAudioClip.GetContent(www2);
                _audio.clip = downloadedClip;
            }
        }

For some reason, audio in webgl isn't played.

EDIT 1: When uploading MP3 , error (also in editor) is:

  Streaming of 'mpeg' on this platform is not supported
  UnityEngine.Networking.DownloadHandlerAudioClip:GetContent(UnityWebRequest)


texts:
Hello I'm looking for a bit of advice in which way is the best to proceed creating my applications 'gameloop' - It doesn't want to be a game loop in the truest sense since I'm not really rendering any graphics just displaying some animated gifs.

My goal is to have a task that runs every 30 minutes that decrements pet variables

Example Method
passTime { <pets health> = <pets health> - 1; <pets hunger> = <pets hunger> -1; <pets exp> = <pets exp> + 5; } et

c.  I was wondering the best way to go about this? AsyncTask will be of no use since this ideally wants to be running even when the app isn't.

I would rather use an IntentService subclass rather than a Service subclass but I can't seem to get the IntentService to run through a pendingIntent via the AlarmManager.

So I'm asking advice on the best way to proceed from the ground up with this. Thank you!


texts: When do I need to ask for permission to recreate an old game?

texts:
Possible Duplicates:
  How closely can a game resemble another game without legal problems
  Legal issues for a "fangame" of a commercial franchise?

I want to do a mobile version of an old game I used to like called Bow And Arrow (video, game). There's a project already port it in Ruby. I'm wondering if I can do a remake of this game. Do I have to get permission from the creator, or does it only matter if I use the same resources (graphics and sound)?


texts: Calculating a line's normal for the purposes of collision

texts: Given a line defined as two points in screen coordinate space (which themselves are two 2D vector positions) how would I calculate a 2D Vector perpendicular in the "up" direction for determining a normal force?


texts: Animator, gameObject position not being kept

texts:
I have idle & popout animations. Idle- simple scaling up and down 2d object and popout- get the gameobject's position to the right and leave it there. I'm using animator for this purpose. I have a trigger Popout, which when triggered the animator goes from playing the Idle animation to the popout animation. Then another transition from the popout anim back to the idle anim. The problem is that when it gets back to the idle anim, the position gets back to the first one(i.e. as if the popout anim hasn't been played). My goal is, after playing the popout, the gameObject to stay at the last position from the popOut anim and to continue to be scaled up and down(the idle anim). My goal is, the gameObject to keep its last position set from the popout anim(which is to the right of its initial one) and to continue playing the idle anim from there instead of going back to its initial position.

Why does the animator reverses the gameobejct's position to its initial one, after the popout anim has been played?

In this video you can see the problem and what exaclty I'm doing.


texts:
The situation
The game I'm working on has a 16-bit inspired art theme. It's consistency is relatively relaxed. (i.e. pixels don't have to line up.)
Since it has a slightly dark theme, I decided to light up only the surrounding area of the player. Though I'm town because I'm not sure which of the three methods are most appealing.
Method 1: Smooth lighting
I.e. a smooth gradient between the player and the surrounding area.

I fear it's smooth nature might feel off compared to the rest of the game's art,
Method 2: Pixelated lighting (without pixel alignment)
I.e. a pixelated gradient that doesn't necessarily have to line up with background tiles.

This is more in tune with the game's art, but it's lack of alignment is noticeable.

yellow lines are tile borders while teal lines are lighting borders
Method 3: Pixelated lighting (with pixel alignment)
Essentially the same as the previous method, except without the lack of alignment. This fits the game's art style well, but almost too well. I mean that in a way that the lighting is almost too pixelated.
Conclusion
Perhaps a combination of these methods is the most psycologically pleasing or maybe something completely differn't will fit the bill.
What are your guys' thoughts? / What have other games done in this situation?


texts: Does use of simple shaders improve performace/battery life?

texts:
I'm making OpenGL game for Android. Till now i've used only fixed function pipeline, but i'm rendering simple things.

Fixed function pipeline includes a lot of stuff i don't need. So i'm thinking about implementing shaders in my game to simplify OpenGL pipeline if it can make better performance.

Better performance = better battery life, unless fps is limited by software limit, not hardware power.


texts:
I've been struggling with a decision regarding whether or not to implement a scene graph in my game. I have some use cases that call for such a tool, but I haven't been able to get through some of the implementation details.

Some background: I'm writing a space shooter type game targeted at mobile platform (Android, primarily) and my code is almost entirely C++. I'm not using any middleware; the rendering and physics engines in particular are my own creations. My physics engine updates locations of objects based on forces and impulses. I have no animation system as of yet but may visit this at some point (which may or may not have anything to do with this discussion).

First, I'll describe a good use case. I would like to have a boss that is made up of several discrete parts, each of which can be damaged / destroyed independently. For example, I might have a boss that has an arm that can receive damage independently of the rest of the boss entity. When the arm is destroyed, a fire particle effect located at the bosses' shoulder could indicate that the arm is now destroyed.

As it is, I have decided to try solving such problems with constraints in my physics engine to keep such compound objects together. One such constraint provides 0 degrees of freedom and is essentially a transformation matrix. This is really an attempt to circumvent a problem that ultimately turned me off of scene graphs in the first place, described below.

The primary reason I turned away from use of a scene graph is because I could not find an efficient way to keep nested objects (objects that inherit a transformation from their parent) in both the physics world and the rendering scene. The physics world needs objects to be in world-space (or at least the same space) while the rendering scene needs objects in parent-space. Tracking locations in both spaces might help (and be inevitable) but raises its own concerns, not the least of which relates to performance.

However, given use cases like the one described above, I think that being able to 'work' in parent space will become very important, and trying to force my physics engine to maintain these relationships through the use of constraints is going to become problematic.

Given the use case and predicament described above, should I use a graph structure to pass transformations from one object to another? If so, how should my physics engine calculate new locations and perform intersection tests for objects in different spaces?


texts: Smooth animation when using fixed time step

texts:
I'm trying to implement the game loop where the physics is independent from rendering but my animation isn't as smooth as I would like it to be and it seems to periodically jump. Here is my code:

// alpha is used for interpolation
double alpha = 0, counter_old_time = 0;
double accumulator = 0, delta_time = 0, current_time = 0, previous_time = 0;
unsigned frame_counter = 0, current_fps = 0;

const unsigned physics_rate = 40, max_step_count = 5;
const double step_duration = 1.0 / 40.0, accumulator_max = step_duration * 5;

// information about the circ;e (position and velocity)
int old_pos_x = 100, new_pos_x = 100, render_pos_x = 100, velocity_x = 60;

previous_time = al_get_time();

while(true) {
    current_time = al_get_time();
    delta_time = current_time - previous_time;
    previous_time = current_time;
    accumulator += delta_time;

    if(accumulator > accumulator_max) {
        accumulator = accumulator_max;
    }

    while(accumulator >= step_duration) {
        if(new_pos_x > 1330) velocity_x = -15;
        else if(new_pos_x < 70) velocity_x = 15;

        old_pos_x = new_pos_x;
        new_pos_x += velocity_x;
        accumulator -= step_duration;
    }

    alpha = accumulator / static_cast<double>(step_duration);
    render_pos_x = old_pos_x + (new_pos_x - old_pos_x) * alpha;

    al_clear_to_color(al_map_rgb(20, 20, 40)); // clears the screen
    al_draw_textf(font, al_map_rgb(255, 255, 255), 20, 20, 0, "current_fps: %i", current_fps); // print fps
    al_draw_filled_circle(render_pos_x, 400, 15, al_map_rgb(255, 255, 255)); // draw circle
    // I've added this to test how the program will behave when rendering takes
    // considerably longer than updating the game.
    al_rest(0.008);
    al_flip_display(); // swaps the buffers

    frame_counter++;

    if(al_get_time() - counter_old_time >= 1) {
        current_fps = frame_counter;
        frame_counter = 0;
        counter_old_time = al_get_time();
    }
}

I have added a pause during the rendering part because I wanted to see how the code would behave when a lot of rendering is involved. Removing it makes the animation smooth but then I'll have to make sure that I don't let the frame rate drop too much and that doesn't seem like a good solution. I've been trying to fix this for a week and have had no luck so I'd be very grateful if someone can read through my code. Thank you!

Edit: I added the following code to work out the actual velocity (pixels per second) of the ball each time the ball is rendered and surprisingly it's not constant so I'm guessing that's the issue. I'm not sure why it's not constant.

alpha = accumulator / static_cast<double>(step_duration);
render_pos_x = old_pos_x + (new_pos_x - old_pos_x) * alpha;
cout << (render_pos_x - old_render_pos) / delta_time << endl;
old_render_pos = render_pos_x;


texts: What do I need to know about game design before I design and develop a game in Silverlight?

texts:
I have started to design a game. I have weighed up the options of XNA, Unity, and Silverlight. I am going with Silverlight... Is there anything I important that I am missing that I need to know?

EDIT

I sketched the structural design yesterday: http://carnotaurus.tumblr.com/post/4921541502/old-school-game-to-be-written-in-silverlight

Not to repeat the game specifications at great length, a description of the 2D old school game can be found here: What approach would you take to develop an old school game?


texts:
I'm working on a Unity project with the Lidgren UDP library for connection. I'm new to networking, so I'm not sure on general "best practices" for this area. I'm trying to figure out a good way to be able to quickly trust and verify a received UDP message.

I currently keep a dictionary of players with each player assigned an UID (uint) from the server when the player connects. This UID serves as the key in the dictionary. The player is told their UID. Nothing secret being communicated here, like usernames/passwords, so I'm not worried about things like that.

So I'm having a problem with wrapping my head around how to trust the messages. Things like position updates and user actions will be sent from client->server via UDP. I was thinking of a quick way to process these messages is by including the UID at the start of each message, checking the UID, grabbing the corresponding player from the dictionary, and then updating the players position that way.

But I'm worried that can be easily spoofed/manipulated. All it'd take is some mischief maker to figure it out, and then start inserting random position updates (for themselves or others).

Is there an efficient, more fool proof way to ensure the message is from who it claims to be? Do I have to just rely on comparing IPEndPoints to tell? Is there anything specifically to Lidgren I can or should use?

Please don't respond if all you have is "don't worry about it" or "why would anyone want to do this?" I'd rather learn proper processes now than down the road when/if it becomes a problem.


texts:
I'm trying to make a simple post processing pipeline, depicted as follows with 3 effects in this case:

        |------|    |------|    |------|
   I -->|Shader|-O->|Shader|-I->|Shader|-O->
        |------|    |------|    |------|

I and O stand for a pair of 2 ShaderResourceViews/RenderTargetViews.

My plan was to do the following:

Create a shader resource and render target for each the input and the output
Apply the shader
Swap input and output to be used for the next shader
Goto 2.

This sounds somewhat confusing, but basically the same 2 ShaderResourceViews /RenderTargetViews should be reused for each stage of the post processing pipeline.

Is this possible, or do I have to create separate input and output ShaderResourceViews /RenderTargetViews for each stage of the postprocessing pipeline?


texts: Should I update VAO when I update a VBO?

texts:
My VAO/VBO/IBO work fine on iPad and other devices on Android excepted two (A Samsung galaxy S4 and a Sony Xperia S).

A problem is present when I start my application on this devices, every elements move everywhere and start to blink on each frame, the problem is present on every element updated during the simulation.

I have a SpriteRenderer who share a VBO, so I need to update this VBO on each frame for each sprite (change color, uvs, …).

The visual glitch is not present on static element (like text).

So my question his:

Did I have to do something with my VAO on each frame?

Here is what I've got:

Init part:

 - bind vao
     -> Bind vbo
     -> Bind ibo
 - unbind vao

Rendering part:

for( sprites )
{
     // Update (Need to bind VAO here?)
     bind vbo (lock)
     update vbo data
     unbind vbo (unlock + bind)

     // Draw.
     bind vao
     drawElement
     unbind vao
}

Thanks!


texts: How can we compare the scores of 2 Facebook friends?

texts:
We need to show players their friends' scores during play.

In the past, Facebook worked perfectly for this. However, now they have depreciated their Graph API. How can we work around this?

We do not want to use the Google Play Store or Gamecenter for this, as people are hardly connected on these platforms. Also, of course making an ID for our own app is also not going to work for us.


texts: Can I use the ENet library in a commercial game?

texts:
I have some problems understanding ENet's license. It's not the zlib license as far as I know, but it seems like it's not GPL either. I'm not a native English speaker and I can't understand what the license exactly is.

Can I use ENet for a commercial game? If yes, do I need to mention that I used ENet and do I need to deliver ENet's license with my game?

I have no problem with mentioning that I use ENet in my credits, but ENet's license delivering thing seems just stupid and not-understable to me.


texts: When one should use events in Unity and how they impact performance?

texts:
let's say that inside an OnGUI() script we want to call a method from another script to handle a particular situation. From a prestational point of view, what's the difference between these 3 approaches?

1.

    public class SomeClass : MonoBehaviour{

        ...

        void OnGUI(){
            if(something)
                 otherClass.heavyWorkMethod();
            ...
        }
    }

2.

public class SomeClassCoroutine : MonoBehavior{

    ...

    void OnGUI(){
        if(something)
            StartCoroutine("someClassCoroutine");
        ...
    }

    IEnumerator someClassCoroutine(){
        otherClass.heavyWorkMethod();
        ...
    }
}

3.

public class SomeClassEvent : MonoBehavior{
    public delegate void SomeAction();
    public static event SomeAction OnEvent;
    ...

    void OnGUI(){
        if(something)
            OnEvent();
    }
}

Where in the third case, the heavyWorkMethod in OtherClass gets called when the event OnEvent is fired.

Thanks for your time. Looking forward to read your answers.


texts: What is an efficient/safe way to broker head to head communication for a mobile game

texts:
I have a mobile game written in XNA/MonoGame with a wcf server and I am currently designing the head to head competition mode. Previously I have created a game that used UDP to set up communication between several clients(one of which acts as server and client) over WiFi but now I want to be able to set up a game between players over the internet. Utilizing the wcf server, I already have methods which allow a player to indicate that they are looking for a game, retrieve a list of other players looking for a game, and indicate that they would like to initiate a game with one of those players.

What I want to know though, is what is the best way to transfer the connection info from one client to the next so that they can directly connect to one another or whether that is actually a good/necessary idea or not. The game only needs to send a list of words from one client to the competitor initially and then send/retrieve status updates every few seconds of how many words have been completed until one of them gets x number of words ahead.

Obviously a direct connection would allow a much tighter window of response to determine when someone has won but really Its not a first person shooter so some flexibility is ok. However, utilizing the server and database to determine each players state can theoretically add a lot of lag especially if there is a lot of load on it.

I haven't set up any push notification for the mobile client and besides the server itself does not have a main loop that would allow it to push out updates, it basically is a front end for access to the game database.

Hopefully I haven't been to vague or general, but I really am looking for suggestions as to where I should spend my effort without having to reinvent the wheel or go down some path that inevitably wont work/cause unforeseen problems. If anyone has a good reference for this that would be appreciated as well.


texts:
I have a png which is mostly transparent, except for a shape I've drawn in white. I want to be able to blend this bitmap with a color when drawing it with Canvas. I'd like something like [Sa, (Dc * (1 - Sa)) + (Sc * C * Sa)], where C would be the color I want to blend with. I assumed I would just set the paint color to C, then call drawBitmap, but the default behavior doesn't seem to be blending.

Is this the right approach? Are there some Xfer codes I'm missing? Can I create a custom shader to do this? Is there an example in the android sdk api I missed that does this?

As an additional constraint, I should mention I want to avoid just creating a new bitmap with the blended color to use. The color C (above) could change every frame, and I don't want to have to generate 100's of these bitmaps for every color that I might need.


texts:
I'm a newbie graphics programmer and I've been wondering recently - how does model data (meshes and materials) flow from application (CPU memory) to graphics card (GPU memory?)? Say I have a static model (e.g. a building) that I load and setup once and don't change throughout the app lifespan.

Does its data get sent to GPU memory only once and sit there forever?
When the model gets actually rendered each frame do GPU processors have to fetch its data each time from GPU memory? What I mean is - if I had 2 models rendered multiple times each - would it matter if I first rendered the first one multiple times and then the second one multiple times or if I rendered the first one just once, the second one just once and kept interleaving it like that? I could call this question "internal GPU data flow" in this sense.
Obviously graphics cards have limited RAM - when it can't hold all the model data necessary for rendering 1 frame I guess it keeps fetching (some of) it from CPU RAM each frame, is that correct?

I know there's a lot of books and stuff about this on the internet but maybe you have some quick general guidelines as to how to manage this data flow (when to send what and how much, when and how to render)?

Edit:
I forgot to make one distinction: there's sending the data to the GPU and there's setting/binding the buffers as current. Does the latter cause any data flow?

Edit2:
After reading Raxvan's post I'd like to distinct a few actions:

buffer creation with initialisation (as he said I can store the data in either CPU ram or GPU one)
buffer data update (which I believe is straightforward when the data is kept in CPU ram and requires fetching from GPU to CPU ram (and then back) when it's kept in GPU ram)
binding the buffer as active (is it just a way to tell the API that I want this buffer to be rendered in the next draw call and it doesn't do anything by itself?)
API draw call (here I'd like to hear from you what actually happens there)


texts: How do you pack resources, in a game when you have too many of them?

texts:
I've recently made a basic Space Invaders clone, in C++, using the Allegro 5 framework. After I finished, I realized I had about 10 sprites, and 13MB worth of DLLs; some of the players didn't even have the mingW DLLs, which was making   the game very confusing.

How do I pack all my resources in a way that I can easily add and remove data to my game, and to reduce the size taken by the resource, basically placing them in one spot? I'm using codeblocks.


texts: How can I find out where a particular texture is being used in my Unity project?

texts:
I have a texture in my assets, and I need to find out where it's being used so that I can change some textures in my project.

How can I find out where a specific texture is used in my project?

The case is that the game needs to be updated to have a Christmas look, so there are a few game textures should be replaced.

This resource checker does not work for me. It shows that there are no textures even though there are:


texts:
In Unity we can use the Attribute [SerializeField] to expose private fields to the Unity inspector like so:

[SerializeField]
private float speed;

Now I want to do the same for methods that I want to use in the inspector: for example OnClick callback methods for buttons. Using [SerializeField] does not work and from what I can tell there is no [SerializeMethod] or similar to expose this functionality. How can I expose private methods to the Unity inspector similar to how [SerializeField] exposes private variables?

To understand what I mean by "expose" I meant having it show up in the inspector like this:

The reason I want this functionality is because I just encountered a bug where I was calling a public method from a script that was just meant to be called as a callback to the OnClick method. Pretty much the same reasoning as wanting to use [SerializeField] to hide variables but expose them to the inspector.


texts:
When I'm creating games, I really love the coding part -- designing, developing the main functionality and "core" part of the game. However, most of my games are reasonably small/easy in terms of coding, but require a lot of content -- whether graphics, levels, sounds, puzzles, story narrative, etc.

I find development speeds through the coding parts, but nearly halts when it comes to content creation -- it's tough, sometimes boring work.

What can I do to make content creation quicker and more interesting/fun? I'm already integrating content into a working game, and building/using tools as much as possible to quickly assemble my content.

Edit: my question is not about learning any particular labor-/time-intensive skills like drawing assets or picking out sound effects; it's about that psychological hurdle when you have to just sit down and grind out the rest of your game, even if it's not the most fun thing in the world to do.


texts: Sample Projects/Source for Navigational Meshes

texts:
Anyone aware of any sample source code that contain Navigational Meshes?

I'm aware of recast navigation (which is a little bit too complicated). - Written in C++.

Preferably C# but C++ is ok.


texts: Why is enabling GL_FRAMEBUFFER_SRGB making the colours brighter?

texts:
My understanding of gamma correction is as follows: We want to do colour math in linear space so we can lerp etc. between colour values and get the results we expect. But human eyes don't have a linear response to light, so we need to modify the colours just before displaying them. sRGB is then commonly used colour space for this. Furthermore, since paint programs and colour pickers talk about colour in sRGB, the colours typically need to be linearized before math is performed on them.

EDIT 2: Turns out I had the following conversions backwards. The rest of the question is left unchanged for context, but I don't want to lead someone else down the same incorrect path.

The actual curve mapping sRGB to linear space is an exponential curve over the range 0 to 1. Linear to sRGB is raising the colour to the power of 2.2. sRGB to linear is taking the 2.2th root of the colour. So since we are in the range 0 to 1 Linear to sRGB make the colours less bright, and sRGB to linear does the opposite.

In my program I'm pulling values out of an GL_R8 texture, interpreting them as alpha values and taking a vec4 as a vertex attribute we'll call colour and multiplying it by vec4(1.0, 1.0, 1.0, alpha) to produce the final colour in the fragment shader. If I set the colour attribute to a known colour and enable the GL_FRAMEBUFFER_SRGB flag, then the colour I get is too bright, and it is exactly as bright as it would be if the sRGB to linear conversion was not applied.

For example if I pass in the colour #222222 I get #666666 actually rendered to the screen according to an external colour picking tool. If I convert the colour #222222 to three floats by dividing by 255.0 I get three copies of 0.13333333. 0x22 = 34 in base 10, 34.0 / 255.0 = 0.13333333. The 2.2th root of 0.13333333 is 0.40017032. 0.40017032 * 255.0 gives us 102. 102 in hex is the 0x66 we were expecting.

At first I thought that the problem was that it wasn't applying the linear to sRGB conversion to the output of the shader for some reason, since things were too bright. So I did some searching and found this answer but that states that the only way that the linear to sRGB conversion will only be applied if GL_FRAMEBUFFER_SRGB is enabled. I'm getting the opposite behavior: the colours are too bright only if GL_FRAMEBUFFER_SRGB is enabled!

I then realized that openGL can't magically know what the semantics of my colour vertex attribute are. So it can't be automatically converting my colour to linear space, unless it's doing something weird and error prone like checking the name of the attribute or just converting every vec3 or vec4. If that was a desired feature, a shader keyword or something would have been a better way to do that.

So I'm confused as to how I'm getting this result. I'm not currently doing any colour math in the shader besides what I've already mentioned, besides alpha blending. But I might want to do more of that later, including loading more textures in the fragment shader so I would like to sort out this weirdness, rather than just disabling GL_FRAMEBUFFER_SRGB and leaving the same mess for myself if I do end up doing more complicated stuff later.

EDIT 1: My windowing library says that my pixel format is sRGB so I don't think that is the issue. If I run glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, &result), result gets set to GL_SRGB. If I check GL_FRONT_RIGHT, GL_BACK_LEFT, and GL_BACK_RIGHT I get GL_LINEAR, GL_SRGB, and GL_LINEAR respectively. But according to this page since I didn't set any stereo rendering settings, then the RIGHT buffers shouldn't matter.


texts:
.

After setting a texture to GameObject, it looks bad.  Some pixels can be seen and colors are distorted. The image itself is in good quality but after importing it to Unity, it looks ugly.

Screenshot explanations:

left, image attached to the GUITexture GameObject
middle, image before importing to Unity
right, after importing (shown in inspector)


texts: Why would one bind several textures to the same OpenGL texture unit?

texts:
This OpenGL documentation article says you can bind 4 (=several) textures to texture units 0, 1, etc. This OpenGL documentation article too.
I found in this Stack Overflow answer an example of why it could be useful to use several texture units (each bound to a different texture).
However I do not understand in which case one would need to bind several textures to the same texture unit, and how one could use them then.


texts:
I'm currently trying to get my head around how to create an item class which contains data for multiple purposes.

As for example I would like to have an Axe which could be used as weapon, but also as a tool to chop trees. The class should contain the following:

Durability, weight, damage vs npcs/players (when attacking), damage vs trees (when chopping), attack speed, chop speed and some enum in which equipment slot the axe fits (e.g. melee slot).

What would be the typical approach?

I stumbled about this answer, but I'm not 100% sure if I'm understanding him right. Is it something like:

public class Item {

    public int durability;
    public float weight;

    public Weapon weapon;
    public Tool tool;

    public class Weapon {
        public int damage; // damage vs players
        public int speed; // attack speed
    }

    public class Tool {
        public int damage; // damage vs trees
        public int speed; // chop speed
    }
}

?


texts: Trying to make a respawn trigger, but any rigid body (or collider probably) keeps triggering it. Any ideas?

texts:
I'm trying to make it so that if any object passes through with the matching tag it will reload the level. However, any rigid body (or collider) is setting it off which is not the desired behavior.

using UnityEngine;
using System.Collections;

public class DamageAuroa : MonoBehaviour {

    public int PHP; //PHP = Player Health from PlayerHealth.cs script.
    public int Damage; //Amount of damage.
    public string Level;

    void Start()
    {
        PHP = GameObject.Find("Player").GetComponent<PlayerHealth>().PlayerHP;
    }

    void OnTriggerEnter(Collider coll)
    {
        if (coll.gameObject.tag == "Player")
            PHP = PHP - Damage;

        if (coll.gameObject.tag == "Ball")
            gameObject.SetActive(false);
            Application.LoadLevel(Level);

        if (PHP <= 0)
            Application.LoadLevel(Level);

    }

}

Any idea why this happens? Or is it something wrong with Unity? Probably just an end user issue.


texts:
My game uses lots of complex objects to store game data. (Each block and entity has its own instance of a class)
I am trying to create a saving and loading system, where the user can save game progress to a text file.
But a simple JSON.stringify won't cut it. These objects are very complex and nested, with instances of different classes contained within. (For example, one instance of the Block class may contain multiple instances of the Text class)
I need a way to boil all this meta data down into text. I've tried multiple libraries, but those don't work with my custom classes.
Any advice on this would be super appreciated!
EDIT: An attempt at writing my own method for doing this
function superString(obj) {
let result = "";
for(var property in obj) {
if(Array.isArray(property)) {
  result += superString(property)
}
else if(property instanceof Block) {
  console.log("EXPORTING BLOCK")
  result += property.exportString();
}
else if(property instanceof Entity) {
  result += property.exportString();
}
else if(typeof property === 'object' && property !== null) {
  result += superString(property)
}

else result += JSON.stringify(property)
}return result;
}


texts: Resuming a previous scene from a current scene using the Unity3D

texts:
I am building a first person shooter game using unity and I am facing the problem of resuming a scene from its current state. It would be easy to pause the scene by using the Time.timeScale = 0.0; within the scene itself. But I am loading a pause scene to ask whether the user wants to restart, resume or quit. But when I click on resume, it loads the scene I want, but it is totally fresh (i.e when the Ammo is supposed to be half full, it is full. Or the enemy has lost a part of his life, but then it starts with life completely full)

How do I resume the previous scene from where it left off using  SceneManager? This could have been somewhat easy by using the Application.loadLevel() and making sure that application does not destroy the previously loaded state.

Here is the script I made for the pause scene.

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

public class pauseScript : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

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

    }

    public void exitPressed()
    {
        Application.Quit();
    }

    public void restartPress()
    {
        SceneManager.LoadScene("prototype1");
    }

    public void resumePress()
    {
        SceneManager.LoadScene("prototype1");
    }
}

Here is the code snippet for calling the pause menu scene. and this is in another script.

SceneManager.LoadScene ("PauseMenu");

Is there anyway to save the current scene before calling the PauseMenu scene as shown in the above statement?
This may be a simple enough query to you but I am completely new to game development as a whole and I am using unity for the first time, so please go easy on me.

Thanks


texts:
I am trying to find a name like "perspective view" of how a camera like this is called:

It is 2d and 3d at the same time. I'm having a hard time trying to find the name.


texts: How can I apply a "genie animation" to a CCSprite?

texts:
I am new to Cocos2D and following this tutorial.

I want to animate a CCSprite with the genie effect that OS X uses for hiding windows to the dock and showing them again.

Here's an example from an iOS library:

How can I do this in Cocos2D?


texts: Simple GLSL example to render a 2d textured quad?

texts:
I would really love to add shader support in my game , although i can't seem to find a SIMPLE example on how to setup opengl for using shaders.

So i would like to ask : Does anyone knows if there are any SIMPLE examples for beginners ? (ie Rendering a simple 2d quad or something like that)


texts: Isometric tiles drawing and picking - JAVA

texts:
I'm trying to draw isometric tiles in Java and implement a tile picking system using the mouse cursor. I draw the tiles using math formulas I found and adapted to my tile textures which you can find below. Tiles are 64x64px but flat tiles are only 32px height even if I draw them using the 64x64 sprite.

public int[] toIso(int x, int y){

    int i = (x - y) * tileWidthHalf;
    int j = (x + y) * tileHeightQuarter;

    i+=xOffset;
    j+=yOffset;

    return new int[]{i,j};
}

public int[] toGrid(int x, int y){

    x-=xOffset;
    y-=yOffset;

    int i = (x/tileWidthHalf + y/tileHeightQuarter)/2;
    int j = (y/tileHeightQuarter - x/tileWidthHalf)/2;

    return new int[]{i,j};
}

The map is a simple 2d array where my tiles are represented by their id.

Here is a video showing what is actually happening: youtu.be/baCVIfJz2Wo


texts:
So i've been trying to make the player face towards the direction i pressed. That part works just fine but when I try to move the player it moves diagonally instead of left/right. Any clues?

 if (Input.GetKey(KeyCode.RightArrow))
             {
                 //moves the player
                 rb2d.velocity = new Vector3(2.5f, 0, 0);
                 transform.Translate(rb2d.velocity * Time.deltaTime);

                 //flips the player right
                 if (human.flipY == true)
                 {
                     human.transform.rotation = Quaternion.Euler(0, 0, 270);
                 }
                 else
                 {
                     transform.rotation = Quaternion.Euler(0, 0, -270);
                 }


texts: Should I use Unity for a "non-game" mobile app?

texts: I have some experience with Unity but I always made games only. Right now I have an idea for an app but I don't think Unity is the most efficient way to do it. Probably Android SDK and OpenGL ES would be better but I have to learn them. So should I learn a new tool or should I stick with what I already know and get this thing done?


texts: AI Game Programming : Bayesian Networks, how to make efficient?

texts:
We know that AI is one of the most important part of Game Programming. Bayesian networks is one of the core part of AI at Game Programming.

Bayesian networks are graphs that compactly represent the relationship between random variables for a given problem. These graphs aid in performing reasoning or decision making in the face of uncertainty.

I am utilizing the monte carlo method and genetic algorithms.

But this take too much time and sometimes crashes due to memory.

Is there any way to implement this efficiently?


texts: Why does resizing my game window move and distort my rendering?

texts:
I'm starting to make a game, and the first screen I've made is a very simple loading screen with some centered text.

On starting it up, the text is nicely centered:

Then I resize the window, and I get:

Why is it stretched? And why has it moved? Looking at my code it looks like everything should be perfectly centered:

public void render(float delta) {
        Gdx.gl.glClearColor(0, 0, 0.2f, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        if (Assets.manager.update()) {
            // Eventually change to a main menu or something
        }

        String text = "Loading " + Math.round(Assets.manager.getProgress()) + "%";

        BitmapFont.TextBounds bounds = fnt.getBounds(text);

        batch.begin();
        fnt.draw(batch, text, (Gdx.graphics.getWidth()/2)-(bounds.width/2), (Gdx.graphics.getHeight()/2)-(bounds.height/2));
        batch.end();
    }


texts: Edges drop out when rendered at a long distance

texts:
I have this weird effect when rendering small objects at a long distance. I already tried using anisotropic filtering but maybe I am not doing it right.

Material script:

material Platform/Border
{
  technique
  {
    pass
    {
      ambient 0 1 0.824 1.0
      cull_hardware none
      cull_software none
      lighting on
      texture_unit
      {
        filtering anisotropic
        max_anisotropy 8
        texture white-pixel.png
      }
    }
  }
}

Screenshots:

How to solve this?


texts: What is the Stencyl and StencylWorks business model?

texts:
Not sure how many of you have heard of Stencyl as a low-barrier-to-entry game development platform, but for those of you that have worked with it - what is their business model? Nothing is free (unless it is open source and this is not), so what's the catch? How do they make their revenue?

EDIT: I have emailed them and have not heard back. Will certainly update when/if I do, though they will probably point me to the blog post that @thedaian found.

Got a response from Jonathan Chung @ Stencyl:

  We're starting off with the tried and true model of selling
  subscriptions to export games to mobile platforms and HTML5. That will
  be our bread and butter for a while.

  We expect though, that we'll end up making more off of other revenue
  streams, such as running a carefully curated marketplace and other
  kinds of online services in which we share revenue with users.


texts: libgdx ashley how to detect clickEvent on Entity

texts:
How can I detect a click event on an Entity?
I use libgdx with Ashley.
Must I implement it by my self e.g. in touch down method of InputProcessor test if any entity is on this click position.
Or exist already a listener for Entity like the ClickListener for Actor in libgdx?

Thanks for your advice


texts: Are there any guidelines/articles/tutorials for creating a network protocol for games?

texts:
I am currently developing a little 2D sandbox game with multiplayer functionality in XNA 4.0 and the latest lidgren-lib for networking.

I found myself quickly at a point where sending a players position to the server and broadcasting the position of all players to the connected clients isn't enough anymore. So I started to make up a protocol for the game.

I haven't done this before, so I'm wondering weather there're any guidelines/tutorials/articles which guide one through this process. A good starting point for me was the protocol of Minecraft, but this isn't a guide or something but rather a well example which I can adopt at some points.

So, are there any guidelines/articles/tutorials for creating a network protocol for games?


texts: How do I move a sprite around using tile based movement in Java?

texts: So, I'm new to Java and I want to get a sprite to move around the screen, like a tile-based movement. I really would like some help and some resources or tutorials could work. I've done a little C#, but I couldn't seem to get it.


texts: Calculating adjacent quads on a quad sphere

texts:
I've been experimenting with generating a quad sphere. This sphere subdivides into a quadtree structure. Eventually I'm going to be applying some simplex noise to the vertices of each face to create a terrain like surface.

To solve the issue of cracks I want to be able to apply a geomitmap technique of triangle fanning on the edges of each quad, but in order to know the subdivision level of the adjacent quads I need to identify which quads are adjacent to each other.

Does anyone know any approaches to computing and storing these adjacent quads for quick lookup?

Also It's important that I know which direction they are in so I can easily adjust the correct edge.


texts: Sprite can jump up through platform onto platform, once while it's on platform, but falls through second time

texts: Sorry, I'm kind of new to this whole thing and trying to learn both Unity and its use of C#. I have overlapping box colliders set up and a trigger on the lower one to allow me to jump through the lower platform. That works fine, and once on the platform, I can jump through it and land on the top, and I can make a singular jump while I am on the platform, but as soon as I jump a second time, I fall right through. Does anyone have any suggestions as to how to go about fixing this? I originally thought it was that the overlap on the two colliders was too much, or that the radius of my ground points were too large, but fixing both of those didn't do me any good. Thanks for the help!


texts: detecting the coordinates where a bullet hits a mesh

texts:
I have a lot of complex objects in a scene and I'm looking for an efficient way to find which object a fired bullet hits, and to find the hit coordinates.

It would be best if there was a lightweight library to do this.

It seems that PhysX can do this, but I didn't find a way except to give every face in every mesh a PhysX system, and that seems to become a bottleneck.


texts: How to unpack game data files encrypted with AES key?

texts: In game development pak files are secured by some encryption and one of these are AES key. I want to know that for security purpose is the AES key is stored in the game files itself? I know that computer cannot store the AES key in his mind so it need some clues or files to extract these Ppak files, so where does these AES keys gets stored in a game file itself?


texts: Godot 3.1: procedurally generating TileMap with AutoTiles

texts:
I'm making a start on a 2d top-down game in Godot, using a TileMap and OpenSimplex Noise to generate the terrain.  It works pretty well, creating decent contiguous regions of different types of terrain.  So far I have been using a simple "one tile per terrain type" but now want to extend it to use AutoTiles, so that I can have it look better, however I don't know how to get the procedural generation to use more than just the first tile in the AutoTile set.

I have got it so that I can hand-draw the AutoTiles in the editor and they work, but is there a way to get a programmatically-set tile to obey the AutoTile layout?  Or do I have to check all 8 surrounding tiles for every instance where this type of tile appears and set to the appropriate tile index?  Surely there is a better way...?

Thanks in advance. :-)


texts: Converting an XNA game from WINDOWS to XBOX

texts:
I have an XNA game for WINDOWS which I want to work on XBOX also.

I've designed the game so that when I want to connect it to an XBOX, all I have to do is supply a different input class,

And I would do that by checking with the preprocessor macros and checking if it's windows or xbox.

But then, when I tried to do Create a copy of this project for XBOX in VisualStudio, it created several new projects (the real XNA project and some of it's dependencies), and it complained about things not working for C# 3.0 and that I should use C# 4.0 instead, which I didn't find out how to do either.

What's the correct way to make both WINDOWS and XBOX versions of an XNA game?

And also, how do I really run the game on XBOX? I haven't found a good tutorial on how I do that... also I don't have an XboxLive membership so if there's a hacky way to do that, it's better


texts: 2D shadow from polar coordinates has hard cut-off at a certain radius

texts:
I'm trying to cast shadows from a 1D texture that goes from white to back according to the distance given by an occlusion map. That part I think I got it right. The problem lies on the algorithm to check if a given pixel is in shadow.

As you can see, the outer limits are clamped, as if it is in shadow. The result I would expect is that it would slowly fade. I don't know why my shader yields this result.
Here is the shader I use for casting the shadows:
#version 330
#define numTextures 32
#define PI 3.14

in vec2 TexCoords;
in vec4 pass_colors;
in vec4 fragPos;
in vec4 worldFragPos;
in mat4 outWorld;

out vec4 color;
uniform vec4 ambientColor;
uniform sampler2D texture_diffuse;
uniform float radius;
uniform vec2 screenResolution;
uniform int lightCounter;

struct LightData
{
    float radius;
    vec3 position;        //light position, normalized
    vec4 color;      //light RGBA -- alpha is intensity
};

uniform LightData lights[numTextures];
uniform sampler2D shadows;

float n3ddistance(vec3 first_point, vec3 second_point)
{
    float x = first_point.x-second_point.x;
    float y = first_point.y-second_point.y;
    float val = x*x + y*y;
    return sqrt(val);
}

float sample(vec2 coord, float r) {
    return step(r, texture(shadows, coord).r);
}

float GetShadow(int lightIndex)
{
    vec2 dir = fragPos.xy - lights[lightIndex].position.xy;
    dir /= lights[lightIndex].radius / 2;
    //rectangular to polar
    dir.y *= -1;
    vec2 norm = dir.st;// * 2.0 - 1.0;
    float theta = atan(norm.y, norm.x);
    float r = length(norm);
    float coord = (theta + PI) / (2.0*PI);

    //the tex coord to sample our 1D lookup texture
    //always 0.0 on y axis
    vec2 tc = vec2(coord, 0.0);

    return sample(tc, r);
}

vec3 GetColor(int lightIndex)
{
    float dst = n3ddistance(lights[lightIndex].position.xyz, fragPos.xyz);
    float intensity = clamp(1.0 - dst / lights[lightIndex].radius, 0.0, 1.0);
    vec3 color = lights[lightIndex].color.rgb * intensity * GetShadow(lightIndex);
    return color;
}

void main()
{

    vec4 DiffuseColor = vec4(texture(texture_diffuse, TexCoords)) * pass_colors;

    vec3 sum = vec3(0);
    for(int i = 0; i < lightCounter; i++)
        sum += GetColor(i);

    vec3 intensity = ambientColor.xyz + sum;
    vec3 finalColor = DiffuseColor.rgb * intensity;
    color = vec4(finalColor.rgb, DiffuseColor.a);
    if (color.a <= 0.0)
        discard;
}

And here is the shader responsable for writing to that 1D texture
#version 330

#define PI 3.14159265359

in vec2 TexCoords;
in vec4 fragPos;
in vec3 lightPos;

out vec4 color;

uniform float radius;
uniform sampler2D occlusion;

void main()
{
    float distance = 1;

    for (float y=0.0; y < radius; y += 1.0)
    {
        vec2 norm = vec2(TexCoords.s, y / radius) * 2.0 - 1.0;
        float theta = PI * 1.5 + norm.x * PI;
        float r = (1.0 + norm.y) * 0.5;
        vec2 coord = vec2(-r * sin(theta), -r * cos(theta))/2.0 + 0.5;

        vec4 data = texture(occlusion, coord);
        float dst = y/radius;
        float caster = data.r;
        if (caster > 0.75) {
            distance = min(distance, dst);
            break;
        }
    }
  color = vec4(vec3(distance), 1.0);
}

How can I get a smooth fall-off instead of this sudden stop at a particular radius?


texts: How would I make my Python game Moddable?

texts:
before you mark it as duplicate, I want to say I have read this: I want to make a moddable game. How does this affect my programming language choice?

And it did not help me. Just for proof of concept, what would I add to

# main.py
import turtle as t
screen = t.Screen()
turt = t.Turtle()
for i in range(8):
    t.forward(100)
    t.right(45)
    t.backward(75)
screen.exitonclick()

to make it so that in another file, you could add something like

import main
main.t.color("red")

to make the turtle a different color.

Basically, what would I add to main.py to make it run the mod settings?


texts:
I'm trying to get my head around scrolling a 2D map that uses a physics engine. If I was to launch a projectile, would I actually be applying the physics to the background images rather than the projectile itself? I'd like to keep the projectile at the center of the 'camera', but I'm not sure how to do this in Silverlight. I thought of using a translate transform to constantly scroll the parent canvas's position, but is this the best way of doing this in Silverlight?

Edit - I'm using Farseer Physics with the Physics Helper library.

*Edit 2 - Solution *

It turns out the MSI installer of the Physics Helper installs an older version that had a broken camera. I downloaded and recompiled the latest source version and it now works!


texts: How to handle similar actions in derived actors (inheritance)

texts:
I have a base class called Attacker that has a update method. The update method moves attacker through an array of waypoints as given below:

- (void) update:(ccTime)dt {
    if(state == kMove) {
        // code to move to next waypoint
        // on reaching the next waypoint, update the next waypoint variable
        // if the final waypoint is reached, then stop the movement of attacker
    }
}

So, the base class takes care of simple waypoint movement logic. Now I derive a few classes like Rifleman, MachineGunner, Engineer from the Attacker class.

Now I want each of the derived class to do a specific action on reaching the final waypoint. For eg., I want the Rifleman to change to attack stance, the machine gunner to deploy and setup his gun, the engineer to start constructing a defense.

How do I achieve this? My current idea is to check for final waypoint condition in the update method of each of the derived class and do the corresponding action.

- (void) update:(ccTime)dt {
    [super update:dt];
    if(state == kMove) {
        // if the final waypoint is reached, then do class specific action
    }
}

Is there any better way of doing this?


texts: How do a make a smooth animation with images of different sizes in pygame?

texts:
I have an animation where my player swings his sword, with 5 images in pygame. The normal resting image is 14x22, and the rest are 13x23, 21x23, 18x23, and 18x23. I am having trouble with my character 'Jumping' when he swings his sword, since the size of my image is constantly changing. Could anyone help my with this?

Here's my code for the animation

elif keys[pg.K_SPACE]:
            now = pg.time.get_ticks()
            try:
                if now - self.last_update > self.frame_rate:
                    if self.direction == 'left':
                        self.game.player_img = self.game.playerattackleft[self.frame]
                        self.frame += 1
                        self.last_update = now
            except IndexError:
                self.frame = 0

Thanks.


texts:
I am trying to figure out how to set up openGL on Linux based operating systems (Ubuntu 12.10) without using any *GLUT libraries. I don't have much experience with developing on Linux distributions.

To be more precise I'm trying to make a statically linked library that compiles on the three major OS flavours (using some preprocessor macros to figure out the os its being compiled on and switch up renderer code, window creation code etc).

On windows I have successfully created a openGL 4.0 rendering context using wglCreateContextAttribsARB and the GL/gl.h provided by mingw.

On Ubuntu I have managed to create a openGL 2.2 rendering context using glXCreateContextAttribsARB and the GL/gl.h provided by mesa3d. This was however in a VMware Ubuntu VM and so mesa(9.0.2 I believe) would only manage to go that far with a virtual graphics card.

So I decided to go ahead and install Ubuntu on a external HDD to take advantage of the graphics card only to later find out that mesa(9.1) can only go up to openGL 3.1. After  a little bit of research I figured out that the AMD and Nvidia drivers have support for openGL 4.3. So I installed the AMD 13.1 drivers (I have a Sapphire 7970 vapor-x 6GB) but then the openGL header files that come with it are really strange, GL/glATI.h tries to include windows.h, it doesn't define APIENTRY etc.

The question is whats the proper way of setting up openGL (with 4.3 support) for Linux? And even if the GL/glATI.h files were proper, wouldn't they fail if ran on a Nvidia card?

I'm manually creating the window with XCreateWindow and then I'm loading the extensions with glXGetProcAddressARB so I'm not going to use GLUT or any GLUT-like library.


texts:
I'm aiming for the following design in my app, and I am having a difficulty figuring how this could be achieved.

The purple part will be the main part of the game, which I have actually already written, implementing InputProcessor. It uses touch controls for dragging (mainly) and touching down or up with the finger.

I didn't think of creating a HUD beforehand and now decided that a Stage would work perfectly for that, but it definitely wouldn't work with the above input method. Is there a way to split the screen into areas like in the diagram, and depending on touch location pass the touch events to either main game InputProcessor or to the Stage?


texts: Setting Square to Dim in Color on MOUSEUP

texts:
I'm trying to create a simple recreation of the popular memory game "Simon" using C and SDL2. The idea is that the game is a small window with four squares of different colors that are purposefully dim. When the player clicks on a square, I want it to "light up" until the player let's go of their mouse button, in which it returns to it's original dim color.

I have this working to an extent, but the problem is that it only works if the player let's go of the mouse button while the pointer is over the square. If they let go anywhere else, the square stays lit up.

Here is the example code:

if(e.type == SDL_MOUSEBUTTONDOWN && mouseX >= 10 && mouseX <= 110 && mouseY >= 10 && mouseY <= 110) {
    if(e.button.button == SDL_BUTTON_LEFT) {
        SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
        SDL_RenderFillRect(renderer, &squareOne);
        SDL_RenderPresent(renderer);
    }
}

if(e.type == SDL_MOUSEBUTTONUP && mouseX >= 10 && mouseX <= 110 && mouseY >= 10 && mouseY <= 110) {
    if(e.button.button == SDL_BUTTON_LEFT) {
        SDL_SetRenderDrawColor(renderer, 0, 50, 0, 255);
        SDL_RenderFillRect(renderer, &squareOne);
        SDL_RenderPresent(renderer);
    }
}

As you can see, I'm looking for the user to be clicking in a very specific area, and waiting for them to "unclick" in that same specific area. There has got to be a better way to do this. Would anyone do me the pleasure of offering a few hints?


texts: What is a portfolio in game development? Does it include programming or modelling and animation too? Can somebody explain it to me?


texts: Intuitively, why is 3.5 the average (mean) roll of a six-sided die?

texts:
Every page I could find on the web that answers this question explains it with Expected Value statistic probability math.

$$(1 * \frac 16) + (2 * \frac 16) + (3 * \frac16) + (4 * \frac16) + (5 * \frac16) + (6 * \frac16)$$

O...K... so we have a mathematical formula that tells us the average/mean/expected value but can't we explain it more simply? We have one die with six sides and every time you roll it, one of those six sides has the possibility of being rolled. Without math, why is the Expected Value 3.5?


texts:
I am working on an endless mobile game right now and I'm currently in the designing phase. Most (or all) mobile games especially endless ones now have leaderboards and a player's position in the board is determined by their score. I want to implement a store from which people buy upgrades, new cool stuff that help them gain more score. Will this cause an unfair leaderboards. Should I remove the upgrades and replace them with only customizations in the store like clothes that don't affect the score?

Thanks in advance.


texts: How to structure code for many unique weapons/spells/powers

texts:
I'm an inexperienced programmer creating a "roguelike-like" game in the vein of FTL, using Python (no PyGame as of yet as I'm still only concerned with text).

My game will contain a large number of weapons (around 50 for starters) that yield unique abilities. I am struggling to understand how to structure the object code in a way that is both powerful (in terms of allowing weapons to have radically different effects) and extensible (so that I can easily add more weapons later by eg. dropping them into a folder).

My first instinct was to have a BasicWeapon class, and have different weapons inherit from that class. However, this seems problematic to me: either I have to make the BasicWeapon class so barebones that it's basically useless (the only features all weapons have in common are name and type (pistol, axe, etc)), or I have to predict every unique effect I will ever come up with and code that into BasicWeapon.

The latter is clearly impossible, but the former can still be worked. However, that leaves me with the question: where do I put the code for individual weapons?

Do I create plasmarifle.py, rocketlauncher.py, swarmofbees.py, etc etc, and drop them all into a folder from where the game can import them?

Or is there a way to have a database-style file (maybe something as simple as an Excel spreadsheet) that somehow contains unique code for each weapon - without needing to resort to eval/exec?

In terms of the latter solution (database), I think the fundamental issue that I'm struggling with is that while I understand that it is desirable to maintain separation between code and data, I feel like the weapons blur the line between "code" and "data" a little bit; they represent the great variety of similar things that can be found in the game, in which sense they are like data, but most of them will require at least some unique code not shared with any other item, in which sense they are, naturally, code.

A partial solution I have found elsewhere on this site suggests giving the BasicWeapon class a bunch of empty methods - on_round_start(), on_attack(), on_move() etc - and then overriding those methods for each weapon. At the relevant phase of the combat cycle, the game will call the appropriate method for every character's weapon, and only the ones that have methods defined will actually do something. This helps, but it still does not tell me where I must put the code and/or data for each weapon.

Is there a different language or tool out there that I can use as a sort of half-data, half-code chimera? Am I completely butchering good programming practice?

My understanding of OOP is sketchy at best, so I would appreciate responses that are not too computer science-y.

EDIT: Vaughan Hilts has made it clear in his post below that what I'm essentially talking about is data-driven programming. The essence of my question is this: how can I implement a data-driven design in such a way that the data can contain scripts, enabling new weapons to do new things without changing the main program code?


texts:
Hey guys, i have strange lighting problem.
I've written my own "deferred lighting" shader and this happend:

Pic: Normal-Map
Pic: Light-Map

As long as i only use one big mesh everything seems okay, but this look pretty wrong.

Here is how i calculate the point light map (http://www.packtpub.com/article/advanced-lighting-3d-graphics-xna-game-studio-40):

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
  // Find the pixel coordinates of the input position in the depth
  // and normal textures
  float2 texCoord = postProjToScreen(input.LightPosition) + halfPixel();
  // Extract the depth for this pixel from the depth map
  float4 depth = tex2D(depthSampler, texCoord);

  // Recreate the position with the UV coordinates and depth value
  float4 position;
  position.x = texCoord.x * 2 - 1;
  position.y = (1 - texCoord.y) * 2 - 1;
  position.z = depth.r;
  position.w = 1.0f;

  // Transform position from screen space to world space
  position = mul(position, InvViewProjection);
  position.xyz /= position.w;
  position.w = 1;

  // Extract the normal from the normal map and move from
 // 0 to 1 range to -1 to 1 range
 float4 normal = (tex2D(normalSampler, texCoord) - .5) * 2;

 // Perform the lighting calculations for a point light
 float3 lightDirection = normalize(LightPosition - position);
 float lighting = clamp(dot(normal, lightDirection), 0, 1);

 // Attenuate the light to simulate a point light
 float d = distance(LightPosition, position);
 float att = 1 - pow(d / LightAttenuation, LightFalloff);

 // Calculate the specular Component
 float3 R = normalize(2 * max(0,dot(normal, lightDirection)) * normal - lightDirection);
 float4 specularComponent = pow(saturate(dot(R, normalize(CameraPosition - position.xyz))), LightShininess);

 return float4(LightColor * att * lighting  + LightColor * att * specularComponent, 1);
}

I don't really know why, but Blender is the root problem here; causing the exact same issue. I would appreciate any tip to solve that problem.


texts: Problem with Material Parameter Collection Reference Variable in Set Scalar Parameter funcion

texts:
I was following a tutorial on using GameInstance. Where the guy in the video would teach how to choose the color of the ship by clicking a button on a level (x), so as to affect the ship on another level (y).

LINK OF VIDEO (in portuguese):

https://www.youtube.com/watch?v=kTiCjPHMJXI&list=PLnwVxZ2WVVpl1sOPaEzK--4fXzq2ZQvE-&index=42

LEVEL X:

CODE OF BLUEPRINT MENU OF LEVEL X (when buttons are clicked):

This code is associated with an enumeration with these three colors (red, green and blue).

My problem appears when I set the target in the function (Set Scalar Parameter Value), it only appears these options for me:

Much like the problem this person had:

https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/90544-material-parameter-collection-reference-variable

In the video it can give a "get" in the variable, which later (apparently) I discovered to be a reference to the object:

I made the "discovery" based on the sign (blue circle):

I did tests with the "blue circles" type variables, but the ones I did did not work.

https://answers.unrealengine.com/questions/169593/how-to-properly-set-vector-parameter-value.html

I would like to know what I have to do so that the referral is done correctly.

Another link that I researched, but that did not help me much.

EDIT 1 (attempt based on Stephen's answer)

**I created a material instance and put it right after the Event Begin Play (I found 2 options, so I did the test with both).

Available Options:

Blueprint:

I defined them as editable, just as I was instructed.

But even so, I could not:

I could not connect the nodes. Warning "Material Intance Dynamic Object Reference is not compatible with Material Parameter Collection Object Reference" is displayed.


texts:
I have working code to display a tiled map. It's composed of a OrthogonalTiledMapRenderer and an OrthoGraphicCamera :

camera.setToOrtho(false, WORLD_WINDOW_SIZE.x,
            WORLD_WINDOW_SIZE.y);

renderer = new OrthogonalTiledMapRenderer(tiledmap, 1 / TILE_WIDTH);

renderer.setView(camera);

So far so good. The map is rendered as seen from above:

My question is, how do I render it with the camera not facing right down to the floor?

Like this:

[Thanks to all GIMP developers :) ]

Is it possible? I tried Camera.rotate(45) but it rotates in the wrong axis. I can't set Camera.direction because of this  - taken from OrthogonalTiledMapRenderer.setView(camera) documentation :

  Sets the projection matrix and viewbounds from the given camera. If
  the camera changes, you have to call this method again. The viewbounds
     are taken from the camera's position and viewport size as well as
  the    scale. This method will only work if the camera's direction
  vector     is (0,0,-1) and its up vector is (0, 1, 0), which are the
  defaults.

If I change the camera direction, the renders are weird or non-existant.

Is it possible to do so with the standard LibGDX api? If not, how can I do this? If not are there any workarounds to get the same effect?


texts: Replacement memory allocators - pros and cons

texts:
I am developing a hobby project to learn game engine development and to have a platform where I can test new ideas and have fun. Currently I have a quick-and-dirty multiplayer server and client using some third party libraries (enet for networking and Ogre3D for rendering). My "game" is mostly like a free-ride sandbox.

I have read some great articles about custom memory allocators and all the benefits - complete control, different strategies for different game objects, tracing and profiling. But also I have read that it is hard to develop an allocator which is better than the default one and that it might be hard to get it to play nicely with 3rd party libraries.

As it seems so hard to develop a custom allocator, I thought about using jemalloc but I'm not sure if it is a good choice for game server and/or client.
I tried to find some 3rd party free/open source memory allocators designed specifically for game engines but I could not find anything production-ready.

I really would like to track allocated objects by their type - to see how many network packets I have, how much memory is taken by meshes, static objects, NPCS etc. and also to see where exactly are some memory leaks coming from. Also I would like to avoid having to restart my game server regularly because of memory fragmentation issues.

What is your experience? Is it a good idea to use some general purpose memory allocator (like jemalloc or tcmalloc) for game servers and clients or should I develop my own custom allocator (which seems a daunting task considering that I don't have enough experience with advanced C++)?

How do I integrate my custom memory allocator with popular 3rd party libraries (enet, Ogre3D, some physics libraries) if I have no idea what allocation mechanisms are used inside of those libraries?

If I decide not to use a custom allocator and stay with the one provided by MSVC runtime, is there any simple way to track my memory usage and prevent memory fragmentation without sacrificing performance?


texts: How to calculate High Score in game when there are two units in the game?

texts:
In my game I am solving a problem, and I am getting certain points for each problem.
Just like collecting numbers falling from the top.
Now I want to calculate a high score on the basis of two items i.e. solved points and time it took to solve until the user get it wrong.
How would I rank any player based on the two events?


texts: How to remove a node from a scene imported with Assimp?

texts: I need to remove one object from the scene graph imported by Assimp and I can't.  I've tried to change aiScene.h including a method called DelNode and I can´t. How can I do it - is it possible?


texts: How to handle day and night in a 2D sprite game

texts: Do I need to draw, for example, a tree how it looks in the day (normal colors) and how it looks at night (colors aligned according to the moonlight)? Or does Unity have a function for that?


texts: What are "socialist core values" or "Chinese Government Approved" for games to run in China?

texts:
Noticed this recently on the Street of Rogue changelog Alpha 37 - Even More Downtown Work:

Internal
Did a bunch of work on a “Chinese Government Approved” Chinese version of the game

Now news outlets are reporting PUBG will change for China and align with ‘socialist core values’:

But, in a statement from Tencent translated by Reuters, the gaming giant says that it will go a step further and alter Battlegrounds to better align with “socialist core values, Chinese traditional culture and moral rules.”

While also mentioning:

It’s not entirely clear what that means.

and

Reuters points out that Tencent’s competitor NetEase has accomplished something similar by adding actual government propaganda to the game, adding “red banners into its battleground ... with slogans such as ‘safeguard national security, safeguard world peace.’”

Steam user ytivarg asked Streets of Rogue developer Madguy

ytivarg 3 Nov @ 4:38am
So what did you have to do to make it "Chineese Government Approved"?

to which he replied:

Madguy  [developer] 3 Nov @ 5:16am
@ytivarg I'm a little wary of getting into specifics, but it's basically some text and art that might be seen as objectionable. You can draw your own conclusions (or sift through the localization folder)

So what exactly does it take to make a game "Chinese Government Approved" or sticking to "socialist core values"?


texts: Will DirectX 10.1 graphics card work with DirectX 11?

texts:
I just started learning DirectX, but I have a problem with its version. I have ATI Radeon HD 4830, this card supports only DirectX 10.1, but when I ran dxdiag it said that I have DirectX 11, then I realized its probably talking about what version does the OS(Windows 7) support.

Now, I just ran some DirectX 11 benchmark and it worked. Does it mean that my graphics card is capable of running DX11 or it just runs in DX 10.1?

I want to know this, because I don't know what version of DX should I use for programming. I'd like to use DX 11 because of shaders, but don't know whether it's safe. If it's not I'd rather use DX9 with shaders, because I heard that DX 10 is buggy and I should use DX9 rather then 10, if DX 11 not available.

Or does DX 11 support older versions itself, so I can use DX 11 headers but limit myself to older features?

So what is your opinion? Should I use DX 11(code compiles, but I am not sure whether my card supports it), or DX 9?

Thanks in advance.


texts: Unity Guitext object always triggering a collision - 2D

texts:
I have a guitext object which I can drag.  I have attached a 2d rigid body.  I have also attached the collider with the following code:

void setCollider()
    {
        Rect box = this.guiText.GetScreenRect ();
        BoxCollider2D boxCollider = (BoxCollider2D) gameObject.AddComponent (typeof (BoxCollider2D));
        var boxX = box.width;
        var boxY = box.height;
        Debug.Log ("boxX = " + boxX + "boxY = " + boxY);
        boxCollider.size = new Vector2(boxX, boxY);
    }

I have a sprite with a collider set as trigger.  However, it triggers as soon as the game starts and is not anywhere near the trigger sprite.  It will only trigger the one time when it starts.  My Trigger on my sprite is as follows:

void OnTriggerEnter2D (Collider2D other){
        Debug.Log ("Order Right Arm");
        Debug.Log (other.bounds);
    }

EDIT: based on answer I have changed the size of the collider to account for the pixel/unit difference:

void setCollider()
    {
        float pixelRatio = (Camera.main.orthographicSize * 2) / Camera.main.pixelHeight;
        Debug.Log ("Pixel Ratio "+pixelRatio);
        Rect box = this.guiText.GetScreenRect ();
        BoxCollider2D boxCollider = (BoxCollider2D) gameObject.AddComponent (typeof (BoxCollider2D));
        float boxX = box.width * pixelRatio;
        float boxY = box.height * pixelRatio;
        Debug.Log ("boxX = " + boxX + "boxY = " + boxY);
        boxCollider.size = new Vector2(boxX, boxY);
    }

Any ideas on how I can get this to trigger only when I drag the guitext over the sprite?


texts: What means the error "already purchased" when buying a Consumable item with Unity IAP?

texts:
I'm facing an issue related to Unity IAP with consumable items. If I try to purchase one it shows: "Item already purchased" with this

  log-
  onIabPurchaseFinished: false
  Unable to buy item (response: 7:Item Already Owned)

Does anyone know what this means?


texts: How to apply steering to a physics body correctly when using a physics engine?

texts:
I have a top down 2d game that uses a physics engine (Farseer).

I'm using the standard steering behaviors to make the AI move around but I'm not sure the correct way to take the so called "steering force" calculated by the steering behavior and apply it to the physics bodies.

For example:

The steering behavior SEEK returns

return desiredVelocity - currentVelocity;

So it is returning a difference of two velocities (in meters per second).

I need to convert this into the force (in Newtons) that I need to apply to my physics body, taking into account its mass and acceleration etc.

I know it should be simply but I'm getting confused! :)


texts: Offscreen waypoint indicator using X and Y screen position

texts:
I was wondering how I could achieve an offscreen indicator effect that helps direct the player to the next waypoint.  My game is 3D, most solutions I have found are for 2D games (i.e Asteroids).
See this example of Warzone.  I have highlighted the parts that I am interested in creating.

The engine I am using has an API call to convert from world to screen position.  This only returns the X and Y components though.  Do I need the Z component to achieve what I am after?
From what I understand so far:

Check if target is off screen
If off screen convert 3D world position to 2D screen position (only X and Y components)

The Math for snapping the 2D UI icon to the side of the screen so it moves around is where I get lost.  I read something about slope intercept is something that can solve this but am not sure how to apply it to my problem.
If it helps I will be writing this in JavaScript, however, I'm not after a language specific solution, am really interested in understanding the Math so I can write it myself for any language.


texts: Using peer to peer for prediction in a client-server network model

texts:
By implementing peer to peer connections between clients in a client-server network model I should be able to increase the prediction fidelity as this theoretically would provide the client with other clients commands for a given tick earlier than it would receive the servers game states for the same tick.

One problem I can think of is that clients would have to be able to interpret other clients commands (usually they just have to listen for game states, not commands). This would be a little bit like an RTS model I guess. This should be solvable without any negative effects on gameplay.

Another problem is that clients could cheat by sending fake data to their peers when it is beneficial to them. This can be mitigated by having the client aware of the real commands through the server and have them immediately stop listening to any clients that fed it false data. This should therefore be solvable with different degrees of negative effect on gameplay depending on the design of the game and how impactful a few ticks of wrong command info is at the worst possible moment.

(Unfortunately, you can't have the server punish any client because it has no idea who's lying, it can only help clients themselves understand if they are being lied to by providing them with correct data).

Am I correct in assuming that this would increase prediction fidelity or is there something I'm not accounting for? The idea is that this allows the client access to some information about the other clients faster than in a traditional non peer to peer model where it would base predictions solely on its own commands.


texts: How can I compute the common points when spheres intersect?

texts:
When two spheres intersect they should share one or two points. I want to know how to compute those points?

I was thinking of something like this:

-check if the spheres intersect
-calculate radius_1 distance from center_1 in the direction of center_2
-calculate radius_2 distance from center_2 in the direction of center_1
-substract the smaller to the larger and have that one as "collision" point

This sounds to me a little too tricky, I wanted to know if there is a simplier way to achieve this?


texts:
i need a help i have an Isometric Staggered tile map in Tiled (mapeditor.org).

100x100 tiles, 94x54px, 9447x2727px. total.

How can i make this in html5 canvas ?

var context = document.querySelector("canvas").getContext("2d");

context.drawImage(img, 0, 0, 96, 54, x, y, 96, 54);

i'm try with this. but can't complete my map.

i need do in for.

for (var row = 0; row < 100; row++) {
    for (var col = 0; col < 100; col++){
    screenx = (row - col) * (96/2);
    screeny = (row + col) * (54/2);
    context.drawImage(img, 0, 0, 96, 54, screenx, screeny, 96, 54);
    }
}

but the result is:

How can i correct this ?


texts: GameMaker: Studio - Slow down calculations

texts:
I currently have an orbital simulator, with a brilliant answer in another Game Development question here, and would like to know how to slow down the calculations of Game Maker, to be able to do more precise ones as my orbits suffer variably intense Apsidal Precession.

Examples of this can be found in games such as Kerbal Space Program and
Universe Sandbox 1/2. In KSP, you have the Max Physics Delta Time which allows slower gameplay, but more calculations. In Universe Sandbox you are able to change the accuracy of calculations causing orbits to go crazy and extremely precise.

How am I able to implement such a thing into GameMaker: Studio?


texts: Why is 90 FPS recommended for Virtual Reality games?

texts:
Origin of the question
I have recently finished an internship at a (small) game development company which is working on a Virtual Reality game that is also used in medical rehabilitation. From what I have heard and read online, you generally want to achieve at least 90 FPS in a VR game because otherwise the player can get motion sickness or dizzyness, etc.
I am aware that not everyone is getting sick but from what I have read, you still want to aim for that 90 FPS to be sure, although I am unable to find the exact reason for this number. (it feels like an industry standard)
Questions
"Why is 90 FPS an industry standard when developing a VR game?" and "Why can people get sick when playing on lower frame rates?"
When searching online, I keep reading about 'studies' that show that people will be more likely to feel sick or dizzy when playing a VR game below 90 FPS but I never see the actual reason (source) as to why that is.
I can only make assumptions based on what I know already but I would like to know the exact reason (or as much of a reason as possible) and hopefully a source as to why 90 FPS is chosen (and not 80 or 100) and what causes some people to become sick from lower framerates.
sidenote: I am referring to VR games for devices as the 'Vive', 'Rift', etc. (as there are also VR Simulations for pilots, etc. which also have elements such as simulated movement that can impact sickness)


texts: Efficient collision detection using quadtrees

texts:
I recently started to learn Java and OpenGL with the LWJGL and I'm making some simple games to get started.

At first, when I was going to implement collision detection I immediately thought there had to be an smarter thing than just cycle through each pair of objects (which is an ugly O(n²) operation), so I did some ressearch. It seems that in 2d, what works for most people is a data structure called quadtree.

As I've been working a lot with binary trees (and implementing them) in college, I don't find much of a difficulty in implementing a simple quadtree, but what's really blocking me right now is movement:

Many of the implementations I've seen out there treat this in a way which I consider rather inefficient, but I can't think of anything better. What they do is, each frame of the game execution, they clear the whole quadtree, and add again all the objects which need to be checked for collision that frame, so that way the position updates will be also updated in the quadtree. Is there a more efficient way to do this? I think the objects should be replaced inside the quadtree, and nodes should be added/deleted taking into account those replacements.

I don't know if I'm over-thinking it. Even with the clearing and re-adding method it turns an n² operation into an almost n·log(n) operation. But this is just theoretically, and I have to add another linear operation (clearing and re-adding the quadtree), so I'm worried it wouldn't do any improvements in the actual speed...

Also, another related doubt. I see many people with different approaches regarding quadtrees. Some state that objects that can't fit completely in a quadrant, for a given level, should be stored at least one level upwards, while some others argue that it is better to store objects only in the quadtree's leafs, and an object overlapping at several quadrants should be stored in all of them. Of course we're talking about references here (I'm using java so I can't work with anything else anyway...), I just mean that this would'nt be a serious memory issue, and thus I'm not taking that into account. Anyway, I was just wondering: Which of those might be better? and why?

Any help and other related comments will be much appreciated

Thanks in advance


texts: How to design a GUI / controls system classes

texts:
I'm at the stage when I need to develop some kind of GUI with windows, clickable buttons, etc. It's going to be a RPG game so these components will be used extensively so I want them to be as flexible as possible.

I was thinking about something like winform controls funcionality though much simpler, I don't think I'll need anything more than a window/panel, button, label and image controls.

So far I made abstract Component class which basic attributes like position, width/height
and two events - mouseover and click. All controls will be derived from this base class.

public abstract class Component
{

    public event EventHandler MouseOver;
    public void OnMouseOver()
    {
        if(MouseOver != null)
            MouseOver(this, null);
    }

    public event EventHandler Click;
    public void OnClick()
    {
        if (Click != null)
            Click(this, null);
    }

    private Rectangle componentRectangle;
    private bool isVisible;

}

My question is how to integrate my controls with the rest of the game, I was thinking about something like GUIManager class that would contain the list of controls and manage displaying them and firing events. I'll be calling the update method somewhere in the game loop.

public class GUIManager
{
    private List<Component> componenets;

    public void Update(Vector2 mouseLocation)
    {
        foreach (Component component in componenets)
        {
            if (component.IsVisible)
            {   // mouse is over component
                if (component.ComponentRectangle.Contains((int)mouseLocation.X, (int)mouseLocation.Y))
                {
                    component.OnMouseOver();
                }
            }
        }
    }
}

Now lets say I want to show character's inventory screen. Is it a good way to just create the controls, add events and then them to GUIManager's controls list to take care of it? Or maybe you can suggest some entirely diffrent approach?


texts:
I'm not sure this kind of question has been answered yet, if so i'm sorry to duplicate it.

My question is rather simple :

I'm creating a simple Isometric game with libgdx, i'm using Tiled but only to design the map and render it with OrthographicMapRenderer.

The map is a static map of 6864 * 6880 pixels, one tile is 59*43 pixels

I wanted to do some pathfinding to my game, so I decided to store my map data into a simple 2D array like this : int cells[i][j] which would contains 0 if the tile is walkable or 1 if it's not, it is as simple as that !

Currently I've simply using basic formula to convert world cartesian coordinate to Isometric coord, and formula to get tile pos based on iso pos, (eg : you input a iso coord, the function return a vector like <2,5> which is the 2nd x tile and 5th y tile.

It perfecttly work as execepted, I also make it that iso tile coord is always positive ( <0,0> is at the top left corner of my world )

But here is my Question or doubt : How to handle correctly the game data tile ? Does a 2D array is sufficient, if yes, how to, for exemple write a function that get if a tile is walkable or no based on tile coord ? ( example : I click on my map, the coordinate is translated to tile coord ( < 4,5> for example,) how to check if this tile is walkable ?, i dont get on how to do it i'm really lost.

EDIT : Ive successfully implemented the isometric logic : I can convert world coordinate to tile coorinate ( eg : (5075;4851) -> (203;28)) and the reverse but i'm confused on how to fill the 2d Array, use it for A* algorithm and make the bridge between these coordinate and the 2D array

Thank you for you help,
Regard


texts: Merging multiple image with DirectX D3DImage best approach?

texts:
I'm currently rendering up to 6 images (7440 x 7440) together via a series of colorizing shaders (one each image) and then merging shaders (5 to merge colorizer result). I'm not getting the performance I would expect. I'm using D3DImage to render into a WPF application. The rendering is appearing to be very slow. However, the shaders are rendering in .005 secs each. This is currently rendered on one quad...

Is it better to flush between image and merge or send on flush at the end?

Are C# for loop slowing it do? The benchmarks are not showing that but...

Also I use the colorize shader to change color in near real time the UI locks up...

Windows 7 I know is limited to 1 device. Windows 10 I know support multiple instances of devices... is there a way to use that capability? is it worth it?

Here is the kicker I will need to eventually do this on 20 quads.

Thank you in advance!


texts: How do you get a multiplayer-only game to reach critical mass?

texts:
Say you have a multiplayer-only game in which players are randomly paired head-to-head against a random online player...

How do get such a beast off the ground?

You need enough players online at all times such that any random player game request will be paired with someone else's request.

Chicken and egg ... You need players to play but without players to play no players will play!

How do I reformulate the problem to make this work?

This happened to me a while back and I haven't come up with anything useful since.
https://github.com/fictorial/Rock-Paper-Scissors-World-Masters-iOS


texts:
I'm trying to create a VRChat world in Unity, using VRchat World SDK3.
But I'm getting a strange behavior in Udon Graph assets (as shown by the arrows in the screenshot).
Steps I took:

I've installed the appropriate Unity version (2018-04-20f1) via the hub,
Then proceeded to importing VRChat SDK 3 (VRCSDK3-WORLD-2020.12.09.04.44_Public.unitypackage),
Then on the project tab, I navigated to the "Udon" folder, created a subfolder and inside it I created a Udon Graph Program Asset.
Finally, I opened Udon Graph and I added a public GameObject variable.

The result was as seen in the image seen bellow: the GameObject variable displays a buggy text (the text self (GameObject) shows up twice, superimposed on top of itself - as indicated by the arrows in the attached screenshot).


texts: How can I ensure GLFW callback events only happen once in the main loop?

texts:
The problem is that the mouse and keyboard events can be triggered before the main loop(in which the program starts to render and update content) takes place. In the program if the moues button is pressed, there will be a sound effect. And the code looks like this

void main()
{
// Here I initialize everything including parsing model files,
// so when the window appears it's initially plain white(loading files and not
// drawing stuff). I set up the callback functions with glfwSetKeyCallBack()
// and glfwSetMouseButtonCallBack().
// The next line is the main loop

 while (!glfwWindowShouldClose(window))
 {
 // Here I draw all the content and this is supposed to be only the place that the events
 // can be triggered
 }

glfwDestroyWindow(window);
glfwTerminate();
exit(EXIT_SUCCESS);
}

When I debug the program, the window will appear and if then I click the mouse, the sound effect will appear when the program starts drawing stuff on the window. But I want the callback
functions to process events only when window enters the main loop. It should not receive or process events during the initialization part. Is there a way to prevent the callback functions to receive or process events before the main loop?


texts: Using 2D std::vector for map and collision

texts:
Hello to anyone reading this. I am having trouble on how to use std::vector. From what I know, std::vector is a flexible version of an array and iterator is used to go through each individual element within a vector.

std::vector<std::vector<int>> row;
std::vector<int> column;
//This is equivalent to... (?)
int array[i][j];

So what if I wanted to use a 2D std::vector for a tilemap?

std::vector<std::vector<int>> row;
std::vector<int> column;

for (int i = 0; i < row.size(); ++i) {
    for (int j = 0; j < row[i].size(); ++j) {
    //something with map
    }
}

for (itr = row.begin; != row.end(); ++itr) {
    //something with each block of the map?
}

Sorry if the code is incomplete or wrong. I can't seem to understand the standard format of std::vector and using an iterator.

Thank you to those willing to help.


texts: Prevent showing movie files after packaging unreal game

texts:
I developed a game which has some videos inside it. I added videos into my project folder so that I can access them.

After packaging, on the folder all videos will be shown as its original format which everyone can play it.

How is it possible on release version no one can go to game folder and play it? Maybe some kind of encryption or change format of file which only its game can play it would help it.

For example when you have a game on your computer, the only way to see the video is that you play the game and you will see relevant videos in the right time. However, after packaging, all videos will be on a folder any everyone can go to the folder and play it and see videos even without playing game.

In Unity after releasing the game, you can't access assets, it will be shown in a file with .resource extension so no one can access it. However, in Unreal Engine, it will show the real file.


texts: Concerns about Google Play Games security

texts:
I want to develop a Android game using LibGDX. Let's take a classic example ; some player can battle another one in turn based matches. The outcome of match defines the reward in some ingame currency. There will be premium currency with in-app purchases, and both can be used to purchase some upgrades.

I am discovering both Android and GPG at this point. GPG allows some P2P turn battles, matchmaking and cloud saves, making it looks like quite the thing I need.

However, I have concerns regarding its security. The currencies needs, for obvious reasons here, to be fully secure, non corruptable by altering saves on the device. In the same way, it is my understanding that the turn based (and real time) matches are P2P, between devices.

My question is, what GPGS does to enforce security on both (cloud) saves and P2P matches ? Will I need to use some backend server for this case ? And if yes, how can I authenticate a player logged in GPG on this backend server ?

Thanks for any clues about that.


texts: How to draw the imagebutton and place it in the lower left corner

texts:
I have the button:

soundBtnStyle = new ImageButton.ImageButtonStyle();
    soundBtnStyle.up = skinBac.getDrawable("on");//
    soundBtnStyle.down = skinBac.getDrawable("off"); //

    soundsButton = new ImageButton(soundBtnStyle);
    soundsButton.setSize(120, 120);

    soundsButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            game.rainMusic.setVolume(0.0f);
        }
    });

call the button in the constructor,I can not figure out how to add a button to the stage.

game.batch.begin();
    game.batch.draw(soundsButton, 0, 0,120, 120);
game.batch.end();
enter code here

It does not work, an error


texts:
I'm trying to clone space invader of atari and I have problem with bounding rect calculations.. the rect is not correctly bounded.. maybe I have problem with the transformations

void Barrier::Render()
{

    if (mBarrierImage)
    {
        CIwFMat2D Transform;
        // Build transform
        Transform.SetIdentity();
        Transform.SetRot(0);
        Transform.ScaleRot(1);
        Transform.SetTrans(Position);
        Iw2DSetTransformMatrix(Transform);

        Iw2DSetColour(0xffffffff);

    CIwFVec2 pos = Transform.t;
    BoundingRect.x = Position.x;
    BoundingRect.y = Position.y;
    BoundingRect.w = (float)mBarrierImage->GetWidth();
    BoundingRect.h = (float)mBarrierImage->GetHeight();
    Iw2DSetColour(0xff0000ff); // Set red
    Iw2DDrawRect(CIwFVec2(pos.x, pos.y), CIwFVec2(mBarrierImage->GetWidth(), mBarrierImage->GetHeight())); // Draw red outline


texts: How much to roll Z to make horizon level

texts:
I've got a flying camera with some arbitrary rotation. (It also has a translation, but that's not important.) It's flying along its local Z axis, traveling in some direction over the ground with some rate of climb or descent.

I'd like to gently correct it so the horizon is level. Or, equivalently, I'd like to apply rotation around camera's pointing direction (Z) until it's up-vector (Y) is as up as it can be.

That is, I want my camera X and camera Y to adjust, leaving camera Z (forward) exactly the same.

The rotation is represented as a 3x3 matrix. Quaternion solution would be fine, also...

How much do I need to rotate it to get the horizon level?

Any help appreciated!

Edit: I'm currently in c++.

Edit2: Here's a picture further clarifying... I need to rotate in the local XY plane, the grey disk, til X touches the ground plane, Y is up-ish, and Z is unchanged... which sort of suggests an approach...