texts: Why aren't ModLoader's decompiled files showing up?

texts:
I want to start making a Minecraft 1.6.4 mod, but have this trouble with ModLoader:

I've run the decompile.bat batch file, but when opening the eclipse folder, the bin folder is empty. The batch file ran fine with no errors, and /src/minecraft/net/minecraft contains many decompiled java files, but no modloader files like BaseMod.java.

If I open this folder with Eclipse, the package explorer menu stays empty.

What's happening here?


texts:
I'm planning on building an online presence of a game I'm working on once it reaches a stage that would allow for creating marketing material (screenshots, trailers, etc).

Should I trademark/copyright my game before I start building online presence?
How long does the trademarking/copyrighting process take?
How much money can it cost?


texts:
I have been making a turn-based board game in UE4 and have come to the point of making a first pass on the AI. I planned to use Monte Carlo Tree Search but this requires you to make (at least) one copy of the game state for each simulation. I am guessing that I will have to do  hundreds of simulations per move.

I am fairly new to UE4 but the problem is that there isn't really a separation between view and logic (at least the way that I have programmed it!). For example I have actors which contain their static meshes, current material etc as well as their logical state. I think in UE4 to create a real deep copy I would have to spawn new actors etc. Obviously in hindsight I have  made a big mistake and should have realised this earlier so that I could have switched to a different engine, but too late for that now.

Neither of the ideas that I have come up with are good:

1) Implement a special copy function which sets the static mesh etc to nullptr. I am not sure how Unreal will react to creating all of these actors but not spawning them in the level, my experience up to now suggests not well.

2) Make AI versions of all classes e.g. an AIUnit class which can be constructed from a normal Unit class but only initialises the minimum required data. I think this would work but it would be painfully inelegant with the obvious downside that I will essentially have to maintain two almost identical games and keep the rules in sync.

MCTS with UE4 doesn't seem to have many hits on google so any advice would be appreciated, I am willing to sacrifice some dead time e.g. wait 1 second every turn for AI "thinking" time.


texts: Fair monetization of a MMO with a simulated economy

texts:
I am in the design phase of a MMO game based around flying age-of-sail airships.  Players will be able to captain their own ship (owned by their  in-game nation or faction or themselves if they become sufficiently wealthy), or play as a crewmember on their own or another ship in battle , or as ground defence personnel when their own ship becomes too boring.

The players might also design or redesign the flying sailing ships (and later, as technology progresses, flying steam or diesel ships), and test new ship design, or plan ground defences.

All of this would be based around a simulated economy, where resources are produced, shipped and either consumed or lost to make value-added foods, commodities, communities or vessels.  In a war, commerce raiding should - eventually - have an impact as much as direct military action against enemy troops and vessels.

Players could be merchants, pirates, smugglers, privateers, naval captains, or just another member of a ship's crew.  Players could also design airships and ground defences, and contribute to the governance of their province.

So, for all of this, how can I monetize this game?  I need to consider startup capital, but more importantly, it needs to make a profit.

However... I don't want to fall into the ways of many games with micro-transactions.   That means no pay-to-win - a paying player must have only their own skills and equipment to help them win against a free-to-play player... if I go with that method.

The economy is simulated, and I would like the method of monetization to have a minimal impact on that, but not necessarily no impact. Players must know exactly what they are spending their in-game currency upon, an must be able to sell for in-game or possibly even real currency any 'physical' game object - with a cut to the broker (i.e. the developer).

I have considered an up-front cost, but that alone does not guarantee an income stream as the player base becomes saturated.  I have considered instant IAP of objects that would otherwise take time to produce - the player buys them from the developer's nation.  I have considered allowing a certain amount of free screen time per month, extendable by a purchase.

What methods would guarantee continual income for a number of years at least, without unduly upsetting players who may be wary of traps such as loot chests or pay-to-win?  Can a game such as this be funded prior to the commencement of development?


texts: I can't seem to figure out what's causing this bug with the "layout" keyword in GLSL

texts:
I have a GL shader file whose first few lines currently look like this:

#version 120
layout (location = 0) in vec3 position;
layout (location = 1) in vec2 vertexUV;

When I try to compile this shader when running the program, it returns this error:

0:2(1): error: syntax error, unexpected NEW_IDENTIFIER

From what I know, this means that the word layout is giving it trouble. What am I doing wrong? Do I need to provide more information?


texts: How to know if a game concept is "different enough"?

texts:
For the past year or so, I've been designing a top-down zombie shooter game. However, after playing a 2d top-down battle royale game, it's given me inspiration to build a similar game. The graphics would be very similar, though there would be new things like building.

I'm trying to decide if this concept is different enough; there's another similar game, though it has different graphics and some other key differences.

I'm wondering at what point two games become too similar, and how to avoid taking too many ideas from one game (a common problem for me).


texts: Unity2D: Don't Destroy On Load UI button

texts:
I have a UI button as a child under my background canvas. What I want to do is to save the button through out scene, I tried using DontDestroy OnLoad but It saved ay canvas and everything under my canvas, rather than saving just the button. Anyway this is my DontDestroyOnLoad script:

void Awake()
{
    DontDestroyOnLoad(transform.root.gameObject);
}

Thank you. :)


texts: If I want to create game for mobile and tablet on android and ios, which aspect ratio or screen resolution should I use?

texts:
Now my game is currently use 3:4 aspect ratio ,which is 480*640
, so my game has the letterbox (I don't like stretch) on my android mobile and my friend mobile. I don't like letterbox, so I have just change color of my letter box to the color that blend with my game background, but I don't like it either. So now I think about change aspect ratio and screen resolution of my game.

how about 480x800 ?


texts: Inside the game loop, the game is paused by pressing P, meaning that the game loop does not run anymore. Problem is that after this loop is halted, P cannot be pressed again to resume the loop, since it was inside the loop itself. How to make it so that when P is pressed again it makes the loop work again?


texts: Nav Mesh Agents are not moving along the mesh

texts:
I'm fairly new to unity.I've been playing with Nav Mesh Agents lately.I have encountered this problem twice.The first time I didn't bother redoing my project all over again.But now its bothering me too much.
I initially had a NavMesh baked along the road in my game.But later I had to change the layout of the roads, hence I had to rebake the Nav Mesh.
But now I'm having the problem where the agents are not moving along the Nav Mesh to Reach the destination, but instead they "try" to move along the shortest path.As a result of this all agents gather to a point rather than moving along the track.I've shown below a picture to better illustrate my problem.

They try to move along the red line instead of going along the road and then getting to the destination.
I'm pretty confident that nothing's wrong with my code because it worked earlier and works well in other scenes.Is there anything I missed when re-baking the Nav Mesh?Any help to get the agents to move along the road is much appreciated?
Thanks in advance.


texts: Google Sketchup pro exporter/importer for MD5 model format?

texts: Where can I find google sketchup pro MD5 (The doom3 model format) exporter/importer? If there isn't one what modeling program can I use to export/import MD5 models?


texts: How can i change door close/open speed in animator, and how to tell player if the door is close wait/idle until the door will open?

texts:
In the Animator window of the door i have two states: Door Open and Door Close.
And two parameters type of trigger: open and close.

In the two states Door Open and Door Close between them there are two transitions.
I didn't make any Has Exit Time but i did add in both transitions the triggers as conditions. On the Door Open to Door Close i added the close condition and on the Door Close to Door Open the open condition.

And the script that attached to the door:

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(Animator))]
public class DoorActivatorMecanim : MonoBehaviour
{
    private Animator DoorAnimator;

    void Start()
    {
        DoorAnimator = GetComponent<Animator> ();
    }

    void OnTriggerEnter(Collider col)
    {
        DoorAnimator.SetTrigger("open");
    }

    private void OnTriggerExit(Collider other)
    {
        DoorAnimator.SetTrigger("close");
    }
}

The door have a box collider component.

Now when the player is moving to the door when he get inside the box collider area the OnTriggerEnter is on and the door is open and stay opened until the player is moving out of the box collider area then it's getting to the OnTriggerExit and the door is close.

What i want to do is to control the door open/close speed. When the door open it open in medium speed but when the door is close it's shutting down closing at once very fast like the door is falling and not closing animation.

So i want to add another parameter in the Animator maybe type float and call it speed and somehow to control the close/open speed from the script.
So i added the speed float parameter but not sure how to use it in the script and control the close/open door speed:

And the second problem is if for example the player is running to the door and door open speed is slower then the player speed i want somehow to tell the player that the door is still close so idle until the door is opened when the door is opened then change from idle to walk/run again. But i'm not sure how to detect when the door is close/open and then how to tell it to the player.

Update the script with the speed parameter setting:

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(Animator))]
public class DoorActivatorMecanim : MonoBehaviour
{
    public float doorActivateSpeed = 1f;

    private Animator DoorAnimator;

    void Start()
    {
        DoorAnimator = GetComponent<Animator> ();
    }

    void OnTriggerEnter(Collider col)
    {
        DoorAnimator.SetFloat("speed", doorActivateSpeed);
        DoorAnimator.Play("Door Open");
    }

    private void OnTriggerExit(Collider other)
    {
        DoorAnimator.Play("Door Close");
    }
}

For some reason and i can't explain yet why the speed parameter is working only on the door open making it open slow but the door close is still very fast too fast the door is like falling/shutting down. And both open door and close door states and animation settings are the same in the editor.

Can't figure it out.


texts: How do i create bounding boxes with XNA 4.0?

texts:
I am having some trouble making bounding boxes for my models I am using within XNA 4.0. The way it was done in XNA 3.1 seems to be obsolete as you can no longer access parameters that were used before in XNA 3.1. Has anyone got any decent links I have been looking around the net for a while now and all I am finding is things for XNA 3.1 or below.

Help much apprechiated.
Regards
Mark

EDIT:

Hey, the problem i am having is getting the min and max points for my model i load through the content pipeline. as articles i have seen on how to do it tell you to do such things as VertexPositionNormalTexture[] vertices= new VertexPositionNormalTexture[mesh.VertexBuffer.SizeInBytes / mesh.MeshParts[0].VertexStride; but i can no longer call size in bytes and vertex strides within XNA 4.0


texts:
I read that you in theory can get vertex offsets from GPU shader in CPU by transpiling the shader to CPU callable code or creating a compute shader that calls the shader code (are there more ways?).
I am wondering how one should approach this if one wants to use a shader from shadergraph. Can I get the same noise textures on CPU as on the nodes in shadergraph (GPU) for example? They can be important in driving the result.
I think it is possible to export as hlsl so maybe transpiling can be done automatically.


texts:
I've got a an OpenGL scene rendered with a bunch of sprites, and I'd like to automagically add drop shadows to all of them.  Here's a picture showing what I mean:

The scene uses orthographic projection, the sprites are textured quads, and I'm using the depth buffer to draw them front to back.  I'm working with OpenGL ES 2.0, but thoughts from the iOS or non-ES worlds would be appreciated as well.  I've tossed a few ideas around in my head of how I can go about this, and I'd like to find out which has the most promise.

Draw each sprite twice, the first normally, the second with some kind of drop shadow shader a bit deeper in the scene.  Not sure if this is possible?
Draw a sprite, then draw it again, darkened and with some alpha, several times with some random jitter applied to the verticies.  This may look silly and not at all like a shadow.
Draw the base scene without background to a texture, then blur and darken it to create one large drop shadow.  Then draw the base scene over the drop shadow texture, then finally over the background.  This would lose the shadows between sprites, though.
SSAO in a post-processing pass.  Might be the most dynamic and automatic, but could look fuzzy/grainy and really slow things down.
At creation time, generate a shadow texture for each sprite.  For rendering, draw a sprite and then its shadow texuture a bit deeper in the scene.  I think I'd like to avoid this due to the loading time and extra memory requirements, but this may be the fastest and best looking?

I don't want to do any shadow work with external textures, since I use the same sprite textures at varying scales, and pre-baked shadows would scale unnaturally.

So are any of these better than the others?  Are there other options I'm not thinking of?  Thanks!


texts: Unity: How to create a selection box around gameObjects (Text or images) similar to those in Unity editor?

texts:
In my Unity app, the user has the option to input text and import images. I have implemented these using TMP_Input Field and Image/Sprites respectively. The app also requires that the user knows the currently selected text/image and can also drag these text and images and sometimes resize them.
To achieve this what I need is a UI like this.

This is the actual Unity editor. But I want to have similar box around my text and images in my app. So that the user knows the current selection and may also drag the text/Image or resize it using the blue circles in the corners.
I am not sure how I can achieve this. One way which I see is to have views which wrap my text and images and these views will have these boxes as the backgrounds.
But I thought that there may be an easier way to do this, probably something that comes with Unity since this looks like a general requirement to me. I am not sure though. What would be the best way to achieve this? WIll I have to do everything from scratch or are there any existing UI components or assets which can make this easier? Any suggestions are appreciated. Thanks!


texts: Is it possible to run two unity simulations at the same time on same computer?

texts: I know it is possible to open multiple unity projects at the same time on the same computer but is it also possible to run two unity projects at the same time and on the same computer. I tried running two unity simulations simultaneously, the one I run lastly, ran fine but the one which I ran first slowed down.


texts: Physics Object on Client moving too quickly in comparison to the Server: Should be a copy

texts:
I have a client server scenario. On the Server a force is applied to a 2d object. I want the client to copy the movements of the server but not through constant positional updates. My current approach is to send the objects name, position and speed to the client for the client to apply those to its own object and therefore copy the server. The speed is calculated by subtracting the last known position from the current one and working out the magnitude:

physicsManagerScript.SendInfo (transform.name, transform.GetComponent<Rigidbody2D>().position, (transform.GetComponent<Rigidbody2D>().position-lastPos).magnitude);

The position and speed are received via RPC and each go into a list on the client and then the client object applies these via Vector3.MoveTowards:

transform.position = Vector3.MoveTowards (transform.position, receivedPos [index], receivedSpeed [index]/Time.deltaTime);

My problem is that even though the same magnitude is applied on the client as the server, the clients object moves very quickly in comparison to its server counterpart. The server object bounces around and eventually slows, however when it is moving slowly the client object flashes to its new position. I dont understand why this is happening when it should be moving at the same speed as the server object. Any help would be greatly appreciated.

**Additional Info

I have an invokerepeating method on the server that every second sends the name, position and magnitude to a physics manager script. This physics manager script then RPC's the client sending the correct position and magnitude to the correct name of object. The client object places the received position and magnitude into seperate lists. Vector3.MoveTowards is then used to move the client object to its new position at a new speed. However the speed it moves at is very quick in comparison to the server, when i want it to copy the server. This is for a distributed physics project, ie the server handles the physics and sends down the appropriate info without the client using any physics.


texts: How do I programatically lay tiles with the Godot engine?

texts:
I am completely new to Godot Engine, and quite an amateur in game development, in general. I have a small project where I want to implement a procedurally generated level, and for that I'd like to be able to programmatically place tiles. I'm thinking about something like in this video for GameMaker, however, I haven't found a documented way to do that for Godot.

Does Godot support programmatically laying tiles, and if so, how?


texts: Same name and copyright / fanfiction question

texts:
OK, so this is still about a game... only a web-based browser game, in this case NationStates, a political/social role-playing game that's text/image-based, interactive fiction.

It's a political/social satire, basically.

I'm creating fictional magazines for a fictional nation, and they're being hosted on a flipbook site. My question relates to titles and same names.

I obviously can't call my fictional newspaper relating to the nation The Times or my fictional car magazine Auto Trader, as they're trademarked - I checked on ipo.gov.uk,  but if I was to call them The Anytown Express The Times or The Anytown Express Auto Trader (with different logos than the original to avoid copyright infringement, as well), would that fall under copyright infringement / trademark infringement, and is adding an affix sufficient enough to differentiate themselves?

I don't actually have anything yet on the site about my fictional nation's media... so am OK for now, but when I actually do, what's the right way to go about it?

Since this game is a parody/satire/social commentary, what's the right way to do a parody successfully?

All help is gratefully appreciated.


texts: multi-dimension array problem in RGSS (RPG Maker XP)

texts:
This is my first day code script in RMXP. I read tutorials, ruby references, etc and I found myself stuck on a weird problem, here is the scenario:

I made a custom script to display layered images
Create the class, create an instance variable to hold the array, create a simple method to add an element into it, done
The draw method (skipped the rest of the code to this part):

  def draw
    image = []
    index = 0
    for i in 0..@components.size
      if image.size > 0
        index = image.size
      end
      image[index] = Sprite.new
      image[index].bitmap = RPG::Cache.picture(@components[i][0] + '.png')
      image[index].x = @x + @components[i][1]
      image[index].y = @y + @components[i][2]
      image[index].z = @z + @components[i][3]
      @test =+ 1
    end
  end

Create an event that does these script

> $layerz = Layerz.new $layerz.configuration[0] = ['root',0,0,1]
> $layerz.configuration[1] = ['bark',0,10,2]
> $layerz.configuration[2] = ['branch',0,30,3]
> $layerz.configuration[3] = ['leaves',0,60,4] $layerz.draw

Run, trigger the event and the result :

ERROR! Undefined method`[]' for nil:NilClass pointing at this line on draw method :

  image[index].bitmap = RPG::Cache.picture(@components[i][0] + '.png')

THEN, I changed the method like these just for testing:

def draw
    image = []
    index = 0
    for i in 0..@components.size
      if image.size > 0
        index = image.size
      end
      image[index] = Sprite.new
      image[index].bitmap = RPG::Cache.picture(@components[0][0] + '.png')
      image[index].x = @x + @components[0][1]
      image[index].y = @y + @components[0][2]
      image[index].z = @z + @components[0][3]
      @test =+ 1
    end

I changed the @components[i][0] to @components[0][0] and IT WORKS, but only the root as it not iterates to the next array index

Im stuck here, see :

> in single level array, @components[0] and @components[i] has no problem
> in multi-dimension array, @components[0][0] has no problem BUT
> in multi-dimension array, @components[i][0] produce the error as above
> mentioned.

any suggestion to fix the error ? Or did I wrote something wrong ?


texts: What is the general strategy to pre-load game data(entities/map)

texts: I'm new to games programming and am wondering what tactics games use to pre-load entity and map data. Will a game initialise with the fundamental map data stored in memory?


texts: How to give parallax backgrounds more depth

texts:
I have 3 tiled images of some sort of galaxy/space in the background of a 2D Game:
The first one has an alpha of 100%, the second an alpha of 80% and the last one has an alpha of 60%.
I scroll the the one in the background slower than the other ones of course.
classic parallax.
In the foreground I have some particles flying towards the player to simulate some dust / stars flying by. (I know that stars don't fly by, but I think we all have seen this in a lot of games).
But I can't quite achieve the depth effect I am looking for. I want it to look "deeper".

I did read something about using blending modes for the backgrounds, but that would require to render them as objects right?

So the question is: What is a good technique to do a scrolling parallax background in GameMaker?


texts: How to properly manage game music and sounds?

texts:
I'm developing a WinForms customized version of Pac-Man for a Software Engineering project and I reached the point where I have to implement music and sound effects. I used the MVC architectural pattern, so almost every entity in the game has: a model, a view and a controller (for example, I have a MainMenuModel, a MainMenuView and a MainMenuController).

In order to play music and sounds I decided to use the System.Windows.MediaPlayer class (because the System.Media.SoundPlayer one cannot play two sounds simultaneously). More specifically, I put in every controller the related MediaPlayer objects. So, for example, in the MainMenuController I put: the MenuBackgroundMusicPlayer, the MenuItemSelectionSoundPlayer and the MenuItemOpeningSoundPlayer.

This solution works fine, but I would like to know if it is considered bad design to have multiple instances of MediaPlayer spread all over the controllers, instead of having a single static centralized MediaPlayer instance that handles everything. The problem with having a single instance is that I don't know then how to play two or more sounds simultaneously, because a single MediaPlayer object can handle a single media at a time.


texts:
If I have a Model that is drawn with a different effect occasionally, what is the typical approach to this?

Models have effects stored in each of their meshes, and you seem to be forced to use those.

Typically this is done:

foreach (ModelMesh mesh in model.Meshes)
{
    foreach (Effect effect in mesh.Effects)
    {
        effect.Parameters["World"].SetValue(world);
        // Other stuff related to this specific effect is done here.
    }
    mesh.Draw();
}

I want to be able to do this:

foreach (ModelMesh mesh in model.Meshes)
{
    myEffect.CurrentTechnique.Passes[0].Apply();
    mesh.Draw(); // Mesh will be drawn with "myEffect".
}

What are our options?


texts: Using python as a controller in Blender Game Engine

texts:
I'm trying to learn how to use BGE, and one of the things I'd like to do is programatically move the cube using a python script. I added a controller but no luck. See screenshot. I'm trying to run the python script at the top of the page, all it's supposed to do is move the cube a little. It works if I click "Run Script" but I want it to happen automatically when BGE is running. What am I missing?

http://i.imgur.com/7KsoiAd.png


texts: Dynamic items in Scrollable Vertical Layout overlap Unity

texts:
I have followed steps from this tutorial site to create dynamic scrollable vertical layout. I am trying to show 10 prefab buttons in a scrollview dynamically. I can see buttons at runtime, but they are overlapped.

ScrollPanel:

Content Container

I am probably missing some components tweaks. Or problem is due to anchors? Please guide me to resolve this issue. Thanks.


texts:
Possible Duplicate:
  Effective marketing strategies for independent game projects

I created a javascript game for browsers.
Do you know easy ways to promote it?


texts: Why does my collider behave strangely after a coroutine

texts:
So I'm trying to create a simple script that is going to handle the logic for cutting down a tree
I'm experiencing some strange behaviour with my script.
I have a private field which holds the "HP" for the tree which starts at 100, and when I hit the tree it goes down by 25 every time, so I need to hit it four times in order for me to cut it down.
Once the tree reaches <= 0 in terms of HP it should play an animation which simulates the tree being cut down, wait a couple of seconds and then play another animation of it appearing again.
Most of this works fine, it's not until after the animation, where I start my CoRoutine to wait for a couple of seconds it starts messing up.
ISSUE
The first time I cut it down, it works fine.. However.. After it respawns I need to hit it like 4-5 times for it to go down to 50 health and then it works like normal.
So I hit it once, it gets to 75, I hit it twice, still at 75, 3 times.. still at 75.. And eventually, it starts going to to 50, 25, 0 etc..
This only happens after I cut it down the first time, and the first time it works fine.
Here is my Tree script NormalTree.cs
public class NormalTree : MonoBehaviour
{
    public static NormalTree instance;
    private int health = 100;

    public Animator animator;
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        animator = GetComponent<Animator>();
    }

    private void Update()
    {
        if (health <= 0)
        {
            KillTree();

        }
    }

    private void KillTree()
    {
        StartCoroutine(TreeSleep());
    }

    IEnumerator TreeSleep()
    {
        animator.SetBool("treedead", true);
        gameObject.tag = "DeadTree";

        yield return new WaitForSeconds(3f);

        animator.SetBool("treedead", false);
        gameObject.tag = "Tree";
        health = 100;
    }

    public Item DamageTree(int damage)
    {
        health -= damage;
        Debug.Log($"Tree health {health}");
        if (health <= 0)
        {
            return new Item { Amount = 1, ItemRarity = Item.ItemRarityEnum.Gray, ItemType = Item.ItemTypeEnum.Log };
        }
        else
        {
            return null;
        }
    }
}

And in my PlayerController I have this, which essentially checks if my hitbox collides with an object that has the tag "Tree"
private void OnTriggerEnter2D(Collider2D other)
{
    if (other.CompareTag("Tree"))
    {
        var wc = Skills.FirstOrDefault(x => x.Name == "Woodcutting");

        var tree = other.GetComponent<NormalTree>().DamageTree(25);

        if (tree != null)
        {
            inventory.AddItem(tree);
            wc.AddExperience(25);
            Debug.Log(wc.Level);
        }
    }
}


texts: difference between an engine and a library

texts:
I'd like to know the difference between a library and an engine. I've searched some information and if I'm not wrong, an engine gives you more options and makes work easier than a library.

An engine can help you for example handling user input or handling collisions but I don't know how. I mean I've been using SFML and it has a function that detects collision between two rectangles. You can handle user input too.

How does an engine work? In what ways handling collisions for example is easier with an engine than with a library?


texts: How to Design a Generic Collision Detection System?

texts:
I'm designing a C++ 2D collision module, and I ran into a problem designing a system where the collider is unaware of the shape it's colliding against.

I'd like to have a abstract base class called Collision Component and the subclasses define the specific shape (circle, rectangle, polygon, etc...).

The Quad tree and Axis Aligned Bounding Box checks are fine.  The difficulty I ran into is when I'm calculating intersection tests.  I don't know how to define a function in the parent class similar to this:

bool CollisionComponent::IsIntersecting(CollisionComponent* other);

The easiest approach is to cast other to specific subclasses and invoke overloaded functions:

bool IsIntersecting(const Circle& a, const Circle& b);
bool IsIntersecting(const Rectangle& a, const Circle& b);
bool IsIntersecting(const Line& a, const Circle& b);
// on and on

I prefer not to implement functions this way.

I thought of breaking down polygons to its elements, and pass an array of segments into a function.

bool IsIntersecting(const std::vector<Line>& relevantSegments);

Although this would be more robust, I feel like this is more expensive, and I may lose precision when interpreting curves as polygons.  This approach seems to be the best so far though since I can probably optimize it for complicated shapes.

Another approach I've considered was to find the closest point to the center of the other shape, and test if the shape encompasses the point.  Unfortunately, this runs into issues with concave polygons, and cases where the shapes are barely clipping at the edges such as this example:

*------------------------------*
|                              |
|             C                |
|                            __+--*
*-------------------x-____-----* /
                ___---          /
          ___-x-               /
    ___---          C         /
_---                         /
                            /
---------------------------*

/*
C = center
* = vertex
x = point on shape that's closest to the other shape's center
*/

I feel like this problem was solved before, but my reading material doesn't cover this.  How do I design a collision system where the base class does not care about specific shapes?


texts: How can I load raw Bayer images using OpenGL?

texts:
I want to load a raw Bayer format image and convert it to RGB using OpenGL.

So far I have played around with glTexImage2D() and loaded a Bayer image as a monochrome texture. My question is: how can I do per-pixel operations on this texture so that I can convert it to an RGB image?


texts: How can I switch between scenarios in a text game?

texts:
I am making a text-based adventure game. How should I go about changing to another scene if the player wants to e.g. go to the house or walk down the road?

I am using Objective C, but C will work also. Here is my code so far:

printf("Welcome to Kingdom Quest! This is a text game.\nYou will be shown what is going on ");
printf("and it is up to you to decide what to do. Use words like get, go and pick up.\nDo not use any upper case letters.");

printf("\n\nYou are in a feild and it is almost nighttime. You are facing north. The only thing you have is an empty ruksak.");
printf("\nWhere do you want to go");
printf("\n>");

while (true) {

char string[256];
fgets(string, 255, stdin);

if (strcmp(string, "go north\n") == 0 || (strcmp(string, "go n\n") == 0))
{
    printf("There is a rusty old sword on the ground.");
    printf("\n>");
}
else if (strcmp(string, "get sword\n") == 0 || (strcmp(string, "pick up sword\n") == 0))
{
    printf("Sword taken.");
    printf("\n>");
}
else if (strcmp(string, "go south\n") == 0 || (strcmp(string, "go s\n") == 0))
{
    printf("Nothing is this way.");
    printf("\n>");
}
else if (strcmp(string, "go east\n") == 0 || (strcmp(string, "go e\n") == 0))
{
    printf("There is a dirt road here.");
    printf("\n>");
}
else if (strcmp(string, "go west\n") == 0 ||  (strcmp(string, "go w\n") == 0))
{
    printf("There is a small mountain up ahead, with a house on top of it.");
    printf("\n>");

}
else
{
    printf("What?");
    printf("\n>");
}


texts:
I am trying to understand exactly what defines a game mechanic, and whether it is the same as a gameplay mechanic. There are many different sources online that try to define this but they appear to be quite inconsistent. Two that go into quite a bit of depth are below:
https://en.wikipedia.org/wiki/Game_mechanics (game context)

https://badgeville.com/wiki/Game_Mechanics (gamification context)

I understand the concepts of objectives, challenges and rules in a game, but exactly how do game mechanics tie into these? For example, are game mechanics simply abstract ways of motivating users (eg. points, achievements, discovery etc)? Or are they more practical aspects of a game such as a cover system, or how a character moves, jumps etc?


texts: C# Adventure Game - Simple Dialog System

texts:
For school we have to make a small adventure game in C# (Visual Studio 2015) with a custom game engine made by our teacher. Now I want to implement a small dialog system between Liz (The main characer) and her teddybear.

The way I would like it to work is by using buttons. The bear starts out with "I can't let you pass Liz". Then the player can choose between three options (which are buttons) 1. [Question] 2. [Demand] 3. [Observe].

I am just not sure how to implement this and what would be the most efficient way of doing this codewise. To make it a bit more clear I've added an image of the entire dialog that needs to be implemented.

Any help/tips would be welcome!

Thanks in advance


texts: Why does my frames per second function return inconsistent results?

texts:
I have a FPS function that:

private static void runGameFPS2() {
    long beginTime; //The time when the cycle begun
    long timeDiff; //The time it took for the cycle to execute
    int sleepTime; //ms to sleep (< 0 if we're behind)
    int fps = 1000 / 40;

    beginTime = System.currentTimeMillis();

    //Update game state
    updateGame();
    //Render state to the screen
    renderScreen();

    //Calculate how long did the cycle take
    timeDiff = System.currentTimeMillis() - beginTime;

    //Calculate sleep time
    sleepTime = fps - (int)(timeDiff);

    if (sleepTime > 0) {//If sleepTime > 0 we're OK
        try { Thread.sleep(sleepTime); }catch(InterruptedException e){}
    }else{
        //suppose will not be
    }
}

public static void main(String[] args){
    while(true){ runGameFPS2(); }
}

When I run my code, Java works at different speeds on same computer or on different computers.

How can I write a consistent code, that Java will always work "same time" (for example 40 FPS) on mycomputer or any computer?

Note: suppose sleepTime will never be sleepTime < 0


texts:
I happened to see this structure of a gooey player character made in flash.

Can anybody suggest onto what computer science concept I should use to

make a goo
make it behave like a goo

Thanking You,

Vish


texts: Jerky motion when standing on hovering object

texts:
In a level of a 3D FPS I'm making, I have several floating pillars that move up and down (the x and z positions are always the same). When the player stands on one of the pillars, the motion is incredibly jerky going up, but smooth going down. I think the player is sinking into the pillar slightly and then catching up.

I've tried different colliders, all sorts of combinations with rigidbodys and character controllers. I've tried setting the pillar as a parent of the character and then having the player hover slightly. I've just hit a brick wall and would appreciate an outside perspective. Here's my code just in case the issue is in there.

Player movement

 public float walkSpeed = 6.0F;
 public float runSpeed = 10.0F;
 public float jumpSpeed = 8.0F;
 public float gravity = 20.0F;
 private Vector3 moveDirection = Vector3.zero;

 void FixedUpdate(){
     CharacterController controller = GetComponent<CharacterController>();

         moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
         moveDirection = transform.TransformDirection(moveDirection);
         moveDirection *= walkSpeed;
         if (Input.GetButtonDown("Jump")){
             moveDirection.y = jumpSpeed;
         }

         if (Input.GetButton("Sprint")){
             walkSpeed = runSpeed;
         }
         else{
             walkSpeed = 6.0F;
         }

     moveDirection.y -= gravity * Time.deltaTime;
     controller.Move(moveDirection * Time.deltaTime);
 }

 void OnCollisionStay(Collision hit) {
     if (hit.gameObject.tag == "Column") {
         transform.parent = hit.transform;
     } else {
         transform.parent = null;
     }
 }

Pillar movement

 float height;
 float speed;
 Vector3 start;
 Vector3 end;
 Vector3 startOrEnd;
 void Start(){
     speed = 0.01F;
     start = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z);
 }

 void Update () {
     motionControl(speed);
 }

 float randomNumber(float min, float max){
     float number = Random.Range(min, max);
     return number;
 }

 void motionControl(float speed){
     if (gameObject.transform.position == start) {
         end = new Vector3(gameObject.transform.position.x, randomNumber(0, 10), gameObject.transform.position.z);
         startOrEnd = end;
     }else if (gameObject.transform.position == end) {
         startOrEnd = start;
     }
     gameObject.transform.position = Vector3.MoveTowards(gameObject.transform.position, startOrEnd, speed);
 }


texts: What are the performance difference between unsigned and signed integers?

texts:
I am aware of the performance hit when mixing signed ints with floats.

Is it any worse to mix unsigned ints with floats?

Is there any hit when mixing signed/unsigned without floats?

Do the different sizes (u32, u16, u8, i32, i16, i8) have any effect on performance? On which platforms?


texts: How to set up the camera for a PS Vita game?

texts:
I am starting my first project for Unity and I want to start a new game for PS Vita. This console has a resolution of 960x544 pixels.

How do I have to set up my camera so that it adapts to this aspect ratio?


texts: Changing colour of multiple prefab instances when dragging over them

texts:
So I am having some issue trying to get it so that when I touch/mousedown that an instantiated prefab changes color and then with mouse down still any other prefab that mouseenters, that prefab should change color as well. the bit of code that i have is shown below. Nothing happens though, other than the one prefab that received the OnMouseDown changes color, but not the others OnMouseEnter. If i remove the if statement though, they do change color OnMouseEnter. Any suggestions on how to do this or what i may be doing wrong?
Thanks
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Letter : MonoBehaviour
{
    Color clkColor = Color.red;

    private bool _clicked;

    void Start()
    {
        _clicked = false;
    }

    void OnMouseDown()
    {
        _clicked = true;
        this.GetComponent<SpriteRenderer>().color = clkColor;
    }

    private void OnMouseEnter()
    {
        if (_clicked == true)
        {
            this.GetComponent<SpriteRenderer>().color = clkColor;
        }

    }
}


texts: How to prevent enemies from oscillating left and right during chase?

texts:
I have a grounded enemy with a simple chase state. When in this state, the enemy moves with constant vel.x toward the player.

If my player jumps directly above the enemy however, the enemy will quickly flip directions back and forth a few times, since each time the vel.x is updated it flips sign. If the player is on a ladder above the enemy, the enemy will just oscillate back and forth indefinitely. Very ugly.

My enemy does have an engaged state where he pauses and then attacks, but my player has a high jump and so can maintain a far enough distance to avoid triggering the enemy to enter this state.

I am wondering what design choices I can make to prevent this ugly oscillation back and forth during chase.


texts: (Where) Can I learn to create art for my 2D games?

texts:
I'm currently bad at drawing. If I want to create something looking acceptable, it usually takes me hours and hours to fiddle around just to get the basic looks right.

I think that I'm not completely skill-less, I just lack simple drawing techniques..

Am I a hopeless case?
Where is a good place to start out in drawing for 2D games? I'd like to be able to create acceptably good backgrounds, terrains / tilemaps, characters and weapons


texts: Unity: How do I fix the players model rotation in a NetworkManager to spawn properly?

texts:
How do I fix the players model rotation in a NetworkManager to spawn properly?

I created a game with the NetworkManager code.
Player Model is a cone I made and imported.

all works fine but when the NetworkManager spawns the player model it is sideways.
I have tried turning it in 3ds but the player remains sideways when it is spawned by NetworkManager on run, Ohterwise the model is fine in unity, and no matter how I rotate it, in or out of unity , The NetworkManager Rotates it.
All other objects attached to the main object remain with proper orientation all, All other objects including instantiated ones appear properly.


texts:
I am making a game in c++ with opengl and glm and was working on my terrain when this happend :

as it appears it is renderering just the way i planned it, but my question was, how do i make it appear so that the their are not as many shadows? i have no idea of how i can fix this.

Here is the normal code:

        glm::vec3 calculateNormal(int x, int z) {
            float heightL = getHeight(x - 1, z);
            float heightR = getHeight(x + 1, z);
            float heightD = getHeight(x, z - 1);
            float heightU = getHeight(x, z + 1);
            glm::vec3 normal(heightL - heightR, 2.0f, heightD - heightU);
            glm::vec3 result = glm::normalize(normal);
            return result;
        }

and here is the terrain normal generation code

for (int i = 0; i < vertex_count; i++) {
                for (int j = 0; j < vertex_count; j++) {

                    float height = getHeight(j, i);

                    vert[vertexPointer * 3] = (float)j / ((float)vertex_count - 1) * size;
                    vert[vertexPointer * 3 + 1] = height;
                    vert[vertexPointer * 3 + 2] = (float)i / ((float)vertex_count - 1) * size;

                    glm::vec3 normal = calculateNormal(j, i);

                    norm[vertexPointer * 3] = normal.x;
                    norm[vertexPointer * 3 + 1] = normal.y;
                    norm[vertexPointer * 3 + 2] = normal.z;
                    ...

here is the terrain generation code

float getNoise(int x, int z) {
            int seed = x + z + (std::rand() % (0 - 15));
            return seed * 2.0f - 1.0f;
        }

        float generateheight(int x, int z) {
            return getIntoplatedNoise(x/16.0f, z/ 16.0f);
        }

        float getSmoothNoise(int x, int z) {
            float corners = (getNoise(x - 1, z - 1) + getNoise(x + 1, z - 1) + getNoise(x - 1, z + 1) + getNoise(x + 1, z + 1)) / 16.0f;
            float sides = (getNoise(x - 1, z) + getNoise(x + 1, z) + getNoise(x, z - 1) + getNoise(x, z + 1)) / 8.0f;
            float center = getNoise(x, z) / 4.0f;
            return corners + sides + center;

        }

        float getIntoplatedNoise(float x, float z) {
            int intX = (int)x;
            int intZ = (int)z;
            float fracX = x - intX;
            float fracZ = z - intZ;

            float v1 = getSmoothNoise(intX, intZ);
            float v2 = getSmoothNoise(intX + 1, intZ);
            float v3 = getSmoothNoise(intX, intZ + 1);
            float v4 = getSmoothNoise(intX + 1, intZ + 1);

            float i1 = interplate(v1, v2, fracX);
            float i2 = interplate(v3, v4, fracX);
            return interplate(i1, i2, fracZ);
        }

        float interplate(float a, float b, float blend) {
            double theta = blend * M_PI;
            float f = ((float) 1.0f - cos(theta)) * 0.5f;
            return a * (1.0f - f) + b * f;
        }

        float getHeight(int x, int z) {
            return generateheight(x, z);
        }

Thank you very much for you time


texts:
Im making a game in XNA 4 and this is the first time I'm using the Content loader to initialize a simple class with a XML file, but no matter how many guide I follow, or how simple or complicated is my XML File the ContentManager cant find the file; the Debug keep telling me: "A first chance exception of type 'Microsoft.Xna.Framework.Content.ContentLoadException' occurred in Microsoft.Xna.Framework.dll".
I'm really confuse because I can load SpriteFonts and Texture2D without a problem ...

I create the following XML (the most basic Xna XML):

    <?xml version="1.0" encoding="utf-8" ?>
<XnaContent>
  <Asset Type="System.String">Hello</Asset>
</XnaContent>

and I try to load it in the LoadContent method in my main class like this:

System.String hello = Content.Load<System.String>("NewXmlFile");

There is something I'm doing wrong? I really appreciate your help


texts: Modifying alpha of pixels in sufrace/texture

texts:
I have a texture who's surface I've loaded with an image. Some areas of this image are completely transparent (alpha = 0), some completely opaque, and some are somewhere in the middle.

The issue I'm having is that when i draw the texture, the semi-transparent areas are "too" transparent. I want to make them more opaque.

In short, i want to multiply the alpha of all pixels on the surface by some constant. 0's will stay at zero. 255 will stay at 255. But the semi-transparent should get more opaque.

Is this possible? I've been messing around with the alpha blending render states but none of them seem to be able to do what i need them to do.

Thanks!


texts: Unity - Save and load "Snapshots" of game for debugging?

texts:
I'm relatively new to Unity debugging, and I've got an issue that happens every so often about 2 minutes into playing through a scene. If I can do the following, it would save me a lot of time debugging:

Pause the scene
Save the snapshot
Modify some code
Play the snapshot saved in step 2
Repeat 3-4

Is this at all possible with Unity, or should I just modify my code to running "closer" to the point I'm trying to debug?


texts: If SpriteBatch.Draw's SourceRectangle is null does a rectangle still get created?

texts:
If you use the following SpriteBatch.Draw overload, does a Rectangle get created for the texture?

spriteBatch.Draw(texture, textureRectangle, null, Color.White, 0f, textureOrigin, SpriteEffects.None, 1f);

If so how would you access the Rectangle?


texts: Is it possible to have 2D and 3D properties of the shader in Unity?

texts:
In properties of standard objects there are both 2D and 3D properties, like this

On the other hand, in properties of a shader, I can apparently specify only 1D and 4D properties. Is this true? Is the possiblity to specify 2D and 3D really omitted?


texts: Unity, rb.MovePosition and transform.Rotate at the same time

texts:
I can't figure out why my object can't move and turn at the same time.

    public float moveSpeed;
private Vector3 rotationSpeed;
public Camera cam;

public Vector3 straightForward;

public Quaternion spreadAngleRight;
public Quaternion spreadAngleLeft;

public Vector3 localRightVector;
public Vector3 localLeftVector;

public Vector3 newVectorRight;
public Vector3 newVectorLeft;

private Rigidbody rb;

Vector3 movement;
void Start () {
    rb = gameObject.GetComponent<Rigidbody> ();
    rotationSpeed = new Vector3(0, 100, 0);

    straightForward = transform.TransformDirection (Vector3.forward);

    spreadAngleRight = Quaternion.AngleAxis (45, new Vector3 (0, 1, 0));
    spreadAngleLeft = Quaternion.AngleAxis (315, new Vector3 (0, 1, 0));

    localRightVector = spreadAngleRight * straightForward;
    localLeftVector = spreadAngleLeft * straightForward;

    newVectorRight = transform.TransformDirection (localRightVector);
    newVectorLeft = transform.TransformDirection (localLeftVector);
}

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

    #region Control
    if(Input.GetKey(KeyCode.W)){
        rb.MovePosition(transform.position + transform.TransformDirection(Vector3.forward * moveSpeed) * Time.deltaTime);
    }
    if (Input.GetKey (KeyCode.A)) {
        rb.MovePosition(transform.position + transform.TransformDirection(-Vector3.right * moveSpeed) * Time.deltaTime);
    }
    if (Input.GetKey (KeyCode.S)) {
        rb.MovePosition(transform.position + transform.TransformDirection(-Vector3.forward * moveSpeed) * Time.deltaTime);
    }
    if (Input.GetKey (KeyCode.D)) {
        rb.MovePosition(transform.position + transform.TransformDirection(Vector3.right * moveSpeed) * Time.deltaTime);
    }
    if (Input.GetKey(KeyCode.W) && Input.GetKey(KeyCode.D)){
        rb.MovePosition(transform.position + transform.TransformDirection(newVectorRight * moveSpeed) * Time.deltaTime);
    }
    if (Input.GetKey(KeyCode.W) && Input.GetKey(KeyCode.A)){
        rb.MovePosition(transform.position + transform.TransformDirection(newVectorLeft * moveSpeed) * Time.deltaTime);
    }
    if (Input.GetKey(KeyCode.S) && Input.GetKey(KeyCode.D)){
        rb.MovePosition(transform.position - transform.TransformDirection(newVectorLeft * moveSpeed) * Time.deltaTime);
    }
    if (Input.GetKey(KeyCode.S) && Input.GetKey(KeyCode.A)){
        rb.MovePosition(transform.position - transform.TransformDirection(newVectorRight * moveSpeed) * Time.deltaTime);
    }
    Vector3 mouseInputX = Input.GetAxis ("Mouse X") * rotationSpeed;
    Vector3 mouseInputY = Input.GetAxis ("Mouse Y") * rotationSpeed;

    gameObject.transform.Rotate (mouseInputX * Time.deltaTime, Space.Self);
    cam.transform.LookAt(gameObject.transform.position + Vector3.up * 2f);

    #endregion
}


texts: Calculation of distance while switching between two speeds

texts:
There are two speed values, that are used by moving object. After a while speed switching occurs from V1 to V2. I need the formula that can be used for calculation of current distance (at specified time).

Input variable:

T - Current time

Constants:

V1 - first speed
V2 - second speed
Ts - switching time between V1 and V2
P - switching power

Output variable:

S = ?

I tried to use next formula:
S = Lerp[Clamp(T / Ts, 0, 1) ^ P), V1, V2] * T

But in this case the moving object will be returned back after time and moves forward again.

Probably acceleration should be used in the formula?


texts: Computing uv coordinates on a sphere approximated from an octahedron

texts:
Right now I'm texturing the octahedron with the formular from wikipedia(Finding UV on a sphere): UV Coordinates Wikipedia

That unfortunately leads to heavy distortion right at the beginning, which of course leads to a lot of distortion when splitting up the triangles when approximating it to a sphere.

The upper and lower triangles are okay, the left and right ones are distorted.
Now I'm looking for different formulars to calculate the uv's. Are there any other easy formulars? Or would another approach be much more complicated?


texts:
This must be a odd question. My company asked me to design some games similar type of lumosity (http://www.lumosity.com/). I guess someone already played those games. I fight with them, saying , the algorithm behind is proprietor and gave a reference of below link:

http://www.lumosity.com/blog/brain-performance-index-what-is-bpi/

They said, keep the algorithm in BLACK BOX and go ahead of designing the game. Now I have no idea how to start without that algorithm. So I need experts suggestions. Anyone have any idea about this, I mean how to think/design about the games? Should I simply tell them, it is not possible, you can fire me?


texts: Handling complex selection mechanics in RTS-style game

texts:
When we look at complex RTSs where a simple left button mouse click can mean twenty or more different things, depending on the game and UI state, the code handling this interaction and assigning the right interaction action to the input can easily end up messy and tightly coupled to everything, creating a ball-of-mud architecture/The Class That Does Everything related to interaction.
How can I deal with this situation?
Here's an example of the complex selection mechanics that I'm looking for:

Single left click to select a friendly unit.

If friendly unit is in a group, the group is selected.

If the group is already selected, select the unit.

Single left click to select an enemy unit.

If friendly unit/group already selected, then issue attack order on unit.

If friendly unit/group already selected and enemy unit is in an enemy group, then issue attack order on enemy group.

Same thing but if target is allied non-controllable, then friendlies move towards target.

Etc.
How can I handle this complex selection system, taking into account complex states?


texts: How to remove text from a command line box?

texts:
I'm currently writting a text based game and am currently having a slight issue where all of the text on the screen keeps going up and have had a couple of the testers complaining that it makes the game appear messy and somewhat confusing.

The game is written in C++ as a command line game and I was wondering if anyone knows of anyway that I could clear the screen up without putting a lot of white space into the game as I personally think that isnt a very nice way of doing it. Just to note that this is in a windows environment.

Thanks for any response


texts: Is there any relation between Game Theory and Game Development?

texts:
I'm a Java programmer interested to learn games on Java, recently I looked on a book on Operations Research written by Wayne L.Winston. There is a topic on Game Theory.

It's truly mathematical. I'm just an app developer, but would that book be helpful to start a game career?


texts: How to make proper billboarding trees ? (Unity3D & C#)

texts:
I make a 2.5D first person game like Doom, Duke Nukem 3D, and Daggerfall used to be. I'm new to Unity and game development in general, so I'm sorry if this seems obvious to some people.

What I want is to have the 2D sprites of the trees to billboard smoothly in the same way they did in the old games.
Take a look at this video to understand what I mean: https://www.youtube.com/watch?v=xPwGXf8y6XA&t=277s

I've already tried the proposed solution at http://wiki.unity3d.com/index.php?title=CameraFacingBillboard and it doesn't work the way I want, it's uncanny and off-putting the way it works.

Please help me.


texts: Unity BoxCollider2D causes motion to be exponentially multiplied

texts:
I have a player and an enemy square for my 2D game (technically it's a cube, but it's rendered as a 2D character).  I have a RigidBody2D attached to the player and the enemy each, along with a BoxCollider2D, with trigger ticked on both of them.  However, when I untick trigger the motion gets multiplied drastically.  It appears to be that the trigger being ticked is causing the entire thing to be updated more quickly but I'm not sure.  Can someone help?

FIX
I needed to turn off Auto Mass in the Rigidbody2D.
Thanks @DMGregory

Enemy Code:

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

public class enemyController : MonoBehaviour
{

    [Header("Refrences")]
    public GameObject player;
    public GameObject graphicsGameobject;

    [Header("Speeds")]
    public int movementSpeed;
    public float fireRate;

    // Private Refrences
    new private Rigidbody2D rigidbody;

    // Start is called once
    void Start() {
        rigidbody = GetComponent<Rigidbody2D>();
    }

    ////////////
    // MOTION //
    ////////////

    // Return position to face player
    Vector2 getMouseVector()
    {
        // Get mouse pixel position, convert it to world position, subtract
        // from current position vector to get angle, and return as negative Vector2
        // Why negative?  Only way I could get it to work.
        Vector2 myPosition = transform.position; // V3 converted to V2, that's why this line exsists
        return -(myPosition - new Vector2(
            player.transform.position.x,
            player.transform.position.y
        ));
    }

    // Move the player's RigidBody to chase player
    void moveEnemy() {
        Transform ptrans = player.transform;
        if (ptrans.position.y > transform.position.y) // Up
            { rigidbody.AddForce(transform.up * movementSpeed * Time.deltaTime); }
        if (ptrans.position.x > transform.position.x) // Left
            { rigidbody.AddForce(transform.right* movementSpeed * Time.deltaTime); }
        if (ptrans.position.y < transform.position.y) // Down
            { rigidbody.AddForce(transform.up * -movementSpeed * Time.deltaTime); }
        if (ptrans.position.x < transform.position.x ) // Right
            { rigidbody.AddForce(transform.right * -movementSpeed * Time.deltaTime); }
    }

    ////////////
    // UPDATE //
    ////////////

    void Update() {
        graphicsGameobject.transform.up = getMouseVector();
        moveEnemy();
    }

}


texts: Why might a Projectile hitting a KActor only call HitWall, and not ProcessTouch?

texts:
I have a Projectile subclass that seems to work fine. It travels, does Explode(), etc. But when it hits one of our KActors, I get a HitWall event but not a ProcessTouch event.

So my question is, why would a colliding actor trigger HitWall, but not ProcessTouch?


texts: How do I get an NPC to follow the player(and stop when it gets within range)

texts:
I'm making a game where you have a friend follow you. I have a script that partly works, but when the friend exits the trigger, it won't follow the player.

How do I get the friend to follow the player once indefinitely, or until it hits the trigger again?

Here is the script:

public Transform friend;
private int movespeed;

public int speed;
public Rigidbody rb;

// Use this for initialization
void Start()
{
    speedup();
}

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

    transform.LookAt(freind);
    Vector3 eulerAngles = transform.rotation.eulerAngles;
    eulerAngles.x = 0;
    eulerAngles.z = 0;
    transform.rotation = Quaternion.Euler(eulerAngles);

    rb.AddRelativeForce(0, 0, movespeed);

}

public void OnTriggerStay(Collider other)
{

    if (other.tag == "Player")
    {
        movespeed = 0;
    }
    else
    {
        speedup();
    }
}

public void speedup()
{
    movespeed = speed;
}


texts: How to split 2 teams for a FPS death match game in Unity?

texts:
I'm making a playable one level only FPS death match game in Unity. I'm in the part where the AIs now can find and shoot their own target and keep looping to find targets until nothing left. Every AIs and including player were tagged with tag "Target" for the AIs to randomly find their target. (I already excluded self finding).

Now I want to split them in 2 teams. And here is the thing that I keep wondering. Should I use 2 tags for 2 teams (like team red, team blue for ex) then make and attach 2 scripts separately for each AI in the team (the logic in the script will be like "team red" will find game object with tag "team blue" and vice versa). Is that how it works? Is there more efficient way or should I say, "smarter" way to work around this problem?

Here is the script if you need to know more about what I am trying to say https://github.com/Bezari0us/FPS_AI_Behaviour


texts: Using Behavior Trees and Events together

texts:
I am beginning to work with behavior trees and am unsure how events should be handled within the tree. Lets say we have a space game where the player is dogfighting with a handful of other ships, some friendly some not. The player destroys a ship and the rest of the hostile ships should then start to retreat.

How was should the shipWasDestroyed event effect the other ship's behavior trees so that they start running the retreat behavior?

One way I could think of doing this is have all the conditions I care about be high level nodes that effectively state change the ship. This would mean I'd have to check all of these state change conditions on every frame the behavior tree was run, even if they are very rare occurrences. I'd prefer not doing this for performance and complexity reasons.

From looking at the Halo papers on behavior trees it seems that they handled this by dynamically placing nodes into the tree when the event occurred. It seems like calculating where the new node should go could be problematic depending on the current state of the running behavior.

How is this normally handled?


texts:
How to use Screen and touchDown?

...

    playButton.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            ((Game)Gdx.app.getApplicationListener()).setScreen(new MyScreen());
        }
    });

...

public class MyScreen extends Stage implements Screen {

    public MyScreen() {
        super( new StretchViewport(320.0f, 240.0f, new OrthographicCamera()) );
    }

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

        super.act(delta);
        super.draw();
    }

    @Override
    public void show() {
        Gdx.input.setInputProcessor(this);
    }

    @Override
    public void resize(int width, int height) {
        getViewport().update(width, height, true);
    }

    @Override public void hide() {}
    @Override public void pause() {}
    @Override public void resume() {}

    @Override
    public boolean touchDown(int screenX, int screenY, int pointer, int button) {
        Gdx.app.log("MyScreen","touchDown");
        return super.touchDown(screenX, screenY, pointer, button);
    }
}

result - empty

why touchDown does not fire ?


texts: OpenGL ES Basic Fragment Shader help with transparency

texts:
I have just spent my first half hour playing with the shader language.

I have modified the basic program I have which renders the texture, to allow me to colour the texture.

varying vec2 texCoord;
uniform sampler2D texSampler;

/* Given the texture coordinates, our pixel shader grabs the corresponding
 * color from the texture.
 */
void main() {
  //gl_FragColor = texture2D(texSampler, texCoord);
    gl_FragColor = vec4(0,1,0,1)*vec4(texture2D(texSampler,texCoord).xyz,1);
}

I have noticed how this affects my transparent textures, and I believe I am loosing the alpha channel which would explain why previously transparent area's appear totally black.

If I use the following line instead, I am shown the transparent area's

gl_FragColor = vec4(0,1,0,1)*vec4(texture2D(texSampler,texCoord).aaa,1);

How can I retain the transparency after this modification to the colour?

I have seen various things about a .w property, and also luminous, but my tweaks with those and the .aaa property are not working XD


texts: How to render multiple objects as a single object for fluid simulation?

texts:
I'm trying to do fluid simulation using particles in 2d game. I have larger particles, which interactive each other physically, those particles collide with environment (e.g wall,obstacles) to simulate fluid.

However drawing things doesn't go well. I'm trying to figure out how to render the circles without the gaps in between. I've tried blurring the circles like so:

But the gaps remain. Also, blurring the particles causes the particles dimension to change visually every frame. Meaning the physics shape and the visual shape don't match up.

How can I render these objects as one?

finally, i got some effect like this, even artefacts exists:

here is my solution, steps as following:
1.draw water or fluid with SPH.
2. blur all of it.
3. does metaball with it.


texts: How can I implement triple buffering using Direct3D 9?

texts:
I am creating an application using Direct3D 9. I want to implement triple buffering with vsync. I can successfully create a graphics device object with 2 back buffers. How do I know which buffer to draw to?

EDIT:

Here is how I retrieve a pointer to the back buffer onto which I will draw using a deferred shading technique:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer
pd3dDevice->GetBackBuffer(0, 1, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);

UPDATE:
The application appears to run faster when I use a pointer to the first back buffer like so:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer --- NOTICE THE Back Buffer Index parameter is now 0 ---
pd3dDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);

When using the back buffer at index 1 the frame rate falls to 30fps while using vsync. This produces artifacts and Horizontal Shearing. Using the back buffer at index 0 seems to be correct. When using this buffer the application presents a frame at the refresh rate of the monitor. Therefore in order to correctly implement triple buffering using Direct3D 9 you should draw to the back buffer at index 0.


texts:
I started using Godot lately (mostly because the editor supports Linux).

There is one thing that bothers me: the Godot splash screen. I know that I can (somehow) remove it and I saw something about C but I'm not sure.

Is there any way to remove it? Or maybe it is only in the editor and once you export the game it'll disappear?


texts:
So for example I have a class called TypingKeyboard. It allows you to display a string while it's being typed by the computer with sounds. I need one in the menu, for the title. And one for the credits, and some in-game.
So loading every sound and storing it to the RAM for every instance of TypingKeyboard is not very efficient.

So, I want to make a class that already holds these sounds, then call it when I need it, so I don't have to load everything.

How do I design this? I mean, how do you get these sounds loading and then make them accessible without initializing a class for it?


texts: Inserting into the first available inventory slot

texts:
Hello my inventory system picks up one item but does not pickup any more to fill the other two slots. It is saying the whole inventory is full when it should be one slot is full.
Here is my code for the inventory and this is attached to the player.
public class MedInventory : MonoBehaviour
{
    public bool[] isFull;
    public GameObject[] MedkitSlot;
    public GameObject[] BandageSlot;
    public GameObject[] CoffeeSlot;
}

This next script is attached to the items you pickup.
    public class MedPickup : MonoBehaviour
{
    private MedInventory medInv;
    public GameObject itemButton;
    private void Start()
    {
        medInv = GameObject.FindGameObjectWithTag("Player").GetComponent<MedInventory>();
        itemButton.SetActive(false);
    }

    void OnTriggerStay2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            GameObject[] targetSlot = new GameObject[0];
            bool validItem = true;

            switch (gameObject.tag)
            {
                case "medkit": targetSlot = medInv.MedkitSlot; break;
                case "bandage": targetSlot = medInv.BandageSlot; break;
                case "coffee": targetSlot = medInv.CoffeeSlot; break;
                default: validItem = false; break;
            }

            if (validItem)
            {
                for (int i = 0; i < targetSlot.Length; ++i)
                {
                    if (!medInv.isFull[i])
                    {
                        medInv.isFull[i] = true;
                        itemButton.SetActive(true);
                        Instantiate(itemButton, targetSlot[i].transform, false);
                        Destroy(gameObject);
                        break;
                    }
                }
            }
        }
    }
}


texts: Device model detection and comparation doesn't work

texts:
I need to detect device model, and if it is Galaxy Ace GT-S5830i, print it out. But it never print's it (it doesn't get through condition).

My code:

public String mDeviceModel = android.os.Build.MODEL;

System.out.println(mDeviceModel); //this prints my GT-S5830i

if (mDeviceModel == "GT-S5830i") //compiler don't get thru this cond.
    System.out.println("GALAXY ACE S5830i"); //never printed

I can't get what's wrong here.


texts: Javascript-How to create a moving bullet animation from canvas

texts:
the bullet cant see to move at all

function bullet() {
    this.x=playerx;
    this.y=playery;
    this.init=function(){
        this.x+=5;
        draw(this.x,this.y,10,10,"blue");
        console.log(this.x)
    }
}

in another function

if(k.keyCode==17){
    bullets=new bullet();
    bullets.init();
}


texts:
when a sprite, like a space ship, reach the window border I call a method to "turn off" the engine by setting the speed to 0. But then it's impossible to move the sprite back, because the speed is set to 0! I would preciate some help to solve this! Perhaps there is another way to do this? Thanks!

Some of the code

if (position.X > 800)
EngineOff();

direction = new Vector2((float)Math.Cos(rotation - 1.62), (float)Math.Sin(rotation - 1.62));
position += direction * speed;

And the method that controls the engine

 // Engine on
    public void EngineOn()
    {
        speed = 1;
    }

    // engine off
    public void EngineOff()
    {
        speed = 0;
    }

EDIT: Would it be possible to rotate the ship, so it's point inwards the game area? Would it be possible to rotate it 1/2 of a turn or 1/4 of a turn? My thought was that when the spaceship hit the border, it just turn around and continue moving inwards the game area.


texts: How to make the damage inflicted to the enemy and the main character more unpredictable

texts:
I am developing a small mobile game. The enemy can damage my player by throwing objects at his side, and the player can damage the enemy by hitting him with a bat.

For the moment, I am calculating the damage that was caused by the player or the enemy in a very simple way. For example, my enemy has 100% of health. When the player hits him with a bat, the enemy is losing 10% of his health. So after 10 hits the enemy is "dead".

But this is not interesting. The game process is very simple and predictable: you are moving, see the enemy, hit him 10 times, and the move to the next enemy. When the enemy hits the player,the player loses 10% of his  health. That is not cool (the game process is very static).

An alternative, is to use random integer values to calculate damage values. Can anyone give an idea, how to make damage process more interactive and unpredictable, and how to make proportional link between player health and enemy health and the damage.


texts: Grouped enemy movement out of sync after changing directions

texts:
Im working on a Galaxian/Space Invaders Inspired game. Im working on the enemy movement and am running into an issue where the enemies get out of sync when changing direction.

My setup is that I have a global variable enemyHorizontalDirection. Its initially set to left and any time an enemy hits the left or right side of the screen its set to whatever direction the enemies should go in. While this works Im running into an issue where the enemy that triggers the global variable enemyHorizontalDirection gets out of place. Below is a video of the behavior.
http://www.youtube.com/watch?v=3kRlT9_Dt1Q&feature=youtube_gdata_player

The enemies are created from left to right from a 2d array. Each enemy is added to a List at creation. I am looping through the list end to beginning at the moment. The problem occurs on the left side. When I loop through from beginning to end the problem occurs on the right side.

Here is the enemy Update Method:

if(groupedMovement)
{
    // When hitting right side of the screen set direction to left
    if(this.x > (Futile.screen.halfWidth - GMain.instance.gameScreenOffset) - (this.width / 2))
    {
        GMain.instance.enemyHorizontalDirection = "left";
    }

    // When hitting left side of the screen set direction to right
    else if(this.x < (-Futile.screen.halfWidth + GMain.instance.gameScreenOffset) + (this.width / 2))
    {
        GMain.instance.enemyHorizontalDirection = "right";
    }

    if(GMain.instance.enemyHorizontalDirection == "left")
    {
        this.x -= 4f;
    }

    if(GMain.instance.enemyHorizontalDirection == "right")
    {
        this.x += 4f;
    }
}

Here is where I loop through the enemies and call their Update();

for(int p = _player.Count-1; p >= 0; p--)
{
    Player player = _player[p];
    player.UpdateLocalVertices();

    Rect playerRect = player.GetTextureRectRelativeToContainer();

    if(_player.Count == 0) break;

    // Handle player/enemy collisions
    for(int e = _enemies.Count-1; e >= 0; e--)
    {
        GSpriteEnemyGameObject enemy = _enemies[e];
        enemy.UpdateLocalVertices();

        if(enemy.active)
        {
            Rect enemyRect = enemy.GetTextureRectRelativeToContainer();

            if (enemyRect.CheckIntersect(playerRect))
            {
                CreateEnemyDeathEffect(enemy, true);

                enemy.RemoveFromContainer();
                _enemies.Remove(enemy);
                PlayerHit();
            }
        }

        if(enemy.y < -Futile.screen.halfHeight)
        {
            enemy.RemoveFromContainer();
            _enemies.Remove(enemy);
        }

        if (_debug) DebugLineDraw.drawHitBox(enemy, Color.red);

        enemy.Update();
    }
}

Im hoping someone can point me in the right direction. Im not sure of the exact cause of this or how to approach a fix for it.

Any help much appreciated!


texts: Working with tiledata of different sizes

texts:
I recently bought an asset for my game, basically a tilesheet, with seperate pngs as well, but where as previously I've created tilemaps out of identically sized tiles these are all in varying sizes but scaled to fit in with say 128 x 128 tiles or 256 x 256 tiles.

so one of the main blocks might be 128 x 128 but some other elements of them may be slightly oddly sized such as  173 x 214, this obviously wont tile well as it is, so I was wondering how I should approach this? do i need a tile editor that can support layers with different dimensioned tiles? or do i need to find some way of chopping, padding and aligning these images into the same 128x128 tiles?

thanks


texts:
Hello im new to unity and im learning raycast right now , after checking the documentation here https://docs.unity3d.com/ScriptReference/RaycastHit-triangleIndex.html , i got something that's confusing me , what is the difference between :

 MeshCollider themeshhit = thehit.collider as MeshCollider;
 //
 if (themeshhit == null) {
 Debug.Log (" | themeshhit == null ! | ");
 }
 //

and :

 MeshCollider themeshhittwo =  thehit.collider.gameObject.GetComponent<MeshCollider> ();
 //
 if (themeshhittwo == null) {
 Debug.Log (" | themeshhittwo == null ! | ");
 }
 //

Both method is working correctly , but i want to know what is the difference between them , and i also want to know which one is better if comparing against speed , compatibility , and ability .

Edit : variable thehit is look similar to this

 RaycastHit thehit;


texts: Monogame/XNA Hardware Instancing problem

texts:
Here's a youtube video of my problem.

https://youtu.be/1zB4q9_sNQI

Look at how the hideous cube kinda slides into the terrain and rotates weirdly with the world and from above its vanished into the terrain. None of the other models (not instanced) have that problem.

I'm having trouble getting hardware instancing to work as I need it to. For some reason my instanced models appear to vanish from above.

I thought I was doing something wrong with the instance transforms (which maybe I am). So i ripped out all but the scale and translation for those... same problem.

I thought it might be a depth problem so I just set the depth at 0 and STILL i have the same problem.

I made the simplest model I could with 1 bone and 1 texture. Same problem.

Maybe i'm missing something obvious.

Here's the vertex shader:

VertexShaderOutput VertexShaderCommon(VertexShaderInput input, float4x4 instanceTransform)
{
    VertexShaderOutput output;

    // Apply the world and camera matrices to compute the output position.
    float4 worldPosition = mul(input.Position, instanceTransform);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);

    // Compute lighting, using a simple Lambert model.
    float3 worldNormal = mul(input.Normal, instanceTransform);

    float diffuseAmount = max(-dot(worldNormal, LightDirection), 0);

    float3 lightingResult = saturate(diffuseAmount * DiffuseLight + AmbientLight);

    output.Color = float4(lightingResult, 1);

    // Copy across the input texture coordinate.
    output.TextureCoordinate = input.TextureCoordinate;

    return output;
}

Please help. I've been stuck on this for a day or two now annoyingly.

If you need an more code you might think relevant let me know.

Thanks in advance!


texts: XNA significant loss in fps by just adding a few hundred thousand more triangles?

texts:
I've got a minecraftish game that's running nice and smooth with a total of 9.3 million triangles, about 50-70fps average.  Then if I try to render 9.9 million triangles I get hell and it drops to < 1 fps.  I'm drawing them exactly the same way, it's definitely the drawing as I have a vertex buffer for each chunk, then I run through them all, check if they're in sight and if they are I draw them.  It works fine at high fps until I have just those few extra triangles which destroy the FPS.

Edit: Added drawing code:

First I loop through all the chunks.  I check if they're visible and if they are I mark them as visible then draw them.

        foreach (Chunk chunk in GlobalWorld.LoadedChunks)
        {
            if (chunk == null || !chunk.DrawThis)
                continue;

            if (!player.ViewFrustrum.Intersects(chunk.Bounding))
            {
                chunk.IsInSight = false;
                continue;
            }
            chunk.IsInSight = true;

            GlobalGame.graphicsDevice.SetVertexBuffer(chunk.VertexBuffer);
            GlobalGame.graphicsDevice.Indices = chunk.IndexBuffer;

            ChunkShader.Parameters["xWorld"].SetValue(chunk.WorldMatrix);
            ChunkShader.CurrentTechnique.Passes[0].Apply();
            GlobalGame.graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, chunk.VertexBuffer.VertexCount, 0, chunk.IndexBuffer.IndexCount / 3);
        }

Then after that I draw all the transparent parts of the chunk (so they don't conflict with other chunks).  I already made clear if they're visible above so I just check if that bool is true.

        foreach (Chunk chunk in GlobalWorld.LoadedChunks)
        {
            if (chunk == null || !chunk.IsInSight || !chunk.DrawThisTransparent)
                continue;
            GlobalGame.graphicsDevice.SetVertexBuffer(chunk.TransparentVertexBuffer);
            GlobalGame.graphicsDevice.Indices = chunk.TransparentIndexBuffer;

            ChunkTransparencyShader.Parameters["xWorld"].SetValue(chunk.WorldMatrix);
            ChunkTransparencyShader.CurrentTechnique.Passes[0].Apply();
            GlobalGame.graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, chunk.TransparentVertexBuffer.VertexCount, 0, chunk.TransparentIndexBuffer.IndexCount / 3);
        }

With 3721 chunks loaded it runs fine with them all being drawn at the same time.  With 3844 chunks being loaded it runs fine unless you view all of them.  Now that's only just over 100 more chunks yet it's dropping from 60fps to < 1 fps.


texts: How do I add a Rigid body and a box collider component to a Texture2D?

texts:
I am making a snake game. I'm basing it on a basic tutorial game, which does no collision detection, wall checking or different levels.

All snake head, piece, food, even the background is made of Texture2D. I want the head of the snake to detects 2D collisions with them, but Rect.contains isn't working. I'd prefer to detect collisions by onTriggerEnter() for which I need to add BoxCollider to my snakeHead.


texts: what is the math behind the parenting a transform in unity?

texts:
in unity when you parent an object or transform with another object, all transform(position, rotation, scale) are calculated depending on that parent object. sometimes we need to know about the local data of that transform and sometimes we need to know that data based on the world axis.
I need to know how that is implemented in math and vector functions.


texts: Algorithm to propagate internal Physics force in a structure of building

texts:
Scenario:

A floating structure composes of many nodes (or in more visual meaning - a cubic block).

Every node is snapped to the same 3D grid. (similar to a minecraft castle)

There are external forces apply to each node at different values.

For example, node A receives force = Vec3(1,0,0) at time = 1s-3s, node B receives force = Vec3(0,1,0) at time 2s-4s.   Most external forces apply to center of mass of node.

Every pair of adjacent nodes (6 neighbors) is tied together by a "joint" i.e. glue.
Each joint can received some (but limited) pulling/pushing force/torque.

Question:
How to calculate/approximate force of each and every joints?
I want to use them to break object apart / create some spark graphics.

Maximum flow problem is fast, but too limit for this case.  Although it is quite efficient to propagate force like fluid in pipe system, it don't support Torque and many sources/sinks.
https://en.wikipedia.org/wiki/Maximum_flow_problem

Networks of Torque Propagation requires a solid ground, so it can't be used for this problem.
http://www.cs.brandeis.edu/~pablo/thesis/html/node29.html

Bullet Physics Engine : I tried to use its constraint, but for very high amount of nodes (400), they are not stable, i.e. become divergent & explode.

My poor approach : I initialized all force between joint = Vec3(0,0,0), and then use Newton Rules (F=ma & T=Ixw) to propagate force gradually in each iteration.  It always yields perfect result but take too much time (10+ ms), so it is unusable.

Note that the algorithm can provide non-optimal solution and can have some limitation (e.g. no torque).
Performance is important (500 nodes within 1-2 ms, C++).


texts: How do I safely change properties on my skybox?

texts:
Usually in Unity, when your scripts make changes to something at runtime, those changes are not persisted back to design-time.  This is generally considered a good thing.  But for whatever bizarre technical reason, this does not apply to shader properties on materials.  If you change something while the game is running, it stays changed!
Generally the way to get around this is with a MaterialPropertyBlock, which also helps avoid generating a lot of garbage.  But MaterialPropertyBlocks work with Renderers, which leaves out one rather important material: the skybox.
Right now, I have code that says RenderSettings.skybox.SetFloat("_PropName", value);, and it's incredibly aggravating because it always needs to be reset afterwards.  RenderSettings doesn't have a SkyboxRenderer property that I can use in conjunction with a MaterialPropertyBlock, so how can I change shader settings on my skybox and make them not persist after I exit play mode?


texts: Unity - PlayerPrefs.SetString appears to save garbage data

texts:
In Unity, I have an InputField calling this method for OnValueChanged:

public void SetUsername (string s) {
    username = s;
    print(s);
    PlayerPrefs.SetString ("username", s);
}

print(s); succesfully prints the typed text, but PlayerPrefs.SetString ("username", s); is saving what looks like garbage data. After exiting the game, here's what the relevant line of the PlayerPrefs file looks like:

<pref name="username" type="string">ZHNmc2Rmc2FkZg==</pref>

ZHNmc2Rmc2FkZg== isn't the string I saved...

What's going on? What am I doing wrong?


texts: How can I prevent my bullet from influencing other players when colliding with them?

texts:
So when my bullet which is a Rigidbody is hitting another player which is also a Rigidbody, the bullet is getting destroyed immediately. But it seems that this isn't enough to prevent the physics to be applied. I guess that's why my player is getting pushed backward all the time when he is getting hit. I don't want this behaviour, so I tried to fix it :

I tried to lower the mass of the bullet which didn't help. I also tried to change the bullet behavior to a trigger, but the collision detection failed very often.


texts:
Say I have a sprite. Its AABB is easy to find since I know the width and height. Say I rotate it 45 degrees, I don't think the AABB would be big enough to cover it, so I need a new AABB. How can I calculate the bounding rectangle of a rotated rectangle (given a center point, an angle, and its width and height)?

Note that OpenGL does the rotation so I do not have access to the vertex information.

What I'm trying to do is get AABBs so I can do 2D culling for rendering.

Thanks


texts: Drawing on an image before drawing on screen in XNA using VB.NET

texts:
I'm programming a game in XNA, using VB.NET. I want to create an intro to the game that zooms in/out the whole screen and scaling each image to accomplish this is cumbersome at best. I like to be able to draw a lot of .PNG's (or parts of them) onto a whole image, to then be able to manipulate (scale, turn etc) that whole image, before drawing it with the spriteBatch. The examples I can find use something like:

dim bitmap as New Bitmap

or

dim image as New Image

but these codes highlights the "Bitmap" or "Image" as red, and I cannot use them. I'd be thankful for any help on this issue!

please note: I'm new to this, and self taught, so I prefer concrete examples if possible.


texts: How can I represent a tile-based map and related properties on disk?

texts: I'm trying to load a tile-based map in my game. I've been watching SDL tutorials for a while now but they never covered how to represent the map in a file? How can I represent a tile map on-disk in a way that also lets me store information about collision and other properties?


texts:
I spent some time playing with AudioSource.time & AudioSource.timeSamples and read some posts about them. So I get that due to audio compression I can't rely on .time for accuracy so I need to use .timeSamples. Yet, when I printed some output of how .timeSamples work coudn't understand the idea behind it at all. I simply made a 30 sec audio loop and with first play it starts from 7526 and 2nd time 38 and every next time it loops, starts and ends with different timeSample values. Why?

What I simply want to achieve is the thing I wrote in the header and also to be able to play the sound at for example the 5th or 10th or any second without losing the accuracy from the compression for android or ios. How can I do that?


texts:
I have computed the four corners of the viewable bit of 2d map in my 3d view.  So I know the trapezoid that is visible, and I want to 'visit' these tiles in my map.

So my algorithm is basically a convex polygon scanline fill, specifically with four points.

However, I have trouble finding simple sample code to borrow; all want to cope with the complexities of concave and complex polygons and apply winding and such, which is unnecessary in my case and cluttering.

I've contemplated sitting down and writing my own simple trapezoid scanline fill implementation from first principles but was wondering if anyone had a tried and tested version to share that I could copy instead?

Or maybe I've just been googling for the wrong terms and there are some on the net to point me at?


texts: What data structure to use to implement ocean currents and trade-winds

texts:
I'm creating an RPG/simulation game which is similar to the Uncharted Waters Series. The game allows the player to control a fleet to explore and navigate the world on the world map. My Game stores the world map as a tiled map into a 2158 * 1080 2D array.

The problem I'm facing is I want to simulate the ocean currents and trade winds on the world map so when the player is sailing on the map, the speed of the fleet will be affected by the current and the wind. It does not have to be a really accurate simulation because this is not a high-detailed simulation game but it should resonably simulate the ocean currents and the wind.

Requirements:

Need to come up with a data structre to represent the ocean currents
For each point (x,y) on the map, the data structure should provide a fast way to look up what is the strengh and direction of the current at that particular point
The current can have 8 directions (N W S E NW NE SW SE).
The strengh of the current is represented as an Int
Same requirements for trade wind so I think the solution should be the same

My thoughts:

I'm thinking about dividing the world into several regions and each region can be subdivided into smaller regions like a quad tree. For look up I can do a contains(x,y) and find out which region the point is in and then for sub-regions to the same thing until it arrives a leave of the tree which stores the strengh and direction of the current.

Is that a reasonable solution or there are better ways to do this? What are the gotchas for implementing it?

Thank you for you answers!


texts: WebGL (three.js) - rendering object behind camera far plane

texts:
I need to have one object that is always visible/rendered (a lens flare, to be exact). I don't want to set the camera far plane to the maximum possible distance between camera and the sun (performance reasons). Are there any tricks to this? Is this even possible? I could obviously play math and update flare's position so it's always no further than a camera far plane at the correct angle but I also want it to change size depending on the distance as well.

If there are some solutions to such a problem I would be very thankful for answers on how it can be done in three.js.


texts: Rain effect using DirectX 9 capabilities

texts:
Is it possible to achieve something similar to nVidia's rain demo using only shader model 3.0 capabilities? If yes, could you point out a few documents/web resources that are suitable candidates and do not require a heavy programming load (e.g. not more than two hard weeks of programming for one single person)?

It would be nice if the answer could also contain a pro/con phrase for the proposed idea (e.g. postprocessing rain shader vs. a particle based effect).


texts: How do I render terrain in a 2.5D perspective, like in the game Don't Starve?

texts:
I have experience in making 2D side scroller games such as Terraria, but now I want to challenge myself and make a game that has a 2.5D perspective. The game I am trying to mimic is Don't Starve. Right now my focus is on figuring out how to render the ground. I am having a hard time figuring out how they generated the ground, and then rendered it. The way I think they rendered the ground is by first painting the ground in some paint program, and then somehow manipulating that flat image so that it appears to have depth.

I am completely confused by how you would actually render that type of terrain. I want the terrain to have the following features:

Look like the terrain in Don't Starve, here is a video showing the terrain in Don't Starve
The terrain will be flat, and the camera's angle and perspective will be fixed

Any tips and hints will be appreciated, Thank you in advance.

(I am working in Java, using the Light Weight Java Game Library (LWJGL).)


texts: Are Xna XACT audio cues accurately timed enough for a loop sequencer?

texts: Would it be possible to make an audio seqencer using XNA that works by triggering XACT cues periodically using a timer. Would the timing be precise enough to synchronize several audio clips into one loop? (Think Ableton Live)


texts: Loading content (meshes, textures, sounds) in the background

texts:
In my game, I am aiming for a continuous world, that is, a world where you can go anywhere without breaking the immersion through load times and "virtual seams".

My world is broken up into regions, which are nodes in a graph.  A region is considered adjacent to another if it can be travelled to or seen from that region.  In order to keep this continuous, I want to preload the assets needed in the adjacent regions (such as world meshes, textures, and music) before they are actually used.

As for actually loading the content, I use a manager that keeps at most one copy of each asset in memory at a time, accessible by its filename.  When I try to access an asset, it loads it (if necessary) and then returns it.  I can then unload any asset that is currently loaded to save memory.

Clearly, I want to do this in the background so there are no hiccups.  I assume I have to use threads in some way, but I'm not sure how.