texts: How do professional games avoid showing pixel seams in adjacent mesh boundaries due to decimal imprecision?

texts:
Graphics cards are mathematically imprecise.

So when some meshes are joined by their borders, the graphics card often makes mistakes and decides that some pixels at the seam represent neither object, and unwanted pixels appear.

It's a natural behaviour on all graphics cards. How are such worries avoided in Pro Games? Batching? Shaders? Different tangent vectors? Merging? Overlaping seams? Dark backgrounds? Extra vertices at borders? Z precision? Camera distance tweaks?

Screencap of a fix that ended up not working:


texts: What is the difference between “dynamic generation” and “procedural generation”?

texts:
When I think of a dynamically generated game, I think of things like Diablo with randomly generated levels. When I think of a procedurally generated game, I think of things like Flappy Bird and other infinite runners.

But both of these just randomize a level. Is it that procedurally generated games are constantly being generated and dynamically generated games are all generated up front? Or are these terms interchangeable?

What is the difference between a dynamically generated game and a procedurally generated game?


texts: Reliability and suitability of 3G connection for client-server turn-based non-asynchronous game

texts:
I am working on an iOS turn-based client-server game and I am concerned with the reliability of the connection and the length of time it takes to establish the connection.

The game is turn-based but is not asynchronous, so both players must finish their game in one sitting. If one side of the connection is lost, the person who loses connection will lose. As such this is a big concern for me.

I see applications like WhatsApp losing connection quite often even with full bar of data and it takes about 2-3 seconds every time I launch or resume the application to establish a connection. Is this the norm and is there any way to keep the connection from disconnecting from the server as long as the player has 3G connection? What are some things that I can do to improve the play experience given this condition?


texts:
In my cocos2d-iphone game, I have 2 backgrounds (CCnodes), each containing a quite complex hierarchy of sprites.

I would like to make a smooth transition between them:

Initially, only the first background is visible
At the end, only the second one is visible

Is there a good way to set the opacity of a full hierarchy of sprites ?

I tried to recursively set the opacity of all the contained sprites. It kinda works except that:

I guess it's not very efficient
I would like the opacity of overlapping sprites to be 'merged' (as if the background was one single big sprite)


texts: Unity Android Project Settings.gradle file

texts:
I am trying to debug Android project after building it with Unity Editor

The project i want to include is an External Project.

the usual way is Adding to settings.gradle

:include (':common')
:project (':common') as File(...)

and build.gradle

compile project(':common')

1.Its doesn't seems to work since i have no idea (if possible) place the settings.gradle for usage.
Any1 manage to fix it?

2.maybe there is another way to fix this?

Thank you


texts: Why Unity Corrupts textures when used on a Sample Texture node shader

texts:
I am trying create a glow effect on a background, to do this I am using shaders, when I use the main texture everything is okay, but when I put the emission map the texture corrupts

Here's the original image for those trying to replicate the problem:

I am beginner about shaders and Unity


texts:
I'm doing the physics for a 2D game which visuals are represented in openGl. Gravity is 9,8 m/s^2, how do i convert that to my screen size? OpenGl sets width to -1 to 1, and does aspect ratio of the screens real width and height to get height's size(normaly from -3 to 3, due is a smartphone game).

I know i have to convert meters to my screen size units, but what are those units and how do I convert meters to them? For example, lets say I want my screen to represent 20 meters, what are the maths?

9,8 m/s^2 * x screenUnits/m = y screenUnits/s^2

Those screen units are pixels? It doesn't make much sense cos OpenGl scales from -1 to 1 independend of the amount of pixels represented by that size. I want this to work the same on various smartphones.

Thanks in advance.


texts: Why is Unity3D on OSX ignoring my XBox 360 controller?

texts:
I'm using a fork of the Tattie Bogle driver that has a signed kext. The System Settings panel shows all inputs correctly.

One axis is configured in Unity3D 5 like this:

Still, I don't see any input when the game is running. I also cannot configure Positive/Negative Buttons for any input in the Input Manager panel - clicking the input line edit and entering a keyboard key works fine, but pressing a controller button does nothing.

What am I missing here?


texts: How to develop a GameMaker game for both desktop and mobile

texts:
For a few months I have been creating a game using GameMaker Studio 2 Desktop.
It turns out that I would like to launch it also for cell phones, and for that I bought GameMaker Studio 2 Mobile.
That's when my doubt arises.
In GameMaker Studio 2 Mobile, you have the option to open the projects made in GameMaker Studio 2 Desktop, and its interface is the same as in GameMaker Studio 2 Desktop.
There are 2 shortcuts on my computer:

Now I don't know if GameMaker Studio 2 is a new program, or works only as a license that allows me to launch the game on another platform (like a plugin extension).
I remember that in GameMaker Studio 1.4, there was just one version of the editing software, and each version of the game (desktop or mobile) had its own code.
I basically had to copy the game project and edit the copy with its equivalent features.
I remember that one of the adaptations is at the time of clicking on the screen, because on the cell phone you don't use mouse_x or mouse_y.
What I would like to know is if I will need to adapt the code for this mobile version or, when exporting the game for the mobile platform, will the code be adapted automatically?

Before coming here I looked for solutions in these links:
https://www.reddit.com/r/gamemaker/comments/dgmkld/cross_platform/
https://www.reddit.com/r/gamemaker/comments/5mn0p5/crossplatform_online_multiplayer_with_or_without/
https://www.reddit.com/r/gamemaker/comments/5g2ej2/cross_platform/

At one point I realized that maybe I was using the wrong term in the
search, because the results I was finding revealed different things
than what I was looking for: stuff about whether desktop and
mobile players can play together, which is not useful for me since the
game I am producing is not online.


texts:
I'm writing a little 3D physics engine and everything is peachy except that to have constraints behave correctly, I'm having to artificially scale up the inertia tensors. Worse--the amount that I have to do so seems to vary from constraint to constraint.

I'm implementing constraints according to Erin Catto's sequential impulses paper. It does make sense to me that it's trickier to get things to behave well rotationally via discrete time impulses, but not sure what sort of approach to take to improve performance that isn't so hand-wavy; e.g. would satisfying the constraints at the acceleration level in addition help?

Open to any advice, even if it's that there's potentially something fundamentally wrong with my implementation or that I'm being too prissy about not wanting hacky solutions, etc.


texts: what making a good soundtrack for social game

texts: there are many successful social games in Facebook and other social sites like brain buddies, who has the biggest brain and word challenge.both of them have a great soundtrack while playing and in the beginning of the game . my question is how to find a good soundtrack or what's i should look for to find a good soundtrack like this that's help to attract the user specially for games that need concentration ?


texts: Unity5x GetComponent().Play("sequence".StopAll) not working

texts:
I'm working with Unity3D 5x using C#. I've attached collision detection to the character controller script that plays a "gothit" animation clip (using legacy animations).

Here are the code snippets, the first is for the collision:

void OnTriggerEnter (Collider other)
{
     if(other.gameObject.CompareTag ("dmgEnvironment")||other.gameObject.CompareTag ("dmgPlayerHit"))
    {
        GetComponent<Animation>().Play("gothit", PlayMode.StopAll);
        GetComponent<Animation>().wrapMode = WrapMode.Once;
        print("hit damage");
    }
}

The attack animation call:

public void AnimatePunch()
{
    DidAttack ();
    //play animation
    if (canHit && lastAttackTime < lastAttackButtonTime + attackTimeout) {
        SendMessage("DidAttack", SendMessageOptions.DontRequireReceiver);
    }
    GetComponent<Animation>().Play("punch", PlayMode.StopAll);
    GetComponent<Animation>().wrapMode = WrapMode.Once;
}

The problem I'm running into is that the "gothit" sequence won't play on collision but will do so when wired to the AnimatePunch().

I'm not sure why this is happening. Any help is greatly appreciated.


texts: Appropriate MMORPG battle system for Android-oriented MMORPG?

texts:
I need a tip for a game I'm making. Because of many issues I want to make a 2D mmorpg:

A 2D game is easier to code (I'm using ActionScript3 / Starling).
I can more likely find preexistent graphics, and handling them is easier.
Fundamentally: I don't want to eat the device's memory!! Common devices here have at most 1GB RAM memory.

But when I think about battle systems, I imagine stuff like Argentum Online and Tibia. Those battle systems were OK on mouse-keyboard based systems. AO's battle system will be really hard to use (specially by any spellcaster class) in devices like Samsung S3 mini.

OTOH when I think in systems like Pokemon or Golden Sun, both of them being turn-based,  I ask myself about the interation: battles would be locked (they have a protocol, you cannot suddenly leave a fight, you can take as long as you want in each turn,...) which is not acceptable in a mmorpg for many reason (mmorpg users do not expect a protocol, they expect to leave a fight as they'd like, they would HATE users who suddenly go AFK on the middle of a battle without having opportunity to act).

What battle interaction would be a good balance between mobile-device-friendliness and not being a pain in the ass for game dynamics? Suggestions are accepted here (we cannot expect game design have absolute decisions at all).


texts: Handling different screen sizes in multiplayer games

texts:
sorry if this has been asked already. I did some checking around and couldn't find any helpful advice.

I'm developing my first multiplayer game, and it'll be fullscreen when run. My issue is, how do I balance for screen sizes? It seems to me that it might be considered unfair if some players can see more of the playing field than others, and it's not an issue I'd ever considered before since all my previous projects have been single player and usually fixed resolution.

Some options I'd thought of is a zoomable map, so players can handle how much of the screen they see to give them the choice between clarity and view distance. Another was a fixed internal resolution and black bars or sidebars if it's out of the aspect ratio.

Thanks in advance for any help.


texts: Why does my sprite jitter when it arrives at its destination?

texts:
I have just started looking into XNA for WP7 - and I am definitely the sort of person who likes to find answers to my questions without begging for help!

I searched here to find an answer but I found it hard to word my question, so apologies if it has been asked.

Basically I have a sprite, which I am moving to and from set locations on the screen.  I have defined these locations and set up the methods to detect the input on the screen (I only want to be able to swipe left and right to select the location).

The sprite moves to the correct location when I swipe, but sometimes when it arrives at its location, it jitters very quickly backwards and forwards.  My guess is that because of the maths used to calculate the vectors, it never actually hits the exact location, so keeps moving.

My theory was to set up some sort of boundary, where if the sprite was detected within x amount of pixels of the actual location, the sprite is snapped to the correct location.  Would this be a good way of doing something? I imagine it isn't the most elegant solution as it will have that snapping motion towards the end, or am I just over-exaggerating what that will look like in my mind?

can anyone suggest a way of getting around this jumpy sprite?
Code that i think is relevant below :)

Initialising:

player = new Player();
playerMoveSpeed = 12.0f;
player.Position = positionsSet.getLocation(1);

I defined my 4 locations like this:

Vector2 position1 = new Vector2(10.0f, 30.0f);
Vector2 position2 = new Vector2(210.0f, 30.0f);

My calculating the movement happens like this and is where I believe the stuttering to occur:

Vector2 direction = goTo - player.Position;
direction.Normalize();
player.Position = player.Position + direction * playerMoveSpeed;

Oh, and to get there I call this method (the gametime parameter is something I was trying, its not actually being used at the moment :) ) :

if(player.Position != goTo)
moveToLocation(goTo,gameTime);

Any advice would be massively appreciated guys and girls, I think I am getting there, but it is just annoying me now :)


texts: How do I make my character attack on the side of the character that I click the LMB on (Unity)?

texts: This is a top-down game, I guess I should also mention that the character is not centred on the screen and the attack should be in 4 different directions. The attack's direction should be based on which side of the character(up, down,  left, right) that you click on(this should also be universal on the screen, the only deciding factor should be the character and the mouse). I really have no clue where to start on this problem.


texts:
I have been wrestling with creating fog of war for a while now. I actually did create it, but I consider the implementation too resource-heavy to be usefull.

For initial information: I use createjs / easeljs framework / library for the project and the fog of war is now implemented so, that there is a layer with the "fogged" image and data of the map on bottom and on top of that is the non-fogged / clear layer of the map. In the clear layer I only show certain parts by filtering the layer with shapes and the rest is invisible. So only the areas that are visible are shown.

Also note that even the fogged parts are partially visible, e.g. the whole terrain of the map is always visible beneath the fog of war.

This creates 2 different layers with the same information of the map, instead of creating a separate fog of war layer, that would only contain the fog and be filtered to show the non-fogged parts.

I have been unable to make this work so far.

So basically I can now use filters to show certain parts of a layer, but not to make parts of it have an alpha value. E.g. If I have a fog-layer (that contains the fog) and want to show it except certain circular parts (which would reveal the map below, with alpha = 0), how is that achieved? Now I can only show certain parts of a layer with filtering, instead of hiding them / making the have alpha or reverse the filtering.


texts: What game mechanics work best on mobile phones?

texts:
I teach Swift 3 and Android Studio. My students are always asking why I'm not in the mobile market yet; frankly, I'm migrating my 88 games from flash into native mobile apps ... it takes time. My question is: What game mechanics are most successful in the mobile apps for a profitable endeavor? Puzzle sliders? PacMan-ish chases?

I know there are 7 different methods of input, but which provide fun entertaining games? I could use some advice.


texts: crashing generating fire-balls(bullets) with Box2D

texts:
I got crash, making fire-balls as bullets.

I guess I should not use   "private Array fireballs" in player class.
it seems like when I add one more fire as index of 1 into the list, the first index does not look working on destroying in for loop in player class.
it seems only destrying index of 0.

in playscreen class,

 public void handleInput(float dt){
       if (Gdx.input.isKeyJustPressed(Input.Keys.SPACE)){
            playerBlue.fire();
        }

in player class,

private Array<FireBall> fireballs;
public void update(float dt) {
  for (FireBall ball : fireballs) {
        ball.update(dt);
        if (ball.isDestroyed())
            fireballs.removeValue(ball, true);
    }

 }
public void fire() {
    fireballs.add(new FireBall(screen, b2body.getPosition().x, b2body.getPosition().y, Blue.runRightSide ? true : false));

}

in fire class,

public class FireBall extends Weapon {
private TextureRegion fireball;
private float rotate;
public FireBall(PlayScreen screen, float x, float y, boolean rightside) {
    super(screen, x, y, rightside);
    fireball = new TextureRegion(screen.getAtlas().findRegion("fireball"),0,0,40,40);
    setRegion(fireball);
    setBounds(getX(),getY(),getWidth()*2,getHeight()*2);

}

@Override
protected void defineWeapon() {
    BodyDef bdef = new BodyDef();
    bdef.position.set(rightside ? getX() + 12 / AlienAdvantrue.PPM : getX() - 12 / AlienAdvantrue.PPM, getY());
    bdef.type = BodyDef.BodyType.DynamicBody;
    if (!world.isLocked())
        body = world.createBody(bdef);//?
    FixtureDef fdef = new FixtureDef();
    CircleShape shape = new CircleShape();
    shape.setRadius(3 / AlienAdvantrue.PPM);
    fdef.filter.categoryBits = AlienAdvantrue.FIREBALL_BIT;
    fdef.filter.maskBits = AlienAdvantrue.GROUND_BIT
            |AlienAdvantrue.Enemy_Head_BIT
            |AlienAdvantrue.BRICK_BIT
            |AlienAdvantrue.COIN_BIT
            |AlienAdvantrue.Enemy_BIT;

    fdef.shape = shape;
    fdef.restitution = 1;
    fdef.friction = 0;
    body.setLinearVelocity(new Vector2(rightside ? 2 : -2, 2.5f));
    body.createFixture(fdef).setUserData(this);

}

public void update(float dt){
    stateTime += dt;
    rotate +=100; // flip faste// ?
    rotate(rotate);
    setPosition(body.getPosition().x - getWidth() / 2, body.getPosition().y - getHeight() / 2);

    if((stateTime > 3 || setToDestroy) && !destroyed) {
        world.destroyBody(body);
        destroyed = true;
        stateTime=0;
    }
    if(body.getLinearVelocity().y > 2f)
        body.setLinearVelocity(body.getLinearVelocity().x, 2f);
    if((rightside && body.getLinearVelocity().x < 0) || (!rightside && body.getLinearVelocity().x > 0))
        setToDestroy();
}

}


texts:
I produce a strip of quads with texture coordinates to represent a path.

My texture is tiled along these quads.

When the quad is drawn very small (on my integrated Intel chip) it draws distorted.

How can I avoid this?


texts: What are the best ways to serialize and unserialize network messages for C/C++ multiplayer game?

texts:
We are using JSON right now and want to move to a binary format for some types of messages between client and server.

Should I just read structs into the socket?  Use proticol buffers/thrift?

How should I represent arrays of data?

What should the interface look like for packing/unpacking data?


texts: Find projectile initial velocity, and air time, given projectile elevation, distance, angle

texts: I have a target X position (D). I have a turret Y elevation (E). Turret is always pointed at 45 degrees (A). I need to calculate the initial projectile velocity required to hit the target, with an arbitrary gravity constant (G).


texts: UV mapping issues while loading collada model exported with Sketchup

texts:
I load collada models, exported via Google Sketchup, into my Three.js (v63) scene with the Three.js collada loader.

The models are loaded, but with some, textures aren't well mapped, like in the following picture :

My first question is how to detect this kind of problems and then, is there a way to leverage the exported UVs from sketchup to correctly map the textures ?

The model from the sceenshot comes from : http://sketchup.google.com/3dwarehouse/details?mid=557d5f1b5a076bdcf53b1b21212345ca&prevstart=0


texts: Changing coordinate system from Z-up to Y-up

texts:
Blender's coordinate system is different from what I'm used to, in that Z points upwards instead of Y. What would be the simplest way of converting all the world data (so that all animations, texture coordinates, etc still work) so that Y points upwards?

Clarification:

Object positions are defined as matrices, so just switching translation/rotation/scale information in matrices is not a trivial task. (at least it does not seem like a trivial task to me)


texts: what is the best way to code an online multiplayer game?

texts: so i want to create a simple game that runs over a network but I am having trouble deciding what needs to be done in terms of what the server needs to do and what the clients need to do. I understand I should use UDP sockets but I am unsure how to implement it within a game and have all the clients be in sync. Should the server side have like a master copy of the game where i basically runs the game and accepts moves, plays them in itself, and then sends the current state of the object to the other clients?


texts:
I'm having some trouble simulating bullets in my 2D shooter. I want similar mechanics to Megaman, where the user can hold down the shoot button and a continues stream of bullets are fired but with a slight delay. Currently, when the user fires a bullet in my game a get an almost laser like effect. Below is a screen shot of some bullets being fired while running and jumping.

In my update method I have the following:

if(gc.getInput().isKeyDown(Input.KEY_SPACE) ){
    bullets.add(new Bullet(player.getPos().getX() + 30,player.getPos().getY() +  17));
}

Then I simply iterate through the array list increasing its x value on each update.

Moreover, pressing the shoot button (Space bar) creates multiple bullets instead of just creating one even though I am adding only one new bullet to my array list. What would be the best way to solve this problem?


texts:
Lets say I have got terrain effect, contains multitexturing, light. Now water effect. It must be different, but must be also affected by light. Other one, player effect, must also be affected by light, but doesn't share much stuff with others.

How all of these should be mixed together to create proper effect? Should I write multiple techniques in single effect file, or should I split it to as many as possibile and choose which are needed when rendering?


texts: How client movement prediction syncs with server position to avoid a clip around collision?

texts:
I have searched a lot on stackexchange and on google, yet I have not found a satisfactory answer to this seemingly simple question.

I am making an online multiplayer game where the players navigate a 2d map with basic square obstacles. In this case I am making collision checks both on the client and the server, where the server broadcast everyone's position once per second as authority. However, when making a sharp turn around a square, often times either the client makes the turn while the server clips, or the client clips at the corner while the server makes the turn. That is understandable considering the possible discrepancy between the position on the server and the predictive position of the client. How do online multiplayer games usually work around this simple yet crucial problem?

I understand that it comes down to a pixel perfect sync which isn't possible, but how do other games navigate around this issue, to give a flawless collision experience?

What I am considering of doing:

Increase the position broadcasting rate from 1 time per second to however high needed to accurately sync the positions (20/sec). I believe this is the solution most games are doing. This however, will drastically increases the load on the server.
In my case, the game's main mechanism isn't the navigation (think MMO), so I am leaning towards only checking collision on the client side, and have a simpler collision check on the server to ban walk-through-wall hackers. This would relax the server from heavy collision operations which is nice too.


texts: How to make game scene bigger in 2d platformer?

texts: Hi i am current making a 2D platformer game but after i reach an end of screen then it doesn't move forward how to increase the game play screen area so that i will be able to go in vertical direction i am pasting an image of the problem i am new to unity please help me!]1


texts: How do I change a specific set of spawned buttons from gray to green?

texts:
I'm a self-taught programmer.

I have a button class runs like this:

Texture texture;
Color color;
Color differentColor;

SpriteFont font;
...
button1 = new Button(texture, font, ... , color);
button2 = new Button(texture, font, ... , color);
...
button20 = new Button(texture, font, ... , color);

This button will spawn 20 times in a set of specific locations on screen.

I want a set of 10 buttons to light up green at each level non-randomly.

Level 1: button 1,3,6,7,10,12,13,14,15,16 lights up green (must be in this seq)

Level 2: button 2,5,6,7,9,11,13,14,19,20 lights up green (must be in this seq)

Level 3: etc...

There will be 15 levels total.

How do I go about doing this the smart way?

What I think could work is to create a Level class, create 20 Color[] array in it:

Color[] color1;
Color[] color2;
...
Color[] color20;

color1 = {Color.Green, Color.Gray, Color.Green... }
color2 = {Color.Gray, Color.Green, Color.Gray... }

Input each of the color array into the constructor of a ButtonManager class, from the ButtonManager class, spawns the 20 buttons of differing color.

I will be adding more features into the button as time goes on.
Will I benefit in using the command design pattern here?


texts: Why is Particle System Not Visible Without Scene Window Viewing the Origin?

texts:
I have a particle system, which is supposed to be highlighting an important game object, but the Particle System doesn't show on the game window unless the Scene window camera has the Origin (0,0,0) in view. The origin is at the corner of my UI canvases, in which you can see the two white lines marking the edges.

Take a look at these screenshots. On the 1st screenshot, the particle system is not visible. The 2nd screenshot was taken just moments later and the particle system is completely visible (and the number of particles is as if it had already been emitting the whole time.) The only difference is that I slightly rotated the camera of the Scene Window in between screenshots.  The camera was rotated down just a tiny bit to put the origin visible in the scene view.

The particle system immediately becomes visible on the game window as soon as I rotate the SceneView camera so that the Origin is in view.

This is Unity version 5.6.0f3.

There are other questions about particle systems not working, but the cause and solutions appear to be very different.

Here are things I've already tried:

The particle system is already set to "Play on Awake" both before and
after rotating the camera.
I've ensured that all of components and game objects are visible and
enabled both before rotating toward the origin and after.
All of the particle settings (size, etc.) are correct both before
rotating to the origin and after.

Why is the particle system not visible without the origin in the scene view?


texts: Issue with 2d Angular Car Collision Response

texts:
I am having trouble getting the angular collision response to work properly in my 2d car simulation. I have gotten the linear collision response to work between the vehicles, however, the angular collision response does not seem to be working. The problem seems to arise from my slip angle calculation for the car, and it seems to override the angular impulse. The slip angle is necessary to make the vehicle move realistically.
Here's the code to calculate the slip angle:
// Calculate slip angle for front/back wheel
this.wheels.front.slipAngle = -Math.atan2(this.localVelocity.y + yawSpeedFront, Math.abs(this.localVelocity.x));
this.wheels.back.slipAngle = -Math.atan2(this.localVelocity.y + yawSpeedRear,  Math.abs(this.localVelocity.x));

As can be seen in the following pictures, the car rotation response is correctly simulated when it hits the top of the car and rotates clockwise. On the other hand, when the car hits the bottom of the other car, the rotation should be clockwise, but actually still goes clockwise. It seems to me that the problem arises because the slipAngle overrides the angular rotation of the collision.

My project can be seen here: https://victorwei.com/projects/car-sim/ Feel free to take play around with the simulation and view the code to figure out the issue. If there are any suggestions on how to mitigate this problem, that would be greatly appreciated.


texts:
I have a main_mesh that has 10 submeshes, I wonder how I can change the color of of these submeshes to a different color (e.g submesh1 will have a red color, submesh2 will have a blue color,...etc). Any advise please?

UPDATE:

This is how I'm getting my mesh which has 10 submeshes:

        SkinnedMeshRenderer smr  = gameobject1.GetComponent<SkinnedMeshRenderer>();
        Mesh main_mesh = smr.sharedMesh;


texts:
I'm using this script to print out my text in a textbox one character at a time, and to do this I'm using a Tween. I have this set up so that when the Tween sends the tween_completed signal, then the variable finished becomes true. But for whatever reason, the tween_completed signal never gets sent. Does anyone see a reason that the signal wouldn't be sent? Thank you!
extends Control

var tempdialog = [
    'Super Animal Racing is shaping up to be a great game!',
    'Thomas is so good at programming omg!',
    'Isn\'t this so exciting?'
]

var dialog_index = 0
var finished = false
var totalcharacters = 0

func _ready():
    load_dialog()

func _process(delta):
    $AnimatedSprite.visible = finished
    print("visible", finished)
    if Input.is_action_just_pressed("jump"):
        load_dialog()

func load_dialog():
    if dialog_index < tempdialog.size():
        finished = false
        $RichTextLabel.bbcode_text = tempdialog[dialog_index]
        $RichTextLabel.percent_visible = 0
        $Tween.interpolate_property(
            $RichTextLabel, "percent_visible", 0, 1, 1,
            Tween.TRANS_LINEAR, Tween.EASE_IN_OUT
        )
        $Tween.start()
    dialog_index += 1

func _on_Tween_tween_completed(object, key):
    print("tweentrigger")
    finished = true
```


texts:
Hello fellow coders I have been using Unity and other game dev libraries fora fun hobby for many years (on-and-off, I am no expert!). But I really am not happy with Unity and their multiplayer network offerings. I've always wanted to master C++ in the end and also Unreal, so now is the time I will delete Unity and only use UE4 for some time.

I jump into UE4 and many tutorials (official UE website and MANY others paid and free). All of them leap straight into Blueprint system. Every time I watch/read these tutorials I think at the end, that surely the Blueprints part is unnecessary, bloated way of achieving something that can easily be achieved purely in c++ code.

I intend to ONLY work on my own. Not part of any team, and my work will never be built upon by anyone but me.
Personally I dislike visual coding. I hate moving the mouse to small areas and drag-dropping stuff etc.

Will I lose out on any functions etc in the Unreal API if I decide to shun the entire blueprint system?

What reason is there to use Blueprint if you find written code easier?

Not trying to start a flame-war, just want some experienced devs to give me their educated opinion on this matter.

If it was left to me, I would learn to make some basic games in pure code using Unreal API and then I might try to recreate  the same project allowing myself to use blueprints and I will see what takes longer.

But right now I don't even know how to access User Input polling values etc in Unreal, I am about to start learning it all now. Just want to set off on the correct path FOR ME :D

Thanks for any help


texts: IK handle for 'Back' bones. Allowing me to move body downwards and have the knees bend

texts:
So I've followed several tutorials and documentation about rigging my humanoid character in Maya. I've had the same problem with the automatic rig from Mixamo, as well as my own one I just made following the Maya official docs.
I have IK Handles for the legs and arms, they work as expected. But I have seen in some peoples videos they can move the root or lower-back bone downwards and have the characters knees bend with the feet staying correctly grounded.
When I move the root down, as I expected, the whole skeleton just moves down. I tried adding some other ik handles along the spine and hips and lots of variations. If I move the Pelvis, the torso just crunches down into the hips area and the legs dont bend.
The actual cause for me to need my own rig was I need a skiing 'hunched' animation for my character and Mixamo didn't have one.
I've tried maybe 4 or 5 different rig hierarchy already now and always the problem is there. I tried binding my leg joint chains to the pelvis (and the 'back root' which was what is recommended).
So to be clear I want to be able to move the root of the body down and the knees just bend without me modifying each joint. This video shows someone whose character does this (I've pasted it time-stamped at the specific time, you only need to watch 5 seconds, i suggest muting the voice! https://youtu.be/i8cmDK_O-1g?t=70)
Here are some screenshots showing my rig and the outliner showing joints and ikhandles etc:

How can I make my character bend like the guy in the video?
Honestly I have spent a whole day watching videos and reading about this. But none of them seemed to help me with this specific problem. Your help is massively appreciated.


texts: How to scroll Select objects in the hierarchy tab?

texts:
So I am creating breakable objects in unity and I have to select around 200 objects in the hierarchy tab so that I can apply some components to each the pieces. My problem is that once I select more than 100 objects in the hierarchy tab, it starts to bug out and it becomes incredible difficult to select objects. So I was wondering if there was a way to a scroll select or something like the box select like you can use on windows to easily select multiple items, or maybe some other way I didn't mention. It would really help me if someone could tell me a quick way to select multiple things in unity, in the hierarchy tab.

Thanks, Nova


texts: How to prevent tendencies to upper-left corner?

texts:
In a 2D tile-based game I'm making, I have a loop that runs through each of the tiles to check and apply values.
One of the effects is intended to make a circle around itself, using a similar method. However, instead of making a circle (or a square, due to the shape of the map), it tends to smear towards the upper left corner.

In have tried running the loop in the reverse direction every other round, but oddly the effect persists.

I am wondering if there are any tips for preventing such a buildup.

edit:
here's the current code of the simulation system
http://pastebin.com/NsgK0SxP


texts: Setting the colour of a dynamically created tile does not work

texts:
I have a function that takes in the position of a tile on a Tilemap and sets the colour. If I do not replace the tile with a dynamically created one, it works just fine.
However, if I create a tile at runtime, set it's colour and add it to the tilemap, the tile does not change. In the preview window it appears black.
The function can be found below:
private void CreateTile(Vector3Int tilePosition)
{
    var tempTile = ScriptableObject.CreateInstance<Tile>();

    tempTile.flags = TileFlags.None;
    tempTile.color = Color.green;

    tilemap.SetTile(tilePosition, tempTile);
}

Any help would be appreciated, I have spent a few hours on this problem.
Thanks.


texts: What algorithm have you used in the past to generate a simple 2d maze?


texts: Large vertex buffer vs multiple draw calls

texts:
I'm just getting started with OpenGL, and I'm attempting to use it to create a 2D game. In this game, I have a hexagonal grid made up of a very large variety of differently-colored hexagons. As a newbie OpenGL programmer, I see two ways of drawing this grid:

Using a vertex buffer with the data for a single hexagon, then using a uniform offset value and iterating on the CPU to draw the same program many times until I have a grid.
Creating a singular very large pre-calculated vertex buffer that draws all the hexagons in a single call.

What's the most efficient method? Is there a better way of doing this?


texts: Recognize that user has traced a path of vector points with mouse

texts:
How can I check if a player has traced a closed vector shape from an arbitrary starting point all the way around to the beginning?

Setup

Given are the vector points A through E, which form a closed path. The created shape can be convex or concave and even have sharp elongated corners. P1 is the point where the player decides to start tracing. The point can be anywhere on the path and will be set as soon as the mouse or touch is first close to the path.

Requirements

The player starts moving along a visual representation and traces the entire shape until he reaches P1 again. If his mouse path differs too greatly, misses a point or goes outside of a given margin, I want to start over. The player may either have to trace around in the direction from which he first starts without backtracking or just have to fill the entire path even if going back and forth on the path.

How can I approach this problem? Ideally, I would like to implement a vector-math solution. I don't have any pixel data to sample from and it would be rather cumbersome in my real world implementation to generate a suitable image and map world space coordinates to it.

My Attempt

Consider each corner a waypoint with a collision area.
Track each entered collider and when all were hit, solve.
While valid colliders are pending, project mouse position onto the closest point on the path.
If the distance between projected point and mouse is too great, abort.

This approach however doesn't give me perfect results. Firstly, it's not entirely what I want, since in my ideal case the user "draws" or traces the path with the mouse, not just hits the corners. Also, when moving around a sharp corner, the project point will snap from one line segment to the next, giving me ugly visuals, when showing progress.

Possibly Better Solution

As soon as player comes close to path start sampling points from mouse.
Build up a user drawn vector path every time step or distance step.
Check if the draw vectors are similar to the given path.
Problem: user drawn path needs some sort of processing or more complex algorithm until it is comparable to given path.

Thank you for any suggestions! I will post some of my own code as soon as my implementation gives me good results.


texts: Efficient way to store “item” objects in a simple game

texts:
I am developing a simple text-based game from scratch in Java. In this game, the user is able to collect items and store them in an inventory.
My question is: how should I organize the internal structure of my game so that I can load these items in an efficient way?
I need to be able to create fresh instances of an item whenever the user acquires an item of that type, or when instantiating any feature in the game that contains items. In order to do so, I feel like I need some sort of "master list" of all items that I can just copy out of by indexing into the correct location in the list.
I've come up with two potential solutions:

Hard-code this entire giant list into a data structure within my game

Somehow load these items from an XML file at startup and then populate the "master list" of items on the fly

Pros of option 1:

Relatively easy
No IO time
Allows me maximum efficiency in designing the actual item objects

Cons of option 1:

Hard to maintain
Bloats source code
Very tedious to implement

Pros of option 2:

Easy to add/remove/modify items
Allows the user to customize the game if they want to

Cons of option 2:

Requires that I design my objects much more carefully so that they can be built on the fly and stored

Requires that I perform a deep copy from the master list each time I need a new copy of a specific item

I have to write an "item-builder" that is capable of translating the XML input into an actual item object in memory.

Neither of these ideas feels very good to me. Is there something obvious I've missed?


texts:
I am having trouble setting up the frame rate in my first game. I know that I can set it up with

clock = pygame.time.Clock()
clock.tick(60)

but this is not producing very desirable results. If I move a character 1 pixel per frame, it will move smoothly but jitter about once a second. If I print(clock.get_fps()) it tells me that my frame rate is about 59.8. Since it never hits 60, it never syncs up with my monitor's refresh rate and the annoying jittering continues.

That I know of, this is not a problem with the game's performance, since it is in a very early stage of development. If I cap the FPS at 1000 then I can get a maximum FPS of about 270.7. Is there any way I can give my game a continuous frame rate of 60?

P.S. I don't mind that my movement code is tied to FPS. I tried making it FPS-independent using this code, but this introduced some floating-point inaccuracies to my movement. It wouldn't let me set the FPS to exactly 60, either.


texts: Loading Data From Lobby Scene to Gameplay Scene with Photon Network

texts:
As the title suggests, I am currently stuck trying to program a way to load some game mode preferences (ie. what type of game mode/players on each team/ etc...) from a player lobby scene to the actual gameplay scene.
Currently, I have taken the approach of creating a DontDestroyOnLoad prefab that successfully passes the preferences over; however, when mixed with the Photon Networking API, this becomes very annoying as the Prefab becomes unsynced, resulting in players connecting into the game not spawning into there correct positions and teams reading empty, etc...
Is there a more proper and reliable way to approach transferring player game mode data from the lobby scene to the gameplay scene? I've heard that PlayerPrefs could work but am unsure whether or not they should be used when networking is involved.


texts: Opengl drawing a section of a texture stretched over a quad

texts:
Current Situation

I have a spritesheet loaded in for a texture when drawing the specific portions of the sheet that I'd like to have on my quads I do some simple math to get their location on the sheet and normalize it.

My texture is setup like this:

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

The Problem

Where I'm facing the problem is that because I'm using a "chunk" of the total texture I can't take advantage of using 1.0 for the mapping of values to glTexCoordPointer to cause the texture to stretch over the entire face.

Looked Into

I've looked for a glTexParameterf option for scaling options but I failed to find anything.

Question

Is it possible with my current methods to stretch the texture over the face of the quad without having to load a separate image for every "sprite" of the texture? Or am I just doing everything completely wrong?

Picture that hopefully sort of clarifies:

Thanks for any help.

edit
The problem was another issue all together:
Turns out it was another issue all together, I thought this didn't make sense cause it was mapping it to the vertices so it should stretch regardless and infact it does work right I was assigning the wrong the width and height values to the drawing routines calculations. And now I feel really stupid, thanks for the help Byte56. Sorry for taking up your time. The GL_CLAMP solution would be the correct answer if I hadn't made a huge fail.


texts: Is there a way to easily make 3d models and textures for people with no prior experience?

texts: I want to make a game, but I need assets. I am wondering if I should make them by myself even though I never made any textures or 3d models before. Are there technologies that allow you to easily make them? What would you recommend me to do?


texts: How to develop a real-time game server for html5 web app?

texts:
I'm contemplating a graduate project proposal of developing a rather complex HTML5 game that requires real-time server communication. The premise of the actual game play is simple: 10 players battle it out with one another. Many pieces of information will be tracked, such as: player health, each players X/Y position on the screen, items in inventory, etc. The server structure for all of these potential changes, however, is not so simple.

My goal is to develop a scalable environment that can theoretically maintain 50,000 concurrent players in 5,000 separate game instances while all running reliably with less than 1 second latency. My comfort skill set is mostly in web technologies. For a small scale app, I would use PHP/MySQL. But for an app this large, I am confident HTTP requests will not be even a short term solution.

I don't really know how to approach this situation.

Should I develop my own server, if so, what language should I use? I do not want to use NODE.JS. Is Python viable?
Is a single, high-performance server capable of maintaining this type of
load, or will I need to look into developing a cloud/cluster?
What type of database read/write would be optimal for this situation? How would I scale beyond 50,000 players? How would this scale with a cloud/cluster?


texts:
I am making an RTS game in unity like Total War games. As for rendering I am using Graphics draw mesh instanced method and after culling a I can easily render massive amount of soldiers on battlefield also they are animating with shader. I am not using unity gameobjects or unity physic engine(Also they are costly) as only data I am providing is Matrix4*4 to DrawInstancedIndirect method and rendering.Problem is I want to get height of terrain at specific position(to place unit on terrain) So I can pass Y value to Matrix4*4 for rendering. After seraching documentation I found that there are few ways to get height.

Terrain.SampleHeight :
It is easy to get height with this method just need to pass vector position but
costly As When there comes 10,000s of units on battlefield 10k calls for sample height kills performance.

TerrainData GetHeights : Can get heightvalue from it in 2d array but height I get is only for int value i.e [10,500] so there is not any option to get value sayif specific unit is at position[10.52,234.8]

TerrainData.GetInterpolatedHeight : I can get height for float values but I am getting inconsistant result with it.

One option for me is to make flat terrain but it kills immersion. I ran out of ideas here Is there any way I can get of terrain by either terrain texture or by shader ?
Sample Image

EDIT: GetinterpolatedCode

         for (int i = 0; i < position.Length; i++)
        {//position is array contains info of all vectors
         //t is terrainData
            q = t.GetInterpolatedHeight(position[i].x, position[i].z);
            position[i] = new Vector3(position[i].x,q, position[i].z);
            print(position[i]+"//"+ t.GetInterpolatedHeight(position[i].x, position[i].z));
        }


texts:
I was googling for this now for a while but didn't find any relevant data.

Does someone know any statistics of the demographics of mobile gamers that actually spend money on their games? It's clear that this data may vary over different genres but any kind of analysis in this direction would be interesting for me.


texts: Designing an efficient neighbour-networking system

texts:
I'm developing a game, which involves the use of nodes (buildings), and I need to implement neighbour networks that nodes can use to either directly or indirectly access other nodes. Nodes can be created, destroyed, or bridged to at any point in the game.

At the moment, I'm creating a list of all the nodes in a neighbour network, which is re-calculated whenever there is a new addition to the network. Each node in the network will hold a reference to this list. This system works, but I feel that there is a more efficient way to do this.

This is my current code for my node class

public class Node {
    public List<Node> directNeighbours;
    public List<Node> network;

    public void addNeighbour(Node n) {
        directNeighbours.add(n);
        recalculateNetwork();
    }

    public void removeNeighbour(Node n) {
        directNeighbours.remove(n);
        recalculateNetwork();
    }

    public void recalculateNetwork() {
        recalculateNetwork(new Network(), new HashSet<Node>());
    }

    void recalculateNetwork(List<Node> network, Set<Node> searched) {
        if (searched.contains(this)) return;

        network.add(this);
        this.network = network;

        for (Node neighbour : directNeighbours) {
            neighbour.recalculateNetwork(network, searched);
        }
    }
}

Is this the best way to keep track of direct and indirect neighbours? If not, could anyone please give me ideas on how to make this better?


texts: Can I render some vertices as an object instead?

texts:
I am generating vertices at runtime that represent terrain.

I've always drawn the vertices as triangles with GraphicsDevice.DrawUserPrimitives<VertexPositionColor>, but I'm wondering: Can vertices be converted into a "Model" so I could handle model and terrain rendering in a unified way?

This page is quite similar to what I am searching for.

I want to later port my game to Mono. Would this approach cause problems when using the Content Pipeline to convert the data?


texts: Rendering hundreds of animated characters in Unity3D

texts:
I am currently doing some research in anticipation to the development of a game where there is going to be hundreds of secondary entities which will interact with the player and among themselves (little soldiers with a very simple AI and not too many faces).

What I've found so far is that there is a way of avoiding the GameObject overhead, at least for the rendering bit of things, by using the Graphics class, with the Drawmesh method more specifically.

I've tested it and it's not too complicated. I could render any of my models using it and then make them move by rendering the graphics around coordinates in some non-unity "Character" object. The fact that the drawmesh call has to be every frame is actually quite convenient in this case !

However, I've ran into a problem : how do I deal with animated objects ?
Now, I've also done some research on that, and what I've found is that you can "Bake" the skinned mesh into a mesh usable with Graphics.Drawmesh. Then I thought about rendering animated far away characters by updating their mesh with their current animation at a certain interval. This would make the character look wierd but at long distances and among many others it should render quite well.

But the thing is, since I don't want to create a GameObject for each entity, or more precisely only for the ones up close that need a collider and everything so the players can target them with a raycast. And I sure as hell don't want to create a skinned mesh renderer for each far-away character, as it would defeat the point of using Graphics.Drawmesh.

I've thought about one solution to this problem : I could have one "hidden" GameObject with the proper models and animations get requests from "Optimized", meaning far-away character to set himself to a certain frame of a certain animation, bake his mesh and send it back to whoever requested it. I did not run any tests with that solution (I came up with it while writing this) but I'm kinda afraid that updating the mesh of a single entity potentially hundreds of times per frame might lead to wierd behaviors. Besides, I'd have to put it far away so that it doesn't get found by the players.

So, my exact question is : Do you have any better idea as to how I could optimize rendering all those characters some other way, and if not, is there a way to ask Unity "what would this mesh look like on this frame of this animation", thus allowing me to avoid creating a Gameobject just for that.

Thanks a lot in advance !
Cheers !


texts:
Below we have distances from the origin calculated in two different ways, giving the Euclidean distance, the Manhattan distance and the Chebyshev distance.

Euclidean distance is what we use to calculate the magnitude of vectors in 2D/3D games, and that makes sense to me:

Let's say we have a vector that gives us the range a spaceship with limited fuel can travel. If we calculated this with Manhattan metric, our ship could travel a distance of X if it were travelling horizontally or vertically, however the second it attempted to travel diagonally it could only tavel X/2!

So like I say, Euclidean distance does make sense. However, I still don't quite get how we calculate 'real' distances from the vector's magnitude.

Here are two points, purple at (2,2) and green at (3,3).

We can take two points away from each other to derive a vector.

Let's create a vector to describe the magnitude and direction of purple from green:

|d| = purple - green
|d| = (purple.x, purple.y) - (green.x, green.y)
|d| = (2, 2) - (3, 3)
|d| = <-1,-1>

Let's derive the magnitude of the vector via Pythagoras to get a Euclidean measurement:

euc_magnitude = sqrt((x*x)+(y*y))
euc_magnitude = sqrt((-1*-1)+(-1*-1))
euc_magnitude = sqrt((1)+(1))
euc_magnitude = sqrt(2)
euc_magnitude = 1.41

Now, if the answer had been 1, that would make sense to me, because 1 unit (in the direction described by the vector) from the green is bang on the purple.

But it's not. It's 1.41. 1.41 units is the direction described, to me at least, makes us overshoot the purple by almost half a unit:

So what do we do to the magnitude to allow us to calculate real distances on our point graph?

Worth noting I'm a beginner just working my way through theory. Haven't programmed a game in my life!


texts: How to export models with multiple animations using assimp

texts:
I'm implementing a model viewer that allows for preview and minor editing of a game's 3d model assets (custom model format).
I've been searching on the net, and I see that 90% of the use of assimp is for importing assets into games and not the other way. My goal is to do the exact opposite thing. Allow for export to some standard format that supports multiple animations and can be loaded into modeling software (e.g. Blender) then import it back to the viewer.
I've spent the last two days interfacing with assimp in my viewer. I'm generating the scene structure from scratch, node hierarchies, bones, animations and stuff and then try to export it to various formats and load my models in blender. I've been mainly experimenting with collada, fbx and glb/gltf. While geometry is exported properly, I still haven't managed to make any of the formats to work with multiple animations and to be honest I'm not 100% sure if its because of assimp or because of blender that I use for my tests. The main issue that I deal with using all file formats, is that the animation structure tends to break.
For example I got a model with 2 animations, and 9 joints that are animated. When I export my model and load it into blender, I can see that there is a separate animation (Action) generated per joint per animation leading to a total of 18 actions available... This happens with all the file formats that I have tried, and I cant find any way to organize them based on the animation that they belong to...
Specifically for gltf and glb files I found some online viewers as well and I noticed exactly the same thing.
I also discovered FBX Review which presumably has support for collada and fbx. It completely failed to load animations from collada files exported by my code using assimp (same files worked in blender), while i got some partial success with FBX files (it seems to load and detect the different animations but there were some issues with animation playback. Again the same partial animations were fine in blender.).
So my question is:
How can I effectively export a model with multiple animations from my game and have it be read by common modeling software like Blender?


texts: Identifying quad patterns in a two-dimensional array

texts:
In the tech demo I'm trying to make, tetrominoe-style blocks will be placed by the player, at which point the game checks to see if they've made a quad with any existing shapes on the board (a 2D array). If so, the quad should be processed in some way.

I have a 2D array like so:

[ [0, 0, 0, 1, 1, 1],
  [0, 1, 1, 1, 1, 1],
  [1, 0, 0, 1, 1, 1],
  [1, 0, 0, 1, 0, 1] ]

And I need to identify 'quad' patterns such as that in the top-right corner, e.g.

[ [1, 1, 1],
  [1, 1, 1],
  [1, 1, 1] ]

I'm not sure of the best way to do this. I've had a look at some two-dimensional array pattern matching algorithms, which all seem to flatten the 2D array into 1D, then use a 1D text searching algorithm (e.g. KMP) to identify any matches. My problems with that idea are that the quad can be any size, as long as it's rectangular and bigger than an arbitrary minimum (in my case, 2 x 2).

I also thought about using some variant of the 4 way flood fill algorithm or connected-component labelling, for each position of the newly-place tetrominoe. But I'm not quite sure how to best follow the path out and establish the bounds of a quad (for example, capturing this:

[ [1, 1, 1],
  [1, 1, 1],
  [1, 1, 1] ]

out of this:

[ [1, 1, 1, 1],
  [1, 1, 1, 0],
  [1, 1, 1, 0] ]

My latest though is perhaps a floodfill to get all interconnected parts after a tetrominoe lands, then 'round off' the jagged edges, maybe by checking the number of neighbours of each block, if it's 1, remove it, repeating the process until all remaining blocks have 2 or more neighbours. But this seems like it could be slow.

Has anyone any experience of this problem, or any pointers about how best to accomplish this task? I'm sure there's a common or at least applicable algorithm, I just don't know it!


texts:
I'm currently trying to build a game with Ogre3D that is basically a moving vehicle that leaves a green trail (2D manual mesh) in it's path, what i'm trying to achieve is exactly what this image shows:

My problem is that i need to change, by some method/technique, the color of the intersected path where the two meshes overlap (red area).
I've been searching around the Ogre forum and found this thread http://www.ogre3d.org/forums/viewtopic.php?f=2&t=47674, I've replicated that solution in my code but now on the screen i only see the intersected path. I'm a total newbie in stencil buffers and in Ogre generally, so I'm still not sure if this is the best approach to solve my problem.
should I try another method rather than applying a stencil buffer? vertex/fragment shader code that could help?

Any advice or direction that you could provide will be very appreciated.
Thanks a lot

***** UPDATE *****

According to JasonPh's answers i've managed to start adding some code:

1) Create manual texture

Ogre::TextureManager* tmgr = Ogre::TextureManager::getSingletonPtr();
gkString mMapTextureName = "pathTexture";
if (!tmgr->resourceExists(mMapTextureName)) {
    Ogre::TexturePtr ptr = tmgr->createManual(mMapTextureName,
                           Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
                           Ogre::TEX_TYPE_2D,
                           480,  // Width
                           640,    // Height
                           1, // Depth
                           0,
                           Ogre::PF_A8R8G8B8,
                           Ogre::TU_RENDERTARGET);

    ptr->createInternalResources();
    ptr->load();

    Ogre::RenderTexture* pathTexture = ptr->getBuffer()->getRenderTarget();
    gkEngine* engine = gkEngine::getSingletonPtr();
    Ogre::Camera* camera = engine->getActiveScene()->getMainCamera()->getCamera();
    pathTexture->addViewport(camera);
    pathTexture->getViewport(0)->setClearEveryFrame(true);
    pathTexture->getViewport(0)->setBackgroundColour(Ogre::ColourValue::Black);
    pathTexture->getViewport(0)->setOverlaysEnabled(false);
    pathTexture->setAutoUpdated(true);
}

2) Create material from scratch and use the previously created texture. This material is then assigned to my "path" entity.

Ogre::MaterialManager* mmgr = Ogre::MaterialManager::getSingletonPtr();
mMaterialName = uniqueMaterialName("pathMaterial");
mMaterial = mmgr->create(mMaterialName, "General");

Ogre::Technique* tec = mMaterial->getTechnique(0);
tec->setSchemeName("ShaderGeneratorDefaultScheme");
Ogre::Pass* pass = tec->getPass(0);
pass->setVertexProgram("pathMaterial/vs", false);
pass->setFragmentProgram("pathMaterial/fs", false);
pass->setCullingMode(Ogre::CULL_NONE);
pass->setColourWriteEnabled(true);
pass->setLightingEnabled(true);
Ogre::TextureUnitState* tus = pass->createTextureUnitState();
tus->setTextureFiltering(Ogre::TFO_NONE);
tus->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP, Ogre::TextureUnitState::TAM_CLAMP, Ogre::TextureUnitState::TAM_CLAMP);
tus->setTexture(tmgr->getByName(mMapTextureName));

mMaterial->prepare();
mMaterial->load();

3) Fragment shader code

uniform sampler2D pathTexture;

void main()
{
   vec4 color = texture2D(pathTexture, gl_TexCoord[0].xy); =
   if(color == vec4(0.0, 1.0, 0.0, 1) //green
       gl_FragColor = vec4(1.0, 0.0, 0.0, 1) //red
   else
       gl_FragColor = vec4(0.0, 1.0, 0.0, 1) //green
}

This still needs some fixes to work, so new questions have emerged:

1) Do I realy need to render "pathTexture" on screen to this to work? Maybe that texture could only be used to decide pixel colors an then discard it?

2) To only use "pathTexture" as an "input" for my shader, should I add a second pass on my material file with "pathTexture" as a texture unit?

Thanks!


texts: Render rotated rectangle inside other rectangle bounds using Libgdx

texts:
I have this code to generate a red rectangle inside a grey rectangle:

new Rectangle(grey_rectangle_position_x, Game.SCREEN_HEIGHT/2-Rectangle.height/2,0);

This code makes the following:

Now, I want to rotate the red rectangle and randomize his X coordinate but keeping it inside the grey rectangle.

This is my actual code of the rectangle:

public class Rectangle {

    public static int width=30;
    public static int height=60;
    public static Color color=Color.RED;

    public Rectangle(int x, int y, int angle) {
        super(x, y,angle);
    }

    public void render(ShapeRenderer shapeRenderer) {
        shapeRenderer.begin(ShapeType.Filled);
        shapeRenderer.setColor(color);
        shapeRenderer.identity();
        shapeRenderer.translate(pos_x+width/2, pos_y, 0.f);
        shapeRenderer.rotate(0.f, 0.f, 1.f, angle);
        shapeRenderer.rect(-width/2, -height/2, width, height);
        shapeRenderer.end();
    }
}

And this is what I should do to randomize the position of the rectangle:

new Rectangle(randomized_x_position, Game.SCREEN_HEIGHT/2-Rectangle.height/2,0);

The problem is that I don't know how to calculate the randomized_x_position in order to keep the rectangle inside the grey rectangle.

Another problem is that the current Rectangle.render() method is making my rectangle outside the grey rectangle after rotation:

When what I really want is:


texts: UV Mapping in Autodesk Maya 2011 goes wrong

texts: I'm always struggling with UV mapping, I'm still a student though. When I am creating a UV map the texture on the object always seems to be very low resolution... does anybody know  a very good tutorial, or can somebody tell me what I am doing wrong? Thank you.


texts:
Shrinking a concave polygon is quite hard, to do well. But I expect shrinking a convex polygon would be easy.

The naive approach of moving each vertex a certain distance to the centre gives me poor results though: Notice how for long edges, the displacement is much less than the other shapes.

static void shrink_poly( int numcoord, jcv_point* coords )
{
        jcv_point c = {0,0};
        for ( int i=0; i<numcoord; ++i )
        {
                c.x += coords[i].x;
                c.y += coords[i].y;
        }
        c.x = c.x / numcoord;
        c.y = c.y / numcoord;

        const float bordersz = 0.008f;
        for ( int i=0; i<numcoord; ++i )
        {
                float dx = coords[i].x - c.x;
                float dy = coords[i].y - c.y;
                float l = sqrtf( dx*dx+dy*dy );
                float dirx = dx / l;
                float diry = dy / l;
                coords[i].x = c.x + (l-bordersz) * dirx;
                coords[i].y = c.y + (l-bordersz) * diry;
        }
}

So for my second approach, I move the edges instead of the vertices, to get even spacing.
However, doing this causes the shapes to degenerate: non neighbouring edges start to intersect.
I would have to identify these and then collapse the superfluous edge to a new vertex at the intersection point. It also creates concave sections in the polygons, as seen below.

static void shrink_poly( int numcoord, jcv_point* coords )
{
        const float bordersz = 0.008f;
        float shiftx[ numcoord ];
        float shifty[ numcoord ];

        for ( int e=0; e<numcoord; e++ )
        {
                const int i=e;
                const int j = (i+1)%numcoord;
                jcv_point& v0 = coords[ i ];
                jcv_point& v1 = coords[ j ];
                float dx = v1.x - v0.x;
                float dy = v1.y - v0.y;
                float nx = -dy;
                float ny =  dx;
                float l = sqrtf( nx*nx + ny*ny );
                nx = nx / l;
                ny = ny / l;
                shiftx[e] = bordersz*nx;
                shifty[e] = bordersz*ny;
        }

        for ( int v=0; v<numcoord; v++ )
        {
                const int e0 = v;
                const int e1 = (v+numcoord-1) % numcoord;
                assert( e0 >= 0  && e0 < numcoord );
                assert( e1 >= 0  && e1 < numcoord );
                coords[ v ].x += shiftx[e0];
                coords[ v ].y += shifty[e0];
                coords[ v ].x += shiftx[e1];
                coords[ v ].y += shifty[e1];
        }
}

Is there a simple and effective way for shrinking convex polygons?


texts: Dynamic 2D soft shadows with concave polygons?

texts:
I've implemented dynamic 2D soft shadows from this article on gamedev.net.  It uses an image for the penubmra and is fast, physically accurate and looks good in most situations, so I really like the technique.

The problem is that it doesn't work properly for concave polygons, two polygons being close together, or a polygon being small compared to the light source.  The polygons in my app are going to be user generated, so I can't easily avoid these scenarios.

Is there a technique that still looks good an accurate in the situations that I listed?


texts: HumanIK Z axis Up in Maya for Unreal Engine

texts:
I am pretty stumped! I want to use HumanIK in Maya to throw together some prototype animations for my game that is being developed in Unreal Engine 4.7

The issue is that Unreal requires Z axis to be UP and this results in HumanIK Skellies to end up on their backs in Maya when Created.

Is there a way to Configure HumanIK to use Z axis as Up?

Or is there another way around this? I see plenty articles on studios using HumanIK for Unreal so I must be missing something really silly in regards to this issue!

Any help will or suggestions would be greatly appreciated!


texts: Ragdoll on alive creatures: has somebody already implemented it?

texts:
I find that a dead creature falling realistically is boring.

I wonder, has any game implemented an animation system where the model moves depending of the muscle forces and the velocity of the limbs, but calculated ingame ?

It is much faster to have determinate animation data which is loaded and is just read sequentially, but it looks much "static".

Since I hear a lot about procedural generated data, one could generate a body with its own animation depending of the weight of the bones.

I'm not talking about a real-life robot simulation where the bone is standing, auto-adjusting some angles to keep balance, but something more intermediate and more pre-calculated.

The forces vary slightly between steps (some random on a float so vary plus or minus 10%), so the trajectory of the limbsvary between steps.

It would require a lot of adjustement and preconfiguration, but it would look much less deterministic.


texts:
I have an idea for a small game which would generate random 3D planets.

I already have found a way to create a random heightmap in XNA (http://adminspot.net/topic/487-cxnamath-fast-procedural-heightmap-generator-snippet/).

How would I be able to wrap the heightmap around a sphere and then render it on the sphere, creating a planet-like terrain?
Also, would I be able to do something similiar with the .NET port of libnoise (XNA port: http://libnoisedotnet.codeplex.com/)?

I'm not asking for code or anything, just some ideas on how to do something like that.

Thanks.


texts: Is UDP still better than TCP for data-heavy realtime games?

texts:
I know that UDP is usually recommended for real-time multiplayer games with high data usage.

Most articles are serval years old, and since ~80% of all data transmitted on the internet is TCP, a lot of optimization must have been done for TCP.

This make me wonder: is UDP still superior in terms of speed and latency?  Could recent TCP optimizations have made TCP perform better than UDP?


texts: Setting object position in screen space - camera

texts:
I'm trying to set an Image gameobject's transform.position. My canvas is "screen space - camera" because I needed to use a line renderer.

However, when I set the position, say to new Vector3(-320, -240); the object (in play mode) gets positioned at -16266.44, y: -15360, way off-screen.

I've tried to reset the localPosition and such based on some other answers but it doesn't help. What else could be translating my pixel coords?

var go = Instantiate(HexTilePrefab, this.transform);
go.transform.localPosition = Vector3.zero;
go.transform.localRotation = Quaternion.identity;
go.transform.localScale = Vector3.one;
go.transform.position = new Vector3(screenX, screenY);


texts: How do you create images that work for multiple resolutions?

texts:
I'm currently doing some game development and I've been curious about this situation for many years.

Let's say your game has two resolutions: 640x480 and 800x600 (using small numbers just for simplicity). I have an image that I want to, no matter, take up 1/4 of the screen. For 640x480 resolution, it would be 320x240; while 800x600 resolution, it would be 400x300. There's a few ways I think of that this could be accomplished:

Make the image 320x240 and scale it up on the larger resolution (will look pixelated)
Make the image 400x300 and scale it down on the smaller resolution (loss of detail)
Create two separate images for each resolution (size bloat)

Just for 4:3 aspect ration, you probably have 5-6 resolutions that are commonly found in more professional games; plus additional ones for 16:10 and 16:9. Creating separate assets for each aspect ratio makes sense, but doing it for each resolution sounds like overkill and a huge size jump.

How do developers normally handle this sort of situation?

Thanks!

UPDATE: This information would be used for a 2D platformer.

Part of the reason that I'm interested in this is trying to keep a "level playing field" for all players no matter what resolution they are at. I don't want the 800x600 resolution player to be able to see more of the level than the 640x480 player can.

Additionally, since I really have no graphics experience, I'm not sure how much the resolution changes would affect the integrity of the images.


texts:
I'm a total beginner with Directx/3D programming. I need help with implementing hardware instancing on Directx 11. I'm trying to render multiple cubes on the screen, to create some sort of Minecraft-esque voxel engine. The problem is, I don't know where to start to achieve this. This is how my "render frame" function looks:

void RenderFrame(void)
{
    D3DXMATRIX matView, matProjection;
    D3DXMATRIX matFinal;

    // create a view matrix
    D3DXMatrixLookAtLH(&matView,
    &D3DXVECTOR3(0.0f, 9.0f, 24.0f),   // the camera position
    &D3DXVECTOR3(0.0f, 0.0f, 0.0f),    // the look-at position
    &D3DXVECTOR3(0.0f, 1.0f, 0.0f));   // the up direction

    // create a projection matrix
    D3DXMatrixPerspectiveFovLH(&matProjection,
    (FLOAT)D3DXToRadian(45),                    // field of view
    (FLOAT)SCREEN_WIDTH / (FLOAT)SCREEN_HEIGHT, // aspect ratio
    1.0f,                                       // near view-plane
    100.0f);                                    // far view-plane

    // create the final transform
    matFinal = matView * matProjection;

    devcon->ClearRenderTargetView(backbuffer, D3DXCOLOR(0.0f, 0.2f, 0.4f, 1.0f));

    devcon->ClearDepthStencilView(zbuffer, D3D11_CLEAR_DEPTH, 1.0f, 0);

    UINT stride = sizeof(VERTEX);
    UINT offset = 0;
    devcon->IASetVertexBuffers(0, 1, &pVBuffer, &stride, &offset);
    devcon->IASetIndexBuffer(pIBuffer, DXGI_FORMAT_R32_UINT, 0);
    devcon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

    devcon->UpdateSubresource(pCBuffer, 0, 0, &matFinal, 0, 0);
    devcon->DrawIndexed(24, 0, 0);

    swapchain->Present(0, 0);
}

Notice that there's a single vertex buffer containing the verteces of a cube, and index buffer containing its indeces. I want to render many (5000+) cubes on the screen at once on a single draw call, without performance issues, so I know instancing is the way to go, but I don't know how to implement it in my code. What changes do I need to do to my code in order to display multiple instances of the cube?

Thanks in advance!


texts: How to implement 2d collision detection that is immune to low framerate and fast movement?

texts:
I am trying to implement my own collision detection for a 2.5d voxel style platformer using Three.js.
I have a problem with my implementation - if the framerate is too low or the character is moving too fast (usually when falling from high places) it falls right through. Is there a way to improve collision detection to be immune to problems like this?

This is how I detect collisions:

function render(){
    requestAnimationFrame(render);

    setVelocity();
    animate();
    manageCollisions();

    renderer.render(scene, camera);

}

function manageCollisions(){
//Check every game object for collision -> TODO: implement broad phase when dealing with many objects
for(i=0; i < world.length; i++){

    //Check for bottom collision <- ALWAYS check (unless moving up)
     if(velocityY<0) {
        if( (character.position.y - character.height/2) < (world[i].position.y + world[i].height/2)
            && (character.position.y + character.height/2) > (world[i].position.y + world[i].height/2)
            && (character.position.x + character.width/2) > (world[i].position.x - world[i].width/2)
            && (character.position.x - character.width/2) < (world[i].position.x + world[i].width/2))
        {
            console.log("bottom collision " + i);

            velocityY=0;
            jumped=false;
            grounded = true;

            character.position.y = world[i].position.y + world[i].height/2 + character.height/2 - 0.1; //-0.1 prevents shaking
        } else {
            grounded = false;
        }

    }

    //Check for right collision <- ONLY if moving right (velocityX is positive)
    if(velocityX > 0){
        if( (character.position.y) < (world[i].position.y + world[i].height/2)
            && (character.position.y + character.height/2) > (world[i].position.y - world[i].height/2)
            && (character.position.x + character.width/2) > (world[i].position.x - world[i].width/2)
            && (character.position.x - character.width/2) < (world[i].position.x - world[i].width/2))
        {
            console.log("right collision" + i);
            velocityX=0;
            character.position.x = world[i].position.x - world[i].width/2 - character.width/2;
        }
    }

    //check for left collision <- ONLY if moving left (velocityX is negative)
    if(velocityX < 0){
        if( (character.position.y) < (world[i].position.y + world[i].height/2)
            && (character.position.y + character.height/2) > (world[i].position.y - world[i].height/2)
            && (character.position.x - character.width/2) < (world[i].position.x + world[i].width/2)
            && (character.position.x + character.width/2) > (world[i].position.x + world[i].width/2))
        {
            console.log("left collision" + i);
            velocityX=0;
            character.position.x = world[i].position.x + world[i].width/2 + character.width/2;
        }
    }

    //check for top collision <- ONLY if moving up (velocityY is positive)
    if(velocityY > 0){
        if( (character.position.y + character.height/2) > (world[i].position.y - world[i].height/2)
            && (character.position.y - character.height/2) < (world[i].position.y - world[i].height/2)
            && (character.position.x + character.width/2) > (world[i].position.x - world[i].width/2)
            && (character.position.x - character.width/2) < (world[i].position.x + world[i].width/2))
        {
            console.log("top collision" + i);
            velocityY=0;
            character.position.y = world[i].position.y - world[i].height/2 - character.height/2;
        }
    }

}

}


texts: How to improve Batch Rendering to work with 3D skeletal animation data

texts:
I've implemented a batch rendering technique that is described in detail here: http://www.gamedev.net/page/resources/_/technical/opengl/opengl-batch-rendering-r3900

I'd like to extend it now to support 3D skeletal animation data, but I'm not sure what is the best way to do that so that the bone transformation can happen on the GPU rather than on the CPU.  The Batches as they are defined right now depend on a transform matrix but that means that if I try to render a human, each limb would go into its own Batch, which means I would not get any performance gain by using the BatchManager as described in the article above.

Can someone suggest how to do batch rendering that works with 3D skeletal animation data?


texts: Rendering to Texture with Transparency in Monogame?

texts:
Please forgive me if I'm asking a question that has been answered before, but for the life of me, search as I might, I couldn't find a problem exactly like this anywhere.

I'm trying to render a series of sprites, all sourced from transparent PNGs, to a texture. Each of these rendered textures would be layers in a 2D environment which could be subjected to shaders/effects before being placed on the screen.

My problem is that when I try this, the screen fills with black, and only the last texture rendered is visible.

I have tried:
 * clearing the graphics device after setting my render target, using color.transparent.
 * every surface format (those formats mean nothing to me at this interim)

I am new to this particular environment, so I am probably missing something that I can't easily look up.


texts: Keep my 3d player from jumping if he's not on the Ground

texts:
I'm making a 3d game, and I have only made games in 2D before, but i have used blender before too.  My player can now walk and jump, but he is not limited to only jumping of the ground.  In 2D, you separated ground objects in a collision layer, and in the jump method you add an if statement like this

if(myCollider.IsTouchingLayers(LayerMask.GetMask("climbing")))
{
    //do the stuff
}

Apparently this is designed for 2d only.

How do I do this in 3d?


texts: Jumping a sprite while moving in a Bezier action

texts:
I'm creating a game and I need the sprite to jump (move up and down basically) while it's moving on a bezier path so it moves vertically while it still follows the path. If I do this while it's moving along the bezier path:

[mySprite runAction:[CCJumpBy actionWithDuration:0.1 position:ccp(0,0) height:10 jumps:1]];

It jumps vertically but instantly it returns to the position on the path. What I want is to jump relative to the path.

Does anyone know anything about it?

It would looks something like this:

The curve is a sequence of CCBezierBy's by the way.

Thanks.


texts: Testing a Client's Camera in a Multiplayer FPS

texts:
I'm attempting to do a logic test regarding a client's camera in a multiplayer FPS in Unity and I'm a little uncertain of which way to implement the functionality.

The scenario:
 - I have a host and a client playing together.
 - I want to be able to tell if specific objects are visible from each player's camera, even on the edges of their screens.

For a local player this is simple, I just take the local camera reference, convert the target object's position to that camera's viewport space to see if it's within the bounds of the camera, and then raycast to test for blocking objects.

In a Host-Client setup, I've been attempting to ensure I do everything on the Host's machine, but the Client's camera does not exist in that context, only a third-person remote-player.

Possible solutions:

I could pass the object's position to the client, convert it to the client's viewport space on their machine, then send that converted position back to the Host every frame, but this seems like a lot of network traffic for this. Furthermore it would use a stale client's camera position on the Host's up-to-date object position.
Or I could do the full logic test on the client machine and only tell the host the result (e.g., success/fail). But from my understanding this is an ill-advised practice given how authority should be handled in a Host-Client setup...
Or I could keep a camera object on the remote-player and synchronise that with the client's camera position and then do the test solely on the Host's machine involving that synced camera and objects.

I'm not sure which approach to pursue and would appreciate any input!


texts:
@Override
public void create() {
    batch = new SpriteBatch();
    img = new Texture("badlogic.jpg");
}

@Override
public void render() {
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    if (x < 0 || x > 400) {
        speed = -speed;
    }
    x += speed * Gdx.graphics.getDeltaTime() * 60;
    Gdx.app.log("delta",Gdx.graphics.getDeltaTime()+"");

    batch.begin();
    batch.draw(img, x, 0);
    batch.end();

}

I had a problem and i created a new project. The problem libgdx tries to keep 60FPS and avarage deltatime is ~16ms.Some renders take +20ms then next render takes 12ms(render1 + render2 = 32ms) to achieves 60FPS. That makes game laggy. As you can see i don't have anything in the project and it is the same in desktoplaunch. How did you solve this ?

Note: I also tried reqeustRendering. But it is the same thing if the render takes more time than the avarage. I also tried to wait some times for the render if that is smaller than 16ms. It didn't help either. It doesn't have any GC problem. I use Libgdx 1.6.4.


texts: 2D Collision detection and reaction: Rect to Line

texts:
I'm working on a little 2D side scrolling platformer with a couple of friends. The issue I'm having is the level is completely defined by points. They are just a bunch of points which when I read in I turn into line segments, thus creating the floor in a sense. I've been having a lot of issues with this because I'm trying to make appropriate collision detection and reactions but I've never really approached Rect (which my characters sprite is defined as) to a Line (which would represent the section of the floor) collisions. Now I've already tried a few things and what I put together was I treated the character's Rect as if it were 4 Lines and did 4 Line to Line collisions then finding the points where the line's collided I then used some vector math to push out the line from the box. Now as far as that goes it works pretty well IF I'm colliding with one line at a time running into it straight and not on the end points. I'm really wondering if this was a good way to approach it at all really.
What I did for the reaction was make a vector from the center of the character's Rect to the two points then I added them together to make a combined vector then divided it by 2 (so it wasn't to long) and then pushed out by that, which works, some of the time. I can't get it to work without 2 points of intersection.

My questions are: Should I instead go for some other sort of collision detection and reactions?
or
Given your character's Rect and points of intersection on those lines how would you handle the reaction for this?


texts: Unity: Improvements to skinnedMeshRender.BakeMesh performance or alternatives?

texts:
I'm running to a situation where I need to do some manual deformation to a skinnedMeshRenderer's mesh vertices after applying some blendskinning. I'm finding that the following code takes ~15ms to run. I've calculated the time both by running it 100 times and measuring time difference, and by using the Unity Profiler.

Mesh bakedMesh = new Mesh();
skinnedMeshRenderer.BakeMesh(bakedMesh);

The mesh has ~7000 vertices.

I just need loop through each vertex to get its current (blendskinned) position relative to its gameObject's local origin. The goal is to calculate the amount of deformation it experienced.

so something like (pseudocode):

for i in vertices
    deformation[i] = originalVerticies[i] - bakedCertices[i]

It's the call to BakeMesh that is slowing things down, which is required to get bakedVertices[i].

Is there another way to get backedVerticies[i] without actually baking the mesh? Maybe some kind of manual calculation to simulate baking but only on the vertices? or perhaps some way to speed up the baking process?

Additional info:

The reason i'm calculating the deformation is to undo unity's automatic linear blend skinning, since at runtime I want to move some bones without affecting the mesh. However, when I move the bones, unity's automatic linear blend skinning kicks in and deforms the mesh, so this is a way to calculate how much it was deformed so I can "Undo" this blend skinnning by adding the deformation back on to the vertices. Perhaps there is a more elegant solution, but I can't find any way to temporarily turn off the automatic linear blend skinning. Note that I need to do this every single frame.

I'm currently at 15ms for this script, which is really pushing the 16ms limit to maintain 60fps. When I add other scripts etc into the scene it will for sure be laggy. I would also like it to run at at least 90fps since i hope to use this script in VR in the future.


texts: How do I make a Box2D object that makes objects passing through it slower?

texts:
I wish to have a sort of "slow motion" or "slow down" effect on a players character when they walk in a mud area, usually the character velocity is 3f constant in any one direction. The problem is I tried to declare a rectangle to cover the object mud area but I  am only able to get a solid rectangle area and therefore the character cannot walk through or over this area, the desired action would be having the character movement slow down while walking in the mud area. The code below is what I have tried to make this sort of region, but this code only makes a solid object which the character cannot pass through.

 final Rectangle rect = new Rectangle( object.getX(), object.getY(), object.getWidth(), object.getHeight(), vbom );

 final FixtureDef fixDef = PhysicsFactory.createFixtureDef( 0.0f, 0.0f, 1.0f );
 Body body = PhysicsFactory.createBoxBody( physicsWorld, rect, BodyDef.BodyType.KinematicBody, fixDef );
 body.setUserData( typeOfObject );
 physicsWorld.registerPhysicsConnector( new PhysicsConnector( rect, body ) );


texts: Trying to mix and mingle 3d physics with the Unity UI

texts:
I have recently created a drag drop system where I drag stuff from a UI menu and then drop it to another UI. The child of the draggable UI object is a 3d model. I have attached box collider and rigidbody to this 3d object and moving the Object with rigibody.MovePosition and rigidbody.MoveRotation. The object doesn't respond to physics like if there is a box collider in the way, it just goes through it without showing any physical reactions.
I wanted to know if I can do this mixing of Unity UI which helped me in creating this drag drop and also helped scaling the UI and the 3d physics engine to get my job done.
My Project is basically an interactable toy train system where user will create a track and run the carts on it.

the snake/train follows a spline. and runs on it.
Here is a demo
https://drive.google.com/open?id=1L_ZTtYqfcJXsvjHmcNaK6gfRHRHio8h4

I am also extensively rotating the object and it's facing forward so that could be an issue ????


texts: Conditional Variables in Scriptable Objects

texts:
While using ScriptableObjects, how can I make some variables conditional?

Example Code:

[System.Serializable]
public class Test : ScriptableObject
{
      public bool testbool;
      public string teststring;
      public int testint;
}

Goal: When testbool == true then teststring is available to edit, when testbool == false then testint is available to edit while the other one is "grayed out".


texts: I have Unity 5 and when I make a new project, there are no assets that are usually there (Character Controller, Terrain, etc.). How do I fix that?


texts: Comparing angles and working out the difference

texts:
I want to compare angles and get an idea of the distance between them. For this application, I'm working in degrees, but it would also work for radians and grads. The problem with angles is that they depend on modular arithmetic, i.e. 0-360 degrees.

Say one angle is at 15 degrees and one is at 45. The difference is 30 degrees, and the 45 degree angle is greater than the 15 degree one.

But, this breaks down when you have, say, 345 degrees and 30 degrees. Although they compare properly, the difference between them is 315 degrees instead of the correct 45 degrees.

How can I solve this? I could write algorithmic code:

if(angle1 > angle2) delta_theta = 360 - angle2 - angle1;
else delta_theta = angle2 - angle1;

But I'd prefer a solution that avoids compares/branches, and relies entirely on arithmetic.


texts: Started work on a time based business game- one similar already exists... What should i do?

texts: Yeah so like i said, i started to work on a time based game that involves business investments, and as it turns out, there is a game called adventure capitalist that has pretty much the same idea about it. I planned to greenlight my game on steam and i found that adventure capitalist is on steam. Im not sure what i should do. Should i continue but make changes to the game (and if so, what sort of changes) or should i give up and work on something else. I should have mentioned this earlier but in the game, you make investments in the electronic industry, and each type of investment will have a different payout per second and a different base investment price to other types. For example, investing in computers will cost you £500 and have a payout of £5/second but investing in smartphones will cost only £100 and have a payout of £1/second. When you can afford it, you can level up your investment. I havent really added any more to the game than that so any advice would be appreciated, thanks.


texts: How to enable the option "edit physics shape" in the Sprite Editor?

texts:
I can successfully import .png files, create tilesets, and use them in my tilemaps in Unity.
Thanks to DMGregory, I just learned that there exists an option to customize the Tilemap Collider 2D in the Sprite Editor, which allows me to set a custom collider for every tile instead of going through them one by one.

The steps I follow while creating a tileset in Unity is as follows.

Import the .png file.
Open the Sprite Editor.
Select the option Multiple for Sprite Mode.
Select Slice from the Sprite Editor.

Then, I create a Tile Palette in a folder, drop and drag my created tiles, and start creating my level.

I have never encountered the option to modify the colliders tile by tile. What am I doing wrong?


texts:
Im currently trying to texture a (transparent) cylinder. I want the texture image to wrap sideways around the cylinder but not the top and bottom faces, they are supposed to just stay untextured (so transparent, in this case).

So what I did (in Blender) is UV unwrap only the side faces and leaving the top and bottom faces as they are.

However, this method doesn't seem to work very well, because when I import the .obj in Unity the top and bottom faces are mapped to a "random" place in the texture and therefore have color.

My current workaround is to map the top/bottom faces to areas in my texture that are transparent, however, this only works when textures have a transparent place, which isn't always the case.


texts: How can I increase the return from from ads?

texts:
I made a little Windows Phone game and I want to use AdRotator to show ads in the game. My game has 50 levels. Some levels take 30 seconds, other levels more than 3 minutes to complete them.

Will I make more money with longer levels? Can I get more impressions in longer levels?

My game has a free trial mode, but you have to buy the game if you want the entire content.

How can I increase impressions and get a high eCPM rate?


texts: In VR Games, i frequently notice that skyboxes look too close. Would this be a method for making them appear more distant, especially for space games?

texts:
I was playing Star Trek Bridge Crew, and noticed that the starfield looks oddly close. The same goes for the sky in other games. I realized that this is because when rendering the skybox in a game, VR games render the skybox once for each eye. But because games use a large dome or sphere for the skybox, instead of the appearance of the skybox being located extremely far away (Which happens convincingly in non-vr games), the parallax is quite detectable to our eyes and we see the skybox for what it is, a relatively close wall of stars.

To fix this, I propose that when rendering for the right eye, the right eye camera be temporarily moved to the position of the left eye camera to render the skybox, then moved to the correct position before continuing to render the scene's foreground. Alternately, you could move the skybox model's position by a few pixels (as many as the distance between the cameras) to achieve the same effect.

This should make the appearance of the skybox appear at "infinite" distance since that's how we see stars ourselves, with both eyes seeing the photons arriving at almost parallel vectors.

The effect, in VR, should be convincing. Put simply, stars don't move their apparent position when you close one eye. That should be true in vr games too.

My question is whether, to the game devs of stack exchange, this would be possible using this method. I think the main challenge would be in changing the position of an object in the middle of a render pass.


texts:
The following code is supposed to move a player sprite (in this case it's an 8x8 red square) to the coordinates of where the mouse is clicked. I'm able to move the square in the general direction of the click but the sprites path does not always pass precisely through the point. I'd love someone to analyse the code and show me where I'm going wrong with this.

from __future__ import division
import math
import pygame

SCREEN = pygame.display.set_mode([700, 700])
SCREEN_HEIGHT = pygame.display.Info().current_h
SCREEN_WIDTH = pygame.display.Info().current_w
pygame.display.set_caption('Window Caption')
clock = pygame.time.Clock()

class Player(pygame.sprite.Sprite):
    def __init__(self, color=(255,0,0), dims=[8,8], (originx, originy)=(100,100)):
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.Surface(dims)
        self.image.fill(color)
        self.rect = self.image.get_rect()
        self.rect.centerx = originx
        self.rect.centery = originy
        self.speed = 10
        self.vx = 0
        self.vy = 0

    def normalize(self, (p1x, p1y), (p2x, p2y)):
        dx = p2x - p1x
        dy = p2y - p1y
        vlength = math.hypot(dx, dy)
        vnorm = (dx / vlength, dy / vlength)
        self.vx = vnorm[0]
        self.vy = vnorm[1]

    def update(self):
        self.rect.centerx += (self.vx * self.speed)
        self.rect.centery += (self.vy * self.speed)
        print self.rect.centerx, self.rect.centery, self.vx, self.vy # verify calculations

pygame.init()

sprites = pygame.sprite.Group()
player = Player()
sprites.add(player)

looping = True
while looping:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            print "Exiting..."
            looping = False
        if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_ESCAPE:
                    print "Exiting..."
                    looping = False
        if event.type == pygame.MOUSEBUTTONDOWN:
            (left_click, middle_click, right_click) = pygame.mouse.get_pressed()
            mouse_pos = pygame.mouse.get_pos()
            if left_click:
                print "left click", (player.rect.centerx, player.rect.centery), mouse_pos
                player.normalize((player.rect.centerx, player.rect.centery), mouse_pos)
            if middle_click:
                print "middle click", mouse_pos
            if right_click:
                print "right click", mouse_pos

    SCREEN.fill((0,0,0))
    sprites.update()
    sprites.draw(SCREEN)

    # Redraw everything we've asked pygame to draw
    pygame.display.flip()

    # Set frames per second to 60
    clock.tick(60)

# Quit gracefully if we exit the main loop
pygame.quit()


texts: how to make a spritefont with multiple colors and black?

texts:
I want to make a multicolored font like:

My problem is that black is someway "set" as the transparency background for the font, so if i use black or any dark color xna takes it as background too.

How can i define in my spritefont what color is background and what not? is there a way to just draw my font with any program and use that as simple font?