GithubHelp home page GithubHelp logo

cccitygen's Introduction

cccitygen

ComputerCraft Procedural City Generation Framework - taking city generation with command computers to the next level.

GitHub issues Maintenance GitHub license Join the chat at https://gitter.im/viluon/cccitygen

This project aims at providing a solid, object-oriented base for procedural city generation in Minecraft. Rather than being a single script (as most of other city generators out there), CCCG mirrors the hierarchy of real world cities in OOP, from districts down to furniture in individual rooms, and uses this pattern to rebuild these structures in Minecraft worlds, procedurally. Apart from being a framework, it also includes example city generation scripts and working assets that can be used freely in any other project (open source FTW! All contents of this repository are licensed under the terms of the GPL v3.0 license).

WIP Notice

CCCG is still quite young, most of the planned features are missing! I am working hard on bringing it into a usable state, but that will take quite some time. Once the repo hits the first pre-release (0.1) I'll switch to a nicer development flow, but for now all commits are dumped straight to master.

~ @viluon

Features

A list of working features implemented to date.

  • Block
    • Supports full NBT data
    • Separate ID and block value fields
    • solid field for distinction between solid and non-solid blocks
  • Point3D
    • Simply stores 3 values, x, y, z
    • Has overloads for adding Point3Ds or numbers to self
  • Grid3D
    • Stores essentially any data in an array of arrays of arrays (3D)
    • size and origin fields
    • Can be (un)serialized to/from a file
    • Methods for converting coordinates from global to local and vice versa
    • Grid3D:iter() iterates over all elements
    • Constructor automagically fills up the mesh with a fill function
  • Structure
    • Extends Grid3D
    • Structure:build() iterates over Grid3D data and places all Blocks encountered
  • Room
    • Implements IHasChildren
      • Support for any children that have the :build() method implemented
    • So far only supports exactly 4 Walls, Walls can be theoretically empty though
    • Ceiling and floor, handled differently than Walls but are in fact instances of Wall
  • Material
    • Pose as shaders for Rooms (Buildings, Walls, Windows, essentially anything that is made of Blocks)
    • Dynamic values with the Mutator class
  • Mutator
    • Can affect a Block depending on its relative position
    • Simply pass a function accepting block, x, y, z to the constructor to create a Mutator
    • Mutators can be chained (using one Mutator at the beginning of the chain will return a result that passed through the whole chain)
  • MaterialPalette
    • A palette of Materials for Rooms to pick Materials from
    • Shortcut methods to add Mutators to all Materials in a subpalette

Credits

Thanks to @Exerro for his amazing class library.

cccitygen's People

Contributors

viluon avatar

Watchers

 avatar  avatar  avatar

Forkers

gitter-badger

cccitygen's Issues

Handling Non-rectangular Rooms

How should non-rectangular Rooms be handled? What about hallways and such?
Possible solutions:

  • Make Rooms use more than 4 Walls, 1 floor and 1 ceiling
    • This introduces issues like how should these be assembled together, how to keep track of where everything is and how to actually construct such Rooms, because points A and B are just not enough.
  • Make Rooms link to surrounding Rooms and let some of their Walls be zero size, or let them have less than 4 Walls
    • This introduces issues like how should these Rooms be linked together and how should they be constructed, but allows structures like hallways to be built from individual segments.
  • Create a new class for more abstract handling of rooms which would join individual cells
    • This would make handling of Rooms a little more logical and would also prevent weird linking issues from the second idea. This new class could be called Room and the cell could be something like RoomCell

This issue has been derived from #1

ISupportsConstructorChain

An interface for method chaining of constructors. ISupportsConstructorChain would set the __call metamethod to the constructor of the implementing class, which would allow constructs like

local a, b, c = Point3D ( 1, 2, 3 ) ( 2, 3, 4 ) ( 3, 4, 5 )

This issue has been derived from #1

Implement require()

Currently, cccitygen uses a customized version of dofile() to load files. That is, honestly, a terrible solution. For these tasks, require() (unavailable in the ComputerCraft environment) should be used instead.


This issue has been derived from #1

Should Room Floors and Ceilings be Limited to the Inner Area?

Should the Wall object that serves as a floor/ceiling in a Room be limited only to the inner area of the Room? As it is now, the borders of floors and ceilings overlap with the room's walls, which means that floors and ceilings have to be built first and walls "on top" of them.


This issue has been derived from #1

IDuplicable

An interface generalizing the :duplicate() method. Many classes currently implement the :duplicate() method (in fact, all classes should have one). An interface could however generalize this. The constructor for the interface would have to require information on how should the actual class constructor receive arguments (what fields in what order).


This issue has been derived from #1

Add Overloads for Point3D

Add overloads for easier manipulation with Point3D.

  • __tostring
  • __len
    • This should return math.sqrt( self.x ^ 2 + self.y ^ 2 + self.z ^ 2 )
  • __add and __sub
  • __mul and __div
  • __mod
  • __pow
  • __eq
  • __lt
  • __le

Note: The comparison metamethods should simply compare the x, y and z values, and return true if all of the conditions match.


This issue has been derived from #1

Implement Grid3D:resize()

As of now, Grid3D can only be resized when created. That means Window cannot be implemented, because it extends Wall which extends Structure which extends Grid3D, and Window needs to be reoriented when Window:fitToWall() is called.


This issue has been derived from #1

Move Tasks from ToDo.md to Issues

These tasks have to be made into issues:

  • Add overloads for Point3D
  • What about the constructor chain interface?
  • Grid3D should use Point3D for origin
  • Rooms are somewhat limited. They can only have 4 walls. What about non-rectangular rooms?
  • Grid3D:resize()
  • Should room floors be limited only to the inner area (exclude the borders with walls)?
  • Move stuff from ToDo to GitHub Issues (done because the ToDo.md file has been deleted and this is in fact an issue ๐Ÿ˜› )
  • Implement require(), dofile() is dumb
  • Building should keep a list of outside walls
  • IDuplicable?
  • Generalize Palette, add RoomPalette
  • Use RoomPalette in :populate() along with BuildingPopulator or something similar
    • BuildingPopulator will contain a list of rules such as what Rooms the building should use and how should they be connected, how many of them etc
    • BuildingPopulators will define Building types, for example a family house vs. mall etc
    • BuildingPopulators should have a clue about how the building is structured (floors, staircases, elevators?)
  • Rooms should hold the information about windows, Buildings should only link to them

Note: The fact that a task here is checked means that it has been made into an issue, it doesn't mean it's solved.

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.