Coder Social home page Coder Social logo

Air tiles about godot-constraint-solving HOT 3 CLOSED

alexeybond avatar alexeybond commented on June 1, 2024
Air tiles

from godot-constraint-solving.

Comments (3)

dwidge avatar dwidge commented on June 1, 2024 1

Thanks for explaining it's working now.

from godot-constraint-solving.

AlexeyBond avatar AlexeyBond commented on June 1, 2024

Hi. That's an expected behavior. In most cases an empty space is not useful, so, if it wasn't ignored in sample map, it would be more difficult to create a valid sample for rules that don't use empty tiles. With empty space ignored it is easy to just throw some new tiles somewhere in free space of the map and add some adjacent tiles like this:
image
without spending time to fit them into existing part of the map. If empty space wasn't ignored, a sample for a map that doesn't use empty tiles would have always been kept a rectangle without any gaps, because otherwise those gaps would be recognized as empty tiles.

It may be possible to add use of empty cells as an option. But I'm not yet sure how to make it work without interfering with functionality of negative samples, preconditions and communication between threads in multithreaded mode.


The cleanest solution I currently see is to create a tile type that is visible in editor but isn't visible in the game. And use this tile to represent an empty space in samples.

I have just researched how to make it work with grid maps. And the only way I found is a bit complicated and not very efficient (as the "empty" mesh is rendered in game):

  • add a global boolean shader uniform IS_EDITOR, defaults to true
  • in some game script it should be set to false: RenderingServer.global_shader_parameter_set("IS_EDITOR", false)
  • create new material for "empty" mesh. It should use shader like
    shader_type spatial;
    global uniform bool IS_EDITOR;
    
    void fragment() {
    	if (!IS_EDITOR) {
    		discard; // Do not render in actual game
    	}
    
    	ALBEDO = vec3(1.0,0.0,0.0); // Mesh will appear red in the editor
    }
  • add a mesh with this new material to mesh library (use surface material override, not material override if you're using a mesh imported with different material)

Now this mesh can be used in samples where an empty space is supposed to be. And in the game the space will look empty.

This could be easier if meshlib/gridmap did respect visibility layers set in meshlib source scene, but they don't.

from godot-constraint-solving.

dwidge avatar dwidge commented on June 1, 2024

maze-wfc

from godot-constraint-solving.

Related Issues (14)

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.