Broken path after duplicating objects

Report problems here (or use the built-in feedback dialog in the editor)
Post Reply
Philipp@V-Play
Posts: 2
Joined: Mon Sep 21, 2015 10:26 am

Broken path after duplicating objects

Post by Philipp@V-Play »

Hi,

I'm currently working on an importer for our cross-platform game engine V-Play http://v-play.net/ based on Qt. There are a few issues I came across while evaluating RUBE. Our main focus is currently on sidescroller and platformer games.

The two bugs occur on Windows 10 64bit when duplicating items:
1. Duplicating fails if the rube file of the object is in a protected directory e.g. "C:\Program Files (x86)\rube-win32-1.7.3" even when the user has the privileges to read and write. The object is created with a correct path but it can't be show until re-opening the scene. If I have the rube files for example in a directory in user/documents..., then it never happens.
2. Sometimes, the paths are messed up after duplicating. This might only happen if I duplicate several different objects at once. "../assets/img/flake_0.png" becomes something like "../../../../../../../../../../../../../../../Users/pherl/Documents/IT/projects/RubeSidescroller/assets/img/flake_0.png"

Here are some things I found strange concerning the JSON file:
- Why are objects exported? They don't seemt necessary atm because their position offset and scale are calculated into the child items. Therefore, it isn't even helpful to have these objects as scene nodes.
- Why isn't the rotation of images exported? I only need the angle, center and size. I can get this information out of the vertex data but it's much more complicated.
- body.path leads to object.name. But this name property is NOT unique. Luckily it doesn't really matter, because I don't need the objects anyway.
- The image.body is the index of a body in the body array. Works fine but could be better to link to body.name with unique names? You could just add a running number.

And some (subjective) feedback to the GUI:
- The mode switching (i, o, p, b,...) takes a bit time to get used to. I found it quite unintuitive that the item viewer (F6) doesn't reflect the current mode. Combining the object selector with the selection mode could be nice.
- When I click on point where multiple items are overlapping all items are selected. Then I must de-select single items until I have the one I want with right click menu. This is just annoying. Instead, the selection should cycle through the items with left clicks. To select all, you can still select them by spanning a box.
- If the multi-selection is nicer a "select all" mode would be cool.
- Rotate / scale around the selection center should be the default.

Can you please fix the duplication issues? And can you tell me a bit more about the other things?

Cheers,
Philipp
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Broken path after duplicating objects

Post by iforce2d »

Hi Philipp

Sorry for the slow reply, I've been moving countries. My main development computer is still shipping, so it will be a while before I can fix the issues you mention. The questions I can answer though...

- Why are objects exported?
Mainly so that you can attach custom properties to them, for example, enemies placed throughout a level might have high-level characteristics associated with them, such as hitpoints, enemy type, starting state etc which is related to the object as a whole rather than any specific physics element. If objects were not exported you could place this information in one of the bodies of that object, which would still work but is a bit awkward to manage and not such a good allocation of data.

- Why isn't the rotation of images exported?
It is, but will not be present if the value is zero, as mentioned in the file format specs: "Values that are not present in the JSON file should be interpreted as zero, false or empty string (for numeric, bool and string values respectively)." The vertex data was intended as a convenience if you're using glVertexPointer and is not really useful in most cases and should probably be disabled by default I think.

- body.path leads to object.name, but this name property is not unique.
It would be good to mention what the broader problem is here that makes you bring this up. Yes, you can call objects whatever you want, unique names are not enforced. It would be nice to know which other bodies are part of the same object though, which right now requires giving the objects unique names - is that the end goal you are getting at? I think perhaps we should have an object id (unique) in all items of an object so that they can be collected together. This would be an integer property.

- image.body is the index of a body in the body array.
What would be the advantage of using a text name, and forcing users to keep their body names unique? It would make the file size larger and parsing slower since it would be doing a text comparison instead of a constant-time lookup.

Apart from the problem of not being able to collect physics elements of the same object, I don't see the problem with allowing non-unique names for items, or the advantage in forcing the user to keep them unique (or making the app add a running number, which needs to be matched when loading). I often group bodies/fixtures etc by giving them the same name, which is useful when loading the level in my game, because I can do eg. json->getFixtures("metal", mylist) to fill the list with the named fixtures and register them as something that makes a metallic sound when struck.

- switching mode
If the F6 panel doesn't follow the current edit mode, it gives you the ability to work with selections of two types of item at the same time. That's a good point though, I think it would be good to have an option to make the F6 panel always follow the current edit mode.

- multiple items
When multiple items are in the same place, the tool-tip should direct you to right click to dis-ambiguate the selection. Right-clicking should show a popup menu where you can select and deselect individual items at that location. Oh... wait, you have discovered that already, sorry. But in that case, can't you use the right-click menu to select the individual item you want from the outset, instead of selecting all and then de-selecting the unwanted items individually?
If the selection cycled through the items with left clicks, how could you select say, 3 of 7 items?

- If the multi-selection is nicer a "select all" mode would be cool
Holding shift while clicking on multiple items will select them all.

- Rotate / scale around the selection center should be the default
This is a pretty subjective thing wouldn't you say? In any case, it's very easy to switch modes (just hit R again), and which ever mode you were using last time will be kept as the default when starting the next rotation.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Broken path after duplicating objects

Post by iforce2d »

btw exporting of objects can be disabled in the Scene settings dialog under the "Export options" tab. At the bottom there is a section where you can expand the 'world' branch to see further branches.
Philipp@V-Play
Posts: 2
Joined: Mon Sep 21, 2015 10:26 am

Re: Broken path after duplicating objects

Post by Philipp@V-Play »

Thank you for this extensive answer.

Unfortunately, my summer internship is over. So, I can't improve anything right now. But I forwarded it.

V-Play already supports enough features of RUBE for a side-scroller game. Here's a tutorial:
http://v-play.net/doc/how-to-make-a-sid ... -tutorial/

More features are coming soon. Thank you, again.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Broken path after duplicating objects

Post by iforce2d »

That's a very in-depth tutorial, did you write it? Judging from the comment about the F6 panel not following the current mode, I would guess you did :) In any case kudos to whoever wrote it, nice job!
chrisVPlay
Posts: 2
Joined: Tue Oct 13, 2015 12:43 pm
Location: Vienna, Austria
Contact:

Re: Broken path after duplicating objects

Post by chrisVPlay »

Hi,
thanks! And yes Philipp, has written the tutorial. :)

Can you add the V-Play Game Engine as supported language / platform to the "Supported languages" site:
https://www.iforce2d.net/rube/?panel=loaders

Maybe adding the tutorial to your tutorial list might be helpful for other developers as well?


Just if you want to link to it, here is a list of the new RUBE components in the documentation:
http://v-play.net/doc/vplay-group/#rube-components

And here is the announcement about RUBE support with V-Play 2.6:
http://v-play.net/2015/10/v-play-2-6-re ... cker-rube/


Cheers,
Chris from V-Play
Co-Founder V-Play Game Engine
http://v-play.net
mango
Posts: 5
Joined: Wed Nov 18, 2015 12:00 pm

Re: Broken path after duplicating objects

Post by mango »

+1 for fixing this. I'm currently using a python regexp script for fixing the path errors before committing my .rube files to git.
koiko
Posts: 2
Joined: Thu Apr 04, 2019 9:38 pm

Re: Broken path after duplicating objects

Post by koiko »

For anyone interested, a workaround for the

Code: Select all

duplicate(object)
bug is the following (supposed that we need to duplicate the first selected object):

Code: Select all

    object[] selectedObjects = getSelectedObjects();
    object prototype= selectedObjects[0];
    object newObject= addObject(prototype.getFile(), prototype.pos);
The problem is that the

Code: Select all

object.pos
does not return the position of the object but instead

Code: Select all

(0, 0)
which I believe is another bug.

I wrote the following "radialCopy" similar to the radial-copy of fixtures/bodies that iforce2d shows in one of his tutorial videos and I had the problem that the created objects were all centered in (0,0) because the "prototype.pos" returns (0,0). My "objectRadialCopy" is shown below:

Code: Select all

int n = queryNumericValue("Total: ", 12);

if ( n < 2 )
    print("Please enter a value greater than 2");
else {
    object[] selectedObjects = getSelectedObjects();
    object prototype = selectedObjects[0];
    float angle = 360 / n;
    for (int i = 1; i < n; i++) {
	object newObject= addObject(prototype.getFile(), prototype.pos);
	rotate(newObject, 0, dr(i * angle));
    }
}
Post Reply