GithubHelp home page GithubHelp logo

Comments (10)

nicbiondi avatar nicbiondi commented on May 20, 2024 1

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.

Moonboss avatar Moonboss commented on May 20, 2024 1

** 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!

  1. 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.

  2. 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.

edwardrowe avatar edwardrowe commented on May 20, 2024

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.

edwardrowe avatar edwardrowe commented on May 20, 2024

We also have siblings PER RULE but I'm wondering if that's a hack cause it feels hacky.

from 2d-extras.

ChuanXin-Unity avatar ChuanXin-Unity commented on May 20, 2024

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.

nicbiondi avatar nicbiondi commented on May 20, 2024

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.

johnsoncodehk avatar johnsoncodehk commented on May 20, 2024

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.

johnsoncodehk avatar johnsoncodehk commented on May 20, 2024

I have submitted a pull request for this requirement: #37

from 2d-extras.

nicbiondi avatar nicbiondi commented on May 20, 2024

ooh nice! is this pulled? I can't seem to tell. thanks for this!

from 2d-extras.

johnsoncodehk avatar johnsoncodehk commented on May 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.