Comments (10)
Dang nice work edward!
let's hope this project gets some more love. It really is a beauty. I would also accept giving the Generic Rule tile more than 9 siblings. I know this would be overkill for some uses but for mine it would be nice to be able to set rules for two away rather than just one distance.
from 2d-extras.
** Desperate Noob Here **
I'm a hobbyist, and trying to create random tilemap generation, but don't know where to start. I've tried to absorb as much as I can of the 2D Extras, and Unity videos. I have some questions, and ANY help is welcome!
-
to johnosoncodehk, or anyone that can answer.. can you decipher the line:
public class MyTile : RuleTile<MyTile.Neighbor> ?
I understand basic inheritance, but what I don't understand is the <MyTile.Neighbor> part. Inheriting from something that has a List argument? I'm new to that statement construction. -
For learning how to actually produce my own code for Rule Tile scripts, where do I start? i've found a couple videos (specifically Jay Santos' video), and the 2D Extras material, but what else is out there? where should I look for examples/guidance? I've searched and searched and came up with very little.
My End Goal: develop a tile randomization script that will generate custom maps, based on normal tiles and rule tiles. So that in a sense, i'm able to create biomes and coastlines and such that make sense.
from 2d-extras.
On our project (Sparklite) we modified the RuleTile to have what we call "sibling" tiles. When deciding if a rule matches, instead of just comparing to 'this' we also see if it's a sibling.
from 2d-extras.
We also have siblings PER RULE but I'm wondering if that's a hack cause it feels hacky.
from 2d-extras.
Checking for other types of tiles or extending the distance of checks is certainly possible, but we wanted to keep the use of the current RuleTile simple.
Lets see if an extended RuleTile would make sense.
from 2d-extras.
Hi ChuanXin, I agree with this. the default version should be simple to grasp, and it is! This is the first time I have used the RuleTile and ran into the issue of needing to extend the functionality so I thought I would mention it as I believe it will be necessary for many users.
from 2d-extras.
I agree that we should keep the current RuleTile simple to use.
I made a version that is extensible and backwards compatible, allowing you to customize fields and rules.
Extension code (Update with 16/6/2018):
public class MyTile : RuleTile<MyTile.Neighbor> {
public bool customField;
public class Neighbor : RuleTile.TilingRule.Neighbor {
public const int Null = 3;
public const int NotNull = 4;
}
public override bool RuleMatch(int neighbor, TileBase tile) {
switch (neighbor) {
case Neighbor.Null: return tile == null;
case Neighbor.NotNull: return tile != null;
}
return base.RuleMatch(neighbor, tile);
}
}
from 2d-extras.
I have submitted a pull request for this requirement: #37
from 2d-extras.
ooh nice! is this pulled? I can't seem to tell. thanks for this!
from 2d-extras.
This branch can be found here:
https://github.com/johnsoncodehk/2d-extras/tree/rule-tile-extend
When the author did not confirm the merger of these changes, I suggest not to update it for the time being because everything may change.
from 2d-extras.
Related Issues (20)
- Prefab brush is not showing or working both are error HOT 1
- Error message after install, package not loaded HOT 1
- GridInformationKey should implemented IEquatable<GridInformationKey> and override GetHashCode() to avoid GC alloc HOT 1
- 2D Game Kit errors HOT 5
- unity 2021 package missing files HOT 1
- GridInformation.cs error : The name 'HashCode' does not exist in the current context HOT 6
- Editor Warning On Creation: No script asset for RuleTile. HOT 4
- GameObject Brush paint incorrect position when Cell.Position.y < 0 HOT 2
- New transform of rule tile: rotate and mirror HOT 6
- 2021.1.22f1 HashCode Error HOT 2
- NullReferenceException when using Tile Palette HOT 3
- Gameobject-Tiles and Tile Palette Preview HOT 1
- Mixing Tiles HOT 3
- I have an error. HOT 1
- Error deleting RuleTile with GameObject during physics callback HOT 2
- RuleTile with sibling layer tilemaps? z-axis siblings? HOT 1
- PopulateRuleOverideTileWizard can't work right HOT 8
- Animated Tile Expansion
- Tilemap renderer cannot be refreshed after deletion HOT 2
- Request Special Rule Tile
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 2d-extras.