texts: Developing a browser-based RPG: Loading user data

texts:
I'm writing a browser-based RPG in JavaScript, HTML5 with Canvas, EaselJS, etc... I'd like to develop the back end data saving/user profile aspect now.

This is a single player RPG where the player will interact with NPCs to solve quests. It is not online.

I've developed a website in PHP before where I saved my own data in a database, and loaded the images to the page via MySQL and PHP.

For a RPG, how would this process be? In my mind... I will try:

At the RPG menu, have a user login screen. Handle this with a traditional PHP session.
Once the user logs in, load their stats from the database.

What I'm confused about is:

Loading text data is okay I suppose... but how can I load objects that were on the screen in the correct locations at the time of the save? Can this be handled through the database?
I have generated the Players, Objects, and NPCs as Javascript objects using EaselJS. To save the state of these objects, do I have to load the character as a PHP object?

Kind of like:

/**
 * Load a character and all related items and skills.
 * Do this when the user logs in. You can save the data in a session or
 * reload it every time the user makes a new request
 */
$Character = Character::model()->with('items, skills')->find(
    'username:=username',
    array('username' => 'demo')
);

Any tips for loading appropriate data per user profile?

Thanks!


texts: OnCollisionEnter2D incorrect contact point?

texts:
I am trying to shoot a bullet (rigidbody2d, boxcollider2d) to another enemy object (rigidbody2d, kinematic, circlecollider2d). I want the collision point between these two. When they collide, i want a collision particle effect and from the contact point, i want to create 5 rock objects all moving in different directions. How should i achieve this? Problem is that, the contact point i get seems incorrect. Collision particle effect is created when collision happens but the rock objects are created in some other point close to the contact point but not the contact point. Also how to i move the rock objects in different directions after instantiating them?

my code:

void OnCollisionEnter2D(Collision2D coll)
{
    if (coll.gameObject.tag == "Enemy")
    {
        ContactPoint2D contact = coll.contacts[0];

        GameObject rock1 =  Instantiate (rock, contact.point, transform.rotation) as GameObject;
        rock1.rigidbody2D.velocity = transform.up * 20;
        GameObject rock2 =  Instantiate (rock, newPos, transform.rotation) as GameObject;
        rock2.rigidbody2D.velocity = transform.right * 20;
        Destroy(coll.gameObject);
        Destroy (gameObject);
        Instantiate (explosion, transform.position, Quaternion.identity);

    }
}


texts: How do I draw a zoomable image in OpenGL?

texts:
Up to now I have used glDrawPixels but since my image is a large geotiff one, I'm getting some horrible results for example:
this is the code used for zoom extent:

void COpenGLControl::ZoomFullExtent()
{
    GLint iViewport[4];
    glGetIntegerv(GL_VIEWPORT, iViewport);
    glPixelZoom((GLfloat) iViewport[2] / (GLfloat)width,
                (GLfloat) iViewport[3] / (GLfloat)height);
}

Since the image is a square one, it's not a good result.

This is the code used for zoom in:

void COpenGLControl::FixedZoomIn()
{
    glPixelZoom(2.0f, 2.0f);
}

but it does zoom in operation just one time and when I again click on the button the zoom in is not done I think it is because that when I call COpenGLControl::FixedZoomIn for an instance of the class COpenGLControl infact the openGL window is zoommed not the contents in it.

I have heard about texture mapping and how to zoom by changing z of the camera point.

How would I customize the class COpenGLControl for my purpose?


texts: What are some Game Development Publications that accept outside articles

texts:
What Are some Game Development publications (electronic or otherwise) that aren't so large that there is no chance to potentially get included in the publication after a few well-written articles sent their way.

Looking for publications geared towards developers, not gamers, and can be any aspect of the game process, design, development, business, etc.


texts: Poly Count in Unity games. 3d Asset detail

texts:
I've begun making my own characters for my games. These are just tests that I copied from other references (ie. Cartoons TV etc). I used Maya with the 'Convert Smooth Preview To Polygons' to make the mesh nice and smooth.
However upon importing to Unity, perhaps I am wrong, but the number of polys looks way higher than models I just downloaded from Unity Store etc.
If I continue making ALL my assets in this detail, would the game run ok. (I'm targeting PC, not mobile phones. And I don't mind if low end pcs struggle but anything mid-range and up.)
Should this detail be ok and I can focus on my game dev? Or should I spend some more time trying to reduce the poly count on my models (without compromising too much detail)?
Thanks


texts: Algorithms for Automated Game Levels Creation ( 2D )?

texts:
I am trying to algorithmically create a game like the one in the picture below

I am trying to Create random levels from an algorithm.

Ideally, the algorithm will take into account the desired difficulty size and the board size ( N x N ) and produce a random map based on those 2 things.

I personally don't know how to determine difficulty in this game nor how to mathematically model it.


texts: Drag And Drop in libGDX (Target and Source)

texts:
I'm trying to put together a drag and drop system in libGDX with the help of DragAndDrop class. I have the typical system in which you can drag something into a box.

So far it is working all dough I don't know if I am doing it in the most optimal way because but the problem is that one of the draggable object contains two more targets.

So say I have all draggable objects on the left and the boxes (the targets) on the right.

This is what I do for every draggable object:

dragAndDrop = new DragAndDrop();
dragAndDrop.addSource(new Source(icon) {
            @Override
            public Payload dragStart (InputEvent event, float x, float y, int pointer) {
                Payload payload = new Payload();

                payload.setDragActor(drag);
                payload.setValidDragActor(valid);
                payload.setObject(icon);
                icon.addAction(Actions.alpha(0.7f));
                return payload;
            }
            @Override
            public void dragStop(InputEvent event, float x, float y, int pointer, Payload payload, Target target){
                icon.addAction(Actions.alpha(1));
                if(target!=null){
                    draggedInDragBox((CommandBin) target.getActor());
                }

            }
        });

The DraggableObject extends Group and contains Image icon. That's what I pass to the constructor of the source. (Maybe I should pass all the object [this]). I also have the images drag and valid in the DraggableObject. The actual Texture is the same for all icon, valid and drag but I think I need all 3 objects to make it work. Am I right?

Then in the boxes I do:

dragAndDrop.addTarget(new Target(this) {
        //Logic is in source
        public boolean drag (Source source, Payload payload, float x, float y, int pointer) {
            return true;
        }

        public void reset (Source source, Payload payload) {
        }

        public void drop (Source source, Payload payload, float x, float y, int pointer) {

        }
    });

So I pass the object DragBox to the constructor of the target. As you can see all the logic is in the Source. Ass you can tell there. What I do is. If target =! null it means that we dropped the object in a valid place so I want to add the DraggableObject to the DragBox (addActor).

public void draggedInDragBox(DraggableObject do){
    //We add the command in the box
    addCommand(_this); //This simply calls addActor(do) in DragBox
    //We create a new draggable object to be able to use it again
    DraggableObject drOb = new DraggableObject();
    northController.draggableObjectsContainer.addActor(drOb);
}

The difference between a normal DraggableObject and the one that displays subDragBoxes (which extends the first one) is this in the constructor:

public RedDraggableBox() {
    super();
    subdraggableBox[0] = new DraggableBox();
    subdraggableBox[1] = new DraggableBox();
}

And when it is dragged to a main box I just call:

public void showSubDraggableBoxes(){
    addActor(subdraggableBox[0]);
    addActor(subdraggableBox[1]);
    icon.toFront();
}

This is what I want to accomplish.

Say the red is a special DraggableObject that creates subdraggable boxes when placed in a draggable box. So when it is there in the box I add to the group DraggableObject the two boxes. Currently I can drag any DraggableObject to a main box. When I drag an object to a box that has already an object it destroys the current object and places the new one instead, which is exactly what I want it to do.

The problem with red DraggableObjects is that when I Drag something to one of its subDraggableBoxes it erases the red draggable object (with the boxes) and substitutes it by the new one in the main DraggableBox. So by the time a RedDragBox is visible: RedDragableBox.parent() -> RedDraggableObject, RedDraggableObject.parent() -> DraggableBox (the main one).

Thanks in advance.


texts: how to transform child elements position into a world position

texts:
I'm making a 2d space game in Javascript with canvas. In this game there's a bunch of spaceships, positioned in world space, with turrets, positioned relative to their parent ships. These objects also have an orientation.

How do I efficiently calculate the position of a turret in world coordinates? (i.e. when it fires and I need to know where to place a bullet in the world)? Calculating the turrets orientation is trivial - I just add the turrets relative angle to its parents. For position though, I guess I could do a bunch of trigonometry but this MUST be a common problem with a good/fast general solution?

Should I be relearning how to do matrix math again? :)

Update:

Following the answers below I went away and read up on matrix math - to that end I can highly recommend "3D Math Primer for Graphics and Game Development" by Fletcher Dunn and Ian Parberry. The neat thing about matrices is you dont need to understand the maths involved in each transform, just how to use them.

As my project is in javascript I also needed a matrix library and went with gl-matrix.js as it is fast and has a clean (to my tastes) API. Sylvester.js is also very feature rich and worth a look, although not as fast as gl-matrix


texts: Should frame rate affect the speed in a game engine?

texts:
I am writing a 2D game engine for fun. I am able to perform animation using the engine. However, if I change the frame rate (frames per second) the speed of the animation changes.

I have never used any game engine. I want to know whether other game engines handle this issue or not. If not, what is the ideal frame rate for a 2D game?


texts:
Using python and pygame I've built a collision detection system according to the instructions in this YouTube tutorial.

This is updated 40 times per second and controls movement and collision detection between some number of "agents", which are circles, each with a radius of 20:

for a in self.agents:
    dir = a.target - a.pos
    if dir.length >= 3:
        dir.length = 3
        a.pos = a.pos + dir

for a in self.agents:
    for a2 in self.agents:
        if a==a2: continue
        d = a.pos.get_distance(a2.pos)
        if d<40:
            overlap = 40 - d
            dir = a2.pos - a.pos
            dir.length = overlap/2
            a2.pos= a2.pos+dir
            a.pos= a.pos-dir

This looks and works great, as long as the number of agents is below 100. A higher number of agents will cause the pygame frame rate to drop. I left out some code which increases movement speed and pushback for a selected agent, but I don't think it has any consequence for the issue.

How can I make the code more efficient? For instance, would it help to make it so agents only check the distance of other nearby agents, say within a circle 4X the size of the agent, instead checking the complete list in every iteration of the code. Or is it better to change the method all together?


texts:
I want to create the effect of merging of colours if they are overlapping.

My game is a tile-based game. For all intents and purposes, lets consider a tile from (0,0) to (1,1) in the entire example.
A square sprite (lets say red) will start moving from either the diagonal edges, or the centre of the sides and will move to the centre of the tile and fill it.

In this image, 1 red sprite is moving from top centre, and the other one from bottom right.

If 2 blocks of the same colour are moving into that tile, and they overlap, they should change the colour, but only of the overlapping area.

Is this possible? If so, with sprites, or do you recommend materials and textures?

Side note: The shape may not necessarily be square. They can be rounded squares, triangles, etc. Also, the red squares may not look so plain. They may have a few inner-shadow and other effects. Also, colour of the 2 blocks might not be the same. E.g.:
Red and black would merge to form orange.

Any suggestions would be great. Phrasing the question was a little tough. Ask me for any details if something was not clear. Thanks in advance :)


texts: Calculate heading required to turn ship so that its weapon can fire at target

texts:
I have a ship, the ship travels towards a heading (vector3, blue arrow) with an arbitrary speed.

The ship has a weapon on the side, the weapon can point in any direction, except straight forward/backwards from the ship heading. (In example image the weapon is a perpendicular 90* right).

The weapon has a firing arc, in n degrees (so, n/2 degrees in either side from the weapon "point direction").

Given a target at any position on the same side of the ship as the weapon (red circle), how do I rotate the ships heading so that when oriented towards the new heading (in this example, the yellow arrow), the target is inside the bounds of the firing arc? (The ship cannot rotate on the spot, it turns by driving forward towards a heading, like a simplified aircraft)

While my game is set in full 3D, I think a 2D solution will be more than enough.
I use Unity, and C#, but I'm thankful for any solutions.

Edit: To clarify, I am looking for the "math-based" solution, collision-checks etc isn't really feasible.


texts:
I get this Error in Unity when I imported SteamVR :
"Failed to Load IVRRenderModels Interface Version IVRRenderModels_006"
I looked after on it but nothing really solved the problem.
Why is this happening and what could be the solution?


texts: Help understanding IEnumerator Move routine

texts:
I have this code and I know what it does (it will move an object up and down)

But I don't know how its elements work. Could someone please explain it to me?

IEnumerator Move (Vector3 Target) // What this IEnumerator do?
{
    while (Mathf.Abs ((Target - transform.localPosition).y) > 0.1f) {
        Vector3 Direction = Target.y == Top.y ? Vector3.up : Vector3.down;
        //Is this an if/else? and if yes why if target.y == top.y its first choice is vector3.up?

        transform.localPosition += Direction * 5 * Time.deltaTime;
        yield return null;
    }
    yield return new WaitForSeconds(1f);
    Vector3 newTarget = Target.y ==Top.y ? Bottom : Top;
    //Same line but result order is different ?.?

    StartCoroutine(Move(newTarget));
}


texts: How can I implement lights & shadows in a multi-layer 2d tilemap?

texts:
I am in the process of writing an isometric game from scratch, and I'd like to know how/if I can add lights and shadows.

The code I have so far can be found here, but it should be enough to know that right now, the maps are simple 3d arrays of true/false values. Here is a shot of the environment:

If it were a single layer tilemap it would be straight forward. I can understand the simple raycasting in 2d that is required.

However, given that my maps have multiple levels of height as well as cave-like areas, I don't really know how to go about doing convincing shadows for it. Perhaps a per-block solution is the only realistic way?


texts:
Like the title says:
How do I edit this texconv "IMGtoBC3.bat" file so it "READS FROM & PRESERVES the directory structure when writing the "resulting" dds files?
THIS IS FOR END USERS, OF A GAME MOD "EASY CUSTOM ASSET BUILDER"

SO I NEED TO ALLOW "MANY" INSTALL LOCATIONS
PLUS "ENDLESS" CUSTOM DIRECTORY STRUCTURES OF INPUT FILES inside the "directed to use "folders""

I have a large folder/sub-folders with many tiff's that "have the same file name" divided up into "sets".
These dds files are for custom textures in a unity game, file naming is a forced event, but "sorted/selected" by folder.
I have about 3000 file sets ready to convert and I'm not doing them 1 by 1 in Nvidia tool (I hope) and AMD tool and the game have a MAJOR conflict (its as a no go)
BONUS points to anyone that could show me this "bat" file using unity's new tree of "CRUNCH" cmd line dds compressor/encoder.
Suggestions of other tools:
I have tested over 50 apps, for my needs its: Nvidia, texconv and then crunch in level of quality/support
HERE IS THE CODE:
ECHO OFF
Setlocal EnableDelayedExpansion

::Variables
SET @FORMAT=BC3_UNORM
SET @InputFolder=%~dp0Input_IMG_TO_BC3\
SET @OutputFolder=%~dp0Output_DXT5_BC3\
SET @TEXCONVEXE=%~dp0texconv.exe
SET @TEXCONVEXE02=%~dp0texconv.exe
:: Check for texconv.exe
IF EXIST "%@TEXCONVEXE%" SET @TEXCONVEXE=1
IF "%@TEXCONVEXE%"=="1" GOTO EXESTATE_1

:EXESTATE_0
TITLE - ERROR! texconv.exe not found!!!
COLOR 04
ECHO: && ECHO: && ECHO:
ECHO                 === ERROR! texconv.exe not found!===
ECHO:
ECHO     Install Path: "%~dp0texconv.exe"
ECHO:
ECHO    The script needs texconv.exe in order to work properly.
ECHO:
ECHO    Please make sure texconv.exe is in: "%~dp0"

ECHO: && ECHO:

GOTO CONT01

:EXESTATE_1
TITLE - Texconv.exe found!!!
COLOR 0A

ECHO: && ECHO: && ECHO:
ECHO                 [ texconv.exe Is Installed! ]
ECHO:
ECHO     "%~dp0texconv.exe"
ECHO:
GOTO CONT00
:CONT01
ECHO: && ECHO:
ECHO        Please copy/move the missing texconv.exe executable to where the script needs it to be and refresh this window.
ECHO:
:CONT00
IF "%@TEXCONVEXE%"=="1" GOTO START
ECHO: && ECHO: && ECHO     [Press any key to refresh the window] && PAUSE>NUL
GOTO SetTexConvPath

:START

:: Customize CMD Window
TITLE HumanStuff TexConv Batch Directory Script v1.0.2
PROMPT $G
COLOR 04
CLS

:: Make The Folders
IF NOT EXIST "%@InputFolder%" MKDIR "%@InputFolder%"
IF NOT EXIST "%@OutputFolder%" MKDIR "%@OutputFolder%"

::Run TexConv.exe
::-srgb was added because PNG images were getting high contrast colors
::Sorry about the messy code but this was harder to do than it sounds

FOR /R "%@InputFolder%" %%i IN (*.*) DO (
set word=%@OutputFolder%
set str=%%~dpi
CALL :REPLACESTRING
SET @IFOL=!@OSTRING!
CALL :MKFOL
SET @ISTRING=%%i
CALL :TexConv01
)

PAUSE
GOTO SCRIPTEND

:MKFOL
IF NOT EXIST "%@IFOL%" (
    MKDIR "%@IFOL%"
)
GOTO SCRIPTEND

:TexConv01
IF NOT "%@LOGO%"=="" SET @LOGO=-nologo
"%@TEXCONVEXE02%" %@LOGO% -srgb -nogpu -pow2 -vflip -if triangle -bc u -f %@FORMAT% "%@ISTRING%" -o "%@OSTRING%" -y
ECHO:
SET @LOGO=
GOTO SCRIPTEND

:REPLACESTRING
call set str=%%str:%@InputFolder%=%word%%%
set @OSTRING=!str:~0,-1!
GOTO SCRIPTEND

:SCRIPTEND
```


texts: Change text of bus destination sign at runtime

texts:
I have rigged a bus in blender and imported it into Unreal.

Now I want to change the text of the destination sign at run time.

How can i do this?


texts: DirectX9 texture flashing or disappearing

texts:
I am learning DirectX 9 and I have these test models in my scene and this weird texture flashing happens.

If you look at the bottom of the picture you will see a blue area, that is supposed to be filled with the ground texture I have. So every time I move my camera the ground texture flashes very quickly and parts of it disappear lots of times a second. I know it's not a problem with my video card. What could cause this?


texts: Implmenting RLE into a tilemap or how to create a large 3D array?

texts:
Currently I've been using a 3D array for my tiles in a 2D world but the 3D side comes in when moving down into caves and whatnot. Now this is not memory efficient and I switched over to a 2D array and can now have much larger maps. The only issue I'm having now is that it seems that my tiles cannot occupy the same space as a tile on the same z level. My current structure means that each block has its own z variable. This is what it used to look like:

map.blockData[x][y][z] = new Block();

however now it works like this

map.blockData[x][y] = new Block(z);

I'm not sure why but if I decide to use the same space on say the floor below it wont allow me to.

Does anyone have any ideas on how I can add a z-axis to my 2D array?

I'm using java but I reckon the concept carries across different languages.

Edit: As Will posted, RLE sounds like the best method for achieving a fast 3D array. However I'm struggling to understand how I would even start to implement it? Would I create a 4D array the 4th being something which controls how many to skip? Or would the x-axis simply change altogether and have large gaps in between - for example [5][y][z] would skip 5 tiles? Is there something really obvious here which I am missing?

The number of z levels I'm trying to have is around 66, it would be preferable that I can have up to or more than 1000 in x and y.


texts:
I'm trying to switch the camera to another object on collision.

This is what I've tried to do:

    public Camera switchCamera1;
public GameObject player2;

private Vector3 offset;

void Start () {
    offset = transform.position - player2.transform.position;
}

void OnCollisionEnter (Collision col) {
    if (col.gameObject.name == "triggerCube") {
        //SceneManager.LoadScene ("test2");
        Debug.Log ("HIT SOMETHING");
        setWinText ();

        switchCamera1.transform.position = player2.transform.position + offset;

    }
}

However it simply doesn't work. I've set my camera to switchCamera1, I've set the other object to player2. The script is assigned to the collider object.


texts: What has changed in the lighting systems of Rage, Battlefield 3 to make them so realistic?

texts:
I've played and completed Rage and currently Battlefield 3 (which looks a lot better with less hype). One thing that is immediately apparent is the lighting, or the bump maps - I can't figure out which it is - makes the experience on a high end PC a lot clearer and better looking.

What is the advancement that these games are making use of in Open-GL/Direct-X or the graphics cards that has increased the realism of the lighting engines so dramatically?


texts: How to get consecutive voice clips to sound natural

texts:
In the game I'm working on I have to play several short consecutive voice-clips to form a complete sentence. Example (each [] bracket is a different voice clip):

[Bob here,] [we're at]  [some town] [and are on our way to] [some city].

Stitching together different voice-clips like this makes it sound stilted and disconnected. This is because there are unnatural pauses when switching clips, and the pitch and tone of the speaker changes.

My current efforts include two methods for removing the unnatural pauses:

starting the next clip early if a silence is detected at the end of the preceding clip
skipping the first few milliseconds of the new clip up to the first detected 'sound'.

These work OK at removing the unnatural pausimh, but detecting what 'silence' is is difficult, especially when dealing with multiple voice-actors and microphones.

How could I make stitching together voice-clips sound more natural? Any advice would be appreciated. This has to be done in real-time inside the game (I'm using Unity), and can't be pre-processed or done ahead of time.


texts: Which Database (RDBMS vs NoSQL vs BOTH) to use for a Realtime Multiplayer Game?

texts:
I'm working on a realtime multiplayer game that will require a database (for features such as player profiles, friends, unlocks, news, etc.) This is a standard PC game (not browser-based) and will use a client-server architecture. I am new to using databases, and have done some research over the past few days when I stumbled upon the heated debate: RDBMS vs NoSQL. Currently I am leaning towards NoSQL but after reading about the uses for each (RDBMS and NoSQL), I'm tempted to use both. I know that may seem strange, but let me explain my situation:

My team has a shared webhosting package that offers unlimited mySQL storage and bandwidth, the only caveat being that we can only have 25 connections open at one time (shared hosting rule). I am intending on using this for my website (a typical usage no doubt) in order to post news updates, support community features (like comments, uploading fan art, etc.) and the like. That's all fine and good - but! this is where things get interesting... I want to display this same information that is posted on my website, in-game. This means using mySQL for both my website and my game. In addition to news posts and the like, I plan on using it in-game for things like chat and a server list. I am concerned about that 25-connection-rule mostly.

Which leads me to ask Question #1: Will this work and is there a better alternative?

Now besides this, I have read about how well NoSQL performs and is suited for realtime games (I could be wrong, I've walked through a huge RDBMS vs NoSQL flame war to get here and probably am burned). Basically, I would like to use MongoDB for all of my game object data.

And again, it will be helpful if I provide some context: I have found a host (MongoLab) which offers a 240MB MongoDB package for free, which I intend on using until it's necessary to upgrade. Given 240MB, I've calculated that I will be able to store roughly 60,000 players (if each player is roughly 4KB and we ignore other things that might be stored). The storage space, and having to pay for more in the future (should our game be successful) is not a problem. The only reason I currently intend on using MongoDB for all of my game object data is because of how often this game object data will be accessed (such as whenever a player is killed, picks up an item, fires a gun, etc.) I also like the straight forward schema-free documents (which make it easier to map game object data). I should note that, at one time, there will only ever be one server writing to a player's profile in the database (the server the player is in).

I intend on using the same MongoDB in my website, to display player profile information (I'm not concerned with complete consistency, some delay from in-game updates is fine).
Which leads me to my second question, Question #2: Is this a good idea or is there something better I should do?

The game will have a start up experience similar to this:

Client logs in (MongoDB)
Client is at in-game home page w/ chat rooms (MySQL)
Client goes to server list (MySQL)
Client connects to a server and plays in it
Server communicates updates for all players (MongoDB)

This is just the way I imagined it would work.  Does this look good to you, or do you have suggestions on how this plan can be improved?


texts:
When I export my game as runnable .jar file with custom window's icon - it doesn't run. It runs only in debug mode and when I try to launch .jar with the console it says that it cannot load icon file.

Picture of my problem:


texts: Effects of collisons: broken glass, damaged cars, how are they created?

texts:
My question is related in particular to achieving the effects of collision in game engine, how is this done?

I have searched a bit, read from the internet and went through a few tutorials, and saw that one way to create one of the effects, explosion, or something breaking is to create the model in pieces, and apply force (in a game engine such as Unity 3D) to make the pieces fly off. It seems to be a solution, but it doesn't address the problem of items that are vaporized in a big explosion, with so many pieces. How is this done? Basic methods and tricks etc would be helpful.

Secondly, the problem of things bending and getting damaged on impact, such as a car's front end destroyed when it hits a wall? How is this done? One thing that comes into my mind is to create each component of a car in a different state as an animation in 3Ds Max or Maya, and then in the engine, according to the collision, switch the model state in the time bar. Is this how it is done?

Finally, what about materials, such as net of a basketball net, or a soccer goal net for example? Effects of ball hitting it can be calculated and applied in a script, but how to make the net bend and stretch with it? Is it done through models or materials?
Also what about a flag fluttering in the wind?

My questions are specific to game engines, particularly Unity3D. Some good links on the subject would also be helpful.


texts: Drawing each sprite at different location

texts:
I can draw multiple sprites but they are all on top of each other at (0,0). How would I make each sprite appear after one another in a row?

My Rect class and Draw function:

class Rect(pygame.sprite.Sprite):
    def __init__(self,color,width,height,value=0):
        super().__init__()
        self.image = pygame.Surface([width, height])
        self.image.fill(color)
        self.rect = self.image.get_rect()
        self.value = value
        self.x = 0
        self.y = 0
    def change_value(self,color,value):
        self.image.fill(color)
        self.value=value

def DrawRects():
    rect1 = Rect(red, boxW, boxH)
    rect2 = Rect(black, boxW, boxH)
    rects.add(rect1, rect2)

    rects.draw(screen)


texts:
For my Unity game I have a Client-Server model, and I want both sides to ping each other repeatedly to make sure I know what latency between players is.  In the server's case, a client connects and their details are logged.  Their details are then used when the game creates coroutines. This coroutine starts a loop which pings and waits and pings and waits, etc, until the game ends.

However, it doesn't work.  The debug messages are throwing up strange results.   It attempts to ping to IP "::ffff:192.168.0.10", and then is waiting forever.  I don't suppose the fact I am running this via Unity editor and another app window on the same machine should be an issue?  What is the "::ffff" about in the IP it saves when a client connects?  Is that the issue?  If so, how can I best format it properly?

Yes, I need to add another loop in the coroutine to make it go forever.  Once would be a nice start though.

CLIENT CONNECTS TO SERVER

    // Recieve data from all.
    NetworkEventType recData = NetworkTransport.Receive(out socketId, out connectionId, out channelId, buffer, bufferSize, out dataSize, out error);

    switch (recData)
    {
        case NetworkEventType.ConnectEvent:
            if (localConnectionId == connectionId)
            {
                // My active connect request approved.
                Debug.Log("Connection request approved.");
            }
            else // New client.
            {
                string outIp;
                int outPort;
                UnityEngine.Networking.Types.NetworkID outNetwork;
                UnityEngine.Networking.Types.NodeID dstNode;
                byte outError;
                NetworkTransport.GetConnectionInfo(socketId, connectionId, out outIp, out outPort, out outNetwork, out dstNode, out outError);
                AllocateNewLobbyPlayer(socketId, connectionId, channelId, outIp, outPort);
            }
            break;
   }

CREATE PING LOOP COROUTINES

    for (int i = (Game.isServer) ? 1 : 0; i < lobbyPlayers.Length; i++)
    {
        if (lobbyPlayers[i] != null)
        {
            Debug.Log(" STARTED PING FOR " + i);
            StartCoroutine(PingTest(lobbyPlayers[i].ip));
        }
    }

PING LOOP COROUTINE

protected IEnumerator PingTest(string ip)
{
    Ping ping = new Ping(ip);
    Debug.Log(" SENT PING " + ip);
    while (!ping.isDone)
    {
        Debug.Log("WAITING");
        yield return new WaitForFixedUpdate();
    }
    Debug.Log(" PING COMPLETED " + ping.time);
    yield return new WaitForFixedUpdate();
}

DEBUG OUTPUT

 STARTED PING FOR 1
 SENT PING ::ffff:192.168.0.10
 WAITING
 WAITING
 WAITING

etc, etc, etc...


texts: Flipped vertical button element on Canvas not reacting

texts:
I have a small refresh arrow circle that I wanted to use for an indicator in which direction the tile gets rotated on click. After I rotated it by 180 under the rect Transform rotation Y to spin the opposite direction, it does not react anymore for OnClick events. Probably since we are technically clicking on the backside of the image. The non rotated version works, changing the rotation from 180 to 0 works as well.
Is there any way to get a flipped image working without duplicating the source image and flip it before assigning it to the button?
The scene is a simple screen space camera, one canvas with 2 buttons (having the same image source), one button has 180 under Y Rotation and the default EventSystem.


texts: In Ogre, how to get the depth buffer value?

texts:
I am rendering an object to a texture using the following setup code which I copied from Ogre's rendering to texture tutorial:

Ogre::RenderTexture *renderTexture = rtt_texture->getBuffer()->getRenderTarget();

renderTexture->addViewport(myViewPoint); //the original code uses mCamera, but I want
//to render the scene from a different view point.
renderTexture->getViewport(0)->setClearEveryFrame(true);
renderTexture->getViewport(0)->setBackgroundColour(Ogre::ColourValue::Black);
renderTexture->getViewport(0)->setOverlaysEnabled(false);

Is there any way I can get the depth value at runtime as seen from myViewPoint?

I tried to use:

Ogre::GLDepthBuffer *depthBuf = renderTexture->getDepthBuffer();

but it didn't compile and the compiler says GLDepthBuffer is not a member of Ogre.


texts: Rigging Skinning of human skeleton skin mesh scanned by MRI

texts:
I have successfully developed a system in Qt/C++ for human musculoskeletal mocap simulations. I can run asf, amc, bvh motion capture files and can visualize the joint transformations. I even simulated the static rigid bones of MRI scanned meshes.

31 mesh bones were extracted from MRI data and each bone is assigned to *.asf skeleton bone id/name and parent and child relationship is created. I have absolute and relative transformations of each bone and the bone mesh vertices positions are also known.

Now there is a skin mesh over the skeleton bones. I want to do rigging/skinning of that skin mesh with the bone transformation. If a bone transforms, its skin mesh should be transforming too. Literature study tells us that, assign each vertex of its bone and assign some weight to each vertex, sum up all and multiple with the bone's transformation matrix, etc. etc. and find the new position of a vertex.

I have pretty much experience to play with meshes and transformations, I can do that. But here I do not get the concept, first of all, how can we assign vertex to its specific bone? because human skin is a continues with Only One Shell, do we assign by computing the offset/minimum distance from bone to skin? Second question is how do we compute weight for each vertex? Because this mesh is not exported from MAYA or some 3D softwares, where each vertex is assigned with a weight value, but this is a static rigid mesh with no precomputed information. Third question comes to mind that how can we know that this specific vertex should be transforming with the transformation of Foot for example? How do we know that this vertex is a Foot vertex?

I want to have some concepts about the methodology, please guide me.

Thanks.


texts: What's the current preferred method for serving/storing game data on html5 games

texts:
Given all the recent improvements on web platform (webgl, websockets, etc.), it should be now possible to see great games on web. However my biggest concern so far has been around serving and storing the game assets. AFAIK the webstorage only supports a few megabytes and it is not enough for the majority of the games. Even if I work around that limit by providing a ton of different origins, is it possible to claim that it's a safe method? For desktop games we have a lot of anti-cheat mechanisms (steam has one, most A+ have them builtin) If I store my game assets using the webstorage can I claim that they won't be modified by the user?

My game has assets around 800 mbs and I would love to get some feedback on how to serve them and store them properly. I'm trying to satisfy the following:

People shouldn't be forced to download all of the assets every time they want to play the game [unless there's a patch, etc.]
It shouldn't be trivial to make client side hacks and change configs to get all the good stuff without playing/paying for them [greasemonkey!]
Ideally, the solution should work on all the browsers [latest version of IE, Chrome, FF and Safari][no mobile is OK]


texts: Can't set object's local rotation like rotating from gizmo in the scene

texts:
Here, I have a plane model with some sub parts(like aileron) can rotate:

That red section is weight painted(rigged) vertices, and I need to control the rotation of this in Unity by script.

So this is the image in Unity, rotating through green ring(along x axis) of aileron bone from gizmo works exactly I want.

However as you can see in the inspector, I rotated along X axis but it doesn't changed only x axis, it also changed other axis like Y and Z.

So when I just rotate X rotation of aileron from the script or inspector, it gives me total wrong rotation, and here is the solution I got: How to rotate object just like in the scene?

So I wrote the code:

leftAileron.Rotate(0, value, 0);

Now it rotates desired angle but the problem is transform.Rotate method is just rotating the object, means adding the new value to current rotation.

In my case, I need to "set" the rotation, not adding it, because it gives wrong rotation in this case.

I made a slider for explain and demonstrate my problem: here is the slide and it's range is -5 to 5 and default is 0.

The code for rotating aileron is this:

sliderLeftAileron.onValueChanged.AddListener((value) => {
    leftAileron.Rotate(0, value, 0);
});

When I moved slide to left, value goes negative so it rotates like this.

But when I slightly moved the slide to right, it still rotate same direction because the value is still negative and just try to adding it.

So I need to set the rotation of aileron, not adding it, moving slide to right should moves opposite direction and vise versa.

Is there a way to set rotation just like Rotate(0, value, 0) but not adding it in this case, like this:

transform.rotation = Quaternion.Euler(0, value, 0);

I tried bunch of ways but none of them worked, how do I treat my aileron rotation just like in gizmo in the scene?


texts: Calculating voronoi sites with a 2D grid

texts:
I've been diving deeper into voronoi cells for use in a 2D game. There's a lot out there that explains the concept and describes how to calculate them but I'm failing to grasp how best to apply them to a 2D grid.

Mainly, in order to calculate the voronoi cells/edges you need a list of points ("sites").

Do I just choose random points on my grid? If so I need to ensure they're chosen in the right order due to my RNG seed. That doesn't sound reasonable for the world as a whole, so maybe I can use a new seed for every "chunk".

Any advice or further explanation would be great. I have an idea, and lots of example logic on calculating the cells/edges, it's just the points in relation to an infinite 2d grid I have trouble with.


texts: Why is my primitive xna square not drawn/shown?

texts:
I have made this class to draw a rectangle, but I cant get it to be drawn, I have no issues displaying a 3d model created in 3dmax, but shown these primitives seems much harder

I use this to create it

board = new Board(Vector3.Zero, 1000, 1000, Color.Yellow);

And here is the implementation

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Shapes;
using Quadro.Models;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Quadro
{
    public class Board : IGraphicObject
    {
        //Private Fields
        private Vector3 modelPosition;
        private BasicEffect effect;
        private VertexPositionColor[] vertices;
        private Matrix rotationMatrix;
        private GraphicsDevice graphicsDevice;
        private Matrix cameraProjection;

        //Constructor
        public Board(Vector3 position, float length, float width, Color color)
        {
            var _color = color;

            vertices = new VertexPositionColor[6];
            vertices[0].Position = new Vector3(position.X, position.Y, position.Z);
            vertices[1].Position = new Vector3(position.X, position.Y + width, position.Z);
            vertices[2].Position = new Vector3(position.X + length, position.Y, position.Z);
            vertices[3].Position = new Vector3(position.X + length, position.Y, position.Z);
            vertices[4].Position = new Vector3(position.X, position.Y + width, position.Z);
            vertices[5].Position = new Vector3(position.X + length, position.Y + width, position.Z);

            for(int i = 0; i < vertices.Length; i++)
            {
                vertices[i].Color = color;
            }

            initFields();
        }

        private void initFields()
        {
            graphicsDevice = SharedGraphicsDeviceManager.Current.GraphicsDevice;
            effect = new BasicEffect(graphicsDevice);
            modelPosition = Vector3.Zero;

            float screenWidth = (float)graphicsDevice.Viewport.Width;
            float screenHeight = (float)graphicsDevice.Viewport.Height;
            float aspectRatio = screenWidth / screenHeight;
            this.cameraProjection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f);
            this.rotationMatrix = Matrix.Identity;
        }

        //Public Methods
        public void Update(GameTimerEventArgs e)
        {

        }

        public void Draw(Vector3 cameraPosition, GameTimerEventArgs e)
        {
            Matrix cameraView = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);

            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                effect.World = rotationMatrix * Matrix.CreateTranslation(modelPosition);
                effect.View = cameraView;
                effect.Projection = cameraProjection;
                graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 2, VertexPositionColor.VertexDeclaration);
            }
        }

        public void Rotate(Matrix rotationMatrix)
        {
            this.rotationMatrix = rotationMatrix;
        }

        public void Move(Vector3 moveVector)
        {
            this.modelPosition += moveVector;
        }
    }
}


texts:
I'm building a game in which there are tournaments.
During the tournaments we want players to play against each other in an efficient way.

What I'm looking for is a generic algorithm that will match players together in an optimal way in order to:

Have the lowest amount of games possible
Be reasonably sure that after all games are played, the highest-ranked player is the best

Tricky part:

Games can have 2, 3 or 4 players in a death match depending on the tournament.
Tournaments have two or more players, no other constraints.

Does such an algorithm exist?

Note: For the ranking, I will probably be using an ELO-based algorithm (unless you have a better suggestion).


texts: LibGDX: Easy way to draw partial sprites

texts: I am surely overlooking something, but is there an easy to draw for example only half a sprite in LibGDX? I originally thought I could do this with setBounds() but this distorts the sprite.


texts: How to make levels that never get old, even with a leveling system?

texts:
I always get the feeling that in games with a linear plot and leveling system, players never go back to the older levels because the monsters there are too easy and the world has nothing new to offer there.

Players usually don't go visit floor 1 just for memory's sake or to remember the good times they had there. In fact, they probably forget what happened there and move on like it's nothing. For some reason, this bothers me to no end.

Is there a way to remedy that? I don't want the feeling of certain game areas to become obsolete to the player as the story progresses.

I want my game to be dynamic and ever-changing, with things to offer at every location, at every point in the player's game progress, even if one place is not at the right "level" to match with the player's current overall character levels. There should be a kind of equality, where at no point does the player tire of one place and can move freely from one place to the next. Does this sound slightly open-world ish?

This is not only for replayability, but also to provide a certain kind of elegance to the game. I feel like there is something lacking, and something that might be able to be improved, in RPGs, where the story is everything and so "old" levels are treated as second-class citizens. I was always slightly bored when I had "conquered the world" and ran through every monster like it was spaghetti.

One of the solutions I thought of is to simply update the monsters, treasure chests, items, dialogue, etc. at the old locations. Perhaps even updating the graphics would provide a visual cue that the player can have some more novel experiences there. However, isn't that essentially just changing the very nature of the location itself? The problem I have with that is that players will then forget what happened because the place itself disappeared/changed.

If anyone thinks of any good ideas, I would like to hear them. Thanks!


texts: Box2D Static-Dynamic body joint eliminates collisions

texts:
I have a static body A, and a dynamic body B, and a dynamic body C.  A is filtered to not collide with anything, B and C collide with each other.

I wish to create a joint between B and A.  When I create a joint (ex. revolute), B no longer collides with C - C passes through it as if it does not exist.

What am I doing wrong?  How can adding a joint prevent a body from colliding with another body it used to?

EDIT: I want to join B with A, and have B collide with C, but not A collide with C.  In realistic terms, I'm trying to create a revolute joint between a wheel (B) and a wall (A), and have a box (C) hit the wheel and the wheel would then rotate.

EDIT: I create a the simplest revolute joint I can with these parameters (C++):

b2RevoluteJointDef def;
def.Initialize(A, B, B -> GetWorldCenter());
world -> CreateJoint(&def);


texts: When are Lagrangian Mechanics useful in a game?

texts:
I have not used or heavily studied Lagrangian Mechanics before and I have not built a physics engine modeled with constraints yet.

I understand that Lagrangian Mechanics are an alternative way to think about Newtonian Mechanics (standard kinematics equations) in-terms of constraints, does this actually come into practical usage in a game engine?

I've been getting started with constraint-based resolution with this tutorial: http://gamedevelopment.tutsplus.com/tutorials/modelling-and-solving-physical-constraints--gamedev-12578

In addition I'm going through Erin Catto's white paper "Iterative Dynamics with Temporal Coherence": http://www.bulletphysics.com/ftp/pub/test/physics/papers/IterativeDynamics.pdf


texts:
model changes color completely:

G3dModelLoader modelLoader = new G3dModelLoader(new JsonReader());
Model model = modelLoader.loadModel(Gdx.files.getFileHandle("g3dj/model.g3dj", Files.FileType.Internal));
ModelInstance modelInstance = new ModelInstance(model);
modelInstance.materials.get(0).set(ColorAttribute.createDiffuse(0, 0, 1, 1));

I want to replace only the alpha channel with blue color

(one model, many colors)


texts: Why can't I swap fixtures on collision in Box2D?

texts:
I'm trying to swap the fixtures associated with a body after colliding with a specific obstacle.

I can listen to the collision event by extending b2ContactListener. I tested it with a trace and it's working. My listener function in the main game class calls a Player method that makes the swap. But it's just not working.

The body is stored in public var _body:b2Body; in the Player class.

The method I'm calling goes like this:

public function changeFixture():void {
    var newShape:b2CircleShape = new b2CircleShape(1);
    var myFixtureDef:b2FixtureDef = new b2FixtureDef();
    // Here I set density, friction, restitution, etc... Not important now...
    myFixtureDef.shape = newShape;

    _body.DestroyFixture(_oldFixture);
    _body.CreateFixture(myFixtureDef);

    // I know the method is called because this works
    trace('Yay! I'm working!');
}

What might be wrong?


texts: How should I manage the AI using lua scripts?

texts:
My game is in C++ and I want to make AI being managed by lua scripts, but I have no idea how should the scripts look like and the integration in C++.

Should the script be like

   if (whatever_happening) do_something
   if (....) .....
   etc

And in every frame in C++ I should call for every enemy:

   foreach(enemy)
   enemy.handleAi(luascript.file)

Or it is wrong and I should handle it different?


texts: The Thin Red Line. What to present to get interest without showing too much?

texts:
I am Dalilean and I am a gamer. There I have said it. Damn, feels like a weight is lifted from my shoulders… They say the first step is to admit the problem. Now the second step is doing something about it.

So….

As more than a few of you know, I decided to design a game.

Right now I feel like I am at a critical point in development. I am looking at the aspects of the game, from a game play point of view. This means I am past the story, the conceptualization, and now I am dealing with issues of “What specifics do each character have”, “What options and results do the actions of the player have in the game.”

I got to wondering, How much do I show possible investors or developers without showing too much?

I worry that I give them a copy of the Game Design Document; they will just say thank you and nothing else. Then, several years later, I will see my concepts seeping into games. I have learned from previous experiences that not everyone is honest and that a healthy level of paranoia goes a long way in this world.


texts: SpriteRenderer color not responding to script!

texts:
I have written a simple c# class that is supposed to change the color of the Player Renderer.
But, there seems to be a problem! whenever I call the function OnCallFun() ... the color stays put and does not change.
I have looked into the solution for quite some time now but no hope.
does anyone have a solution?
using UnityEngine;

public class ChangeColor : MonoBehaviour
{

    // Reference to Sprite Renderer component
    private Renderer rend;

    [SerializeField]
    private Color colorToTurnTo = Color.white;

    // Use this for initialization
    void Start()
    {

        rend = GetComponent<Renderer>();

        // Change sprite color to selected color
        rend.material.SetColor("_SpecColor", colorToTurnTo);
    }
}


texts:
I'm in the process of converting my game engine from java which used the LWJGL and JBullet to c++. However, when I was implementing Bullet physics my simple simulation of a box dropping from specified height onto a plane ran very slowly.

After scouring the forms I came across two possible solutions:

Compiling my simulation in release mode rather than debug.
Enabling compiler optimizations for speed.

After building in release and enabling the compiler optimizations my simulation still runs at the same speed. I've tested the FPS which usually runs between 400-350fps and that the simulations was stepped each frame. I can't find anyone that has had the same problem as me and I can't understand why JBullet which is a java port of the Bullet Physics Library runs fine on the same PC. Any help would be much appreciated. Thanks!


texts:
Very Basic Question.when i run the the game the game Mode is Too dark as shown below in the picture. please suggest me some Setting how to globally switch on built in light while Running the game in game mode.

Thanks.


texts: Camera with zoom that follows the player in javascript

texts:
I'm passing the time programming a little game in javascript, I've done what I'm trying this in several in game engine. And what I'm trying to do is generate the world while the player walks around the map. Using engines like unity and godot, I have always had the facilities to deal with the camera and the scene. Now with pure javascript I'm kind of not knowing where to go.

Come on, what I have so far:

A world generated by 2D noise and my character in it can move with the keys of the keyboard. What I want to do now is that when walking he generate the world and also the camera accompany him. And that with the scroll of the mouse I can take the camera to a bigger zoom so that I can better visualize the generated world.

So there are 3 questions I have:

1 - How to create a camera that will follow the player, already thinking about the best way to make the world be generated when walking the player.

2 - How to generate the world while he walks (This I believe I can do.)

3 - How to zoom in with the mouse scroll?


texts: Making a sales curve over time from a static baseline figure

texts:
I am making a game where there are objects that will be for sale.  The objects have a reputation score, which is the amount of sales they get each week.  This is calculated up front and remains the same for the entire release period.  The release period is also created up front and represents a period of time in weeks.

In my example Object#1 has a sales score of 10,000 and a release period 8 weeks.  This means it will sell 80,000 copies at 10k/week.

My aim is to take this flat line, and curve it, so it has rising sales at the start, a smoothed peak of sales in the middle, and lower sales at the end tailing off, like a gamma probability distribution curve.  The total sales across the period will be the 80,000, but the distribution of weekly sales will change.

I am looking to create this distribution shape from the flat sales total.  I'd ideally like to keep the sales volume the same, but as long as I have that curve, it doesn't matter too much.  I have looked at the Wikipedia entries etc, but they are all about the maths side of distribution, and calculating distribution from figures, I am just looking to fake that distribution from a median figure.

The idea is once I have this algorithm (or a good tutorial), I can play with it to create other unique distributions, adding variety to object releases, to help make things feel less procedural.

(Any help with improving title and tags greatly appreciated).

Edit -----

I realised I missed out a chunk about looking for help with the programming.  I have read a lot of math algorithms but converting what I am learning into code is proving more difficult.  Ideally I'd like links/references to solutions for this from a C# perspective, to help me see my way past issues like the one below.

I have a function in math:
    BetaCDF(x,a,b) = (x>=1)?1:(x<=0)?0:sum[k=1:b] ( Gamma(a+k-1)/(Gamma(a)*Gamma(k)) * xa * (1-x)(k-1) )

that i am trying to convert into a function.  I have everything covered except for the sum.  I need to sum b times the function on the right, however I cannot figure out how to do this in Unity C#.  The function currently looks like this:

public static double BetaCDF(double x, double a, double b) {
    double k;
    return ((x >= 1) ? 1 : (x <= 0) ? 0 : Sum(k = 1,b )(Gamma(a + k - 1) / (Gamma(a) * Gamma(k)) * Math.Pow(x, a) * Math.Pow(1 - x, k - 1)));
}


texts: 2d Tower Defense - Projectile Prediction

texts: For my map, it's very curvy and the node sizes aren't consistent. I have everything finished so that projectiles will actually fly at an enemy, however if a projectile is going too slow it will miss. I am wondering if I should just go the easy route, and just make the projectile homing, or if I could get help here on where to start. The enemy is changing directions, and moving around, although never changes speed.


texts: Is it possible to update the livetile in XNA WP7 game?

texts:
( I'm not sure if this question belongs here, but since it is related to game development and I have no idea where else I should post this, I will post this here )

As the title says, what I am basically asking is if it is possible to update the livetile of an pure XNA game ( not SL + XNA hybrid )?

I've been thinking something like that whenever user launches the game, I would create an texture dynamically and then update the livetile to show that texture. Even better would be if I could schedule this code to run for example once a day, without requiring user to even launch the game.

Is this possible in WP7 or in WP8 ( is the WP8 SDK even publicly released yet? ) in pure XNA game? What about in XNA + SL hybrid?


texts: .png file to Sprite(2D and UI) - still not visible under source image

texts: I am trying to use an image as a UI Image but even after changing its texture type to Sprite(2D and UI), it isn't visible in the source image menu. The file was created in MS Paint and I'm accessing the source image menu via the "circle selector" next to Source Image in the Inspector. I'm pretty sure I've never had this issue before. I wish I could share more details but there's nothing much to say. What could be causing this issue?


texts:
I want to make a mod for Age of Empires 1 Definitive Edition, in which I split an existing civilization (Phoenicians) into two civilizations:

Eastern Phoenicians: Primarily representing Canaanites
Western Phoenicians: Primarily representing Carthaginians

I want to do so to fix an historical mistake in the development of AOE1 in which the Phoenician tech tree includes war elephants:
As far as I know --- none of the Eastern Phoenicians regularly used war Elephants in their armies:

Eastern Phoenicians from north to south and west to east:

Kingdom of Ugarit | Mittani polities
Kingdom of Tyre   | Kingdom of Aram-Damascus
Kingdom of Israel | Kingdom of Ammon
Kingdom of Judah  | Kingdom of Moab
Kingdom of Edom   | Nabataean polities

My problem

As a webmaster coding primarily in Bash-HTML-CSS-JavaScript-Wiki-Markdown stack who never wrote a GUI program with languages common for the task (such as XML, C++, C# and others) I have no idea where to start.

My question

How to create a new civilization mod for Age of Empires 1 Definitive Edition?


texts:
I use Unity, and I need a shader a bit special.
Unfortunatly my skills about shaders are very limited and I need this shader quickly.

So I want a shader to display a unlit texture on a plane, and when a light affect the plane, instead of make the lighting on the plane, I want that the light change the alpha to make the "lighted" surface transparent.

I think that it's not very hard for someone who know how to make shaders, so if you can help me to do this, it can be very useful for me!

Edit:

Ok, maybe it's not very clear.

I speak about a light, but it's not necessary a light, it can be with an other type of object, or just a position.

What I want is to have an unlit image, with a movable circle zone on this texture which make the zone transparent, like the white circle on this picture (imagine that the with is just the transparency).

The border shouldn't be necessarily with smooth border, it will be also fine with an hard border.

I have thought about a spotlight, because it's like move a spotlight on the picture, but instead of doing the lighting, I want to set the "lighted" pixel transparent (but it's not lighted, it's just to explain what I want), a,d it's not necessary with a light

And yes, the unlit shader can't do this I think, I probably need a custom shader but I don't know how to this (I have thinked about take a basic lighting shader, and use the computed intensity of the light on the pixels to set the alpha instead of use it to set the intensity of the pixel, but I don't know exactly how to do this)


texts: Script Component not Being detected by Vuforia's Default Trackable Event Handler Script

texts:
I have a Script Component named Start inside a GameObject named StartSpawn and I am trying to run a function from Start when the target is found but Unity/Visual Studio is not detecting the Start script component. I even tried restarting both Unity and Visual Studio to only worsen the problem. When I opened both programs again and inspecting the code, the code I added was deleted and the script DefaultTrackableEventHandler.cs was back to its original code. Btw, the function I'm calling to Instantiates a Prefab.

Here's the code inside the DefaultTrackableEventHandler.cs:

protected virtual void OnTrackingFound()
{
    if (mTrackableBehaviour)
    {
        var rendererComponents = mTrackableBehaviour.GetComponentsInChildren<Renderer>(true);
        var colliderComponents = mTrackableBehaviour.GetComponentsInChildren<Collider>(true);
        var canvasComponents = mTrackableBehaviour.GetComponentsInChildren<Canvas>(true);
        //test
        Start summoner = GetComponentInChildren<Start>();

        // Enable rendering:
        foreach (var component in rendererComponents)
            component.enabled = true;

        // Enable colliders:
        foreach (var component in colliderComponents)
            component.enabled = true;

        // Enable canvas':
        foreach (var component in canvasComponents)
            component.enabled = true;

        //test spawn
        summoner.OnAppear();
    }
}


texts: How do I efficiently manage a tile-based map with items and characters?

texts:
I'm working on a simple C++ game to learn the language. It's ASCII, and features a tile-based map, enemies and items that spawn randomly. The player is, as usual, the '@' character. I'm trying to find the best way to handle the map and characters. I have the map in a 2D vector. Originally, it was a vector of characters, but then that became too hard to manage and too fixed, so the map is now a 2D vector of Tile objects. My enemies are contained in a vector called NPCs, and the items that get spawned are contained in a vector called Items.

My problem is in handling the relation between my map tiles and enemies/items. When an enemy stands on a tile, I have a pointer in the tile that points to that enemy, called npcPtr. Same goes for items, with another attribute of that object called itemPtr. This creates problems, because when an enemy dies and gets deleted from the NPCs vector, the pointers in the map don't dynamically update, and now point to the wrong enemies. The same happens for items. I partially solved this by updating the pointers in all the tiles after every move, but that does not seem like the best approach. How should I handle this tile/character relation?

I read this similar question, and that's pretty much how I handle things, but it doesn't seem to be an optimal approach. The advantage to having pointers in the tile is that I can check whether that tile is an enemy, an item or nothing; I don't want to lose that functionality. I can also obtain the NPC/item data right away, using the pointer, without having to parse through the NPCs vector.

My Code:

vector <vector <Tile>> _level //this is my level vector
vector <Character> _NPCs //this is my enemies vector

Making a new tile

Tile t //and then I set the tile parameters

Adding a tile to the level

levelLine.push_back(t)

Adding a whole line to the level

_level.push_back(levelLine)

Making an enemy

Character c //and then I set the parameters

Adding an enemy to the _NPCs vector

_NPCs.push_back(c)

Positioning the enemy objects in the level

//for j in level lines and k in level colums
if (j = _NPCs[i].getY() && k = NPCs[i].getX()){
    _level[j][k].setNPCptr(&_NPCs[i]); }

Handling enemy death

//re-initialize tile where enemy was to empty tile,
//_NPCptr gets set to nullptr
_NPCs.erase(_NPCs.begin() + npcPosition) //erase NPC from enemy vector

for (size_t i=0; i<_NPCs.size(); i++){
    _level[_NPCs[i].getY()][_NPCs[i].getX()].setNPCptr(&_NPCs[i]);
}


texts: How to detect when a moving rectangle (sprite) is tapped

texts:
I am new to Monogame. I am currently developing a simple game, just to learn some basics of Monogame development.
The idea here is to detect whether or not the user has tapped on a a rectangle (represented by moving sprite) and return true if they did or false if they did not, but it always returns false, even if I tap on the sprite. The pertaining functions are here:

// Part of Update function
protected override void Update(GameTime gameTime)
{
    touches = TouchPanel.GetState();

    if (CheckRectangleTouch(arlington.BoundingBox, touches))
    {
        arlington.spritePosition = new Vector2(200, 200);
    }
    else
    {
        arlington.spritePosition = new Vector2(100, 100);
    }
}

// Collision function
private bool CheckRectangleTouch(Rectangle target, TouchCollection touchCollection)
{
    if (touchCollection.Count > 0)
    {
        if (target.Contains(touchCollection[0].Position))
        {
            return true;
        }
    }
    return false;
}

Any idea why is this code not working, or about a better method for collision detection?


texts: Connecting two arbitrary points with 2 lines

texts:
DEFINITIONS:

Any "Point (x, y)" mentioned below is really the bottom left coordinates of a 1 unit by 1 unit rectangle. A "Line" is a defined as a rectangle that is either 1 unit tall and 1 unit or greater wide, or 1 unit wide and 1 unit or greater tall. These rectangles are constructed given a Rectangle(bottomLeftX, bottomLeftY, width, height). The height and/or width can be negative. If either are it will shift the start x or y accordingly as so:

public Rectangle(int x1, int y1, int width, int height) {
  _left = x1;
  _right = x1;
  if(width < 0)
    _left += width;
  else
    _right += width;

  _bottom = y1;
  _top = y1;
  if(height < 0)
    _bottom += height;
  else
    _top += height;
}

THE GOAL:

Given two arbitrary points, define two lines (as rectangles) connecting the two points. The two lines need to randomly 'bend' at one of the two possible connections (see below). The two points aren't in any specific order. Point A's X and/or Y can be above, below or even the same as Point B's X and/or Y.

THE PROBLEM:

I have made a solution that only partially works. There is a bug in my method below where sometimes the two lines do not connect at the bend/junction. It seems to only be when the bend/junction is in the bottom right of the points' bounds.

WHAT I HAVE NOW:

A little background: I'm working on a random dungeon generator. I create rooms randomly, and then I am going to connect them using the described point and line system above. Here's what I have now. "graph" is a Map>, technically it's directional, but the reason was so that I wouldn't draw the same lines twice.

int x, y, dx, dy;
Rectangle a, b;
// loop through each edge of the graph
for(Rectangle outer:graph.keySet()) {
  for(Rectangle inner:graph.get(outer)) {
    // randomly set a and b
    if(random.nextBoolean()) {
      a = outer;
      b = inner;
    } else {
      a = inner;
      b = outer;
    }

    // generate the origin points based on a
    x = (int) a.getCenterX();
    y = (int) a.getCenterY();
    // and the delta of b to a
    dx = (int) b.getCenterX()-x;
    dy = (int) b.getCenterY()-y;

    // create line starting at a, then
    // create line starting at end of above line
    lines.add(new Rectangle(x, y, dx, 1));
    lines.add(new Rectangle(x+dx, y+dy, 1, -dy));
  }
}

Here's what it produces. Most of the time it works, however there are cases where the corners do not line up. I'm not sure how to fix this.

Any input is much appreciated.


texts: Player experience using a server in single player adventure to prevent cheating

texts:
I'm making a game where the user can sell items he finds during the the "single player" adventure on an online, I was looking at ways to prevent any malicious user to create rare and expensive items from scratch to sell them on the net.

I tried obfuscation but soon or later someone will successfully break into my code and I can't afford that, for obvious reasons.

Items are stored in files, so I thought about making client add a digital signature to generated files but I have to keep the key on the client machine, so same problem: if someone finds his key he can apply digital signature algorithm to generate the valid key for any file he creates.

So I ended up think the only secure option was to make the single player adventure interact with the server (everyone around here tends to say this is the way to go, like this subject, in my opinion the accepted answer explains it well).

But what about the user-friendly aspect?

My game is divided in two parts. Firstly the "real" single player adventure, where you can cheat all you want because everything is stored on your pc and server won't ever use it (~24h), then you beat the final boss and you're notified you're able to go online to battle against other players with the stuff you acquired on the single player map. At this point of the adventure, my idea was to record everything the player is doing in singleplayer mode onto the server, so whenever he plays a tournament, his stuff is verified.

I can't verify stuff just before a tournament begins because overpowered items can be obtained but are very rare, I want to systematically know if it was hardly-obtained or cheated.

Do you think it would be acceptable for a player to play "single player mode using internet" if he was told this will allow him later to rank up online and be

The single player map will be kind of mixed with the multi player area, but maybe I can think about a feature to play totally offline but then you won't be able to use your "online items" during this time.

EDIT: My app might outputs txt file (representing an item) with its corresponding digital signature, so I just need a way to be sure that it's my app (and not a modified copy) that has created a given file. That's why I'm reading about Trusted computing and Memory curtaining right now, but maybe I should head to security.stackexchange?


texts:
I'm trying to make a sniper aim prediction for an Unreal Engine 4 game. I've found this interesting question Projectile Aim Prediction with Acceleration, and I tried to implement in C++ what DMGregory said. The result I got isn't bad at all, but I've some doubts about something in his explanation.
First, what does he mean with v_T? Should I calculate it as FVector v_T = targetVelocity - myVelocity; or as FVector v_T = targetVelocity - myPosition;? The vectors myVelocity and myPosition are respectively the velocity and the position of the shooter (me).
Then, I noticed that the sniper projectile trajectory doesn't seem to be a perfect parabola, so I avoided the v_p calculation, and I've simply calculated the predicted target position as

FVector predictedTargetPosition = targetPosition + targetVelocity * deltaTime + targetAcceleration * deltaTime * deltaTime * .5f;

where the 3 vectors targetPosition, targetVelocity and targetAcceleration are relative to the game world axis.  After that, I simply added to the Z component of the predictedTargetPosition the following amount:

recalculatedTargetPosition.Z += fabs(bulletAcceleration.Z) * deltaTime * deltaTime * .5f;

in order to compensate the loss of height of the projectile in time.

What do you think about it?

Thanks in advance.


texts:
I am coding a simple 2D engine to be used with HTML5. I already have classes such as Picture, Scene, Camera and Renderer, but now I need to work on Animations.

Picture is basocally a wrapper for a normal image object, with it's own draw method, but this is unrelated, I'm interested in how animation in 2D games is usually done.

What I planned to do, is to have the Animation class as well act like a wrapper for a few image objects, and then have methods such as getCurrentImage, next and animate (which would use intervals to quickly change the current image). I meant to feed the animation a couple of PNG's at inicialisation.

Is quickly swapping PNG images acceptable for 2D animation? Are there some standard ways of doing this, or are there flaws in my ways?


texts: Camera Transition between 2 position / rotation, and follow a 3rd target

texts:
I have setup a transition of camera between 2 transform, here the result in video:
https://youtu.be/rcwQ6KuEfMw

I have the information of the 2 transform:
- position (vector3)
- rotation (Quaternion)

And I do a Lerp, from Position1 to Position 2, and from Rotation1 to Rotation2:

Vector3 finalPosition = Vector3.Lerp(previousPosition, nextPosition, evaluateValueLerp);
Quaternion finalRotation = Quaternion.Slerp(previousRotation, nextRotation, evaluateValueLerp);

Now the problem is, as you can see in the video: the player target (the car) is lost durring the transition, I would like to keep it always in the view.

How can I manage to do it ?

Thanks you !


texts: Move component to: where to with child components?

texts:
I have a simple static mesh attached to a scene in a blueprint. I want to move the component back to (0,0,0). If a component is not attached to any other component other than the default scene root, I just type in (0,0,0) as the Target Relative Location.

To be precise, I don't want it to go to (0,0,0) but head there and stop, so I just give it the world location and then multiply X, Y and Z by 0.67 (could be any value).

But now I have a few child components attached to an extra scene. This scene is moved (-2460, 3070, 2600). Now to make matters worse, it's ALSO rotated (0°, 0°, 90°) and every component I try to move is ALSO rotated by (0°, 90°, -90°). The numbers themselves aren't hard to crunch but I have no idea what "Target Relative Component" should be now.

I tried adding vectors, subtracting vectors (both relative and world from both the parent and every child component I want to move), inverting transforms, transform directions, rotating the  resulting vectors, unrotating the resulting vectors, nothing seemed to work, at least not the combinations I tried.

How do I get the correct Target Relative Location?


texts: Non-real time simulation of overlapping repulsive balls

texts:
I want to make a non-real time simulation of overlapping repulsive balls, initially in 2D and later in 3D. With "non-real" I mean that rendering is not needed after each time step.

First of all, consider a simple closed domain for simplicity. In practice, domains will be complex and irregular but always closed.

The balls on the boundaries are fixed and could be overlapping. A fixed ball duplicates itself to produce a free ball of the same size whenever no other ball overlaps it. Both fixed and free balls repel each other but fixed balls cannot move. Note that, duplicant ball should be sufficiently tilted to start repulsion. In elastic colliding balls case, after two balls collide they change direction with some velocity but in this case the balls can stop quickly once they stop overlapping. Free balls move until there is no motion or let's say we solve motion problem until convergence. Then each fixed ball produce a free ball again and this process goes on until no fixed ball can duplicate due to being overlapped by any other ball(s).

I think GPU (CUDA) would be faster to solve this problem but initially I am thinking to write on CPU. However, before proceeding to coding I would like to know "feasibility" of this work. That is, considering a million of balls, approximately how long it would take to simulate this or similar kind of problems in non-real time. For a million of balls, if solution time is in order of minutes, I will dive into the problem. So, my question to experienced programmers is that approximately how long it takes to simulate this kind of problem for a millions of variables? Is it in order of seconds, minutes or hours?


texts: Persistent variable for all list members inside a loop called every frame

texts:
I'm trying to add a sort of manager to handle all objects in a list and increase a float value that each individual member of the list has given a condition every single frame. I'm having some trouble wrapping my head around the actual code I need though.

So say I've got an OverlapCircleAll or trigger checking for tagged objects in a certain radius. These objects are then added to a List (foo).

Then, I go through foo with a for loop and declare a float value x for each object.

What I need is for each object's x to increase when the object is also on another list, bar.

So something like this:

for (int i = 0; i < foo.Count; i++)
{
     float x;
     //or float x = 0;?

     if (bar.Contains(foo[i]))
     {
          x += 1f;
     }
}

The problem is, I can't figure out how to make the value of x persist each loop. This function is called in Update() so the idea is that the longer an object is in both foo and bar, the higher its value of x is. I don't know how to save the value of x for the next loop though. Ideally something like:

for (int i = 0; i < foo.Count; i++)
{
     float x;

     if (lastX != null)
     {
          x = lastX;
     }
     else
     {
          x = 0;
     }

     if (bar.Contains(foo[i]))
     {
          x += 1f;
     }

     float lastX = x;
}

But I don't know a) how to save lastX for each object in the list and b) set x to lastX (because for each loop it creates a lastX).

I thought about storing each x in an array of floats and calling the corresponding array[i] to foo[i] to get x, but if I remove something from the list then the array will become desynchronised with the list and all the x values will get muddled up.

What is the correct way to go about this?


texts: Changing Spritefont Sizes Without Anti-Aliasing in MonoGame

texts: I'm using a custom font for a small game in MonoGame, and it is made on an 8x8 grid, so I have to scale it to make it bigger. Currently I am scaling the scale in the spriteBatch.Begin() method, but this means I have to call the End() and Begin() method for every font size I want, which is very inefficient. I found a solution online to prevent anti-aliasing for the Begin() method, but what I want to know is: is there a way to prevent anti-aliasing when scaling by changing the XML file of the spritefont? Any help would be appreciated! :D


texts:
When you are looking at this image:

the player is standing behind the tree. I know that can be accomplished by drawing the background first the player second and the upper tree part after that.

The thing is in the actual tileset there is only one tile that combines the background and the upper tree part:

So how is it possible that there are multiple z-indices within one tile.
Or is the game somehow extracting the upper tree part from the base grass texture and draw them like described earlier?


texts:
I'd to calculate the cartesian rotate values of "aiming" one point at another in 3D space.

For example, assuming rotation order of XYZ:
Point A is at [0, 0, 0]
Point B is at [2, 2, 0]

If point A was "aiming" at point B with primary (aim) axis X, secondary (up) Y; point A's rotate values would be [0, 0, 45]. These values are what I'd like to calculate.


texts: Instantiate a 2D GameObject in certain direction

texts:
I'm working in a Top-Down 2D Game, and i'm trying to avoid the use of rigidbodies and rotations, i manage the direction the player is facing via input and changing the sprites, but right now, i dont know how to shoot a bullet in the direction i'm facing.

I check the direction with the current SpriteRenderer.sprite, but i dont know how to Instantiate a GameObject like

Instantiate(bullet, transform.position, /** One of the Four Angles like (0,90,180,270)*/);

Any idea on how to aproach this?

Thank you.


texts: How to continue Lego microgame tutorial?

texts: I was passing Lego microgame tutorial. I closed it and quit Unity. Now, how can I continue it from the same place? If I opening it's project, I am getting just silent Unity project, without any guidance.


texts: Should your world map have it's own collision object?

texts:
I am attempting to understand collision detection at the moment. I have seen many examples of a simple flat plane with boxes or cubes which move around on the plane and react when the touch each other (or stop at the plane when dropped).

What I am not finding though are more advanced examples where instead of just a flat plane, your map is made up of hills, buildings, walls, etc.

Since all of the examples I have found this far use simple primitive collision object types (boxes and spheres), I am curious what the best approach would be for creating a collision object for something like a game map (like dust2 in counter-strike).

After reading through the bullet documentation I found that you can create a collision object from a triangle mesh, which leads me to believe this might be the best approach. However if your map consists of complex geometry (say hundreds of thousands of verticies and faces), would this be too detailed to use as a collision mesh? Would it then be better to create a separate collision version of the map which is made of simple low poly shapes?

My gut is saying "go with the separate low poly version", but if there is no reason for the extra work, it would make more sense to just use the high poly mesh.


texts: How to disable and enable a randomly generated prefab in an endless runner 3d

texts:
Hi all I have been experimenting the endless runner game for some time and needed to optimize it. I read some articles about optimizing my game and it says that once you instantiate the prefabs in the game, you should enable and disable paths at randomly so as it won't slow down the speed of the device. So I have been trying out some stuff. I managed to disable the randomly generated path but having a hard time re enabling them. Any help would be appreciated.

Here's my code and what I've tried.

TileManager.cs

public GameObject[] tilePrefabs;

private Transform playerTransform;
private float spawnZ = -19.0f;
private float tileLength = 24.0f;
private int amtOfTilesOnScreen = 5;
private float safeZone = 30.0f;

private List<GameObject> activeTiles;
private List<GameObject> deactivatedTiles;
private int lastPrefabIndex = 0;
private Vector3 transformTiles;

void Start ()
{
    activeTiles = new List<GameObject>();
    playerTransform = GameObject.FindGameObjectWithTag("Player").transform;

    for (int i = 0; i < amtOfTilesOnScreen; i++)
    {
        if (i < 2)
        {
            SpawnTile(0);
        }
        else
        {
            SpawnTile();
        }
    }
}

void Update ()
{

        if (playerTransform.position.z - safeZone > (spawnZ - amtOfTilesOnScreen * tileLength))
        {
            SpawnTile();
            DeleteTile();
        }

}

private void DeleteTile()
{
    //Destroy(activeTiles[0]);
    activeTiles[0].SetActive(false);
    activeTiles.RemoveAt(0);

}

private void SpawnTile(int prefabIndx = -1)
{
    GameObject go;
    if (prefabIndx == -1)
    {
        go = Instantiate(tilePrefabs[RandomPrefabIndex()])as GameObject;
        go.SetActive(false);
        deactivatedTiles.Add(go);

    }
    else if (prefabIndx!=-1)
    {
        go = Instantiate(tilePrefabs[prefabIndx]) as GameObject;
        go.SetActive(false);
        deactivatedTiles.Add(go);
    }

    else if (deactivatedTiles != null)
    {
        go = deactivatedTiles[0];
        go.SetActive(true);
        go.transform.SetParent(transform);
        go.transform.position = Vector3.forward * spawnZ;
        spawnZ += tileLength;
        activeTiles.Add(go);
    }
    //activeTiles.Add(go);
    //go.SetActive(true);
    //deactivatedTiles.Add(go);
}

private int RandomPrefabIndex()
{
    if (tilePrefabs.Length <= 1)
    {

        return 0;
    }

    int randomIndex = lastPrefabIndex;
    while (randomIndex == lastPrefabIndex)
    {
        randomIndex = Random.Range(0, tilePrefabs.Length);
    }

    lastPrefabIndex = randomIndex;
    return randomIndex;
}

Here I have pasted the code of What is needed for a solution and what Have I tried


texts: Box2d: Destroy body or setActive to false?

texts:
What is better practice when a body goes out of screen, to destroy the body or just setActive(false)?

I guess in terms of memory it is better to destroy it and free the memory, but is destroying bodies expensive?


texts: How do I clear up artifacts between aligned faces when using AA in XNA 4.0?

texts:
I'm working on a graphics engine that lets you walk around a world that is made up of cubes (voxel engine) and I'm having some difficulties getting the results I want.

I'm not the best at 3D graphics, but I'm willing to learn. When I have anti-aliasing turned off, the textures line up properly together on the surfaces, but when I turn it on, I see a lot of lines between each square face. I've taken a picture:

I've tried changing the mip map mag filter options on the sampler, but cannot get it to look right. I've tried increasing the quality of the textures, but that doesn't help either. When I use Linear TextureFilter but that just makes everything super blurry, and the edges are even more obvious. In fact many edges get some blurry white and dark color to them. Anisotropic doesn't help.

Nothing I do seems to get rid of those lines in between faces when I have AA turned on. Anyone have any advice on where I would start looking? I'm assuming it's because all of the faces are individual, and not mixed together when they are next to each-other. Not just the edges are being anti-aliased. Not sure if I'm even on the right track with that thought.

I'm using XNA 4.0 to do this.


texts:
I searched the whole internet, but I couldn't find something useful.
How to do picking (like ray picking) in lwjgl in orthographic mode (2d)?
I think this is less confusing than picking in 3d, but I really can't figure out how to do it.
Picking for rectangles is easy because you can use the mouse coordinates and the quad coordinates and test if the mouse coords are inside the area of the quad.
But my biggest problem is how to do this with rectangles, and circles? Or quads that looks like a circle because I use a texture of a circle (with transparent corners).
Please can someone explain it to me?


texts: Rotating the view around the origin of the world coordinate system

texts: In OpenGL (using shaders), I want to implement a system that will take the user's mouse as input, and then rotate the view about the origin of the rendered scene. So, I need to compute the view matrix (assume the model matrix is identity) that represents this rotation. If the view were to rotate around its own origin, then I could do this by applying a simple rotation operation to the view matrix. However, I don't want to do this -- I want to rotate about the origin of the world coordinate system. So, given a rotation angle "theta", how can I compute this matrix? Thanks!


texts: Algorithm for securing a retro password system

texts:
For a game I am working on, one of the build targets is the Unity Webplayer, which does not support saving file I/O at all.  However, as it's an action/adventure game based on Zelda 2: The Adventure of Link, I would like to provide my players the capability to save their game somehow.

In light of the webplayer limitations, I was going to circumvent it by creating a password system that the user could simply enter to resume where they left off.  Said password would convey various things about game state, such as event flags, and picked up item flags (true to the game this is based off of, loading a game restarts the player in a pre-determined location.)  This is also convenient for other modes, because the save system would be merely responsible for storing this password, as the password is a compressed version of the game's state.

My understanding is ideally, said setup would just entail creating a series of bits, represented by a complex character (such as, a digit or hexadecimal character) which could be stored in some larger value, then unpacked when entered by the user.

Of course, there's a problem, and that's security.  I have to assume some less-honest player knows the sequence of flags and how to recreate them.  From what I understand, a way to get around that is to append some sort of checksum to the bit sequence.  If that checksum fails, then the system knows that the code is bogus, and to do nothing at all.  Of course, I would also assume that the attacker would be aware of said checksum's existence.

Question: what are some good ways I would go about securing a save-state password as described above to make it less-able to be gamed by cheaters?


texts:
Right now I'm using Bresenham's line algorithm for line of sight. The problem is I've found an edge case where players can look through walls. Occurs when the player looks between two corners of a wall with a gap on the other side at specific angles.

The result I want is for the tile between two walls to be marked invalid as so.

What is the fastest way to modify Bresenham's line algorithm to solve this? If there isn't a good solution, is there a better suited algorithm? Any ideas are welcome. Please note the solution should also be capable of supporting 3d.

Edit: My simple solution was to check if both corners are closed when a line's x and y coordinates change. For the working source code and an interactive demo of the completed product please see http://ashblue.github.io/javascript-pathfinding/


texts: How can I measure the execution time of some code?

texts:
How can I capture how long something takes to complete and log it to the output window (in Visual Studio)?

Is there a special library for this?

clock_t start, end;
double cpuTime;

start = clock();

//....bit to be timed

end = clock();

cpuTime= (end - start) / (CLOCKS_PER_SEC);

OutputDebugString(TEXT("Time: %d", cpuTime));

This code might work but where does it come from?  A special include?


texts: How can I convert a paid iOS game to a free game with in game purchases?

texts:
I have developed a game for iOS that has had a decent amount of downloads, but I think I would get significantly more revenue if I were to convert the game to free to play, with in app purchases (especially since some competitors products are now free to download with in app purchases).

My question is what is the best way to go about converting to a free game with in app purchases without annoying the existing users?

On upgrading I'd like the people who previously paid for the app to have access to all the in-app purchases because I don't want to make them have to pay for content they previously had, and I don't want to make all the content (that is currently in the game) free.


texts: What are some standard stair dimensions for good level navigation?

texts:
I am trying to establish some scale standards for a level. I have been following this guide: http://www.worldofleveldesign.com/categories/ue4/ue4-guide-to-scale-dimensions.php

So far I have walls at 3m high, doors at 2.1m by 1.1m, with the character standing at 1.82m by 0.6m. I am now trying to work out a "good" staircase size. I have tried the above guide's suggestion of 0.15m high by 0.3m deep for each step. To reach 3m however would require 20 steps with these dimensions, which means a single staircase would be 6m long! Visually this looks quite silly in my opinion. If I compare this to real life using the following calculator: http://www.calculator.net/stair-calculator.html,
using realistic step heights and depths the same staircase can be achieved at less than 4m length. This seems more realistic to me.

My main concern is not simply the visual appearance of the staircase, but how much space it will take up in a given building. If in each smaller building the staircase is taking up the majority of the floor space, this won't leave much for the more important elements. At the same time, I am concerned that if I make the staircase too steep it will have a negative effect on the gameplay and navigation. I understand that each level is different, however is there a good rule of thumb for getting started with this?


texts: What are the reasons to reset MMR and introduce seasons?

texts:
I have a game with a ranked mode that keeps track of MMR.

Players have been asking me to have "seasons" so we can reset it and help people who are "stuck in ELO hell" climb better.

My thought is that people who are stuck in elo hell are just bad and that resetting per-seasons are pointless, why not just climb? I'm going to add rewards for the highest rank achieved every 4 months but not reset MMR.

Is there any real reason to reset MMR?


texts:
my game features several tilemaps that are initially loaded from a tmx file and modified during gameplay.
How can I save the changed tilemaps in a save game? Will NSCoding do the trick here or is the CCTmxTiledMap object too complex for that? How would a sample implementation look for this problem?


texts:
EDIT: I've removed some vagueness and replaced it with more of a description of the intended use case.

I'm looking for some suggestions for ways to infer what the player's "forward" vector is in a room-scale 360 experience.
I'm not currently worried about extreme edge cases, especially if it sounds like the user may be intentionally not doing the intended thing, but I am interested in getting a decently accurate forward vector when they could be looking or facing any direction.
I also don't care about "upness" or magnitude of the vector, so it'll end up being projected onto the (Unity's) X/Z plane and normalized.

I'm exploring the idea of punching as a means for locomotion. The player should move in the direction that they punch, which in itself I feel is an easy solve. The problem is, much like the problem of arm-swing movement, it is very hard and unnatural to punch exactly straight forward. People tend to punch at least a little across their body. This causes the player to weave back and forth through the world, like some sort of drunken master.
I don't like the idea of using the headset's forward vector either. I want the player to be able to look around while playing; I feel it is an integral part of the experience to be able to look ahead one punch and plan the next move.

It's also important that sensor set up and room orientation should not be taken into account. I'm looking for something that could work in a large space with 360 tracking.

I've considered:

Grabbing an average position of the hands, getting the vector from the head to this new position. This is where I've spent most of my time, I think. I've tried a weighted average, where hand position gets more or less weight depending on distance from head. In practice, this ends up exacerbating the problem
Grabbing the vector from the head to the dominant hand
Dropping a raycast to the floor and using the hit geometry's forward vector
Getting a complicated IK rig setup, potentially hiding the geometry, and using the rig's hip placement/orientation to infer "forward"

None of these quite feel right to me, although the average-hand-position vector feels the right-est.

Is this a solved problem that I'm just not searching hard enough for? Anybody else have interesting solutions to this problem? Am I being too vague and should really just seek out a solution for a much more specific use-case and be happy with that?


texts: What angles and long-side/short-side ratios give the most aesthetically pleasing and graphically regular isometric (squashed and flat side up) hexes, that additionally resolve to whole pixel sizes for several sizes when rendered?


texts: How can I create a tile set that will allow me to render a soccer pitch in perspective?

texts:
I am making a soccer game that needs a large pitch image (the whole play field area is about 3300 * 1200 pixels).

I know I should use the Tiled map editor to create a tile map so that I can create the whole soccer pitch by using just a few tiles, but I'm not sure how I can create a tile set that will allow me to create good-looking fields like in these games:

As you can see, the soccer pitch is not a rectangle but more of a trapezoid, so it changes the way we draw border and grass stripes. The grass stripes are sloping, and the slope changes the closer they are to the goal. That makes it very hard to replicate in a limited amount of tiles.

Currently, I have 3 layers for my field. Each tile is 64 * 64 in size, and I create them this way:

The border tiles. Since the border is not repeating, I take the border, cut it up into tiles, and add them to the tile set. It's fussy, but it seems this is the only way.
Light colored grass. I have a single, repeating 64 * 64 tile that is used to cover the base layer of the field.
Deep colored, sloping stripe grass. This is the one I can't figure out how to create.

How can I create that last set of tiles or otherwise achieve my effect?


texts: Is there any good book or tutorial that explains the physics behind creating a 2D Platformer game? Such as tile rendering, tile map reading, collision detection, camera movement etc.?


texts:
I have a set of vertex locations to create a plane:

this->Vertices = {
    // position         // color          // texture
    -0.5f,  0.5f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f,
     0.5f,  0.5f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
     0.5f, -0.5f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f,
    -0.5f, -0.5f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f
};

Everything is fine, but I can't grasp how I should input these values at the very beginning. I used to give exact locations for vertices in DirectX in pixel unit, but here in OpenGL I should give vertex locations in normalized coordinates.

If I wanted to create a plane say 200px by 200px how should I deal with that when I set vertex data. I know I can transform my plane with coordinate matrices through model space and view space and etc. I just don't know what I should be giving for the initial vertex location values.