Giter VIP home page Giter VIP logo

cgml's Introduction

CGML

(current.gen Markup Language)

A quick way to save data to text files and read it back - not fast, not perfect, but it's simple and does what I want. Slowly adding features.

Built in C# for Unity but can be used anywhere, wiki soon if anyone wants it

Disclaimer: this library is undergoing large changes often and may not be (definitely isn't) ready for production. Use and update with caution. If you're still interested, keep reading.

Here's the idea

I wanted a simple node-based system for moving data in and out of text files, so here we are. Let's go through some key points:

  • A Node is a class that has a name and (optional) value, and can store attributes as a special list (think XML/HTML)
  • All nodes can have child nodes
  • All child nodes are just normal nodes, allowing for unlimited hierarchy levels
  • A CGMLObject is a class with a single ordinary root node
  • Nodes can very easily be looped through recursively

For example

A pretty-printed settings file

<Root>
	<Audio>
		<Volume="0.8" Sound="1" Music="1">/
	/
	<Display>
		<Resolution ResX="1280" ResY="720" Freq="60">/
		<VSync="0">/
		<Fullscreen="2" Monitor="0">/
	/
	<Graphics>
		<ShadowDistance="200">/
		<ShadowQuality="2">/
		<TextureQuality="2">/
		<AntiAliasing="1">/
		<ViewDistance="2">/
	/
	<Gameplay>
		<Difficulty="1" EnableMonsters="true">/
	/
	<Controls>
		<Sensitivity X="0.4" Y="0.4">
			<Linked="true">/
		/
	/
/

Strengths

  • Ease of use
    • Can convert between text files and class instances with a single function call
    • Node system is easy to understand, simple to use
  • Easily optimized
  • Readable when translated to a string

Limitations

  • Node and attribute keys must not include spaces or angle brackets

Unity installation

2020.1.3+ (optional) (strongly recommended)

  1. Change to dark theme
  2. Follow 2019.4+ instructions

2019.4+

  1. Open Package Manager
  2. Click the ➕▾ button
  3. Click Add package from git URL...
  4. Add https://github.com/Alscenic/cgml.git

< 2019.4

  1. In your project folder, open Packages/manifest.json
  2. Add "com.currentgenstudios.cgml": "https://github.com/Alscenic/cgml.git", to the dependencies

Recommended utilities

I highly recommend you use one of these UPM extensions:

Installing anywhere else

  • Clone the repository to your project folder and update when necessary

Etc

Email me if you have questions, concerns, suggestions, or just want to tell me how much you hate it (https://github.com/Alscenic)

All included code is © Kyle Lamothe 2021

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.