Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple versions of the same tile? ($30 on Bountysource) #11867

Closed
sparr opened this issue Mar 31, 2015 · 10 comments

Comments

Projects
None yet
6 participants
@sparr
Copy link
Member

commented Mar 31, 2015

While implementing #11823 it occurred to me that it would be nice to have multiple versions of the same tile. Walls with graffiti, lopsided trees, etc.

Simply replacing each sprite number with an array of sprite numbers to be chosen between is a simple idea, but perhaps too simple. Some alternatives should be more common than others. Maybe we could just hard code a probability curve? first sprite 80%, second sprite 16%, etc.

Also, keeping the view consistent would be important. I'm thinking the random selection could be based on the global X/Y/Z coordinates of the tile. Are there any non-cryptographic hashes that are fast enough to put inside the tile drawing loop that would produce results that don't appear patterned to a human if they just lay down a solid block of those tiles?

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@Chezzo

This comment has been minimized.

Copy link
Contributor

commented Apr 1, 2015

I would love this! I was going to use the multi tile end piece for graffiti on walls cause it mixes them in pretty randomly. Your way is better! And works for everything, not just walls.

@sparr

This comment has been minimized.

Copy link
Member Author

commented Apr 1, 2015

@Chezzo if we went with a static % for each provided tile, what would make sense to you?

50%, 25%, 13%, 7%, 4% ... ?

66%, 22%, 8%, 3%, 1% ... ?

90%, 9%, 0.9%, 0.09% ... ?

@kevingranade

This comment has been minimized.

Copy link
Member

commented Apr 2, 2015

@sparr

This comment has been minimized.

Copy link
Member Author

commented Apr 2, 2015

Per tile weights is the most flexible, but also makes the JSON structure significantly more complex.

@sparr

This comment has been minimized.

Copy link
Member Author

commented Apr 2, 2015

It was suggested in another discussion that the weights simply be 1/N, and if the tileset designer wants to make one sprite more common they can just list it multiple times:

[1000, 1000, 1000, 1000, 1000, 1000, 1000, 1001, 1001, 1002]

70% 1000, 20% 1001, 10% 1002

(this came up when discussing adding this sort of functionality to the mapgen json)

@Chezzo

This comment has been minimized.

Copy link
Contributor

commented Apr 3, 2015

While the above is more versatile, if we are worried about readabilty, we could have two or three booleans, equal, uncommon and rare.

@sparr

This comment has been minimized.

Copy link
Member Author

commented Apr 3, 2015

Where would the booleans live in the data structure?

Here's what it might look like with weights for three different foregrounds, each with four individually rotated sprites:

'fg': [
    {'weight':90,'sprite':[1000,1001,1002,1003]},
    {'weight': 9,'sprite':[1004,1005,1006,1007]},
    {'weight': 1,'sprite':[1008,1009,1010,1011]}
],
'bg': [2000,2001,2002,2003]
@iguanaman

This comment has been minimized.

Copy link

commented Nov 21, 2015

Would it be possible to update the title with the bounty tag and amount? Currently @ $30

https://www.bountysource.com/issues/10279028-allow-multiple-versions-of-the-same-tile

@sparr sparr changed the title Allow multiple versions of the same tile? Allow multiple versions of the same tile? ($30 on Bountysource) Nov 21, 2015

@sparr

This comment has been minimized.

Copy link
Member Author

commented Nov 21, 2015

I can't change the label, but I changed the title.

I'd like to reach a consensus on the approach to probabilities before someone implements this, though.

So far the simplest option that has come up that still allows all of the flexibility is to just allow the list to have repeated entries and pick from all entries with equal probability.

My favorite is the one where we make fg and/or bg into a list of objects with weight and sprite keys. This is the most extensible in the future, such as if we want to add conditions to certain sprites.

@iguanaman

This comment has been minimized.

Copy link

commented Nov 21, 2015

The best solution I've seen so far is the example you posted last. With the weight and sprite as one object inside an array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.