Getting supertile group info

Post here your questions about the OpenSpace 2.x or notify bugs and suggestions.

Moderators: Lapo, Bax

dannyrg
Posts: 19
Joined: 19 Oct 2010, 19:08

Getting supertile group info

Postby dannyrg » 25 Oct 2010, 18:58

Hi,

How can I find the "group id" of a tile?
(so I can find all the other tiles composing such supertile of same group id)

Is there a method of retrieving all tiles of a group id or of a supertile?
(let's assume all skins of said supertile have a trigger. I'd like to conduct an action relating to ALL the tiles within that supertile, regardless of which of the individual parts of the supertile was clicked)

btw, can I set the groupID of a supertile at map editing or is it always automatic?

thanks
dannyrg
Posts: 19
Joined: 19 Oct 2010, 19:08

still no answer?

Postby dannyrg » 29 Oct 2010, 14:19

Still waiting on some help with this one...
anyone...?
User avatar
Bax
Site Admin
Posts: 4522
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 30 Oct 2010, 13:10

Retrieving a group is not currently possible. Can you please give an insight of what are you trying to achieve?
Paolo Bax
The SmartFoxServer Team
dannyrg
Posts: 19
Joined: 19 Oct 2010, 19:08

the goals...

Postby dannyrg » 30 Oct 2010, 16:57

So there are two goals here, which are unrelated to each other.

1: Let's assume I have "hidden" an item in a tile. when a tile is clicked it triggers a search in the database to see if that tile contains a hidden item.
so far so good since I can calc the tile's IX (or use coords) to check against the database, which is already aware of such hidden items and their locations.
But, if an item is hidden on a tile which is a part of a supertile, then two things happen:
a. I cannot assign a tile trigger, only a skin trigger (this is fine, because I trigger the search via the skin instead)
And b. (which is the problem) as a supertile, I need all skins composing it to trigger the search and since the item is only "hidden" on just one of those tiles, I need to know all the tiles that belong to that supertile, so I can search for an item in each of those tiles in the database.
ultimately, I want to click on any part of a supertile and find out if there is a hidden item in that entire supertile. (if it's a house, or a large bush or whatever, the user can't be expected to click it several times in different locations to make sure he "searched" everything. to the user it's a single object and the search should reflect that).


That was scenario one.

Scenario two: I'm not too sure if is really exactly relevant to what I was asking originally, but it's something i'm not sure of how to do anyways and perhaps this approach can be utilized or perhaps you can steer me in the right direction -
In most isometric games out there (especially facebook) you create "production" units on the map and they do all sorts of things.
They are typically larger than a single tile (so a supertile) and they act as a single unit, in the eyes of the player.
So when you mouseover them, they light-up and show a tooltip. When you click them, they each have their own functions.
I understand I need to build the individual logic for each such unit type.
What I don't know how to do, is how to identify a supertile (moused-over / clicked) as a specific unit (both in type and individuality among all other items).
User avatar
Bax
Site Admin
Posts: 4522
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: the goals...

Postby Bax » 01 Nov 2010, 16:22

a. I cannot assign a tile trigger, only a skin trigger (this is fine, because I trigger the search via the skin instead)

This assumption is wrong. If you read the Map editor manual, you will find out that keeping the CTRL key pressed when clicking on a tile belonging to a group, you can edit its instance properties and add triggers to it.
In this way, for example, you can give an instance name to all the tiles (so you can retrieve them at runtime) and use the trigger parameters to save the name of the specific tiles which hides something.
Paolo Bax
The SmartFoxServer Team
dannyrg
Posts: 19
Joined: 19 Oct 2010, 19:08

interesting...

Postby dannyrg » 01 Nov 2010, 16:35

I see that I can ctrl-click on any of the supertile-individual tiles that are:
1. the skin tiles
2. all the other tiles of the group that are not completely covered by the skins

Then I see that I can assign to them a name (and possibly an inventory item ref, which i'm not yet sure how it works).
However, since it's a non-walkable tile, I cannot assign a trigger.

Am I correct so far?

If so, it seems I am still remaining with skin triggers (which I can then do skin.parent.parent to get the tile) if I understand correctly, I can then use "getTileByName" to get the tile with a specific instance name, but, I don't see a way to get ALL tiles with that instance name, so does that mean I can only give singular names to those tiles and not the same name? and if so, again, how would I retrieve them by association with the tile(skin) that was actually clicked?

I am fully aware I may be missing something here, since I am rather new to this, so I apologize in advance.
dannyrg
Posts: 19
Joined: 19 Oct 2010, 19:08

further info

Postby dannyrg » 02 Nov 2010, 01:32

Hi Paolo,

In continuation of this discussion, I'd like to say that upon further investigation it seems that for what we require for our project, getting this piece of information is going to be pretty crucial in order to get the feature we want, within a reasonable development effort.

I would ask the following:
Why is the "Tile" class not providing such a basic piece of information as the groupid when that data is readily available internally?
And since it shouldn't be a big issue to accommodate such a thing, can you post a quick fix version to support retrieving that piece of information?

I can tell you that it is actually going to make our efforts significantly more complex to build such a simple feature as identifying singular map items (such as production unit buildings etc), without being able to get this piece of information from a tile.

The funny part is, that on a _os_map command from the server, I can retrieve all groups on the initial loading of the map, so I can then query the server about all corresponding "production units" to get their info.
But I need the groupID of a tile when it's clicked in order to launch it's individual functionality.

From a development perspective I think the groupID is pretty much the only simple way to singularly identify a group of related tiles (and that is, I assume, the reason why you created groupID's in the first place). so keeping that information unattainable by the developer just doesn't make sense.

Dan
User avatar
Bax
Site Admin
Posts: 4522
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 05 Nov 2010, 07:07

As this is being requested by a number of users, we are investigating its feasibility (of course it is not just exposing the groupId, but also adding related methods and making sure everything will work smoothly).
Paolo Bax
The SmartFoxServer Team

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 5 guests