texts: How can I make actions that effect the position of another player appear responsive when my game server is authoritative?

texts:
You are playing as Lucio in Overwatch. You boop another player and they immediately get booped away. It feels really responsive. But the server hasn't actually registered the boop yet. By the time your command reaches the server, that player might be in a different location and the result of your boop might be completely different. If we needed to wait for a server confirmation, we wouldn't see our boop for, say, 200ms. (assuming 200ms RTT.)
You are driving around in PUBG and see another player. You drive your car in to a player who is running around on foot. They appear to immediately die or at least get bumped away by the impact. You hit the player where you saw him but he is actually somewhere else on the server (you may have actually missed him!). If our game does not respond immediately, we would see the other player clip in to your car as they continue running, then, say, 200ms later they would die or get knocked around (again assuming a RTT of 200ms)

How are situations like these resolved? It seems like the result is simulated locally (prediction) but the outcomes could be so drastic that an incorrect prediction could result in a lot of confusion. (Running over a player who isn't actually in your way, booping a player to your left off a cliff, but they are actually in front of you and won't fall down the cliff)


texts: How to make a TCP Client Server in java over multiple Networks

texts:
So I am trying to write server code for my game, and I am kinda running in a wall. I have seen oracles example for a server and client, but how do I allow it to connect to computers outside my network? Pretty much I'm trying to do the following

Client presses a key to move 1 unit to the left, the server receives the Client's input, checks if any modification is made, if there is send Client back to where they started.

The problem I have is how do I connect a Server and Client on separate internet connections?


texts: How to make a simple dialog system with yes/no options and pages?

texts:
I recently made dialogues. Now I want to add the option to choose yes/no when the dialogue is finished (if it has a choice).

Adding buttons to the dialogue is no problem, the problem I'm having is that I want a "generic" dialogue system. By that I mean, I might have 200 NPCs, and depending on which NPC I am talking to, the yes/no buttons will react differently. This is where I'm stuck. How will the buttons know which methods to call?

Say I have one NPC that offers to sell me an item for 100 gold, and another NPC that offers to show me around the village. How will my system know which functions to call when I press "Yes"?

All I can find on this subject is really complicated using trees and things I don't fully understand yet, and don't really need, since my system is very simple.


texts:
So I'm screwing around with c++ and SFML, when I thought to myself the following:

If the images are compiled into the executable, with enough sprites for the game, memory might become a problem at some time? I might have misunderstood how images are loaded, but they aren't in the release directory so they must compiled and put into memory when the executable is loaded?


texts:
I am using Unity 2017.

The left picture is the original state. Light map applied.

On the right is the state after all meshes are made into Combined Mesh.

Same lightmap settings as left.

As you can see, it is filled with dirty black dots.

What should I do?


texts: How can I procedurally generate the right difficulty of enemy waves?

texts:
I'm programming a space-shooter mobile game with a sandbox gameplay style similar to Defender's.
The player faces infinite waves of enemies moving towards his ship.
The game has many upgrades the player can buy to increase his ship's strength.

It is important that the difficulty of each level matches the player's skill and strength.
This includes setting the right number of enemy waves per level and the number and toughness of the enemies in them.
This must be done procedurally, since the game has no predefined set of levels laid out by a designer.

I'm interested in straightforward solutions  with more or less the desired effect, simple enough to quickly implement and test.

How should I approach this?


texts: Making particles accelerate toward a mouse point

texts:
I'm currently working on a particle simulation program that makes pixels move towards a mouse point continually accelerating, but i'm running into some math issues. Currently my particle will accelerate in the direction of the mouse point, but will not actually accelerate towards a given point(only in it's direction).

To get an idea of what I'm trying to accomplish, my older program does just this but uses the fixed function pipeline. I want to recreate this program using the programmable pipeline and as a result changed around a lot of the program, there is really no similar code between the two at this point. Example of my problem:

As you can see the particle only accelerate in the direction of the cursor, my main equation I'm using is:

//if left mouse button is pressed
if(sf::Mouse::isButtonPressed(sf::Mouse::Left)){
        p.speed += glm::vec3(-pos.x * 30, -pos.y * 30 ,0.0f);   //increase speed in direction
}
//update position of particle with a little bit of spread -- speed(dt) * DRAG * Rand
p.pos += p.speed * (float)(delta) * DRAG * glm::vec3(rand()%5,rand()%5,0);

where my particle struct is:

struct Particle{
    glm::vec3 pos, speed;       //position, speed
    unsigned char r,g,b,a;      //color
    float size, angle, weight;  //?
    float life;                 //remaining life of a particle, if <0 it's super dead
    float cameradistance;       //squared distance to camera : -1.0f if dead

    //used for std::sort, needs an overloaded comparison operator
    bool operator<(const Particle& that) const {
        return this->cameradistance > that.cameradistance;
    }
};

how would I go about simulating the behavior of my first program with this second program I'm writing? I can't seem to wrap my head around doing this as the program structure is so drastically different.


texts: Best approach to render text in OpenGL 4.5

texts:
I have tried to implement text rendering in OpenGL from several tutorials and guides but I am unable to implement any of them successfully.

The latest one I have attempted is [Here]
but it seems to be incompatible with GL 4.5. My end goal is to implement the ability to load TTF files into OpenGL and render them. If someone could give me a hand with a sample code snippet of how to implement this myself, or even to reconfigure the free type library, that would be appreciated!


texts:
I built a casual game where the user answer the right word in random question. Now I want to make this game multiplayer (4 players) working on smartphones and tablets (Androird & iOS) where all the players are clients but one of them is Host/Client who receives the in-game answers to check who won and answer-back to the other three players (Clients) with the score.

However, I'm confused about HLAPI, LLAPI, dedicate server, PUN, Standalone, Local, LAN... I'm a mess right now. What should I choose? having on mind I only send/receive strings, and the game should work with and without Wi-Fi connection.


texts:
I'm creating a procedural world with LWJGL and GLSL. I want to better visualize the biome map being produced and the height map it creates, but my attempts so far have been very inefficient. My first idea was to make a vec3[] holding the biome color for each vertex, but that very quickly took the game from 150 fps to 10-15. The time to render a 512x512 chunk went from around 3 per second to one per five seconds. As you could expect, there was also a problem with it very quickly using up 12gb of ram.
I then thought about making an int[] array for each vertex where each point of the mesh would be able to use as a dictionary to grab a vec3 for the color. So 512*512 integers in an array getting from an array of 15 colors intead of a single array of 512*512 vec3s. This seemed even worse somehow in both FPS and chunk rendering time.
To summarize again, I'm trying to color each vertex with its own color to visually show the biomes. What is a more efficient way to do this?


texts: glClear-like operation that respects the stencil buffer

texts: For the background render in my code I need to perform an operation that essentially acts like calling glClear(GL_DEPTH_BUFFER_BIT) except that it needs to use the current stencil buffer to mask out parts of the screen. The other requirement is that it has to work on fixed function pipeline systems, preferably back to OpenGL 1.3.  Any suggestions on how to best do this?


texts: couldn't switch to requested monitor resolution in Windows 7

texts: Run the game,and it shows that it couldn't switch to requested monitor resolution, DX11 could not switch resolution in Windows 7(both 32 and 64 bit ) when I tried to build the game with Unity 2017.3, and also on 2018.4, but the dialog keep popping out. I already tried to lowered the resolution and updated the integrated graphic driver, but nothing worked. Any idea would be appreicated.


texts: Rotate an object around a point in Ogre3D

texts:
Possible Duplicate:
  How can I rotate about an arbitrary point in 3D (instead of the origin)?

I am new to 3D programming and I have been using Ogre3D lately to get a grasp of it.

What I am trying to do is the following:

I want to make an entity rotate around a point (probably the parent SceneNode) in a circular way only in the X and Z axis.

I have tried using yaw/pitch/roll and rotate but no luck, and I can't find any good tutorials/how-tos online.


texts: Save a mouse coorinates after a specific number of seconds

texts:
I have a specific method that saves my mouse x and y coordinates. I want that mouse coordinates be saved by specific time (for example after 1000ms). How I need to do that in Java?
Please add a simple usage example.

 public void mouseMoved(MouseEvent e) {
        currentX = e.getX();
        currentY = e.getY();

        if(enemy.onWall() == true){
            timer.schedule(new TimerTask(){
                public void run() {
                    saveX = e.getX();
                    saveY = e.getY();
                    enemy.setCont(true);
                    move();
                }
            },100);
            enemy.setOnWall(false);
        }
    }

But this code saves mouse coorinates immediately and then waits for 1000ms and I have old coordinates.


texts: How to load multiple 3D models dynamically xna

texts:
I want to load multiple 3D models .fbx at the same time in my map display.
I can load First Model but when I use ContentBuilder to Load another Model, I Got Error in effect.EnableDefaultLighting ();
This my load function

private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            // Default to the directory which contains our content files.
            string assemblyLocation = Assembly.GetExecutingAssembly().Location;
            string relativePath = Path.Combine(assemblyLocation, "../../../../Content");
            string contentPath = Path.GetFullPath(relativePath);
            fileDialog.InitialDirectory = contentPath;
            fileDialog.Title = "Load Model";
            fileDialog.Filter = "Model Files (*.fbx;*.x)|*.fbx;*.x|" +
                                "FBX Files (*.fbx)|*.fbx|" +
                                "X Files (*.x)|*.x|" +
                                "All Files (*.*)|*.*";
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                LoadModel(fileDialog.FileName);
            }
        }
        void LoadModel(string fileName)
        {
            Cursor = Cursors.WaitCursor;
            // Unload any existing model.
            editorDesign1.Model = null;
           // editorDesign1.CurrentModel.Model = null;
            contentManager.Unload();
            // Tell the ContentBuilder what to build.
            contentBuilder.Clear();
            contentBuilder.Add(fileName, "Model", null, "ModelProcessor");
            // Build this new model data.
            string buildError = contentBuilder.Build();
            if (string.IsNullOrEmpty(buildError))
            {
                // If the build succeeded, use the ContentManager to
                // load the temporary .xnb file that we just created.
              editorDesign1.Model = contentManager.Load<Model>("Model");
              // editorDesign1.CurrentModel.Model = contentManager.Load<Model>("Model");
            }
            else
            {
                // If the build failed, display an error message.
                MessageBox.Show(buildError, "Error");
            }

            Cursor = Cursors.Arrow;
        }

and this is my Draw model function

public void DrawModel()
        {
            foreach (ModelMesh mesh in Model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();
                    effect.World = Matrix.CreateTranslation(Position) * Matrix.CreateRotationX(Rotation.X) * Matrix.CreateScale(Scale) * Matrix.CreateRotationY(Rotation.Y) * Matrix.CreateRotationZ(Rotation.Z);

                    effect.View = view;
                    effect.Projection = projection;
                }

                mesh.Draw();
            }
        }

The problem is when I create two object from my model class and use ContentBuilder to Load another Model I get an exception AccessViolationException was Unhandled Attempted to read or write protected memory. This is often an indication that other memory is corrupt  and get another exception NullReferenceException was unhandled

Can anyone help me tho solve this problem?


texts: How do I create a HeightField in pybullet?

texts:
I've been looking for documentation on PyBullet, the python implementation of Bullet, but I haven't yet found a way to implement the btHeightfieldTerrainShape collision object, which I need to make, well, terrain.

If this isn't possible, is there another way within PyBullet to turn a set of points into a collide-able object?


texts: How do we keep ourselves from being sued for unknown patent infringements?

texts:
There's breaking news about Zynga being sued over some very obvious implementations. This is making me think that the game industry is full of landmines to be stepped on at every turn. What input does everyone have to minimize the damage?

Latest:
http://www.gamasutra.com/view/news/36657/Zynga_Sued_Over_Prize_Redemption_Patents.php

Another example:
https://w2.eff.org/patent/wanted/patent.php?p=sheldon


texts:
In Ogre3d's manual and in the documentation it's said that Ogre::Mesh shouldn't be used for world geometry. Quoting the manual:

  Mesh objects are assumed to represent movable objects and are not used
  for the sprawling level geometry typically used to create backgrounds.

So how do I make world geometry? This feel like an oversight where the authors assumed that the answer was obvious, but I really can't find it. Googling questions like "how do I make a cube?" or "how do I make a room with walls and a floor?" leads me to answers that boil down to "Use your SceneManager to generate a surface mesh, then build walls and stuff with it" which strike me as extremely tedious and inefficient.

tl;dr What is the simplest, recommended way to make static non-file-based geometry in Ogre3d?


texts: Facebook Scores API Global and Daily Rank on Unity

texts:
I need to implement 4 types of leaderboards on my Unity game:

All Time/Daily
Global/Friends

I'm using Scores API from Facebook and I achieved All Time Friends Leaderboards. I'm taking a look at the Scores API documentation and I'm not seeing Daily nor Global rank anywhere.

Is it possible? If yes, how?


texts: How can I develop my Android game for different phone resolutions?

texts:
For instance, the Motorola Droid is as wide as the G1, but has more height.

Should I try to spread the UI out across the extra height found on the Motorola Droid?  How do others handle this problem?

I'm not using OpenGL, but a SurfaceView for a 2D game.


texts: Finding shortest path on a hexagonal grid

texts:
I'm writing a turn based game that has some simulation elements. One task I'm hung up on currently is with path finding. What I want to do is move each turn an AI adventurer one tile closer to his target using his current x,y and his target x,y.

In trying to figure this out myself I can determine 4 directions no problem by using

dx = currentX - targetY
dy = currentY - targetY

but I'm not sure how to determine which of the 6 directions is actually the "best" or "shortest" route.

For example, the way it's setup currently, I use East, West, NE, NW, SE, SW but to get to the NE tile I move East then NW instead of just moving NW.

I hope this wasn't all rambling. Even just a link or two to get me started would be nice. Most of the info I've found is on drawing the grids and groking the weird coordinate system needed.


texts:
Given the following tree structure, where each player logged in can have data for current and completed levels, quests per level, NPCs per quest, and multiple tasks per NPC... I'm trying to figure out the best way to store the current and completed data per player.

I asked the question before, albeit with too much detail. It was requested that I generalize the question... So if you'd like more context, see here:

https://stackoverflow.com/questions/23587430/rpg-storing-player-data-for-semi-complex-tree-structure

Some information about my RPG structure:

Levels, Quests per Level, and Tasks per NPC are completed in chronological order.
NPC dialog and task dialog data is stored in a js object in a npc_dialog_1.js file in the following structure:

var dialog = {
quests : {
    questName : {
        NPCName: {
            TaskName:  {
                 "english" :
                  [
                      "Hello, here is some dialog",
                  ],//more items per task
            }, //more tasks per NPC
        }, //more NPCs per quest
    }, //more quests options per "quests"
}, //more options in dialog besides "quests" if I want
};

I am storing each dialog object in a separate npc_dialog_n.js file per map, that     I'm retrieving with requireJS. This will reduce clutter in a single npc_dialog file.
NPCs per Quest, however, can be started in any order... this is trying to mimic a GTA-style quest queue, as the game follows a general linear progression, yet for each quest you can talk to multiple NPCs and start, pause, and resume the NPC's tasks at any point.

Since the player can start, pause, and resume tasks per any NPC at a given time, I'm trying to figure out the best way to store the current and completed data per player.

mfirdaus recommended the following DB table with M:M relationship b/t user & npc... yet this would add up quickly as each player can have multiple NPCs per quest, and multiple tasks started per NPC... Any way around this set up?

My current db schema:

Thank you


texts: How can I rotate objects around a given point, and then move them to their correct world location?

texts:
I'm building a 2D game using LibGDX. I have a collection of Entities each with their own X and Y positions within the 'world'. The player moves around the world and also has its own X and Y world coordinates, and I use the LibGDX OrthographicCamera which is updated each loop to center on the player location. The player's forward direction is always north relative to the viewport.

What I want to be able to "rotate" the view of the player (essentially by reverse-rotating the world objects using the player location/camera centerpoint as the origin).

I'm attempting to do this using Affine transformations. I had tried something like this each time render is called for the world entities.

Affine2 af = new Affine2();
af.translate(player.x, player.y);  // Move origin to centerpoint
af.rotate(entity.rotation); // For testing this value has 1 added or subtracted to it
                            // when I hold down Q and E to simulate the camera rotation.
af.translate(-player.x, -player.y); // Reset origin transform
af.translate(entity.x, entity.y);  // Move to world location
.... // Draw with the af matrix

The thing that I didn't realise at first, is that once the rotation is performed, it also rotates the X and Y axis. So any subsequent translations are done relative to the rotation, and not along the original vertical and horizontally aligned axis, so these objects are not ending up in the correct location at all, and additionally they move around as the player moves which is incorrect behaviour.

What would be the correct way to calculate the transforms so I can rotate these Entities around the player, and then move them into the correct world position based on the rotation?

I'm not sure I've managed to explain this too well, so I drew something to try and show this better:

So when I would want the view to "turn" clockwise, the objects would rotate around the player location counter-clockwise (dotted green box), but if the player moves around the world (i.e. forwards, backwards, left, right) then the entity locations shouldn't be changing.

Edit: After thinking about this more, I'm wondering if I'm going about this entirely the wrong way? I still need the character's X/Y to be "correct" within the world based on the rotation, so actually I should be rotating the player, and then also the view of the world?


texts: OpenGL Vertex Attributes - Normalisation

texts:
Alas, I have searched, and have found no definitive answer.

When would you normalize the vertex data in OpenGL using the following command:

glVertexAttribPointer(index, size, type, normalize, stride, pointer);

I.e when would normalize == GL_TRUE; what situations, and why would you choose to let the GPU do the calculations instead of preprocessing it?
All examples I have ever seen, have this set to GL_FALSE; and I cannot personally see a use for it. But Khronos aren't stupid, so it must be there for something useful (and probably common).


texts: Hammer Editor - How to fix harsh lighting between brushes

texts:
I'm working on an old Half-Life 2 map that I haven't worked on in many years. I changed some textures on the map and for some reason, lighting between the old textures and the ones I now just changed is very harsh.

There are no errors during map compilation. Any ideas what may be causing this issue or how to fix it?


texts: LWJGL Wait for key press in a single method

texts:
Currently I am implementing the possibility in my game to change the keyboard configuration.
Therefor, I have a menu in which is a button for each action the player can do. If the player clicks on one of these buttons, the game should wait until the player hits a key on the keyboard.

But this is my problem. I have no idea how to wait for a keypress.
I tried to do something like:

while(!Keyboard.next()){}
// Now there should be events. Just get the key of the last event.

But it did not work and ended with an infinite loop.
The problem is, it has to work in a single method, as it is the onClick method of the button.

Does somebody know a way to handle this problem correctly?
And how is this done usually? (I have seen such functionality in some games)


texts: Automatic weapon recoil with that "Counter Strike"-feel

texts:
How would you do it?

I already found this function for an impulse (helped by math.SE). It works for single shots, but not for automatic weapons.

Any ideas?


texts: Hero/Character sprite size in comparison to tile size?

texts:
So I'm making this simple platformer where the Hero is 16x16 in size, but also, the tile size is 16x16. Which sounds fine right? But my game window/world is 800x416, which makes the Hero is really really tiny in comparison. This really surprised me, but given Ive never made a platformer before it is also a new discovery.

Is there a rule set for scale in platformer games?

I'd like to have my game window remain the size it is (800x416), cause the game involves large levels. But how big should my hero be?

I hope I was clear with the question, and I appreciate any insight.

Thanks


texts: 3D collision physics. Response when hitting wall, floor or roof

texts:
I am having problem with the most basic physic response when the player collide with static wall, floor or roof. I have a simple 3D maze, true means solid while false means air:

bool bMap[100][100][100];

The player is a sphere. I have keys for moving x++, x--, y++, y-- and diagonal at speed 0.1f (0.1 * ftime). The player can also jump. And there is gravity pulling the player down. Relative movement is saved in: relx, rely and relz.

One solid cube on the map is exactly 1.0f width, height and depth. The problem I have is to adjust the player position when colliding with solids, I don't want it to bounce or anything like that, just stop. But if moving diagonal left/up and hitting solid up, the player should continue moving left, sliding along the wall.

Before moving the player I save the old player position:

    oxpos = xpos;
    oypos = ypos;
    ozpos = zpos;

    vec3 direction;
    direction = vec3(relx, rely, relz);

    xpos += direction.x*ftime;
    ypos += direction.y*ftime;
    zpos += direction.z*ftime;

    gx = floor(xpos+0.25);
    gy = floor(ypos+0.25);
    gz = floor(zpos+0.25);
    if (bMap[gx][gy][gz] == true) {

        vec3 normal = vec3(0.0, 0.0, 1.0); // <- Problem.
        vec3 invNormal = vec3(-normal.x, -normal.y, -normal.z) * length(direction * normal);
        vec3 wallDir = direction - invNormal;
        xpos = oxpos + wallDir.x;
        ypos = oypos + wallDir.y;
        zpos = ozpos + wallDir.z;
    }

The problem with my version is that I do not know how to chose the correct normal for the cube side. I only have the bool array to look at, nothing else. One theory I have is to use old values of gx, gy and gz, but I do not know have to use them to calculate the correct cube side normal.


texts: Generating objects randomly from prefabs in Unity2D

texts:
I am developing an infinite runner using Unity. I have already figured out how to loop a set of backgrounds randomly but I am having problems doing the same for the objects.

So, I have a few objects or obstacles in my prefabs. I want them to generate randomly in the game, not everything at once though.

How do I do that? Can I please get a well-explained piece of code for the purpose?

EDIT : I want the objects to be destroyed as soon as they move out of camera's view (The cam which is following the player).

Thank you.


texts:
What's the simplest way to generate a random "path" for a level in a game? I don't know what search terms I should use to read more. I've looked into maze generation but thats not quite right.

The end result should look like this:


texts: I'm making a simple online RPG for Android & IOS using HTML5 & Phonegap and was wondering: should I include sprite file with the game for downloads (because of bandwidth)? What should I do when I modify the sprite file in the future? (i.e. forced update).


texts: How can I take a screenshot of a certain part of the screen in PyGame?

texts: I need to for my pixel art tool that I'm making to help myself make games.


texts: I installed Linux Build Support, but I need an archive to build, how can I get this?

texts: I`m building a game for Mac, Windows and Linux, I builded the Windows and Mac game, but in Linux, says that need a x86_64 archive, like the image shows, what do I do?


texts: Recent mainstream games written in pure C? not C++ what was/is the point?

texts:
Recent meaning the current decade. I had found this post
https://gamedev.stackexchange.com/a/15403/6544
wasnt c++ adopted as the industry standard quite some time back.
In what sort of situation does it make sense to go with games written in pure c on established consoles/pc/os


texts: Best practice for implementing overall / weekly / daily highscores?

texts:
So I'm setting up social leaderboards and I want there to be daily weekly overall high scores. The way the scoring works is each score is tied to a user after the user logs in so the scores need to always be linked to a user. I'm using the Parse BaaS with Unity C# and I've gotten overall highscores working by adding a highScore field to the ParseUser model. From the research that I've done so far based on google play services and game center has led me to the following solution.

Have 3 fields for the ParseUser model: overallScore, dailyScore, weeklyScore. Reset dailyScore and weeklyScore when appropriate

Is this an appropriate solution for what I'm trying to implement? Is there a more efficient or scalable way to do it?


texts: Protecting the integrity of a game state while minimizing amount of data sent

texts:
I'm developing a multiplayer game in PHP/jQuery, and naturally have to be wary of any sort of data coming from the client.

At present, I have tables of data representing the map (2D roguelike), monsters, items, and player(s).  Initially, my thought was to simply package it all in a JSON object and send it every game tick, however when actually looking at the data I realized that's quite a large packet to be sending.

So, my question is what is a good approach for minimizing data sent to the client?  Obviously I would need to figure out some way of validating whatever it sends back.  Initially we'd hoped to do some minimal verification on the client-side, but each time we thought of one thing we could do it is immediately invalidated with tools like Firebug.

Kind of an open question I realize, but we want to get this right before we move on with our implementation so we don't have to shoehorn in bugfixes later on.


texts: How to distort graphics in a wave-like way?

texts:
I saw a certain graphics distortion effect on multiple games over time and am interested in doing it in 2D. It is like a wave-like texture distortion, I am not entirely sure what it is called actually. Super Mario 64 had an effect like that when you enter a painting depending on your position (https://www.youtube.com/watch?v=H6r5oF73gNI#t=72), also Braid has one which is even more similar to that what I am trying to achieve when you use the time ring (https://www.youtube.com/watch?v=uqtSKkyJgFM#t=38).

I would really like to know how those effects were implement and if there is support for something like that in LWJGL (or even Slick2D). So far, I found absolutely nothing explaining on how it was done.


texts: if a desktop machine supports OpenGL 3.0+ I can assume that it supports OpenGL ES 2.0 too?

texts: This isn't clear for me, if i use the drivers from the GPU manufacturer and they support OpenGL 3.0 and/or above, i can always make an OpenGL ES 2.0 application work?


texts:
I'm working on a thesis about programming an AI combat system for Pokemon (To be implemented in Showdown!). However, I would like to include historical information about the existing implementations of Pokemon AI. This information would offer valuable context to my thesis.

I have been scouring the internet for some sort of algorithm that explains how the AI Trainers make their choices, but have found nothing promising. I realize the fan-games have implemented some more interesting AI systems for their trainers, these would be interesting to see as well.

What I am looking for is examples of the methods used for Pokemon Battle AI decision making used in Pokemon videogames, whether from main series by Nintendo or the many fan-games out there. I realize most of these pose no challenge to an experienced player, but I don't mind, I only wish to compile historical information on previous Pokemon AI attempts.


texts: In AngelCode's Bmfont is there a way to make it so that all of the widths are equal?


texts: How do I approach large companies if I have a killer mobile game idea?

texts:
I have an idea for a game that has potential, but I'm not a programmer.

How do I tell this to development companies without having my idea stolen?  All I want from the company is for somebody to watch a three minute long video presentation about my idea and if they see potential in it then we can talk about the details.

I have already sent an e-mail to several big companies that have the expertise needed to code the game, they haven't answered me. Actually the idea is nothing fancy, no 3D, but fun and unique.


texts:
I am creating a nail salon 3D game where I need to implement nail filing mechanics. I have tried out approaches including mesh deformation but I'm concerned about performance as I am targeting mobile platforms.
How can I shape a nail efficiently for mobile devices?


texts:
I am creating an 2d bird view tile game using the pixijs render framework.
Like pokemon or oldtime zelda.

In those games you sometimes walk behind buildings where the tile would be drawn on top of the player.

I am using an multidimensional array for each tile properties.
Where you can set ground level images and level on top of ground level images.

The 'z-index' can be changed.

Should I create an new property to flag it as an tile that can be on top of the player? Where all those tiles with that property are drawn on top of the player.
But there is an possibility that you can climb/walk on the building and the player should than be drawn on top of the tiles.

You should take the following into consideration

the game is an multiplayer game.

This could be an conflict if all the players/characters (the player,npc, cpu) are one layer and the tiles that can be drawn on top of the player are one layer. Because for example: one player is walking on top of the building and one is behind the building. You cant change the z-index of the player one lower. Because the player behind the building wil look like he is on top of it because the player is drawn on top of it by the changed z-index.

you can be drawn on top of the tile level (like walking om top of the building or mountain)
tiles can change (a building that is going to be destroyed for example) thus are not fixed

So how can I handle tiles on top of a player which can be also beneath one player but not the other?


texts: Why is my call to SetDisplayMode not supported?

texts:
I have some legacy DirectX code that always returns DDERR_UNSUPPORTED.

I originally developed the code using DirectX3, and I am porting it to DirectX7 after spending years away from programming.

The following line is returning DDERR_UNSUPPORTED rather than DD_OK:

hrRetVal = pDDraw->SetDisplayMode(dwWidth, dwHeight, dwBPP, 0, 0);

Could someone please take a quick peek and respond if you see why this might be the case? This is not a commercial application... just something to do for fun.

Based on the Microsoft on-line documents, the SetDisplayMode method is not deprecated, and should work. A compiled version of my legacy program written with DirectX3 renders graphics on newer OS's such as Windows 10, without issue. I am interested in making some changes.

This Video compilation unit:

Sets the video mode to 1024 X 768
Create a DirectX instance, set the cooperative level.
Which when destroyed will Restore video to original mode, and flip to GDI

void Video::Initialize(void)
{

  TRACE("Video::Initialize invoked\n");

  hrRetVal = {0};
  DWORD dwDefaultRefreshRate = 0x0;
  DWORD  dwWidth = 1024, dwHeight = 768, dwBPP = 8, dwRefreshRate = dwDefaultRefreshRate, dwFlags = 0x0;

  try
  {
    Check(hrRetVal); // check for DD_OK

    TRACE("Video: using emulation mode, no hardware\n"); // debugging
    TRACE("Video: DirectDrawCreateEx invoked\n");
    hrRetVal = DirectDrawCreateEx((GUID*)DDCREATE_EMULATIONONLY, (LPVOID*)&pDDraw, IID_IDirectDraw7, NULL);

    Check(hrRetVal); // TRACE value of hrRetVal
    if (DD_OK == hrRetVal)
    {
      TRACE("Video SetCooperativeLevel invoked\n");
      hrRetVal = pDDraw->SetCooperativeLevel(hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
      Check(hrRetVal);
      if (DD_OK == hrRetVal)
      {

        // Lets see if the video is supported
        hrRetVal = QueryVideoCapability();
        Check(hrRetVal);

        if (DD_OK == hrRetVal)
        {

          TRACE("Attempting to set video resolution to: %d %d \n", dwWidth, dwHeight);

          hrRetVal = pDDraw->SetDisplayMode(dwWidth, dwHeight, dwBPP, 0, 0); // this line always returns DDERR_UNSUPPORTED

          // hrRetVal == DDERR_UNSUPPORTED after call to SetDisplayMode

          Check(hrRetVal);
          if (DD_OK != hrRetVal)
            throw (VIDEO_EXCEPTION); // with throw an exception since hrRetVal == DDERR_UNSUPPORTED
        }
      }
      else
      {
        Check(hrRetVal);
        throw (VIDEO_EXCEPTION);
      }
    }
    else
    {
      Check(hrRetVal);
      throw (VIDEO_EXCEPTION);
    }
  }

  catch(int exception)
  {
    TRACE("%Xh exception caught by Video::Initialize\n", exception);
    Video::Check(hrRetVal);

    if (exception == VIDEO_EXCEPTION)
    {
      char message[80];
      strcpy_s ( message, "Unable to initialize video. ");
      strcat_s ( message, "\nApplication will now terminate.");
      FatalMessageBox( message );

      TRACE("APP_EXCEPTION thrown by Video::Initialize\n");
      throw (APP_EXCEPTION);
    }
  }
}

I'm using Visual Studio 2017 Pro v15.7.2, on Windows 10 Build 1803.


texts: How to prevent unbalanced population in MMO game factions?

texts:
In games such as World of Warcraft, the imbalance between factions is often a matter of controversy.

To compensate, WoW applied the Tenacity buff to the outnumbered faction to balance PvP.

However, this only applies to PvP and I wonder if this kind of bonus can be used to encourage character creation in the least populated faction.

Something like an XP bonus for the least populated faction?
For example, 5% XP bonus if the faction represents 45% of the server.
The bonus would be highlighted when creating a character and it would be 0 when the two factions have the same size.

Or a bonus on the economy by lowering auction fees proportionately to the imbalance?


texts: Ways to persist entities and components in an ECS?

texts:
I am working on a small multiplayer game with rpg elements using java and "Artemis ODB". Most of the logic is already done but one important thing is missing. The persistence.
So i am searching for different ways to persist my game. One thing is important, the world is huge and i cant load in the whole world at once. I already stumbled upon two different ways on my own. Using a relational database or a nosql database. But one thing scares me... entity references.
In my game i have an player entity and item entities. The player entity owns a inventory component which stores a reference to some item entities. In my ecs, each entity reference is an simple integer. So this looks like this...
/**
 * Represents the Inventory of our game, contains references to entities acting as items.
 */
public class Inventory extends HibernateComponent {
    public Set<Integer> itemEntities = new LinkedHashSet<>();
}

Why does this scare me ? Well... Entity references are Integers in my case. They are no real ID and i cant set or change this "ID" of an entity because my framework permits it. This brings us straight to the problem. When i serialize this component or the whole player entity it would look like this.
Inventory{
   itemEntities: [40,2,5,50]
}

So when we save this and load it later on we have no entity with the id 40... and even if we recreate that entity we cant set it to an id of 40, because the frameworks permits it. So how the heck do we save references between entities ? ^^
So all in all... what are common ways to save, load entities from an ecs ? How do you do it ? And what would you recommend ?


texts: UE4 or Unity or Libgdx for VR project using Oculus rift and Novint falcon

texts: I've to make a multiplayer game Air Hcokey using 2 Oculus rift and 2 novint falcon controllers , I know that these 3 engines support the Oculus Rift but have no Idea if they do support the Novint Falcon , any advice in which one to use in my case ??


texts:
I'm developing a game in Unity. It's a simple game where the rocket has to reach the point where the player touches on the screen. The movement of the rocket is physics based. When the rocket goes off screen on right side, it appears on left side and when it goes off on left side, it appears on right side. Similar for vertical axis.

In the picture above, the user touches on the bottom right corner. The rocket could either rotate and go there (Path 1) or it would directly go up left off the screen and appear on bottom right corner and reach there(Path 2).  I want to implement the Path 2. How would it calculate the distances and determine the shorter path and then proceed in that direction?


texts: Unity: White outline around seams in my character, make it stop!

texts:
so once upon a time I made a really cool character for my game project and he looked great. Then at some unspecific point in time, my character's UV seams got these awful white outlines around them:

I assumed the problem was that during some texture revision, I didn't paint past the island seams, so I compared the texture file with an image of the UV output, but in fact I did paint past the seams, so that isn't the problem. I have heard that this may have something to do with antialiasing, but I don't want to turn that off if I can fix the problem another way. Also, notice that the enemy character in the above gif does not suffer from the same problem.

What could be causing this? How can I fix it?


texts: Is there a way to export all the images of my tweening effect in Flash?

texts:
i'm using Flash to create the animation of my character in 2D (i'm just beginning). Is it possible to make a tween effect of a character, and then automatically export all the images/frames?

So far, it's a bit fastidious : i create my tweening effect, then i put a keyframe for each frame i want to copy and paste, then i select the movieclips and shapes and copy and paste them into another flash document, i position those clips at the exact same location as the previous image, then i erase the previous image and export the image... For 30 frames! Is there any faster way?

Thanks


texts: How to make my character walk by clicking and holding the mouse button?

texts:
I created an Action Mapping using the right mouse button as a reference.

The Action Map is called "Andar" (walk in english).

In the character code, I call this Action Mapping and in it I make the character walk by clicking the right mouse button (on Floor):

But I would like the character to continue walking if the player clicked the right mouse button and held.

Like Set Destination (action mapping from Unreal).

Other places I searched:

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

https://answers.unrealengine.com/questions/134746/hold-button-for-few-sec-and-play-event.html

It's a simple problem, but I can't find anything about. Not exactly. The problems I found in my search are not the same as my problem. Even changing the words and terms I was not successful.


texts: 2D Finding an algorithm to check pizza toppings positions

texts:
Using unity 3D I am creating a 2D pizza game and I am stuck at finding an algorithm to solve this problem which is Detecting if the pizza is half and half taking into consideration that the user can put the toppings in all rotations shown in the picture and lot more possible distributions.
I used Physics2D.OverlapAreaAll to get position of ingredients on the pizza and I tried getting the sumX and sumY of coordinates of all topping A and sumX and sumY of all topping B and adding A.sumX + B.sumX and A.sumY + B.sumY and if the 2 totals are between 0 and 1 then A and B are on opposite sides but the bad distribution of toppings in the second pic is also accepted by my algorithm. The toppings must be spread like in the 1st pic
I need some easier way to detect the correct distribution of ingredients maybe using collisions or something.
if (sumX > -ErrLvl && sumX < ErrLvl && sumY > -ErrLvl && sumY < ErrLvl)
            {
                Debug.Log("APPROVED HALF-HALF PIZZA");
            }
            else
                Debug.Log("BAD HALF-HALF PIZZA");


texts:
I'm trying to move a kinematic rigidbody (a spaceship) with this code:

float xSpeed = 0.0f;
float ySpeed = 0.0f;
float zSpeed = 30.0f;
Vector3 moveDirection = transform.right * xSpeed + transform.up * ySpeed + transform.forward * zSpeed;
ShipRigidBody.MovePosition(ShipRigidBody.transform.position + moveDirection * Time.deltaTime);

but moving the ship using ShipRigidBody.MovePosition makes it go through other objects with kinematic rigidbody. The collision detection of both objects is continuous dynamic and works for both other rigidbody objects and the object with the character controller.

I've tried not using a kinematic rigidbody for the ship but when it gets hitted by projectiles (with rigidbody) it moves and starts spinning around.

So my questions here would be:

Should I use a rigidbody for the NPC ship or use a character controller?
There is any way to prevent a rigidbody from move after collision of other rigidbody, besides making it kinematic?
How can I move a kinematic rigidbody so it doesen't go through other kinematic rigidbodies?

Thanks for your help!


texts: Libgdx - How to change GestureListener pan finger sensibility?

texts:
I implemented GestureListener in my Overlap2dStage to pan the camera when the player drags its finger over the screen. But I also have some actors that extend InputAdapter to detect when the user touches on them. Then I mix them with a InputMultiplexer.

So far it's working fine on my computer, but when I get into Android and tap an object it trigers  both: pan() from stage and touchDown() from the actor.

I remember I read something about a pan box to decrease the sensibility, since in a touch screen you are touching several pixels, it detectes a pan. It's worst in smaller screens.


texts: Unreal virtual function causing unresolved external error

texts:
I'm making a base gun cpp class that just has the stuff all the other guns will have.  I have a virtual function called PullTrigger that doesn't do anything, I just want to have it on the base gun so i can implement it on the derived classes without recreating it.  in my header file under private, I have this code
virtual void PullTrigger();

I tried adding override after the parantheses, but it gave me an error.  As is, VS is uncomplaining, but Unreal says the function has an "Unresolved external symbol".  I have no clue what that is.  How do i fix this?


texts: Transition from UIView to CCScene in Cocos2D

texts:
I've surfed the internet for quite some time but haven't come to find an answer.
Any help would be greatly appreciated.
I am trying to perform a transition from a UIView to a CCScene
So i have a class which is connected to a .xib file.
I am able to present that scene using

  [[CCDirector sharedDirector]replaceScene:[LevelSelect scene]
  withTransition:[CCTransition transitionCrossFadeWithDuration:1]];

But when i try to change to a CCScene which does not have a .xib file, it doesn't perform the transition, but plays the audio that is present in the next scene.

  [[CCDirector sharedDirector]replaceScene:[Play
  sceneWithDifficulty:1]];

Thanks.


texts: How do I make magenta in my PNG transparent in HTML5/Canvas/JS?

texts:
I'm putting together a simple hex map to use within an HTML5 / Canvas / JS game and before I get round to sorting any custom graphics, I was wondering if anybody knew how to make the pink/magenta backgrounds transparent so that I can overlap my tiles?

Cheers!


texts: How can I manage an animated UI from ActionScript?

texts:
I'm trying to code a game of Poker in AS3, using Flash Professional CS5 (although I try to keep as little code as possible in the .fla).

When a player bets, for example, I need to be able to show an animation of some chips sliding into the center of the screen. After that happens, the AI decides what to do, and another animation of their chips occurs. Then a menu pops up so the player can choose their own next action. And so on.

I started writing a UIBet interface with bet(amount) and raise(amount) methods and so on, that you would implement with a class extending MovieClip and fill in the methods with gotoAndPlays to various animations. But if I just have code that calls these graphics object like so:

playerUIBet.bet()
aiUIBet.bet()
menu.prompt()

Then, if I understand Flash correctly, what'll happen is that the code will finish executing, and then all of those animations will happen simultaneously.

How can I get these animations to happen sequentially? What if I want to insert pauses between them? Some kind of solution like this? What's the best way to do this in AS3?


texts: How to fire a touch event only for the touched sprite?

texts:
I have a set of sprites, each one implementing InputProcessor, and registered to an InputMultiplexer, when a sprite is touched, everyone fires the touchDown event.

Ok, so I can get the touch coordinates, unproject, and compare with the sprite bounds to know if it was touched, but it wasn't what I had in mind when I implemented InputProcessor into my sprites, I thought only the touched one would fire.

Don't even know if it is a problem, I'm planning to have about 80 sprites reacting to touch. Is this the best solution?

Is there a way to fire an event only for the touched sprite?

I'm not using scene2d or actors.


texts:
I am trying to develop a stronger AI for the popular game, Zatacka.
The basic aim of the game is to survive the longest. It's like the TRON game, but the characters can only turn smoothly, instead of 90 degree turns.

I am new to game AI. I have the following ideas in mind, but I don't know how they can be implemented.

Collision prediction. If another player is about to come into the same area, then the player should turn around and try to evade.
Hole taking capability. How to detect holes. How to distinguish holes from a normal empty area.
Early detection of a dead end and being able to turn around before its too late. The problem with this how do we determine a dead end, it could be a bit far than our current position. Doing a path finding algorithm and searching for the wall or a player's body might not be efficient enough as this has to be done for each steps.

Are there any standard algorithms for these problems? Can somebody throw some light on how I can approach these problems?


texts: Calculate angular velocity from rotation matrix difference

texts:
I am working on something for a game. I need to calculate the angular velocity, however in my situation I only have access to the previous rotation matrix and the current rotation matrix (and some other variables like dt or age of the object).
My angular velocity is hereby constant between t0 and t1.
The normal formula for the angular velocity W(t) = dR(t)/dt * R(t)^-1 can't be used here, since I have discrete values. Is there a possibility to calculate the angular velocity between timestep t0 and t1 with the given R0 and R1 rotation matrix of an object?
I am not very advanced with matrix math, so please go easy on me.


texts: What are the different attributes of a vertex array object (VAO)?

texts:
What are the 16 attributes of a VAO?
0. vertex position
1. vertex colours
2. normal vector
3. texture coords
4. ???
5. ???
6. ???
7. ???
8. ???
9. ???
10. ???
11. ???
12. ???
13. ???
14. ???
15. ???


texts: Changing Box2D Body from Kinematic to Dynamic after contact

texts:
What is the correct way to change a Kinematic body into a dynamic body?

context - I have a dynamic body as a projectile which has to be fired at a kinematic body (it is kinematic because i am tweening it around the world in random movements). when the projectile makes contact with the kinematic body I would like it to become a dynamic body and be affected by gravity and I will apply a force to the contact point.

At the moment I am simply changing the type with in a menthod called by the contactListener

body.setType(BodyType.DynamicBody);

my biggest issue is that gravity is not acting on the body once it is changed to dynamic, so I'm pretty certain I'm going about this the wrong way.


texts:
I am making a game in which a cube travels along a maze with the motive of crossing the maze safely. I have two problems in this.

The cube needs to have a smooth movement like it is traveling on a frictionless surface. So could someone help me achieve this. I need to have this done in a event callback function
I need to move the camera along with the cube. So could someone advice me a good tutorial about camera positions along with an object?


texts: How do I use _com_ptr_t with RenderTargetView and DepthStencilView?

texts:
I have successfully used _com_ptr_t with the ID3D11Device and IDXGISwapChain but when applying the same reasoning to the RenderTargetView and DepthStencilView, the function m_spD3DImmediateContext->OMSetRenderTargets(...) sets the m_spRenderTargetView smart COM pointer to null! Then, subsequent draw calls fail on ClearRenderTargetView and ClearDepthStencilView.

Is it because I am passing the smart pointer incorrectly?

HR(m_spD3DDevice->CreateRenderTargetView(pBackBuffer, 0, &m_spRenderTargetView));
...
HR(m_spD3DDevice->CreateTexture2D(&stDepthStencilDesc, 0, &m_spDepthStencilBuffer));
...
m_spD3DImmediateContext->OMSetRenderTargets(1, &m_spRenderTargetView, m_spDepthStencilView);
assert(m_spRenderTargetView); // <=== FAIL

I think the smart pointer overloads the operator& so that it returns an Interface** (see Extractors in _com_ptr_t class).


texts:
I am tired of typing  "cd c:\socket\nodejs"
                      "node testserver.js"

Into the command promt..

How do I create a shortcut or bat for it?


texts: Transitioning Heightmaps Using Voronoi Cells

texts:
I'm partitioning a procedurally generated world into regions using voronoi noise. The goal is to create individual regions in a world each unique from each other. Each region has a distinct set of properties, one of which is having a procedurally generated heightmap.
The issue I am having is transitioning from one region's heightmap to another. Each region's heightmap  is composed of multiple 'layers' of simplex fractal noise. Because the regions are using voronoi cells, and each region has its own distinct heightmap, they do not smoothly transition into each other.
Any guidance on how to solve this issue would be greatly appreciated!


texts: realtime multiplayer game database design

texts:
I'm creating a real time client/server game, where each match is a 1v1. I'm a little lost as how to implement this. I want it to be viable for 1,000 simultaneous matches, but as I'm expecting around 100 db entries per match (I need to log players' past states), that would be a 100k row table.

I don't know if I should use an RDBMS that indexes the table by match ID, and if that would be fast enough.

I'm also contemplating using plain files with my own extension for each match, but that would be 1,000 of them on my machine, and I don't know if that would be too slow.

If anyone has any suggestions on how I can implement this, I'd really appreciate it.


texts: Java, spawn algorithm that gets harder each level

texts:
I am currently in the process of making my 3rd Java game (everything I have learned is from YouTube videos, so I may be doing some things wrong) named "Blocked". But I have run into a problem: how do I make an algorithm that gets progressively harder each "level". but first let me briefly explain the game, so you are a small human and blocks are falling from the sky, and you try to avoid them, there are 5 types of blocks: Basic, fast, shop, killer, safe. So I want my game to start with very few (basic only) tiles to fall, while the game is going (infinitely) I want it to get harder but not just unlocking new blocks, but also changing the frequency the more difficult blocks spawn (up to a certain threshold of course).

P.s. pseudo code is fine by me.
P.s. (2) if you need any clarifications ask me!


texts: Client-side prediction and interpolation

texts:
Although my game uses a peer-to-peer model, I've still taken the approach of assigning each player to be a partial authority.  What I mean by this is that each player acts as the "server" for a number of objects, and all the other players are "clients" for those objects.

It also uses a fixed update interval and variable render interval.  I'm considering a 50Hz update frequency, so the rendered time lags behind the current time by 20ms in order to guarantee two states to interpolate between.

When a client recieves authoritative state information from the server, it comes with the timestamp of when it was sent.  Because all the players use a synchronized clock, the client can correctly place the state along its "update timeline", the state history of which is stored for up to 100ms back.

However, in order to hide latency, each client also predicts the behaviour of all objects in the vicinity, regardless of whether or not they are the authority.

The difficulty I'm having is figuring out how to correct errors on the client side and stay synchronized with the server state, when server information for a specific object will be coming far less often than updates happen.  What is a good way to smoothly correct current information with information from the past after several prediction steps have been done on estimated information?


texts: Game networking, limiting amount of movement packets

texts:
I have been developing a server/client model for a game project I am working on. Everything works great, client side prediction works, server reconciliation works. Basically, the character can move smoothly without any hiccups.

However, the problem is that I am currently not using frame independent movement, it doesn't rely on the elapsed time between updates. Every time a movement packet is received, it will move the character x amounts of pixels. The packets are gathered on the client with a certain rate.

If someone were to modify the rate so that it would gather it faster, that means it would send more packets and make it move faster. Essentially, they would be speed hacking.

How would I go about preventing this behavior. If I try to add frame independent movement, server reconciliation doesn't work any longer since it doesn't know how much to move it after the server correction was received.
Is the best way to just limit how many movement packets that can be received server side per second?

I have been reading the source networking article, but they do not mention anything about this as far as I can see.

By the way, when I send these packets, I do not send them as they are gathered, rather I send them bunched together at another rate, to reduce bandwidth.

Edit: I think I was a little bit unclear about my packets. My packets contain user commands that holds the current state of the keyboard, mouse and whatever else is collected. The server receives the packet, which can hold MORE THAN 1 user command, as it sends the pakcets at a slower rate than the commands are collected. This is exactly what is described in the source networking article. The server receives the packet and handles ALL user commands as soon as it is received, thus if the packet contains a lot of user commands (the client modified the rate of which it collects them, or duplicated them) the server will move it more than intended. Modifying how often it sends the packets doesn't matter, but the gathering of the user commands does.

Let's say the server sends the packets every 100ms, and collects the commands every 50ms. That means every packet will hold 2 user commands. But if someone modifies the collection rate to, say every 10ms. Every packet will contain 10 user commands which would move the character further since the server moves it for every user command.


texts: Is there a tool to batch resize images to nearest power of two, on a specific side?

texts:
For example, i have multiple images with similar properties like width = 66 and height = 62, i would need the resulting image to be 64x60, keeping its ratio. is there any Gimp plugin example, or a simple and fast to use tool that already does this?

My main problem is that the art department guys sometimes save hundreds of textures with the wrong resolution, for example, 1025x1025, which occupy 4 times as much memory as a 1024x1024 image, or or 560x520, which could be scaled down to not use too much memory. I know they should be the ones doing the resizing but at this point, but i would like to quickly correct the error for the sake of the whole team.

I am using Corona SDK, and using OSX Mavericks. A relevant document about image optimization on Corona can be found here. (Nothing we do not know about, basically power of two stuff.)

I have tried ImageMagick before, but right now i already started building my own gimp plugin thanks to the examples provided below, have done 1 gimp plugin before but this will be a new challenge.


texts: How can I mod an item to take experience from a player in Minecraft?

texts:
I am creating a mod that has invincible tools which take experience from the player each time they are used.

Can someone please tell me how to make the tools take away the experience when used?


texts: How can I export models from 3DX Max into XNA?

texts:
I am looking for a way to import my 3D models (including materials and shaders) from 3D Studio Max to XNA.

For example, if I have a model with diffuse, bump, reflection textures and values (through Max's basic shader), I want to be able to present it in real-time using the XNA framework.

I thought about doing it like this:

3D Studio Max -> ASCII FBX export.
Parse FBX and extract bump/reflection/et cetera textures.
Set up a custom HLSL shader and pass the relevant parameters to it.

Is this the correct way to do it?


texts: Unity 2D detect if swipe goes through an object

texts:
I am developing a game in unity with flying arrows that the user tries to deflect by swiping through them (changing their direction). I can get the arrows to move with the swipes, but they move no matter where the swipes occur. I want them to only move (be affected) iff the swipe goes through the arrow. Here's what I have so far:

public class swipe : MonoBehaviour
{

private Vector2 leftFingerPos = Vector2.zero;
private Vector2 leftFingerLastPos = Vector2.zero;
private Vector2 leftFingerMovedBy = Vector2.zero;

public float slideMagnitudeX = 0.0f;
public float slideMagnitudeY = 0.0f;

bool touched = false;

void Update()
{
    if (Input.touchCount == 1)
    {
        Touch touch = Input.GetTouch(0);

        if (touch.phase == TouchPhase.Began)
        {
            leftFingerPos = Vector2.zero;
            leftFingerLastPos = Vector2.zero;
            leftFingerMovedBy = Vector2.zero;

            slideMagnitudeX = 0;
            slideMagnitudeY = 0;

            // record start position
            leftFingerPos = touch.position;

        }

        else if (touch.phase == TouchPhase.Moved)
        {
            leftFingerMovedBy = touch.position - leftFingerPos; // or Touch.deltaPosition : Vector2
            // The position delta since last change.
            leftFingerLastPos = leftFingerPos;
            leftFingerPos = touch.position;

            // slide horz
            slideMagnitudeX = leftFingerMovedBy.x / Screen.width;

            // slide vert
            slideMagnitudeY = leftFingerMovedBy.y / Screen.height;

            if(touched)
            {
                //rigidbody2D.velocity = new Vector2(slideMagnitudeX, slideMagnitudeY)*20;
                rigidbody2D.AddForce(new Vector2(slideMagnitudeX, slideMagnitudeY)*5000);
                touched = false;
            }
        }

        else if (touch.phase == TouchPhase.Stationary)
        {
            leftFingerLastPos = leftFingerPos;
            leftFingerPos = touch.position;

            slideMagnitudeX = 0.0f;
            slideMagnitudeY = 0.0f;
        }

        else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled)
        {
            slideMagnitudeX = 0.0f;
            slideMagnitudeY = 0.0f;
        }
    }

}

void OnMouseEnter()
{
    touched = true;
}
}

The only way I have been able to find so far is using "onMouseEnter" which only works for very slow swipes.

How do I detect whether a swipe goes through an object?


texts: Unity and the problem with calling functions from other scripts

texts:
I'm not sure how everyone handles this, but I'm running into lots of instances where I want to call a nonstatic script from another script which forces me to add the nonstatic script to the gameobject that also handles the other script. Such as, I would have two classes in different scripts:

public class Example1:MonoBehaviour{
public void someMethod(){
}
}

    public class Example2:MonoBehaviour{
public void anotherMethod(){
}
}

if I wanted to call anotherMethod from someMethod, I would need to do this:

   public class Example1:MonoBehaviour{
    private Example2 exampleTwo;

void Awake(){
exampleTwo = gameObject.AddComponent<Example2>();
}
        public void someMethod(){
exampleTwo.anotherMethod();
        }
        }

Is this really how everyone is working? It just seems extremely long and complicated, making me attach a whole bunch of scripts to one gameobject at runtime, and then I run into a whole bunch of issues with multiple copies of each script (such as with mousedown functions or input functions).


texts: Random Spawning Traffic at Pace Fitting "Frogger"-style Gameplay

texts:
In my game level, you have to cross a busy road to buy something and then cross back again. The general gameplay mechanics are now set up and playable. But I wanted to know if this routine I used to randomly spawn the cars can be improved upon.

So far, I simply set the percentage chance of it spawning a car that frame (I have 0.01f for now), and only call the spawnCar() method when my random number 0-1 is less than that chance. Like so:
private void Update()
    {
        if (Random.Range(0f, 1f) < 0.01f)
            SpawnCar();

    }

    void SpawnCar()
    {
        Color color = new Color(Random.Range(0,2), Random.Range(0, 2), Random.Range(0, 2), 1);
        if (Random.Range(0, 2) == 0)
        {

            Car car = Instantiate(carPrefab, new Vector3(SPAWN_POSITION_X, 0, Random.Range(1, LANE_WIDTH)), Quaternion.Euler(0, -90, 0));
            car.InitCar(true, Random.Range(8,15), color);

        }
        else
        {
            Car car = Instantiate(carPrefab, new Vector3(-SPAWN_POSITION_X, 0, -Random.Range(1, LANE_WIDTH)), Quaternion.Euler(0, 90, 0));
            car.InitCar(false, Random.Range(8, 15), color);
        }
    }

But sometimes there are lots of cars, sometimes not so many. I am wondering if there are better ways, or other factors I can account for when spawning the cars to give a better difficulty curve. (The level is constantly revisited so ideally it will get harder and harder perhaps 10 or so times until it's at 'max difficulty')


texts: Raycast only specific layer and ignore other collider

texts:
I am willing to raycast specific layer and ignore other layers no matters its colider is above to my navPoint layer object?

 int specificLayerMask = LayerMask.GetMask("NavPoint");//raycast only this layer ignore others

        if (Physics.Raycast(raycastObject.transform.position, fwd, out objectHit, specificLayerMask))//50
        {}

the above code raycasting to navpoint layer but unable to bypass other layers colliders. is there any way available to ignore all other collider and raycast to desired layer only no matter colliders are behind any other collider


texts:
I've started messing around with Game Maker Studio. The problem I'm having is trying to get a gravity code for orbiting.

Here's how i did it in XNA

        foreach (GravItem Item in StarSystem.ActiveItems.OfType<GravItem>())
        {
            if (this != Item)
            {
                Velocity += (10 * Vector2.Normalize(Item.Position - this.Position *
                    (this.Mass * Item.Mass) / (Vector2.DistanceSquared(this.Position,
                    Item.Position)) / (this.Mass));
            }
        }

Simple and works well, things or bit and everything is nice.

but in Game maker i don't have the luxury of Vector2's or a For-each loop to loop threw all the objects that have a
mass. I've tried a few different things but nothing seems to work

distance = distance_to_object(obj_moon);

//--Gravity
hspeed += (0.5 * (distance) * (Mass * obj_moon.Mass) / (sqr(distance)) / Mass)
vspeed += (0.5 * (distance) * (Mass * obj_moon.Mass) / (sqr(distance)) / Mass)

thanks for the help


texts: How can I refactor an enum so that it is still available in the inspector?

texts:
I am trying to use an enum so that it is available in the inspector. This code works:

public ArmorTypeEnum ArmorType;
public enum ArmorTypeEnum { Light, Medium, Heavy };

How can refactor it into a single line?

How can I make ArmorTypeEnum private while keeping ArmorType public?


texts: Licence to use RPG systems like Pathfinder

texts:
I am sketching out my 2012 programming project, and Im planning to make a classic fantasy RPG game.

The world design, plots, characters and all that I can make, but being a avid tabletop role-player, I would love to use a stable and tested rpg system like Pathfinder, since its balanced and interesting.

Would there be a problem if I make a game (indie dev, but still planning on selling it) using the pathfinder license ? Do I have to purchase a license? And would I able to say that it's based on the Pathfinder ruleset, or should i keep that under wraps.

All big official D&D games boast with that they are official, so doesn't this mean that unofficial games can exist too ?

It's not because I wan't to jump the lowest fence, and all storylines and the game setting will be by my own hand. But I love the Pathfinder system and actually think it could use some publicity as well.

Was considering posting this on the rpg board, but this is a game dev issue in my eyes.


texts: Unity, Cannot change a single Vector2 element of mesh.uv?

texts:
I have a simple procedurally generated mesh, with uvs that tile correctly

for(int i=1; i<vertices; i++) {
    uv[i] =  new Vector2(x,z);  //pseudocode
}
mesh.uv = uv;

This works fine. However if I later attempt to change one of the mesh.uv entries

for(<loop over four nodes on tile>) {
    Debug.Log("before: " + mesh.uv[vertex_index].ToString()); // print before

    mesh.uv[vertex_index] =  new Vector2(new_x,new_y);

    Debug.Log("after: " + mesh.uv[vertex_index].ToString()); // print after
}

I get no change in mesh.uv.

What am I missing about unity mesh storage? This works fine for a simple array of Vector2:

Vector2[] v2 = {Vector2.one, Vector2.one};
for (int j = 0; j < 2; j++) {
    Debug.Log(v2[j]);
    v2[j] = new Vector2(2,3);
    Debug.Log(v2[j]);
    }

EDIT:
I can make a successful uv-change by making a copy of the mesh.uv, changing the Vector2 values in the copy and then assigning mesh.uv = copy.

Vector2[] uvCopy = mesh.uv;
for(changed vertices) {
    uvCopy[vertex_index] = new Vector2(new_x, new_y);
}
mesh.uv = uvCopy;

I still would like to know what was wrong with my original approach, if anyone has any ideas.


texts: So, I've read a lot about using FSMs to do game state management, things like what an FSM is, and using a stack or set of states for building one. I've gone through all that. But I'm stuck at writing an actual, well-designed implementation of an FSM for that purpose. Specifically, how does one cleanly resolve the problem of transitioning between states, (how) should a state be able to use data from other states, and so on. Does anyone have any tips on designing and writing a implementation in C++, or better yet, code examples?


texts: why does my objects only spawn once or really slowly?

texts:
public GameObject fallingRockPrefab;
public Vector2 spawnsMinMax;
float randX;
float randY;
void Update()
{
    if (Time.time > nextSpawnTime)
    {
        float SpawningInBetween = Mathf.Lerp(spawnsMinMax.y, spawnsMinMax.x, Difficulty.GetDifficultyPercent());
        print(SpawningInBetween);
        nextSpawnTime = Time.time + SpawningInBetween;

        randX = Random.Range(-5.6f, 5.6f);
        randY = 5.57f;
        SpawnPosition = new Vector2(randX, randY);
        Instantiate(fallingRockPrefab, SpawnPosition, Quaternion.identity);

    }

}

I set the "spawnsMinMax" over at the inspector in Unity as high as I can like (25 or 30 etc) but it still spawns once or like 1 or 2 per second. Even I set the number as low it can go, it still spawn in the same way. How do I fix this?


texts: How to do simultaneous action without it being real time?

texts:
This is really a pacing question, but there's no tag for that:

The general concept is that the players are working in a team and need to be able to react to eachother's movement and observations as they happen(not being turn based) without the game having to be played at a real time pace.

This question and it's answers offer some insight: Turn-based strategy games where action happens in real-time? But I'd like to implement it so players can change their queued actions on the bases of realtime stimulus.

Right now my thought is to use an action queueing system in which the players can state a series of actions they intend to take and actions are played out simultaneously until one player runs out of queued actions or certain triggers offer a brief "change your queue" period.  It seems like it would be clunky and leave players waiting a lot of the time.

Any bright ideas to make this possible while still enjoyable?


texts: Question about creating a sprite based 2-D Side Scroller with scaling/zooming

texts:
I'm just wondering if anyone can offer any advice on how best to go about creating a 2-D game with zooming/scaling features akin to the early Samurai Showdown games. In this case it would be a side scroller a la Metal Slug, the zooming would come in as more enemy sprites entered the screen, or when facing a large sized boss. A feature that would be both cosmetic as well as functional to the game.

I've done some reading and noticed a few suggestions that included drawing different sized sprites, a standard size and zoomed out size.

Any thoughts?

Thanks for your time.


texts:
I need ScrollRect, but at startup I don't know how many elements it should keep. Moreover this elements should be kept in categories that can fold/unfold.

The problem is that height of content doesn't updates after folding/unfolding. This worked in Unity 5 with ContentSizeFitter in content and each category, but this doesn't work with Unity 2017.

Items are added at runtime with instantiating from prefab in a certain category.

Is there any solutions without additional scripting?

EDIT

Additional screenshots

When unfolded can't scroll anything because content size is too small

This is script part for instantiating items inside categories.


texts:
Using XNA, is it possible to access the GameTime object before Update is called for the first time?

Can it be used in the game constructor, Initialize or LoadContent methods?


texts:
I have a top down billiard game. And on click / tap the ball moves in the clicked direction like in the image below:

Now, I want a line to be drawn in the direction where the mouse is hovers or the finger is swiped, here is my update code:

void Update () {

        //this should make the line, why not working?
Vector3 forward = transform.forward;
Debug.DrawRay(transform.position, forward);
Debug.DrawLine(transform.position, transform.position + forward * 10000);

        if (Input.GetMouseButtonDown (0)) {

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

            if (Physics.Raycast(ray, out hit, 100.0f)){

                //

                //
                Vector3 startPos = transform.position;
                Vector3 clickPos = new Vector3(hit.point.x, hit.point.y, transform.position.z);
                Vector3 direction = Direction (clickPos - startPos);

                //direction
                rb.velocity = new Vector3(direction.x * 5, direction.y * 5, 0);

            }

        }

    }

I tried DrawLine, Drawray, any ideas?


texts: Version control for game development - issues and solutions?

texts:
There are a lot of version control systems available, including open-source ones such as Subversion, Git, and Mercurial, plus commercial ones such as Perforce.

How well do they support the process of game-development? What are the issues using VCS, with regard to non-text files (binary files), large projects, et cetera? What are solutions to these problems, if any?

For organization of answers, let's try on a per-package basis. Update each package/answer with your results.

Also, please list some brief details in your answer, about whether your VCS is free or commercial, distributed versus centralized, etc.

Update: Found a nice article comparing two of the VCS below - apparently, Git is MacGyver and Mercurial is Bond. Well, I'm glad that's settled... And the author has a nice quote at the end:

  It’s OK to proselytize to those who
  have not switched to a distributed VCS
  yet, but trying to convert a Git user
  to Mercurial (or vice-versa) is a
  waste of everyone’s time and energy.

Especially since Git and Mercurial's real enemy is Subversion. Dang, it's a code-eat-code world out there in FOSS-land...


texts: How to create an extensible rope in Box2D?

texts:
Let's say I'm trying to create a ninja lowering himself down a rope, or pulling himself back up, all whilst he might be swinging from side to side or hit by objects. Basically like http://ninja.frozenfractal.com/ but with Box2D instead of hacky JavaScript.

Ideally I would like to use a rope joint in Box2D that allows me to change the length after construction. The standard Box2D RopeJoint doesn't offer that functionality.

I've considered a PulleyJoint, connecting the other end of the "pulley" to an invisible kinematic body that I can control to change the length, but PulleyJoint is more like a rod than a rope: it constrains maximum length, but unlike RopeJoint it constrains the minimum as well.

Re-creating a RopeJoint every frame using a new length is rather inefficient, and I'm not even sure it would work properly in the simulation.

I could create a "chain" of bodies connected by RotationJoints but that is also less efficient, and less robust. I also wouldn't be able to change the length arbitrarily, but only by adding and removing a whole number of links, and it's not obvious how I would connect the remainder without violating existing joints.

This sounds like something that should be straightforward to do. Am I overlooking something?

Update: I don't care whether the rope is "deformable", i.e. whether it actually behaves like a rope, or whether it collides with other geometry. Just a straight rope will do. I can do graphical gimmicks while rendering; they don't need to exist inside the physics engine. I just want something a RopeJoint whose length I can change at will.


texts:
My graphics card is a UHD 620 from intel and it says that it has 24 texture units (as far as I know).
Using SDL2 creating and loading 25+ texture works fine, so am I not understanding what the max texture unit actually means? If I were to launch a program that uses more than 24 texture units would it crash if I tried to draw them all at the same time or would it just be really slow having to cycle between then in the shader program?


texts:
I have a quadtree implementation that works well with what I need for handling collisions between enemies, projectiles, and heroes.

However, most of these types of entities are pointbased, with varying radius but that's about it.

I have a weapon idea for lazer or ray weapon that's essentially a line.  How does something like that fit in to working with something like a quadtree?  Normally when we have a quadtree, we are essentially letting that data structure handle point masses to figure out which subset of objects we need.  How then might we handle something like a line?

The dumb way to do it is to just query the enemies and do something like a circle line intersection test on all the enemy objects.  This is obviously not efficient especially when we already have a quadtree.

One idea i have are to just put some dummy projectile object along the line and submit those to the quadtree.  Then if we get any returned objects from those dummies, then we can use the circle line intersection test on it.

Any ideas pertaining to how to use ray weapon that requires some line intersection test with a quadtree would be appreciated.  Thanks.


texts: Multiplayer game server headerless (Unreal/Unity) vs Custom Maps

texts:
I've been pondering about different approaches that a multiplayer game server can be managed and programmed.

For instance some of the big engines like UE4 & Unity provide a 'build' flag that can enable them to run headless meaning it'll just be the calculations that are enabled for that mode and will handle a ton of the game state sync, object references, hit detection, cool downs etc..But what I'm wondering is if this is the best approach? From my current understanding for each game running there would need to be a new instance of the headless game.exe running that will then create new connections for users into the game, sync up the players and start. This sounds very resource heavy (I might be overthinking it).

EDIT:
In the case of custom game server what would be a good approach into integrating the map data so that UE4 client map can be simulated on the back-end?

I can think of a simple solution looking at it from a 2D prospective, since it's just X,Y we can create a bitmap/grid of position that are available, where walls are etc via simple tile tools that can be easily mapped 1:1 to the client and use that information. However when it comes to 3D I don't see a solution on how to have a 3D map, collision detection and physics simulation.


texts: Unity - Joint tearing under larger force

texts:
I have a chain that is made of connected configurable joints. I used ultimate rope builder for the rope chain creating.

The problem is that when i apply a larger force to the chain, it starts to tear and chain links starts to flicker and move chaotically.

Video available here:
https://youtu.be/zGOgk4Ictt0

What could be causing such a behavior ?


texts:
I have the following code:

public GameObject characterButtonPrefab;
public GameObject characterButtonContainer;
public GameObject optionsContainer;

public GameObject[] charButtons;
private int charButtonsIndex = 0;
private Text[] cBT;
private string[] buttonTexts = new string[] {"Strength 5", "Agility 5", "Intelligence 5", "Charisma 5", "Diplomacy 5" };

private void Start()
{
    LevelIsOver = false;
    IsNextWave = false;
    //Time.timeScale = 1;

    for (int i = 0; i < charButtons.Length; i++)
    {
        int size = charButtons.Length;
        cBT = new Text[size];
        GameObject container = (GameObject)Instantiate(characterButtonPrefab);
        container.transform.SetParent(characterButtonContainer.transform, false);
        cBT[i] = characterButtonPrefab.transform.FindChild("Text").GetComponent<Text>();
        cBT[i].text = buttonTexts[Random.Range(0, buttonTexts.Length)];
        charButtonsIndex++;
    }

    //if (charButtons.Length > 0)
    //{
    //    GameObject currentChar = (GameObject)Instantiate(characterButtonPrefab);
    //    currentChar.transform.SetParent(optionsContainer.transform, false);
    //    currentChar.transform.SetSiblingIndex(0);
    //    currentChar.GetComponent<Button>().onClick.AddListener(() => CharacterSelection());
    //}
}

I declared the size of array to 20 in the inspector and everything work fine. The buttons are created and text changed.
The question is how do I duplicate the first button in that array to another panel ? I have searched the internet  but nothing found about this.

I have tried this:

GameObject currentChar = (GameObject)Instantiate(charButtons[0]);
     currentChar.transform.SetParent(optionsContainer.transform, false);
     currentChar.transform.SetSiblingIndex(0);
     currentChar.GetComponent<Button>().onClick.AddListener(() => CharacterSelection());
 }

But I get ArgumentException: The Object you want to instantiate is null.


texts:
So Update is called every frame while FixedUpdate is called on Physics time, which can be modified.

Is it better to depend on FixedUpdate to have optimized game loop so that everything doesn't get called so much.
OR
Is it better to write a coroutine to Update/FixedUpdate and set things there?

public void Start(){
   StartCoroutine(MyIntervalMethod());
}

 void MyIntervalMethod(){
   for(;;){
   yield return new WaitForSeconds(.2f/*or whatever time interval is suitable here*/);
   }
}


texts:
I'm trying to figure out how to render my scene to a cube map. I've been stuck on this for a bit and figured I would ask you guys for some help. I'm new to OpenGL and this is the first time I'm using a FBO.

I currently have a working example of using a cubemap bmp file, and the samplerCube sample type in the fragment shader is attached to GL_TEXTURE1. I'm not changing the shader code at all. I'm just changing the fact that I wont be calling the function that was loading the cubemap bmp file and trying to use the below code to render to a cubemap.

You can see below that I'm also attaching the texture again to GL_TEXTURE1. This is so when I set the uniform:

glUniform1i(getUniLoc(myProg, "Cubemap"), 1);

it can access it in my fragment shader via uniform samplerCube Cubemap.

I'm calling the below function like so:

cubeMapTexture = renderToCubeMap(150, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE);

Now, I realize in the draw loop below that I'm not changing the view direction to look down the +x, -x, +y, -y, +z, -z axis. I really was just wanting to see something working first before implemented that. I figured I should at least see something on my object the way the code is now.

I'm not seeing anything, just straight black. I've made my background white still the object is black. I've removed lighting, and coloring to just sample the cubemap texture and still black.

I'm thinking the problem might be the format types when setting my texture which is GL_RGB8, GL_RGBA but I've also tried:

GL_RGBA, GL_RGBA
GL_RGB, GL_RGB

I thought this would be standard since we are rendering to a texture attached to a framebuffer, but I've seen different examples that use different enum values.

I've also tried binding the cube map texture in every draw call that I'm wanting to use the cube map:

glBindTexture(GL_TEXTURE_CUBE_MAP, cubeMapTexture);

Also, I'm not creating a depth buffer for the FBO which I saw in most examples, because I'm only wanting the color buffer for my cube map. I actually added one to see if that was the problem and still got the same results. I could of fudged that up when I tried.

Any help that can point me in the right direction would be appreciated.

GLuint renderToCubeMap(int size, GLenum InternalFormat, GLenum Format, GLenum Type)
    {

    // color cube map
    GLuint textureObject;
    int face;
    GLenum status;

    //glEnable(GL_TEXTURE_2D);
    glActiveTexture(GL_TEXTURE1);
    glGenTextures(1, &textureObject);
    glBindTexture(GL_TEXTURE_CUBE_MAP, textureObject);
    glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);

    for (face = 0; face < 6; face++) {
        glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, InternalFormat, size, size, 0, Format, Type, NULL);
    }

    // framebuffer object
    glGenFramebuffers(1, &fbo);
    glBindFramebuffer(GL_FRAMEBUFFER, fbo);

    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X, textureObject, 0);

    status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
    printf("%d\"\n", status);
        printf("%d\n", GL_FRAMEBUFFER_COMPLETE);

    glViewport(0,0,size, size);

    for (face = 1; face < 6; face++) {

        drawSpheres();
        glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, textureObject, 0);

    }

     //Bind 0, which means render to back buffer, as a result, fb is unbound
       glBindFramebuffer(GL_FRAMEBUFFER, 0);

       return textureObject;
    }


texts: Find out which way to rotate based on current rotation and final rotation

texts:
I have one object that I want to rotate to a certain angle with 'smooth' rotation.
I looked up  on how to solve that and I came up with this: enter image description here

But how do I know in what way to rotate, positive or negative?
According the the picture on ex. 1, I need to rotate positively because it is the closest way for me to rotate. And on the second it is the negative way.
But how do I know this? I've tried several solutions but I can't seem to find anything that is correct.


texts:
I have had a problem with OpenGL where glOrthof is not being applied, leading to my frame having the default 1:1:1 ratio. Here is the code initializing it:

    public void reshape(GLAutoDrawable glAutoDrawable, int i, int i1, int i2, int i3) {
        GL2 gl=glAutoDrawable.getGL().getGL2();
        if(window.getWidth()!=screenWidth||window.getHeight()!=screenHeight)window.setSize(screenWidth,screenHeight);
        unitsTall=window.getHeight()/(window.getWidth()/unitsTall);
        gl.glMatrixMode(GL2.GL_PROJECTION);
        gl.glLoadIdentity();
        gl.glOrthof(0.0f, unitsWide, 0.0f, unitsTall, 0.0f, 1.0f);
        gl.glMatrixMode(GL2.GL_MODELVIEW);
    }

unitsWide is equal to 100. Here is the code for drawing the rectangle:

    public static void drawRect(float x,float y,float width,float height){
        GL2 gl=Render.getGL2();
        gl.glRotatef(-rotation,0,0,1);//Rotation needed to be reversed
        gl.glColor4f(red,green,blue,alpha);
        gl.glBegin(GL2.GL_QUADS);
        gl.glVertex2f(x,y);
        gl.glVertex2f(x+width,y);
        gl.glVertex2f(x+width,y+height);
        gl.glVertex2f(x,y+height);
        gl.glEnd();
        gl.glFlush();
        gl.glRotatef(rotation,0,0,1);
    }

The "Render" class is the class with all of the main methods for OpenGL. Here is the code that I used for drawing the rectangle:

Graphics.drawRect(0,0,0.5f,1);

Finally, here is a screenshot of what it looks like when this code executes:

I have looked around and have not found any other problems like this. Please tell me what I might be doing wrong.


texts:
before I started C++ I digged around in ActionScript3 for a while.
The first thing I've noticed is that you apparently have to call all your objects/game-characters individually and tell them to update() for example.

My first thought was to sort them into arrays/vectors and do for-loops for efficiency since I don't know about C++ events yet but I'm curious what you guys are doing!

Can you use Recursive functions inside the class to make it work independently?

Let's say I'd want to animate a tree with a spritesheet.
Would I have to call the tree's update() every frame or can I tell the object to get stuck in a Recursive loop and handle the animations itself?


texts: How to model multiple "uses" (e.g. weapon) for usable-inventory/object/items (e.g. katana) within a relational database

texts:
So I'm working on expanding the uses of items over at www.ninjawars.net, and I'm not exactly sure how to represent them flexibly in the relational database that we use.

I may be barking up the wrong tree, so feel free to make suggestions in other directions, but currently I'm thinking that each item should have relational "tags".

For example, a Katana is currently a row in the "items" database.  To make it into a weapon, and a holdable thing, I was thinking that I would have a database of "traits", and a item_traits table that simply linked between them.

// Objects and their basic data

item_id | item
1 | Naginata

// Things that objects can do

trait_id | trait
1 | weapon
2 | holdable

// How those objects do those things, e.g. powerfully, weakly, while on fire

_item_id | _trait_id | item_trait_data
1 | 1 | damage: 5, damage_type: sharp, whatever, etc

I'm not really sure how to model the extra data that results (e.g. the damage that a sword will do, the damage_type, etc).

I'm also not especially happy that the whole of an item would be stored in more than one place, e.g. in order to create a copy of an item with a different name, like a "short sword", I would have to copy from multiple tables to create the duplicate item.

Is there a better way to lay this stuff out that I'm missing?

Edit: I should just note that I've already got a postgresql database in use on the site, which is why I want to use it for my data storage.

Edit: I've added an answer for the implementation that I'm currently looking at.


texts:
I want to create a Lightning Effect Like http://www.youtube.com/watch?feature=player_embedded&v=mmU2GAYGVSU for my game.

The following blog explains it briefly but I am not able to understand the following line:

midPoint += Perpendicular(Normalize(endPoint-startPoint))*RandomFloat(-offsetAmount,offsetAmount);

UPD: I went through older question posted at gamedev.stackexchange and found following explanation:

Normalize(endPoint-startPoint):

That line gets a unit vector (vector of length 1) from startPoint to endPoint

Perpendicular(Normalize(endPoint-startPoint))

then gets a vector perpendicular to that (i.e. at right angles to the line)

I want to know  whether python has inbuilt function for

Getting a unit vector (vector of length 1) from startPoint to endPoint
Getting a vector perpendicular to that (i.e. at right angles to the line)


texts: Handmade Terrain vs. Terrain Engine in Unity?

texts:
I'm planning a game right now, to be made in Unity, and I'm trying to decide how I'll approach the basic level construction. Essentially, my game takes place on an island in an infinite ocean, very similar to Wuhu Island:

My question concerns all the stuff heightmaps can't handle. To use Wuhu Island as an example, note the lighthouse cliff, and the nearby similarly jutting-out cliff. The volcano itself is also empty, and there are some tunnels through it on the other side.

I was thinking I would just model the entire island myself in Cinema 4D, but as I read more about the terrain system, it seems Unity has special optimized rendering systems in place for terrain objects. Would I be shooting myself in the foot performance-wise if I just built my island entirely by hand? This will be for mobile, so the little stuff might well count. Am I even approaching this question correctly - if not, how would you best go about creating (something very close to) Wuhu Island as a level in Unity? Is there any reason for me to not do it as one mesh? I have effectively zero experience with 3D game dev - only rendered 3D video/stills for other applications, so this is a learning process.


texts: How to simulate or actually make your code wait for user input in response to events in turn-based games

texts:
I'm controlling the main loop with Game States like in pseudo code below:

loop{
      if (Not Game.WaitingForUserInput){

          if (Game.Started){
              StartTurn();
          }

          if (Turn Started){
              DoSomething();
          }
}

This works fine, until the inner workings of a method like "StartTurn()" or "DoSomething()" requires waiting for user input.

Also, Assume that calling "DoSomething()" triggers an event that is listened to by more than one object. Each object that handles the event requires user input to finish handling the event.
To illustrate:

DoSomething() ==> fires an event that is handled by 2 objects with methods that follow this pattern:

HandlingMethod()
{
    // some logic

    // Here we need to get a variable X that is determined through user input
    // like clicking a UI element. So, we need to wait (or simulate wait) until X is
    // determined.
}

This means when the first object starts handling the event, the 2nd object must wait until the first object has finished handling the event.

I tried tight loops inside these methods like:

...
while (X is unknown){
   // just loop and check X until user has clicked something
}
... X here will be known

However, this leads to the UI to hang and user will not be able to interact with the application.

By the way, I'm using a windows application (windows forms) for the UI.


texts: Trouble with Raylib install on Arch Linux

texts:
I am learning Raylib game library, but in the "First Person Maze" example the images cannot be found, for example:
`Image imMap = LoadImage("cubicmap.png");`

returns a File not Found by the compiler/linker, it´s the same with the other image. I am using CodeLite IDE, but I don't know how to add assets, right now I have them in a virtual folder named "resources".
Any help would be nice, I have googled the problem but I can't find anything. But now I don't know what's wrong because I have compiled the library with make and make install and also added Raylib package from Arch Linux and I can't even run the My first window example from the site.


texts: How can I use .txt or .xml reference file to slice up spritesheets in Lua?

texts:
I've been learning to code games in Lua, and I've recently started on my own project. I wanted to use the following spritesheet from Kenney.nl, as well as a few other spritesheets from them

but I'm a little confused as to how to cut it up. Some of the sprites are irregularly sized from the normal 70x70, and there's a 2px gap between each one, so my current understanding of how to generate quads from a spritesheet doesn't seem to apply
Thankfully, the spritesheets each come with an associated .txt or .xml file (it varies, not sure why) that gives the top left x/y coordinates, as well as the width and height of each sprite. This seems like it would make the job of creating a reference table of sprites really easy, but I can't figure out how to include something like
<SubTexture name="box.png" x="0" y="864" width="70" height="70"/>
<SubTexture name="boxAlt.png" x="0" y="792" width="70" height="70"/>
<SubTexture name="boxCoin.png" x="0" y="720" width="70" height="70"/>
<SubTexture name="boxCoinAlt.png" x="0" y="576" width="70" height="70"/>

or
fishSwim1 = 76 0 66 42
fishSwim2 = 73 43 62 43
flyDead = 143 0 59 33
flyFly1 = 0 32 72 36
flyFly2 = 0 0 75 31

as a reference file in my Lua code. Everything I've seen online has been guides on chopping up spritesheets with uniform width and height, or using some website or service to create a spritesheet/reference file, which I don't need to do (and I'd rather do as much as possible within my code)