texts:
Currently, I am making a top down game using Unity. Here is the problem that I’m trying to solve: The player in my game is always centered on the screen, and the since the map is rounded, the agents controlled by AI must acts and be shown base on the distance of the round map. Here is the sketch for the better explanation.

I want to ask for a good way to design and implementing the above task.

And here is my approach for this task:

I split the map into 4 areas (could be smaller and more in number).
Each of the 4 areas will have its corresponding area outside of the map area (The outside map areas are trigger boxes).
When the area that is covered by the main camera has its parts out of the map area, these outside parts will active the trigger boxes that are overlapped by them.
When a trigger box is activated, all the agents in its corresponding area inside the map will be moved temporally to the trigger box area. This can be done just by adding the difference between the trigger area position and the inside map area that the agent is staying to the agent’s position.
When the area that is covered by the main camera no longer overlap the trigger box, all the agent will move back to its corresponding position inside the map. This process is done by reversing the moving out process.

Here is the sketch for this.

And the flawless come when there are agents with the flocking or forming formation behavior that requires the agents to have connections with others. When an agent is moved out of it actual position, the other agents in the formation will lose their connection with the moved agent (Like the distance between them suddenly becomes large). I think that this could be somehow solved by storing the actual position of the agent and marking it as moved, but it may be too computational cost, or having too many cases.

I tried to think of a different approach, that the map border is a circle, and to show the round view is just needed to take the symmetric through the center of the map. However, the circular border shows a bad animation when the agents try to move through the border.
(I don't have enough reputation attach image about the flocking behavior problem and the circular approach, so you have to imagine it)

If you can solve the problems that I mentioned above or have a different approach, please show me. Thank you.


texts: Xna: Splitting one large texture into an array of smaller textures

texts: I would like to split a large texture into a one dimensional array of smaller textures. How should I do this?


texts: Why is the sprite flickering in full screen mode in SFML?

texts:
I have been trying to make a simple platformer game with SFML. Here is my main method where draw and update functions call the draw and update functions of all my entities which in turn update the variables and draw updates the position of the sprite which is to be rendered.

int main() {
sf::RenderWindow window(sf::VideoMode(0, 0), "My First SFML Game", sf::Style::Fullscreen);
int frames = 0;

if(!init()) {
    std::cout << "Could not initialize\n";
    return 1;
}

sf::Clock clock, frameClock;

while(window.isOpen()) {
    sf::Event event;
    while(window.pollEvent(event)) {
        switch(event.type) {
        case sf::Event::Closed:
            window.close();
            break;
        case sf::Event::KeyPressed:
            if(event.key.code == sf::Keyboard::Escape)
                window.close();
            break;
        }
    }

    //keyboard handler
    if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) {
        if(player->velX > -7) player->velX--;
    }
    else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) {
        if(player->velX < 7) player->velX++;
    }

    if(frameClock.getElapsedTime().asSeconds() >= 1/FPS) {
        update();
        draw(window);
        window.display();
        window.clear();

        frames++;
        frameClock.restart();
    }

    if(clock.getElapsedTime().asSeconds() >= 1) {
        std::cout << frames << " frames per second\n";
        clock.restart();
        frames = 0;
    }
}
}

There is a strange flicker when I press left or right arrow keys (actually, almost every second). However, it did not happen when I repeatedly pressed prt sc. It also does not happen when with that much intensity (but it still happens a little bit) when I switch out of the full screen mode.


texts: Fail to install ML-Agents (python packages)

texts:
I have been trying for hours to install pytorch and mlagents with cmd, however I am getting pretty much the same error for each package I'm trying to install -

ERROR: Could not find a version that satisfies the requirement typing-extensions (from torch==1.7.0) (from versions: none)

ERROR: No matching distribution found for typing-extensions (from torch==1.7.0)

I'm using python version 3.7.9, attaching a screenshot of the cmd.
Also, as you can probably notice - I'm getting a repeating warning every time I'm using pip and I'm not sure of it's something to avoid -

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/torch/


texts:
Is there any way to handle the response for the wwwform we are using add.form method and there is no way to validate the data insertion we cant say the values are entered into database or not is there any way to check the response?

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class LoadOnClicktes : MonoBehaviour {
    public Text box1;
    bool ch=false;

    // Use this for initialization
    string url1="*******/index.php";

    // Update is called once per frame
    public void LoadScene(int score1)
    {
        string kill = box1.text;
        Debug.Log (kill);
        int sco = Player.score;
        Debug.Log (sco);
        WWWForm form = new WWWForm ();
        form.AddField ("name", kill);
        form.AddField ("score",sco);
        WWW WWW = new WWW (url1, form);
        Debug.Log ("Done");
        ch = true;

    }
    /*void OnGUI(){
        if(ch)
        GUI.Window (0, new Rect ((Screen.width / 2) - 150, (Screen.height / 2) - 75
        , 300, 250), ShowGUI, "");
    }
    void ShowGUI(int windowID)
    {
        // You may put a label to show a message to the player

        GUI.Label(new Rect(65, 40, 200, 30), "Score Submitted");

        // You may put a button to close the pop up too

        if (GUI.Button(new Rect(50, 150, 75, 30), "OK"))
        {
            ch = false;
            // you may put other code to run according to your game too
        }

    }*/

}


texts: Merging several textures into one using RGB channels

texts:
Would it be possible to place a texture into each RGB channel?

Example:
Red = wood.png
Blue = tiles.png
Green = metal.png

The advantages I could see are saving space, memory and draw calls and the resolution might not suffer. (unless I'm missing something)

I've seen people pack many textures into one but they have to be scaled to fit which lowers resolution.


texts: Can't connect to Steam using Blueprints in UE4.25

texts:
I'm following this tutorial by Unreal Engine itself, but I don't have a Steam overlay popup like I'm supposed to, (according to the tutorial.) And actually a lot of people have a similar issues like this.
What I have done / tried is:

Enabling Steam overlay (in Steam settings, but it was already enabled)

I've already edited the DefaultEngine config file

I'm playing my game (in Unreal Engine) from the Standalone Game option

Searching this up, re-watching tutorial, looking at tutorial's comments

Enabled the Online Subsystem Steam plugin

And I still don't know what the issue is. I've also looked at this thread by the Unreal Engine community, but it didn't help that much.


texts: Tick() method error when I run it. HELP!

texts:
Okay so I get this error:

Exception in thread "Thread-2" java.lang.NullPointerException
at basic.game.here.Game.tick(Game.java:71)
at basic.game.here.Game.run(Game.java:54)
at java.lang.Thread.run(Unknown Source)

Here is the code it says the error relates to:

package basic.game.here;

import java.awt.Canvas;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferStrategy;

import basic.game.here.tiles.Ground;

public class Game extends Canvas implements Runnable {

private static final long serialVersionUID = 1L;

public static final int WIDTH = 960, HEIGHT = WIDTH / 12 * 9;

private Thread thread;

private boolean running = false;

private int FPS = 0;

private World world;
private Player player;

public Game(){
    new Window(WIDTH, HEIGHT, "BASIC", this);

    world = new World();

    player = new Player(500, 200);

}

public synchronized void start(){
    thread = new Thread(this);
    running = true;
    thread.start();
}

public synchronized void stop(){
    try{
        thread.join();
        running = false;
    }catch(Exception e){
        e.printStackTrace();
    }
}

public void run() {
    long lastTimeChecked = System.nanoTime();
    int frames = 0;
    while(running){
        tick();
        render();
        try {
            Thread.sleep(6);
        } catch (InterruptedException e){
            e.printStackTrace();
        }
        frames++;
        if(System.nanoTime() - lastTimeChecked >= 1000000000){
            FPS = frames;
            frames = 0;
            lastTimeChecked = System.nanoTime();
    }
}
}

private void tick() {
    player.tick();
}

private void render(){
    BufferStrategy bs = this.getBufferStrategy();
    if(bs == null){
        this.createBufferStrategy(3);
        return;
    }
    Graphics g = bs.getDrawGraphics();
    g.setColor(Color.BLUE);
    g.fillRect(0, 0, WIDTH, HEIGHT);

    g.setColor(Color.YELLOW);
    g.setFont(new Font("Dialog", Font.BOLD, 18));
    g.drawString("" + FPS, 5, 20);

    //g.drawString("(" + player.x + ", " + player.y + ")", 5, 40);

    world.render(g);
    player.render(g);

    g.dispose();
    bs.show();
}

public static void main(String[] args){
    new Game();
}

}

Here is the player class because I think it is related to this:

package basic.game.here;

import java.awt.Color;
import java.awt.Graphics;

public class Player {

private int x, y;

public Player(int x, int y){
    this.x = x;
    this.y = y;
}

public void tick(){

}

public void render(Graphics g){
    g.setColor(Color.CYAN);
    g.fillRect(x, y, 16, 16);
}

}

Thanks in advance!


texts: How do "game maker" tools like Blitz3D create .exe files?

texts: There are several applications like Blitz3D or other kinds of game construction tools that compile scripts or other game data to a single executable file. How do they do that?


texts: Unity: how do I edit a second scene when my objects are still in the first?

texts:
I have my game set up so that objects like the Canvas and the main character are set to DontDestroyOnLoad; they're only initiated in the first scene. However, this means that when I load my second scene in the editor, those objects aren't there yet.

I could copy and paste them over, but then the objects in the second scene will be duplicates of the ones in the first.

This is a problem because I can't, for instance, create a public variable on the character controller and attach an object from the second scene to it. The character doesn't exist in scene 2 yet and the object doesn't exist in scene 1.


texts: Do I need forward declaration for a good message based communication system?

texts:
I am thinking about a game engine like this:

I am trying to implement message-based communication. Every ReceiveMessage() method processes the Message, or forwards it into the right direction based on the messages recipentType. For example:

The EngineCore infinite loop sends render messages towards Game.
Game forwards the messages towards every GameObject.
GameObjects forward the messages towards their RenderComponent.
The RenderComponent must send its RenderData back to the RenderEngine.

As far as I know, this can only be implemented if the dependencies are bidirectional, which requires forward declaration. Is this possible in another way, or do I have to implement this in a "polling" way?


texts: How to implement back and forth steering behavior?

texts:
I am trying to implement some behavior for a flying enemy in my 2D platformer.

The desired behavior is for the enemy to fly back and forth across the player, harrowing him.

If the player was standing still, the enemy would simply fly back and forth across the player, say 128 pixels to either side of him. If the player was moving, the enemy would adjust his movement accordingly. For example, if the enemy was heading left and the player was moving right and reached a sufficient distance from the enemy, the enemy would start heading to the right of the player.

I currently implement this using a simple seek steering behavior. I have the enemy seek toward a point a fixed distance to the left of the player. When he arrives at that point, I have him then seek toward a point a fixed distance to the right of the player. If the player moves, these points also move.

Further, as my enemy approaches these target points, I slow his velocity in proportion to his distance to the target. In other words, I have a seek-with-approach behavior.

There are problems with this method. For example, if the enemy is currently to the left of the player and is seeking the left target point, if the player then starts moving left, the target point will also move left and the enemy will never reach it. It will appear as though the player is simply chasing the enemy.

So my question is: How can I implement this kind of back and forth steering behavior, accounting for the fact that the target can move? Is there a simpler way that I am not seeing?

I work in Godot, but would prefer an engine-neutral answer.


texts: How to hide objects behind an invisible plane?

texts:
I am using Unity 2019.1.4f1 (personal) in regular 3D mode. I want to make a material for a plane that will cause everything behind that plane to be invisible.

I want a character who steps through a doorway to appear to disappear into "hammerspace" when he passes the door frame. I will post pictures in a minute.

Blender concept (note how space after the doorframe is successfully occluded):

Unity WIP (note how path after doorway is not yet occluded):


texts: Which is faster: raycasting or shadowcasting?

texts: I'm looking to create an FoV implementation and I was wondering which algorithm is faster - raycasting or shadowcasting?


texts: How can I test if my rage game's hardest levels are achievable?

texts:
I love rage games and have made a rage game too, but I always wondered how to test if levels in these types of games are too hard or not, since it's ironically too hard to test.

For example: If I were making a game similar to Super Hexagon or Super Meat Boy, do I need to take all the time and effort to go through and beat the whole game? Or are there some easier, but valid workarounds?

I had this problem in a game I made a few years ago. It has 4 difficulties: easy, normal, hard and insane. Before release I'd only completed easy mode and post-release I completed normal, but I'm not sure if hard and insane are achievable.

Here's the game in case you want to see it:

https://gamejolt.com/games/30-seconds-to-survive/30107


texts: Design question: best way to model and visualize a long grid of data

texts:
Perhaps some noob questions for a scientific application that you can assist with: I am trying to render a large, evenly spaced grid of data in 2D.  The full data set dimensions could be anywhere from 48x250,000 to 1000x15,000,000 points/pixels.

The data is evenly spaced, but I need to change the aspect ratio, and then render only a section of that data on the screen at a time.  I need the users to be able to smoothly scroll forward or backward along the long dimension with user input, or press the "play" button and have it move forward or backward at certain speed.

I am looking for advice on how to handle this via DirecX or OpenGL (probably using SharpDX or OpenTK).

The basic approach I am considering is to use textures that the application generates on the fly from the data and then map them to a very simple model. I would keep the graphics card supplied with a large enough scene so that as the user scrolls or moves around that they don't have to wait for the application.  Questions I have are:

1) does this approach make sense?  i am presuming this is way more efficient and faster than creating a bunch of primitives with discrete colors. true?

2) is there a particular texture format that is good to use and easy to create (or do i create it directly)?  I have the data in application memory as large arrays and it loads/unloads from disk as needed.  I would map the scalar values to a color as I create the image/texture blocks.

3) would mipmaps be useful? i could have an aspect ratio (or small enough window) that there are fewer screen pixels than data in the viewable range.  Or, would it just automatically subsample?

4) if mipmaps are used, most of the scaling is along the long dimension, so could i uses non-square subsamples?

4) does creating compressed images make sense?  or, would the compression overhead yield much benefit (or how might i determine this)

5) how would i go about finding an optimal texture size?

Any other general advice?

Hopefully this is a straightforward problem for the cool stuff y'all do in games!


texts: Programming strategy to handle big programming project in Unity3d

texts:
Almost three months ago! We started a big Tough project and still it is continue almost done, some bugs, some logic issues and some redundancies in code. Its a Unity3d Project. Every models/animation/environment are all completed nicely then, it came to the programmers(us).

Now, after writing too many codes, some ill logics, bugs I have learn so many things and I don't want to share. Its is scatters in my mind strongly disagree with lead/teammates but anyhow it is continue.
 But the next big thing I want to ask you that how do we handle a big project(programming side)?
     What are the best right suitable pattern to program in Unity3d using C#. How experience programmer do this work? how do they start to code?
     What I did wrong or notice wrong is the list given below:

 1. Did not do paper work enoguh i.e., algorithm writing

 2. change code abruptly

 3. write code abruptly

 4. without plannig code

 5. things make dependent

Guide me the right thing so that next time it should keep in mind and we don't made any mess.

Answer require from experience Developers, consider myself as your junior and you are giving me instruction.


texts: In a shader, how to know if a given 3D projected point is visible by camera?

texts:
In a shader, I would like to know for a given projected 2D pixel if the related 3D point is visible by camera (not especially the main camera, the projection and view matrix are provided to the shader as parameters).

By visible, I mean I can shoot a ray from that 3D point to the camera position without hitting any object.

The result should be similar to the camera being a light source and test would fail where there is shadows.

I think one possible solution would be to first render scene from camera view into a texture (eg : render texture) and then use than information later in the shader for the main rendering.

EDIT : I forget to mention what I want in the end is Projective texture mapping.
I have tried to implement what Stormwind describe (I did not used a Surf but a render texture) It almost works, however shadows are not aligned correctly (like they are moved by a given offset).

Here is the shader that I wrote  :

float4x4 _CameraMatrix;
sampler2D _MainTex;
sampler2D _DepthTex;

v2f vert (appdata_base v)
{
    v2f o;
    o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    float4 cameraPos = mul(mul(_CameraMatrix, UNITY_MATRIX_M), v.vertex);
    o.scrPos = ComputeScreenPos(cameraPos);
    return o;
}

half4 frag (v2f i) : COLOR
{
    float4 cameraPos = i.scrPos;
    cameraPos /= cameraPos.w;

    if(cameraPos.x > 0.0f && cameraPos.x < 1.0f
    && cameraPos.y > 0.0f && cameraPos.y < 1.0f)
    {
        float depth = tex2D(_DepthTex, float2(cameraPos.x,cameraPos.y)).r;
        float cameraDepth = cameraPos.z;

        if(depth > cameraDepth)
        {
            return tex2D(_MainTex, cameraPos);
        }
        else
        {
            return float4(0.0f ,0.0f ,0.0f ,1.0f);
        }
    }
    else
    {
        return float4(0.0f ,0.0f ,0.0f ,1.0f);
    }
}


texts: unity UI limitation for tutorial purpose

texts:
i want to add a tutorial part to my game that i make by unity.i have some panels that for tutorial purpose i want to limit user to just click a button.most of games make a dark panel over all places except learning  UI.

i know there is lots of ways for making that but is there any standard way for that?


texts: I wanted to create a simple mobile online game for me and my mates. How should I handle the networking?

texts:
I've made a few simple games and one multiplayer game where you connect through LAN but for this one I wanted to learn something new. I have the game concept working on my computer, it's just waiting for the networking.

I was looking to create networking similar to mobile online quiz games, where:
- you use your Store account as the game account
- you are not restricted to LAN or same WiFi network, but rather everything goes through an external server
- you have a Friends list,Recently Played list where you can see who's online right now
- you can invite a random player to a match or search for particular player to play with them/add them to your Friends list

Something like that. I don't know if you can host servers for a match on mobile devices, or how feasible it would be, given mobile internet isn't free, but it would make for a nice addition if the external server was only for handling information about who's online.

I'm working in Unity btw. so any recommendation for package from Asset Store is welcomed

Thanks in advance! :)


texts: How can I blend meshes together where they intersect?

texts:
In a lot of my scenes I have things like this:

and this:

All the places I've circled are places where a prefab overlaps with another one or with the terrain.

Is there any way to make those lines softer/more natural and blend together more?

When I can, I try and hide the lines with trees or other items, but that doesn't work in every case.

I wonder if I can solve this with something like the soft particles effect. Soft particles in Unity help blur the line between a particle system and a rendered mesh. This keeps you from having jarring hard cut offs and straight lines in something that's supposed to be amorphous. (That's as far as my understanding goes) Can I use something like this to blend my prefabs together?


texts:
I'm developing a game using polling for the input method. However, now that I'm delving deeper into the game menus and other UI components, I'm finding that I'd probably like to have event driven input. Perhaps even having both, using event driven for the UI and polling for the "world" input. I'm curious on what the best way to go is.

I'm defining polling as: each update loop I check what keys are press, where the mouse is, buttons pressed, then run through them and do actions based on the info collected.

I'm defining event driven as: interrupt based events, when an event happens and interrupt is triggered and a code block is run based on the event.

Do you think it's best to go all event driven, all polling, or is a combination of both acceptable? If you have pros and cons for either please list them. Thanks.

EDIT

The game is Java/OpenGL based, so will be released to Windows/Mac/Linux. The possibility of extending that to mobile devices is low. The game is RTS style, 3rd person 3D.

EDIT 2

I'm still not totally happy with the way I've implemented this, but what I'm moving toward is catching events in my UI and if they're not handled by any of my UI components, I pass the event on to the "World" for picking/selection. Something like:

@Override
private boolean handleEvent(Event event) {
    if(hud.handleEvent(event)) {
        return true;
    }
    return WORLD.handleEvent(event);
}

This way I don't get clicks leaking through the UI to select objects behind buttons and what not.

Currently my camera controls are still based on polling, and that seems to be working for now, but I may update that later on.

I appreciate all the answers, sorry I could only pick one!


texts: HTML5 game pases when you go to another tab

texts:
I'm making a simple game and I use requestAnimationFrame. Now the problem is that each I change to another tab the game pauses and when I return the game continues.

This is really bad because the game is multiplayer and restarting the game each time a user switches to another tab doesn't seem like a great idea.

Do any of you have any idea how I can keep the game active, while the user change to another tab?

Thanks.


texts: Proper and easier way to make isometric animated art

texts:
Assuming I don't want to use 3D engine/models (no 3D in the game, I can use 3D offline), only 2D, in order to make for a game, for example, a single character, this would be the workflow I already got in mind:

Model in 3D
Texture it
Rig it
Animate it
Render it

For each part of the body/items -in order to sort gearing-
For each type of animation (attack, move, idle, die, dodge, hurt)
For each angle (I'd like 16 angles, or 8 as minimum)
For each frame (let's say 15 frames/sec)

This is a ridiculous amount of sprites. 400 sprites for 1 item. (Could it be too much?)

And then

Get the animation controller with extra work: sort the sprites properly depending on animation frames and angles (example at p. 11 of Paul Siramy extracting animations of Diablo II)

All this seems to me, for a bad designer, and a person who aims to make a game for the moment alone, too much work. Are there alternatives to get similar results, without 3D engine? I've heard about something called 3D bitmaps or "Vortex" (used in don't remember which strategy game for vehicles), but I could not find any information about it.


texts:
I am building a decent multiplayer iOS-Android card based game. While this game is played with regular old 52 cards deck, it does have unique rules and game play. That makes it little hard to market since no one is precisely looking to play  initially.

I have been researching quite a bit about game marketing and most recommendations are to build out fan following which is also quite hard and time consuming (taking away from building game).

I have some indie marketing budget (~5k) I set aside to help gain some traction. While I understand that this not my strengths, what are the best ways to invest it into the game?


texts: I want to simulate that random and soft movement that lot of games got (like BF3) when you use the scope of a sniper gun, so the question is how to achieve that.


texts:
I'm wondering why so many MMOs are only partially voiced? I asked makers of games (Thimbleweed Park, in their Q&A) how expensive voiceover is, and they said it wasn't especially expensive unless you hire A-list stars. So why would so much game dialogue be only present as text to be read onscreen?

The only reason I can think of is the same that exists for localization in all software: You can't record VO until all the dialogue is finished and frozen, so it is another fixed delay between finishing the rest of the game and shipping. So it doesn't seem like it's not manageable.

To be clear: I'm not looking for opinions or theories (that would only make the mods close this question) but actual reasons and experiences from people who have shipped games with partial voiceover.


texts: How do you define walkable and unwalkable areas in Tiled?

texts:
Hi I want created map in Tiled program.
How can I generator that 2D array with
0 - unwalkable
1 - walkable
2 - damageble

I suppose I must set it somehow, can someone tell me how to give me link so some tutorial ?


texts: I can't understand the batcher.draw at libgdx

texts:
here is the code:

batcher.draw(birdMid, bird.getX(), bird.getY(), bird.getWidth() / 2.0f,
             bird.getHeight() / 2.0f, bird.getWidth(), bird.getHeight(),
             1, 1, bird.getRotation());

what each parameter in this method presents?
Please explain in detail


texts: SourceTree doesn't show the differences in Unity scene files?

texts:
Back in the day it worked, but for some reason in my new projects it isn't.

Every other asset's difference is shown correctly in a text format (i.e. .prefab), only .unity files won't work, in the diff view it says:

  No changes in this file have been detected, or it is a binary file.

I did these:

In Project Settings > Editor, Asset Serialization is set to Force Text.
Created a .gitconfig in the root of my repo, with this content: (the path is correct)

[merge]
tool = unityyamlmerge
[mergetool "unityyamlmerge"]
trustExitCode = false
cmd = 'C:\Program Files\Unity\Editor\Data\Tools\UnityYAMLMerge.exe' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
Also in SourceTree > Tools > Options > Diff, I increased a few limits, set the external diff and merge tool to C:\Program Files\Unity\Editor\Data\Tools\UnityYAMLMerge.exe but none of them helped.


texts: Coordinate and positioning problem on iOS with cocos2d-x

texts:
I'm using cocos2d-x alongside with Marmalade and running some tests and tutorials before starting an actual project with them. So far things are working reasonably well on the windows simulator, Android and even on Blackberry's Playbook, but on iOS devices (iPhone and iPad) the positioning seems to be off.

To make things clearer, I put together a scene that just draws an image in the middle of the screen. It worked as expected on everything else, but this is the result I got on an iPhone:

To get the coordinates for the center of the screen I'm using the VisibleRect class from the TestCpp sample. It just uses sharedOpenGLView to get the visible size and visible origin, and calculate the center from that.

CCSprite* test = CCSprite::create("Ball.png", CCRectMake(0, 0, 80, 80) );
test->setPosition( ccp(VisibleRect::center().x, VisibleRect::center().y) );

this->addChild(test);

Also I have a noBorder policy set on AppDelegate:

CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder);

One funny thing is that I tried to deploy the TestCpp sample project to some iOS devices and it worked reasonably well on the iPhone, but on the iPad the application was only being drawn on a small portion of the screen - just like what happened on the iPhone when I tried using the ShowAll policy.


texts: Issues using NetworkServer.Spawn with Unity and Mirror-Networking

texts:
I am using Mirror to handle the networking aspect

When I spawn an object on the network, I Instantiate it on the server and then use NetworkServer.Spawn to notify all clients to spawn the object.

However, when this object is eventually spawned on the client side, it seems to be spawned at the wrong position for a few seconds and then corrected itself and move to the correct position as is reflected by the server. Is there something I am not doing? Is this normal?

Also I noticed if I changed the Network Sync Mode to 0, then it will only spawn in the wrong spot for a split second.

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

public class EnemySpawner : NetworkBehaviour
{
    public uint theId;
    public int maxNumEnemies;
    public int spawnDelay;
    public GameObject enemyToSpawn;
    float curSpawnTime;
    BoxCollider2D boxColl;
    // Start is called before the first frame update
    public override void OnStartServer()
    {
        curSpawnTime = spawnDelay;
        boxColl = GetComponent<BoxCollider2D>();
    }

    void Start()
    {
        if (!isServer) return;
        theId = netId;
    }

    // Update is called once per frame
    void Update()
    {
        if (!isServer) return;
        if (transform.childCount < maxNumEnemies && curSpawnTime <= 0.0f)
        {
            Vector2 spawnPoint = new Vector2(Random.Range(boxColl.bounds.min.x, boxColl.bounds.max.x),Random.Range(boxColl.bounds.min.y, boxColl.bounds.max.y));
            curSpawnTime = spawnDelay;
            SpawnEnemies(spawnPoint,netId);
        } else
        {
            curSpawnTime -= Time.deltaTime;
        }
    }

    [Server]
    void SpawnEnemies(Vector2 spawnPoint, uint theId)
    {
        GameObject gobj = Instantiate(enemyToSpawn, new Vector2(60.7f,1.3f), Quaternion.identity);
        gobj.GetComponent<EnemyController>().parentNetId = netId;
        NetworkServer.Spawn(gobj);
    }
}

The way I've organized things, in the hierarchy I have:

Enemies
   Area1
      Spider(Clone)
      Spider(Clone)

Area1 has the EnemySpawner script.  The spider is registered a spawnable prefab.
Both Area1 and the Spider have a NetworkIdentity with no boxes checked.
Additionally, the Spider has a NetworkTransform and NetworkAnimator.


texts: Java game: jumping glitch on multiple collisions

texts:
I need help with checking for intersections in a game I'm creating. When a character collides with a single obstacle on the screen everything works as intended, but when multiple obstacles are added to the screen the character can only jump off of the last obstacle that is being checked for collision. The character still collides properly with the other obstacles (doesn't fall through, cant walk through) but can't jump off of them.

My intersection checking code follow, obs is an ArrayList of obstacles, ground is the boolean that determines if the character is allowed to jump. The obstacle and character have a hitbox created by 4 rectangles.

public void checkIntersect(ArrayList<Obstacle> obs){

    for(Obstacle a: obs){

        if(a.getLeft().intersects(this.getRight())){
            if(getDx()>0){
                sidecollision=true;
                setDx(0);
                this.x-=1.5f;
            }
        } if (a.getRight().intersects(this.getLeft())){
                sidecollision = true;
                setDx(0);
                this.x+=1.5f;
        } if((a.getTop()).intersects(this.getBottom())){
            ground=true;
            setDy(0);
            this.y-=.10f;
        } else if(!(a.getTop()).intersects(this.getBottom())){
                ground = false;

                //return ground;
        } if(a.getBottom().intersects(this.getTop())){
            ground=false;
            setDy(0);

            this.y+=.1f;
        }

    }
}

And this is how collision is being checked on the game component:

bg.update(quote);
win.fill(clear);
bg.drawBG(win);
for(Obstacle o: obs){
    o.draw(win);
    o.update(bg);
}
if(quote.isVisible()){
    quote.movedrawProtag(win, keys);
    quote.checkIntersect(obs);
}


texts:
I want to make 3d Matrix rain like this shader that you can rotate camera.I tried to convert this shader but It have many calculations that it's expensive inside game engine.then I tried to make this effect by trail Renderer but I couldn't make random letters inside trail renderer.finally I tried by Instantiating quads but It hadn't fade like trail.

so my question is how can I make this effect In efficient way?


texts: How to get a safe index for glVertexAttribPointer without shader?

texts:
I'm learning to use VBOs and trying to keep it simple before building up. Trying to do it without writing a shader right now. It looks like this is possible, but I cannot seem to find a way to get the index parameter for glVertexAttribPointer.

I've seen that you can get the index with glGetAttribLocation, but that function seems to require a shader be passed in to get the index.

I don't want to assign the index, because I'm worried about different pieces of a project accidentally using the same index and causing problems. (If there's some reason I shouldn't be worried about that, please let me know)

Question is: Without using shaders and without assigning the index, how can I get the index for glVertexAttribPointer?


texts: UE4 Repeat fail: how to feed text widget unique message on instances

texts:
I am a noob who has spent many hours looking at similar questions and responses but still failing to get desired result. I am going to be thorough and specific - I'm very keen on walk-throughs with any helpful experts! Thanks in advance.
Backdrop
My level consists (ideally) of the following:

Trigger boxes
Spheres that have 2x-sided texture with media player texture (let's call these "movie globes")
Transparent actors with blinking borders and are clickable ("highlight_inspect")
(I made these with a tutorial on adding post-process stencil depth something or other in order to get a blinking appearance)
Text widget that appears to inform viewer of what they clicked. Variable across unique instances

In simple terms let's say I have 5 trigger boxes with 5 unique (360º video-captured) movies. You step into trigger, sphere appears around the actor and the media texture/movie begins playing on inside of that sphere (I successfully did this), at which point you can pan around and look. I initiate a delay function before the visibility for "highlight inspect" appears, so that the user may spontaneously first look at movie around them before seeing blinking highlights over certain people, things, etc captured/displayed in movie imagery.
Let's say the movie globes are depicting different forest types or different habitats, and the user is meant to learn about "xx oak tree" "yy pine species" "zz herb that provides x benefit" etc. The idea is to have a kind of interactive museum per se.
Some globes might only have one highlight, some might have 4 - the idea is that I can use the "highlight_inspectable" actor object as a click event across these instances but each one returns unique text upon a widget template (saves font/color/style etc)
As if to demonstrate my thick-headedness around this issue of actor objects and instances, I also currently have separate but locationally equivalent triggers for the globe and for the highlight object, mainly because I need different spheres to call different movies in their blueprint... in other words

I have an actor that has a component 'trigger capsule' that toggles visibility of a sphere
i have an actor that has a component 'trigger capsule' that toggles visibility of highlight_inspect mesh object..

I just need a simple way to do all this *sigh/shakes fist/bangs head on wall.
what I'm failing to learn
I've come across "casting" and "blueprint interfaces" and "event dispatchers" and more, and I'm still not grasping those and whether any apply here and how.
I kinda understand that I should be able to make the Text Element in the Widget "variable" and/or bind it to a variable.. but I can't smoothly achieve this.
Thank you for your help, I am posting some images below (in the screenshots the pink cylinder+light is the trigger, and the next screenshot is user's POV standing there after globe materializes and highlight is showing. the sketch up is for more illustration)
ps the second screenshot is actually in next comment
-SS


texts:
The title may be a little wrong for what I am asking, but that was the closest I could think of.

My problem is I am making a game that includes a World class and a WorldObject class. the World class contains a std::map<unsigned int, WorldObject*> in order to keep track of all objects that are in the world. On the flip side, the WorldObject class has an unsigned int as a unique ID, and a World* to the world that it is currently in.

When it comes time for the object to be removed from the world and deleted, I made it so that can either be done by calling WorldObject::removeFromWorld() or World::removeObject(WorldObject*). The problem is, I'm not entirely sure how to set up these methods so the object is removed from the map in World, and the World* reference is removed from the object all in one fell swoop. I'm still relatively new to C++, so I'm not very sure how memory management works with deleting pointers and such, but this is what I was able to come up with my limited knowledge:

WorldObject.cpp

WorldObject::~WorldObject()
{
    world = nullptr;
}

void WorldObject::removeFromWorld()
{
    world->removeObject(this);
}

World.cpp

bool World::removeObject(WorldObject* object)
{
    if (contains(object))
    {
        objectList[object->getObjectId()] = nullptr;
        delete object;
        return true;
    }

    return false;
}

This seems a little too circular for me, and the main problem that I'm not sure will work or not happens if WorldObject::removeFromWorld() is called. If this method is called, it is placed on the stack and then calls World::removeObject() , but this method deletes the calling object. I know objects can "commit suicide" but I dont know if that makes it so the calling object can be deleted before World::removeObject returns.

Anybody who could confirm if this method works, or even give a more efficient solution (as I'm sure there is) would be greatly appreciated.


texts: How many VBOs should I use and should I keep a copy of their data?

texts:
Firstofall, I am sorry if my question is to broad.

I am developing a tile based game and switched from those gl.Begin calls to using VBOs.

This is kind of working allready, I managed to render a hexagonal polygon with a simple shader applied.

What I am not sure is, how to implement the "whole" tile concept.

Concrete the questions are:

Is it better to create 1 VBO for a single tile and render it n-Times in
  every different position, or render one huge VBO that represents the whole "world"
Depending on the answer above, what is the best way to draw a "linegrid".
  Overlay with the same vbo using the respecting polygon.mode , or is there a way
  to let the shader to this?
How would frustum-culling or mousepicking work then, do i need to keep the
  VBO-data in memory?


texts:
In RPGs sometimes there will be hybrid-classed characters, ie, characters that can fill the roles of multiple characters. Sometimes they're really weak and useless because despite filling out many roles they're just not good enough to do it, and othertimes they're extremely overpowered because they can do the job of characters with a single dedicated role just as well, while still being able to do other jobs.

This often leads to either using those characters all the time, or avoiding using those characters because they're dead weight. Even just "fine tuning the numbers" doesn't seem to work because the weaker they get in regards to a dedicated role character the less useful they are overall, and then when buffing their numbers to make them more capable of holding their own makes a small reduction in power compared to a dedicated role character a minor tradeoff, because they're doing the roles of two characters in one spot.

Is there a way to actually make hybrid-role characters useful while still making players want to carry single-role characters too?


texts:
There is a popular paper, and numerous examples, on how to efficiently perform collision detection for a line with a grid. However, I'm drawing up blanks on how to do the same thing but with a line that has thickness.
In my game, I'm considering adding projectiles that are not infinitly thin (for example, a giant plasma ball launcher), and I need to figure out which cells along a grid that it collides with. Initially I thought it'd be as simple as just using the Minkowski Sum method of adding the width/height of the projectile to each cell of the grid, and then treating the projectile as infinity thin line along a bloated-overlapping-grid, but that doesn't look like it's going to work with the existing algorithm.
Are there any other papers/algorithms that describe how to accomplish this? Or is there a way to modify the existing algorithm to accomplish this? Or are there any tricks to implementing this indirectly?


texts:
I have a lot of billboarded 3D spheres (they have a heightmap so work properly with depth and penetration; although each is made of just a quad (with slight distortion), they look and feel and are true 3D spheres): http://www.youtube.com/watch?v=88idbFlvQV0

The choice of using billboards is for throughput on low-end hardware.

How can I effectively cast shadows from these?  It occurs to me that using proper shadow-volumes will take a lot of fill-rate and complexity.  I am fill-rate sensitive.

I was wondering if there is any way to billboard the shadows cast by my billboards?


texts: Generate smaller quads from a large quad?

texts:
I have a big quad (100x100) and I was wondering how can I generate smaller quads from this big quad?
 Such that I will have multiple small quads and I can add a different texture to each quad.


texts: Where can I download earlier versions of Oculus? I specifically need Oculus utilities 0.8 so as to use it on RiftCat

texts: I am trying to create a game using the Leap Motion, Oculus and Unity 5. I am using RiftCat to tether it to a mobile. But games built with Oculus versions 0.6 - 0.8 are allowed to be tethered. I have found the Oculus Runtime for 0.8 but I am not able to find the Oculus utilities package. Is there another way to do this? Can anybody provide a link where I can download the Oculus utilities 0.8 for Windows.


texts: Create sprites from 3D models at runtime in Unity

texts:
From my previous post where I search solutions to have animated characters in an isometric world (using 2D engine as base) arised this question.

I'd like to create and instantiate 2D sprites from 3D models, using Unity, at runtime, in order to use them as they were sprites, ordering them by depth, etc.

There are already unity scripts (maybe using 3d party software) that make this, like Sprite Maker. How is this done? (You have to pay to get the Sprite Maker). Anyway, I need to do it at runtime, instead of baking a spritesheet.

How do I do it? Is it posible?

Other solution, instead of converting it to sprite, is being able to sort the 3D model as it were a sprite. But how?


texts: Game engine that allows for objects being placed in-game

texts: I am looking for a game engine with multiplayer support that allows for players to place objects in the terrain. (eg. in TF2 one can place teleporters, etc... or in minecraft one can place blocks). I don't need the placeable objects to be interactive like in TF2, but I just need an engine that won't make me code this from scratch. I have decent knowledge of Python, PHP, HTML, C++ and C# (and a small knowledge of Lua scripting, although I have only been at it for a few months) so I should be able to handle most engines. So far I have looked at UDK and Cryengine, and wasn't thrilled with either.


texts: Isometric view : what is the right angle to use?

texts:
Wikipedia states in an isometric view, all angles must be equal to 120.

I am building my assets by making screenshots of some 3D models, so I can get any point of view on them. I tried to capture them with a POV which gave me angles of 120 everywhere, but once I put those 2D assets in an isometric game engine, it was a bit weird looking.

Then I noticed something weird : in Age Of Empires, angles are not of 120 but 127 ! example : http://img1.wikia.nocookie.net/__cb20120311170558/ageofempires/images/7/74/Age_of_empires_building_towncenter.jpg
I tried building assets so that their base has an angle of 127 and it's better looking.

What is the reason behind that ? What is the right angle to use ? What do you use ?


texts: I rendered a tiled map, with the help of slick2d, in my JFrame in Java. I can move my main character, but it is just that the character itself moves. I would like to do it that, if the player moves, the map moves and the player himself stays in middle of the frame. Do you have any suggestions on how to do that ?


texts:
I have a object selection function by checking the mouse click and getting the relevant object.

How ever there is a rare situation where if one object is partially behind the other then both objects are in the given area so im wondering how I can make the game know which one was selected, as currently my method does not know.

This is my function that works it out:

function getobj(e){
    mx = e.pageX - curleft; //mouse click x
    my = e.pageY - curtop; //mouse click y

    function searchSprites(sprites, x, y) {
        var matches = [],
        i = 0,
        data = null;
        for (i = 0; i < spritea.length; ++i) {
            data = spritea[i].data;
            if (x > data[0] && y > data[1] && x < data[2] && y < data[3]) {
                var imageData = ctx2.getImageData(x, y, 1, 1);
                if(imageData.data[3] !== 0){
                    return [spritea[i].id];
                    i = spritea.length;
                }
            }
        }
    }
    res = searchSprites(spritea, mx, my);
    bid = res[0];
    if(bid === '1'){
        alert('You selected the skyscraper in front!');
    }else if(bid === '3'){
        alert('You selected the skyscraper behind!');
    }
}

Image of the map:

It keeps telling me I clicked the skyscraper behind which is not necessarily what the user is trying to do. How can I improve the accuracy of this ?


texts: What resources are available for using Qt as a toolkit for games

texts: Qt is an excellent application toolkit and overall the best for C++. While some large projects use Qt (KDE for example), I haven't seen many games using it. So I decided to make my own. But what does Qt provide that may be useful when writing a game (in my case a 2D game)?


texts:
Im trying to make a car game, but i cannot get the acceleration code right. With this code:

        if(gas){
        speed += 3;
    }else if(break_ && !(speed < 6)){
        speed -= 3;
    }else if(!break_ && !gas && !(speed < 6)){
        speed -= 0.3;
    }else{
        speed = 6;
    }

it is up on 1000 within 5 secounds. I tried multiplying it with smaller numbers, but it still doesnt work(in fact it got worse). So, how can this be improved so it has reasonable parameters? Asof the maximum speed, i can implement that on my own.


texts: Application components dependancy and decoupling

texts:
In my client application I have two major components:

GameCore - wrapper that handles everything about running the actual game
NetworkClient - A layer that takes care of communicating(receiving/sending packets) with the server.

What I am not sure about is the way the NetworkClient should server information to the GameCore process of the game. The core process has an event queue that is executed in update() calls. My initial idea is to have something like this:

NetworkClient receives a snapshot of the state changes, takes that snapshot and chops it down to event objects for the GameCore process to handle.

The problem I see with that, isn't the NetworkClient class too dependent on the Core class. The oposite is not an issue however because, there can be a different client(udp,tcp etc) that works with the Core class.

So from a design point of view, is there a reason I might not want the NetworkClient class to be written for the specific implementation of the Core class.

PS: I am using JavaScript, but the question does not necessary concern the implementation technology.


texts: How exactly do you deconstruct the Tiled Map Editor exported tile ID?

texts:
I am trying to build 2D maps with Tiled Map Editor for my game, and I export them under text format, so a tile can look like this:

1,2,3,15,2,12,2
5,23,1,6,2,3,4,6

and so on, for many rows. In this link you can see an example of a map, to get a better idea.
Now let's say I have 3 layers, each using its own tileset. The numbers in the layer represent the ID of the tile, basically the number of the tile in the sheet. If grass is the 2nd tile, then the ID is 2, and so forth.
However, as you can see in the link, different tilesets will export different IDs per layer, notice how in the object layer I can have IDs such as 81, when in fact the ID is only 1, so it adds up 80 or so.
Since I am trying to make my map system as flexible as possible, I need the real ID in order to make some calculations. How does tiled export these sort of IDs? I simply want to determine what number to substract in order to get the id, like so:

tile.id = currentid - something_strange;


texts: How many database connection should use in a MMO game server?

texts:
Game server links to database, how many database connection should use? The data update works like this:
update role object to database every X minutes, commit all updates every Y minutes.

There are 3 ways:

Only one database connection
One worker thread one database connection and set transaction level to "Read Uncommitted". Worker thread loop all roles in it to do update & commit periodically
One game session one database connection and set transaction level to "Read Uncommitted". A dedicated thread to loop all connections to do update & commit periodically

Method 1 has a problem which database connection object needs shared by multiple worker threads, for JDBC, connection class is thread safe, but I don't know what about C++ such as MySql driver. If it have to use mutex to make thread safe, there will be a performance degrade: all worker threads have to synchronize their data frequently.

Method 2 has a problem to update old data. One map in game server run in dedicated worker thread. For example, role A in map 1 which compute by thread 1. role A transport to map 2 which compute by thread 2. This might cause thread 1's commit call after thread 2's commit call, so the older update which already executed in thread 1 commit after thread 2's commit.

Method 3 seems is a waste of system resource. Because in MMO there is no need to be transaction isolation, any change in a game session should be immediately seen by other sessions. In contrast with web app, so many connections has litte meaning. However the "Read Uncommitted" isolation level can let other session read data which has not committed yet.

==================================

I forget there is a thing called connection pool. Generally it is thread safe implemented so I do not need to care synchronization problem anymore. And the connection number is dynamic so I can leave problem of how many connection number to it. Only I do is get a connection from it.
So, method 1 & 3 both practical.


texts:
I am using D3D11 on D3D10 hardware, trying to get a very simple compute shader to run (my hardware supports cs_4_0).

What is the best way to pass data to the compute shader?

I've seen some samples use a constant buffer (cbuffer), but it seems very restrictive to me (in the hlsl cbuffer declaration I'd have to specify the amount of input (e.g. if a want to process an array of floats, I'd have to declare in my hlsl cbuffer an array of floats with a specific number of elements).

Other examples pass the input in the structured input the comp. shader will store the results in. Besides the fact that this might not suit my particular algorithm (maybe a thread needs access to more that just one element) I can't declare my structured input as dynamic, so to update it from the cpu (i.e. to add new values for the GPU to process) I'd have to use UpdateSubresource, which is not as efficient as Map, Unmap.

So, there must be a better way to send input to the Compute Shader. Any suggestions?


texts: Box2d : How to apply a force to keep swinging from left to right?

texts:
i'm losing myself in this...

Situation: Working on a game in cocos2d with box2d and I have a ropejoint between one fixed body and one dynamic body.

When I drop the dynamic body is swings from left to right and then from right to left due to the gravity in the world.

The problem: The swings are getting shorter and shorter till finally the dynamic body hangs still beneath the fixed body. This is normal behavior but I need it to keep swinging.

My thoughts: I think I need to apply a tangential force to the ropejoint in the direction of the swinging but how to do this is a mystery for now :)

EDIT 1
The swinging does not have to be in perfect balance, it just can't slowly die.


texts: Unity - Accessing a UI's text through a Transform

texts:
I have this in my player's component list. The HungerTarget transform is the text box in the UI canvas. How would I change the UI's text here?

using UnityEngine;
using System.Collections;

public class HealthHunger : MonoBehaviour {
    //public Transform HealthTarget; Not being used yet...
    public Transform HungerTarget;

void Start () {
}

void Update () {
    //set HungerTarget's text to ...
}

}


texts: How to make projectiles shoot at mouse position?

texts:
I'm looking to make it so my fired projectile is shot at the position of the mouse so aiming is an option ie:up down ect..

I have the script working to where it spawns the cloned object and launches it but it only shoots straight from my players hand before disappearing. how can I adjust my command so the object is shot in the direction the mouse is pointing?

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

public class ProjectileShooter : MonoBehaviour {
  [SerializeField]
  Transform attachmentPoint;
  GameObject prefab;

  void Start () {

    prefab = Resources.Load ("projectile") as GameObject;
  }

  // Update is called once per frame
  void Update () {
    if (Input.GetMouseButtonDown (0)) {
      GameObject projectile = Instantiate (prefab) as GameObject;
      projectile.transform.position = attachmentPoint.position + Camera.main.transform.forward * 2;
      Rigidbody rb = projectile.GetComponent<Rigidbody> ();
      rb.velocity = Camera.main.transform.forward * 40;
      Destroy (projectile, 2.5f);
    }
  }
}


texts: How can I have my third-person camera track slightly ahead of the player as he or she moves?

texts:
I have a 3rd person camera controller in a top-down game. I have my cameran following the player and I currently use linear interpolation to make the movement smooth and a little laggy. But I would like to do the opposite: when the player moves in a certain direction the camera moves a little bit ahead, so as to reveal more of what is ahead of the player.

    void Update ()
    {
            var newX = player.transform.position.x;
            var newZ = player.transform.position.z - 17;
            var y = transform.position.y;
            var targetPosition = new Vector3 (newX, y, newZ);
            transform.position = Vector3.Lerp (transform.position, targetPosition, 0.01f);
    }


texts:
I recently started a new project, and I'm wondering if I should change the technology now before it's too late.

I'm using SDL with C++, I have around 6 classes, and the game is going alright, but I got to this point where I have to rotate my sprite to make it point to the coordinates of the mouse.

It's a 2D topdown game, so if I pre-cached the images, I'd have to load 360 images, which is bad for memory. If I used SDL_glx, I could do the rotation real time, but I heard it'd drop my frame rate very drastically, and I don't want my game to be slow.

I also read I could use OpenGL, which is faster at these things. The problem is, how much would I have to change my code if I moved to OpenGL with SDL.

So, I considered moving to a completely different language - Java - which is much simpler, and would allow me to focus on the game and handle networking much more easily than with C++.

I am very confused, and would like to hear your opinion - thank you!


texts: How to organize GameObjects into logical groups in a Unity Scene?

texts:
Obviously there are a Scene hierarchy, but the problem is that the scene hierarchy was not meant for organizing GameObjects because parent GameObjects affect the transformation of their children.
For example what can one do to select all the decoration GameObjects? Some might be children of non-decoration GameObjects and buried very deep in the scene hierarchy while others might be root GameObjects.
One solution could be to add a Tag, but since Unity restrict you to only one tag per GameObject, that makes the usage of tags pointless as I have different overlapping categories.
Another solution would be to name objects but that is very error prone as a typing mistake will loose my GameObject. Also the team need to memorize possible tokens in the name which allow even more room for human errors.
Another solution would be to add an identifying Component, similar to how tags work in most other applications. But will there be a penalty in build time/runtime in a large project because of the additional Scripts (Components)?
Any other ideas how I can organize my Scene so that I can easily select a logical group of GameObjects from different unrelated parents in the editor Scene or Hierarchical view?


texts: When should I acquire game objects with dependency injection, find-with-tag, or singletons?

texts:
This is sort of a best practice/efficiency kind of question, and I haven't really seen any other question talking about these three things together.

Essentially, Dependency Injection, Find with Tag (like the Unity function), and Singletons are all ways of acquiring globally required game objects (like for instance, a sound manager or the player object).

For each, in which case does it make sense to use one over another? (I'm aware it's quite an open question, but I am looking for aspects which typify the situations in which you might use one over another).

Why is each better or worse for doing the job of acquiring a globally required object?

Are there any other methods of doing this not mentioned here?


texts:
My trees keep on falling at the same time and I am not sure why! I am new to Unity3D javascript.

Here is my script:

#pragma strict

//INTS
var health = 5;
//GAMEOBJECTS
var tree : GameObject;
var log : GameObject;

function Start () {

tree = this.gameObject;

}

function Update () {

if(Input.GetKeyDown(KeyCode.Mouse0) && Player_script.axehave && health >= 1 && Camera_script.tree){
health -= 1;
}

if(health == 0){
tree.GetComponent.<Animation>().Play();
Destroy();
}

}

function Destroy(){

yield WaitForSeconds(2);
Destroy(tree.gameObject);

}


texts: How to to convert UV coordinates to texel coordinates and how to convert texel coordinates to "array coordinates"?

texts:
I am currently writing a UV texture mapper.

But i don't know how to convert UV coordinates to texel coordinates.

And i also have no idea how i should convert texel coordinates to "array coordinates".

By "array coordinates", i mean number that represents a part of an array (in this case a bitmap).

Here is my code:

 su =  (u0)  * (tx-1) ;
 sv =  (v0)  * (ty-1) ;

 texloc = ((sv >>16)* bytes_per_row) +((su>>16)* bytes_per_pixel);

Also i use fixedpoint math to interpolate between the uv coordinates.

tx and ty are the dimensions of the texturemap.


texts: How can I make the X button in the Cardboard XDK exit VR mode?

texts:
When I build a game using Unity 2017.2.0f3 and the Cardboard SDK (using XR settings) and run it on my device, I see two controls overlaid on the screen, a cross and a gear:

Currently, pressing the cross control does nothing. I'd like to make the cross exit VR mode when pressed.


texts: Marching cubes with destructible environment

texts:
I've been spending a lot of time over the past few days finding out information about the marching cubes algorithm and I'm pretty sure I understand it.

My game would be using chunks of land with the voxels stored in an octree in the chunk and unless it won't run with this many voxels I was going to try with .25m blocks at first.

to make the mesh I would loop through all of the blocks I would consider to be solid(above 0.5 density from 3d Perlin noise) and call the Perlin noise function for each of the blocks vertices. Depending on the combination of vertices that are within the visible density range the mesh would be one of the 256 combinations. then move the vertices of the mesh based on interpolating the density values of the corners to make a smooth surface.

Now I want to make it possible to place blocks and dig them. All placed blocks wouldn't have a smooth flag so wouldn't have the marching cubes mesh built from them so they would retain their crisp edges. How could I make it so that if you dig blocks they would look smooth? I couldn't just use perlin noise could I, because all of the dug blocks would be considered completely solid as they are in the solid area above the isovalue. However there are plenty of videos with deformable marching cubes terrain. could somebody explain how I could do this or suggest another algorithm?


texts: How to find the point on a hypotenuse divinging triangle into two right triangles?

texts:
Consider the following image:

Knowing the (x,y) coordinates of A, B, and C; how would one find the point D? D being the point where line CD cuts the triangle into two smaller right triangles?

I feel like this is elementary, but searching for this is just giving me formulas to find the length of the lines, not the point I am trying to find.

EDIT:

Someone asked before deleting their post if this is a right triangle. Well; it COULD be, but not necessarily.

I should clarify why I need this. I have a quadratic bezier curve, and I want to find this point D on the triangle created by the 3 points (start, end, and control) of the bezier curve. I ultimately intend to check the angles formed by line CD at point C to restrict the "sharpness" of the curve (for road creation)


texts: how to move object in a circle around point?

texts:
There are two controllable objects orbiting around a centre block. Unfortunately, I don't really know how to stick them so they can only move around the block (left/a sends them clockwise, right/a sends them anti-clockwise) and can only get them to move like normal sprites not on a set path.

I haven't got any code to show yet, but I could really appreciate either some advice, or preferably some examples.


texts: How I start a over a new game using a ui button logic code?

texts:
My Hierarchy have 3 main GameObjects :

Game Data where all the gameplay objects are stored as childs of the Game Data GameObject.
Main Menu and all objects of the main menu stored as childs under the Main Menu GameObject.
Game Manager GameObject that have a script that control the game like pausing the game or go to the main menu.

By default the Game Data is disabled and all the gameplay objects childs disabled too. Then when starting the game with the main menu when clicking the button to start a new game I'm just activating the Game Data object :

This script is attached to the Main Menu :

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

public class MainMenu : MonoBehaviour
{
    public GameObject gameData;

    public void StartNewGame()
    {
        gameData.SetActive(true);
    }

    public void ResumeGame()
    {

    }

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

This is working for first time starting a new game.

And this script is attached to the Game Manager GameObject :

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

public class GameController : MonoBehaviour
{
    public static bool gamepaused = false;

    public GameObject gameData;
    public GameObject mainMenu;

    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.P))
        {
            gamepaused = !gamepaused;

            if (gamepaused)
            {
                Time.timeScale = 0f;
            }
            else
            {
                Time.timeScale = 1f;
            }
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            gameData.SetActive(false);
            mainMenu.SetActive(true);

            Time.timeScale = 0f;
        }
    }
}

This script is working. When pressing the P button the game pause/continue.
When pressing the ESCAPE key the game also pause but also back to the main menu by switching the gameobjects disable/enable.

Now let's say I pressed the escape key while playing the game and I'm back to the main menu now I want to start a new complete game but clicking the StartNewGame ui button.

The problem is that this time I don't want to just active the Game Data like I did before :

gameData.SetActive(true);

This time at least in my logic I want to destroy the existing Game Data and instantiate a new Game Data using a prefab I already have of the Game Data.
This is my logic but I'm not sure how to do it. Or something like that.

The main goal is to be able to start over a new game each time clicking the StartNewGame ui button.


texts: As3 Flash How to check if a bitmapdata is completely set to transparent using an eraser?

texts:
I'm trying to make a window-cleaning game with flash as3 on the timeline.
(Sounds boring I know, but I realy have some fun idea's with it)

So I have: A dirtywindow movieclip on the bottom layer
and a clean window movieclip on layer 2(mc1) on the layer above.

To hide the top layer(the dirty window) I assign a mask to it.

// this creates a mask that hides the movieclip on top
var mask_mc:MovieClip = new MovieClip();
addChild(mask_mc)

//assign the mask to the movieclip it should 'cover'
mc1.mask = mask_mc;

With a brush(cursor) the player wipes of the dirt ( actualy setting the fill from the mask to transparent so the clean window appears)

//add event listeners for the 'brush'
brush_mc.addEventListener(MouseEvent.MOUSE_DOWN,brushDown);
brush_mc.addEventListener(MouseEvent.MOUSE_UP,brushUp);

//function to drag the brush over the mask
function brushDown(dragging:MouseEvent):void{
    dragging.currentTarget.startDrag();
    MovieClip(dragging.currentTarget).addEventListener(Event.ENTER_FRAME,erase) ;
    mask_mc.graphics.moveTo(brush_mc.x,brush_mc.y);
}

//function to stop dragging the brush over the mask
function brushUp(dragging:MouseEvent):void{
    dragging.currentTarget.stopDrag();
    MovieClip(dragging.currentTarget).removeEventListener(Event.ENTER_FRAME,erase);
}

//fill the mask with transparant pixels so the movieclip turns visible
function erase(e:Event):void{
    with(mask_mc.graphics){
        beginFill(0x000000);
        drawRect(brush_mc.x,brush_mc.y,brush_mc.width,brush_mc.height);
        endFill();
    }

}

I hope you can help me with the following problem:
The game-aspect of this should be the points the player get's for cleaning/erasing all the dirt.

Can anyone tell me how I can check if all pixels are set to transparency?  So how to check if all the dirt has been erased? And than for example trace ("window cleaned")

I tried the compare() function but didn't have much luck with it :(...


texts:
I loaded some textures just one time before I go to my mainloop(glutMainLoop).
I am using SDL for the texture loading.
However, when I compile, my game is running at 6-10 fps.
When I don't load the textures(so the game is running without the textures), I have 30-50 fps.
Please help me, I don't know what can cause this low fps.

Texture loading using SDL and OpenGL:

#include "LoadTextures.h"
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
LoadTextures::LoadTextures(){}
GLuint LoadTextures::texture[10];

void LoadTextures::loadStuff(const char * imgPath, int amount){
        SDL_Surface * surface = IMG_Load(imgPath);

        glGenTextures(1, &texture[amount]);
        glBindTexture(GL_TEXTURE_2D, texture[amount]);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        glTexImage2D(GL_TEXTURE_2D, 0, surface->format->BytesPerPixel, surface->w,surface->h, 0, GL_RGBA,GL_UNSIGNED_BYTE,surface->pixels);

        SDL_FreeSurface(surface);
}

It would be a mess to post my whole code, but this is where all my textures are loaded, in the beginning of my code(so just one time, no more).

Sorry for bad English, please help...

EDIT:

This is where I render the sky texture(that causes the lag).
Information: LT.texture is an array where all the (just one time) loaded textures are stored in so I can use them. I use double buffering.

void Drawing::drawSky(){
    ///THE SUN
    glPushMatrix();
    glBindTexture(GL_TEXTURE_2D, LT.texture[6]);
    glEnable(GL_TEXTURE_2D);

    glColor4f(1.0f, 1.0f, 1.0f,1.0f);

    glBegin(GL_QUADS);
        glTexCoord2f(0, 0); glVertex2f(-10.0f,-5.0f);
        glTexCoord2f(0, 1); glVertex2f(-10.0f,4.0f);
        glTexCoord2f(1, 1); glVertex2f(100.0f,4.0f);
        glTexCoord2f(1, 0); glVertex2f(100.0f,-5.0f);
    glEnd();

    glDisable(GL_TEXTURE_2D);
}

EDIT:
This is where I swapped buffers:

void Main::display(){
    ///BACKGROUND COLOR(AKA THE SKY)
    glClearColor(0.0f,0.0f,1.0f,1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    ///LOAD THE IDENTITY MATRIX TO RESET THE DRAWING LOCATIONS(AKA CLEARING THE SCREEN)
    glLoadIdentity();

    ///SO EVERYTHING HAS THE CORRECT SIZE
    glTranslatef(0.0f, 0.0f, -5.0f);

    //draw.drawSky();
    draw.drawSun();

    ///CAMERA MOVEMENT
    glTranslatef(cameraX, 0.0f, 0.0f);

    ///DRAWING AND RENDERING TEXTURES AND ANIMATIONS
    draw.drawTerrain();
    draw.drawGrass();
    draw.drawClouds();
    draw.drawPlayer();
    draw.walkAnimation();

    ///SO THE PLAYER CAN JUMP
    if(inputClass.flying){
        inputClass.returnFly(0.007f);
    }

    ///FPS COUNTING AND CALCULATING THE DELTA TIME
    float recentTime = (float)clock();
    deltaTime = recentTime - startTime;
    startTime =  recentTime;

    ///FPS SHOWING TO CONSOLE WINDOW
    //std::cout << "Delta: " << deltaTime << std::endl;
    std::cout <<  "FPS: " << (1 / deltaTime) * 1000 << std::endl;

    ///MOVEMENT OF THE CAMERA
    cameraX += cameraSpeed * deltaTime;

    ///SWAP THE BUFFERS FOR SMOOTH RENDERING
    glutSwapBuffers();
  }


texts: Unity - change transform.localPosition like transform.Translate with Space.Self

texts:
I run into the problem with moving object regarding to its rotation. The thing is that I'm changing object position by assigning new transform.localPosition value. In specific cases I want to modify assigned value by slightly changing z axis (height) of the object.
I tried to do it with use of transform.up. I expected move along local z axis (like in Unity scene preview), but it doesn't work as expected.
transform.Translate(Vector3.up, Space.Self) works exactly as I want, but as I said I want to combine it with transform.localPosition i already use. How should I modify passed Vector3 so it works correctly?
Update:
Class below is used to simulate move of an object around sphere. For example plane flying around Earth. I adjust plane rotation so it's chassis is facing Earth. Object is moving on the Earth surface though. I want to move it slightly up so it flies. That's why I want to move it along local z axis as it is distance from the core of the Earth.
Full class snippet (I'm using LeanTouch package)
public Transform lookAtTarget;
RaycastHit hit;
RaycastHit lastHit;

public float rotationSmoothTime = 0.3F;
public float moveSmoothTime = 0.3F;
private Vector3 rotationVelocity = Vector3.zero;
private Vector3 moveVelocity = Vector3.zero;
private Vector3 lastNewRightDir;

protected virtual void Awake ()
{
    Use.UpdateRequiredSelectable (gameObject);
    lastNewRightDir = transform.right;
}

void Update ()
{
    var fingers = Use.GetFingers ();
    if (fingers.Count < 1)
    {
        Move (lastFingerScreenPosition, Vector2.zero);
        return;
    }
    LeanFinger finger = fingers[0];
    Move (finger.ScreenPosition, finger.ScreenDelta);
    lastFingerScreenPosition = finger.ScreenPosition;
}

public void Move (Vector2 fingerScreenPosition, Vector2 scaledDelta)
{
    var ray = Camera.main.ScreenPointToRay (fingerScreenPosition);
    LayerMask mask = LayerMask.GetMask ("Interactable");

    bool newHit = Physics.Raycast (ray, out hit, float.PositiveInfinity, mask);

    Vector3 rightDir = transform.right;
    Vector3 newRightDir = lastNewRightDir;

    Vector3 targetPosition = lastHit.point;

    if (newHit)
    {
        targetPosition = hit.point;
        lastHit = hit;
    }
    else if (lastHit.distance == 0)
    {
        return;
    }

    Vector3 forwardDir = (targetPosition - lookAtTarget.position).normalized;

    if (targetPosition != transform.position && scaledDelta != Vector2.zero)
    {
        newRightDir = (targetPosition - transform.position).normalized;
        lastNewRightDir = newRightDir;
    }

    rightDir = Vector3.SmoothDamp (rightDir, newRightDir, ref rotationVelocity, rotationSmoothTime);
    Vector3 upwardDir = Vector3.Cross (forwardDir, rightDir);
    transform.rotation = Quaternion.LookRotation (forwardDir, upwardDir);

    transform.localPosition = Vector3.SmoothDamp (transform.localPosition, targetPosition, ref moveVelocity, moveSmoothTime);
}}

Before transform.localPosition = Vector3.SmoothDamp (transform.localPosition, targetPosition, ref moveVelocity, moveSmoothTime); the targetPosition value should be adjusted so object moves 1 unit alongside local z axis.


texts: How can I render attack ranges as in this screenshot?

texts:
Divinity: Original Sin 2 has an amazing range-of-attack display. When I select a character's abilities, the range of the ability will appear (as shown in the screenshot below).

I'd like to know how to create an effect like this.

You can see this system in motion via this YouTube video

I think It just displayed navmesh , so I tried to display my navmesh.I used NavMesh.CalculateTriangulation() , GL API to displaying.

After baking navmesh attach this script to your camera and give this a material:

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

public class NavmeshDebuger: MonoBehaviour {
    public Material material;

    void OnPostRender() {
        var triangulation = NavMesh.CalculateTriangulation();
        if (material == null) {
            return;
        }
        GL.PushMatrix();

        material.SetPass(0);
        GL.Begin(GL.TRIANGLES);
        for (int i = 0; i < triangulation.indices.Length; i += 3) {
            var triangleIndex = i / 3;
            var i1 = triangulation.indices[i];
            var i2 = triangulation.indices[i + 1];
            var i3 = triangulation.indices[i + 2];
            var p1 = triangulation.vertices[i1];
            var p2 = triangulation.vertices[i2];
            var p3 = triangulation.vertices[i3];
            var areaIndex = triangulation.areas[triangleIndex];
            Color color;
            switch (areaIndex) {
            case 0:
                color = Color.red; break;
            case 1:
                color = Color.green; break;
            default:
                color = Color.blue; break;
            }
            GL.Color(color);
            GL.Vertex(p1);
            GL.Vertex(p2);
            GL.Vertex(p3);
        }
        GL.End();

        GL.PopMatrix();
    }

}


texts:
I see that some XNA resources implement ICloneable (namely the Effect class) but textures don't. I have encountered a situation where I need to make a complete copy of a RenderTarget2D texture and use it as inputs for two separate rendering effects. One effect will change the contents of the RenderTarget2D so I can't pass it to the other effect, which is why I need two copies.

Can you "clone" or deep copy a RenderTarget2D in an easy way? My current work around is that I wrote a copy function that sets a new render target, uses a simple effect to just re-draw the contents of the target to be copied to into a quad and return the new render target. But seems like a lot of work around simply to create a copy.


texts: Clamp GameObject Into Isometric Camera Viewport

texts:
I'm using the next code to move an objecto into an isometric projection (30/45)

[SerializeField] private Camera cam;
[SerializeField] private Transform target;
[SerializeField] private float speed;

private Vector3 forward, right;

private void Start()
{
    forward = cam.transform.forward;
    forward.y = 0;
    forward = Vector3.Normalize(forward);
    right = Quaternion.Euler(0, 90, 0) * forward;
}

private void Update()
{
    if (Input.GetKey(KeyCode.Mouse0))
    {
        var righMovement = right * speed * Time.deltaTime * (Input.GetAxis("Mouse X"));
        var upMovement = forward * speed * Time.deltaTime * (Input.GetAxis("Mouse Y"));

        if (righMovement != Vector3.zero && upMovement != Vector3.zero)
                target.forward = Vector3.Normalize(righMovement + upMovement);

            lastPosition += new Vector3
            {
                x = righMovement.x + upMovement.x,
                y = righMovement.y + upMovement.y,
                z = righMovement.z + upMovement.z
            };

            target.position = lastPosition;

            //target.position = Clamp(lastPosition);
        }
    }
}

At same time I want to clamp that object based on the screen size to avoid move the target when is off screen, so I made this:

private Vector3 Clamp(Vector3 position)
{
    var w2p = Camera.main.WorldToViewportPoint(position);

    w2p.x = Mathf.Clamp(w2p.x, .2f, .8f);
    w2p.y = Mathf.Clamp(w2p.y, .2f, .8f);

    return Camera.main.ViewportToWorldPoint(w2p)
}

But I'm getting some weird behaviours, the X axis clamp is fine, but Z is not working at all, and Y is on move what is not ok. It's quite probable I'm doing this in the wrong way. How it should be?


texts: What is the standard practice for animating motion -- move character or not move character?

texts:
I've downloaded a bunch of (free) 3d warriors with animations. I've noticed for about 25% of them, the 'run' animation physically moves the character forward in the z direction. For the other 75%, the animation just loops with the characters feet moving etc., but does so in place, without changing the character's physical location.
I could fix this by:
1.) Manually updating the transform in code for this 75%, to physically move the character
2.) Alter the animation by re-recording it, with a positive z value at the end (when I did this it caused the character to shift really far away the rest of the units, probably something to do with local space vs world space I haven't figured out yet).
But before I go too far down this rabbit hole, I wonder if there is any kind of standard? In the general case, are 'run' / 'walk' animations supposed to move the character themselves, or is it up to the coder to manually update the transform while the legs move and arms swing in place? Is one approach objectively better than the other, or maybe it depends on the use case? If so, what are the drawbacks of each? I know nothing about animation, so I don't want to break convention (if there is one).


texts: Using the same font with different sizes in libgdx

texts:
I am using BitmapFonts, LabelStyles and Labels for my texts.

I want to resize some labels, so i use this.

fontType.scale(-.6f);

LabelStyle style = new LabelStyle(fontType, Color.WHITE);

titleLabel = new Label("Points", style);
titleLabel.setColor(Color.RED);
titleLabel.x = 260;
titleLabel.y = 310;

but when i want to resize another label, all the labels containing that font resize (I create a new LabelStyle). So i resize the label instead of the font, but that doesnt solve the problem, because it doesnt resize the label, any idea?


texts: UV Texture coordinates out of [0,1] (WebGL)

texts:
I'm creating a 3D game with WebGL and i'm using Wavefront Objects as a base model format.
I recently found some models, their texture coordinates of which are out of the typical [0,1] range and i really don't know how to handle them (in code).

I know of course this is a known issue, texture coordinates can be outside of [0,1] and the solution is to use GL_REPEAT wrap mode.

But this is no solution to me since i have a lot of non-powered-by-2 textures and i need to use CLAMP_TO_EDGE wrap mode (the solution to non-pow-2 textures).

I tried to bypass this issue by coding, so to convert [0-,1+] ranges into [0,1] but with not much of success (although somewhat). Here's what i did:
I looped "vt" entries (from my parser) and the cases i'm checking are these (pseudo):

U,V = texture coordinates as they come from file

if (U<0) {
   U = U + Math.abs( Math.floor(U) );
}
if (U>1) {
   U = U - Math.floor(U);
}
if (V>=0) {
   V = Math.ceil(V) - V;
}
if (V<0) {
   V = Math.abs( Math.floor(V) - V );
}

The above fragment will take a U,V of unknown range and will convert it into [0,1], taking also care the WebGL texture coordination system (0,0 buttom-left for WebGL but 0,1 for Wavefront, the 3rd case above)

The numbers are calculated correctly but the result is not the expected and i'm afraid there is a misunderstanding by my side on how the GL_REPEAT mode works.

So my question(s)

Can this be solved by code, so i can use CLAMP_TO_EDGE?
In case there's no way, is there any program than can take a model of REPEAT-ed coordinates and produce one in [0,1] range? I'm already using Blender but could not find a setting for this in exporter.


texts: Sprite editor "minimum size" feature alternative in Unity 5

texts: As you know , unity has been removed its minimum size feature in sprite editor multiple auto slice mode. In some pics Unity discovers a lot of tiny rubbish sprites for example as 4x3 or 10x5 pixels. Is there anyway to set minimum size for good auto slicing in Unity 5?


texts: Best way to draw 2D shapes on a 3D flat object

texts:
I want to draw shapes (arcs, circles, lines) on a table, which is in 3D space. The table top is at Y=0 level and oriented so it points to (0, 1, 0). There are some other 3D objects on the table, so depth buffer has to be used. What is the best way to do this?

I do it now by drawing triangles or flat models on top of it. But for this I have to draw them at - for example - y = 0.05 This causes problems, because too small value makes z-fighting, especially on Android, and I'm going to have more of these drawings, so I would need to use different Y levels. I want the object to be perceived that they are exactly at the table level.

Some texturing? Some other way? Performance is of course important.


texts:
I recently start learning Unity3D and following VTC's video tutorials and others tutorial, so far i've found it very easy to work it and to create stuff, i havent got to the part where i need to script anything YET.

While i still havent hit the scripting part yet i did like to ask:

Do i really need to script anything to
make a simple game with it ? (why am i asking this ? until now from the tutorials i've been watching it seems that unity3d has most of the physics and codes needs to create a working version of a simple game, for example making falling crates, the rigidbody functions, it taking into account flags and grass being touched by the wind and moving)
What are some simple examples of
where will i be scripting for ? (just wondering if there will be something to script for even for a simple game and what would that be)
When i build the finish project will it compile everything as if it was a VS project and make a working version without the need of any other wrappers for it is data, etc ? (this is sort of self replied by their webpage but i just wanted to confirm if i got this right)

I am aware those might be subjective questions but while i am unexperienced with it and havent found anything related to those questions yet or havent meet the end of a project to be able to confirm for myself i would like to receive some advices and information in regards this.

PS: i did a search but i was not sure of what should i look for to find answer for this kinda of questions so if this is a duplicate of any sort let me know and i will delete it once i am pointed out for the duplicate.

Best regards.


texts:
How can I remove these(on the picture) actors if I only have access to root's Window methods getChildren() and getCells() ?
I've tried somthing like this:
removeActor(getCells().get(1).getTable().getCells().get(0).getTable()...getTable());

But it always return the root Table.

UPDATE

I've came to this:

Cell<FileChooser> cell = getCells().get(1);
removeActor(cell.getActor().getCells().get(0).getActor());

But now it throws nonsense Exception:

Exception in thread "LWJGL Application" java.lang.ClassCastException: com.kotcrab.vis.ui.widget.file.FileChooser$11 cannot be cast to com.kotcrab.vis.ui.widget.file.FileChooser

How class cannot be cast to its own type?


texts:
In HaxeFlixel 4 all FlxObjects have a path property which must be a FlxPath instance

class FlxObject extends FlxBasic
{
    ...
    /**
     * The path this object follows.
     */
    public var path(default, set):FlxPath;
    ...

a tilemap can be used to find a path

var points:Array<FlxPoint> = tileMap.findPath(pathStart, pathEnd);

and then an object can walk that path

object.path = new FlxPath();
object.path.start(points);

What I want to do is run some custom code when the path ends, whether it was cancelled or was fully completed

what I see others do is this (player being the object in question)

override public function update(elapsed:Float):Void
{
    if(Std.is(player.path, FlxPath)){
        if (player.path.finished || player.path.nodes==null) {
            trace('finished walking');
        }
    }

But this tends to run indefinitely once the player has finished walking, yet I want it to run once. Secondly I don't even want the PlayState update function to be aware that there was an event where the player finished walking, it's none of it's business unless I tell it that it happened, I want this code block to be self-contained.

I discovered that FlxPath has an onEnd function, which is exactly what I need, but it does not call any callback, neither are there any ways that I know of to attach it, there is also the onComplete property, but I was not able to make use of it.

so here is what I'd ideally like

object.path = new FlxPath();
object.path.start(points, function(cancelled){
    trace((cancelled) ? 'path cancelled': 'path completed');
});

and this would run only once upon the path ending or getting cancelled

any ideas on some way of achieving this?


texts: Change color of a texture in a specific matrix location

texts:
I have following bool matrix:

bool[,] centerPiece = new bool[,] { { false, true, false }, { true, true, true }, { false, true, false } };

Using a method, I put a texture down every time the boolean hits true. Is there a way for me to select an individual texture in the matrix and change it's color independently, without changing the others in the same matrix?

I'm aware I have to use the Color method to change the color,
and that to select a specific point in my matrix the syntax is along the lines of centerPiece[1,1], but the rest baffles me.


texts:
A newbie to XNA here.  This is a followup to my previous question that showed me part of what I was doing wrong but I'm still not getting what I want.  I'm setting up a BasicEffect thus:

Effect = new BasicEffect(GraphicsDevice);
Effect.VertexColorEnabled = true;
Effect.Alpha = 1.0f;
Effect.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
Effect.GraphicsDevice.BlendState = BlendState.Opaque;

and the draw loop:

GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, MaxDepth, 0);

All polygons are being rendered where and how I wish except they should be fully opaque and they aren't.  The actual image looks more like the various colors are being combined in a fashion I'm not sure about:


texts: In cocos2d's plist output, what are 'offset,' 'colorSourceRect,' and these other fields?

texts:
<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
        <dict>
            <key>frames</key>
            <dict>
                <key>frame1.png</key>
                <dict>
                    <key>frame</key>
                    <string>{{0,0},{96,288}}</string>
                    <key>offset</key>
                    <string>{3,-6}</string>
                    <key>rotated</key>
                    <false/>
                    <key>sourceColorRect</key>
                    <string>{{80,12},{96,288}}</string>
                    <key>sourceSize</key>
                    <string>{250,300}</string>
                </dict>
                <key>frame2.png</key>
                <dict>
                    <key>frame</key>
                    <string>{{96,0},{96,288}}</string>
                    <key>offset</key>
                    <string>{3,-6}</string>
                    <key>rotated</key>
                    <false/>
                    <key>sourceColorRect</key>
                    <string>{{80,12},{96,288}}</string>
                    <key>sourceSize</key>
                    <string>{250,300}</string>
                </dict>

Above there is a part of a plist output in cocos2d format. each frame has own node, I do not know what is offset, sourceColorRect is. the first string node is the Rectangle of the current frame on sprite, but what are the "offset", "sourceColorRect" and "sourceSize"


texts: How mesh transformation works under the hood

texts:
We can look at the most popular engines like Unity and Unreal engine (maybe Godot and other).
As far as I understand (at least I would do this), we store the original mesh, and then for every change (shift, rotation or scaling) we turn the change into a matrix, and apply it to all vertices of the copy of the original mesh, with which  we will work later.
But it seems to me that this will not be very fast, so I doubt if this is really so.
I tried to see how the transform is implemented in the source code of the Unreal engine, but ... there is so much code that after spending a few hours searching, I gave up.
I will be glad to see a link to an implementation in an unreal engine (or any popular engine in general), but extra points - if you explain the code.
PS: if you know several implementations of transformation, then I would be glad if you tell me about the known ones and, if possible, describe their pros and cons.


texts: To split or not to split large 3D objects?

texts:
I have a fairly simple question for which I'm seeking guidance:

Should large 3D objects be splitted into smaller ones?

By wide, I mean an object that would be as wide as a game level is, below is some mountain, the first picture shows it as a single mesh, the second picture shows it as multiple meshes.

Facts I've considered (might be wrong):

a large object simplifies the scene hierarchy with less objects in total, but at the same time it might be rendered more often than necessary since it will be considered as visible
a large object made out of smaller objects makes the scene hierarchy more bloated, but at the same time on a performance aspect is better since only visible parts of it by the camera will be rendered, the rest being culled

Note, these objects aren't complex by today standards, that mountain is less than 1K triangles and a complete level is likely to be less than 30K triangles.

Ideally, I would like to have the least amount of objects in the scene hierarchy to keep it simple, but at the same time I am wondering whether or not over simplifying the level might put extra problems on the table I haven't thought about.


texts: Where can I find True Type fonts that are free for commercial use?

texts:
Possible Duplicate:
  Where can I find fonts for my game?

Does anyone know of fonts that are true type and unicode that can be used in a commercial game for free?


texts: Any tips for aligning existing sprite sheets to a grid?

texts:
I've been dabbling with sprites, and I've found most sprite sheets that have been posted for existing games (for example, Sonic & Knuckles) are not aligned to a grid.

I've found this frustrating when trying to use these sheets to set up animations in Unity. I managed to align the spritesheet above manually, but it took a while and I'm wondering if anyone has tips on how to make this process easier/faster?


texts: Unity 3d auto-move player forward script

texts:
Trying to write a basic script to attach to the player on Unity 3D, I want them to move forward automatically. I'm guessing that will be part of the Update function and using transform, but that's about as far as I get.

I'm assuming it's a Transform.translate function too, but not sure what parameters to use to move forward 1 m/s automatically (for example). Also, how do I block W and S keys moving forwards and backwards, and instead use the for up and down? (My character is 'floating' and I'm looking to incorporate space harrier style controls)

Thank you!


texts: Does collision between two Area2D work differently than collision with Rigidbody2D?

texts:
Consider a Main.tscn with:
(1) a player:
+ Player extends Area2D
|_ AnimatedSprite
|_ CollisionShape2D

The player has:
func _on_Player_body_entered(body):
    hide()

(2) a falling rock:
+ Rock extends RigidBody2D
|_ AnimatedSprite
|_ CollisionShape2D

(3) a trap:
+ Trap extends Area2D
|_ AnimatedSprite
|_ CollisionShape2D

The collision between Player and falling Rock (Area2D vs RigidBody2D) makes the player disappear as expected. While, the collision between Player and Trap (Area2D vs Area2D) does nothing. Is it expected?


texts: How can I use Body tracking in Android using ARCore or some other libraries?

texts:
I know that ARCore on Android doesn't support Body Tracking like ARKit does. But is there some alternative or workaround to achieve it? Some other SDKs or Libraries or maybe even if there is some way to do it through ARCore itself?
To make it clearer I plan to use something like this in an AR game for Android. I plan to develop it in Unity 2019.4.x.
My search result in Google didn't yield a useful result as it gets mixed with ARCore Motion Tracking (which isn't what I am talking about here) or implementation with ARKit. But I got a little hope that there might be some way out after reading this post on Unity Forums.