Alrighty, so I promised a bit of a demo on what I've been working on.
So it's abstraction of a rectangle grid-driven world, basically a game engine, called
Cipher. It is publicly available for any and all in
Github, and I'd naturally love it if anybody would like to pitch in - though I suspect it'll be a solo project for the time being. It is a back-end, although I did for example implement a simple graphics render engine so I could showcase what's happening under the hood. The engine is built in Java, and I was planning to work on a front-end, but it's been on hold for the time being while the engine itself is tested on command line.
Below is an example run of creating a simple "world" with one building and a sort of a fence around it. The cubes (="tiles") or the walls (="edges") do not yet have characteristics
per se, although their respective characteristics tables already exist in the database. I'm hoping to maintain a level of abstraction, so that the engine itself could be extended to suit many varying types of needs; let's say anything from a Crypto Kingdom like macro economy city sim to a 4X space game where e.g. solar systes are tiles or something.
Here's a run on the console as well as PNG output of what the example world looked like:
run:
Successfully connected to the dummy Cipher PostgreSQL database
Starting Cipher command line...
Enter commands following by a line change with a spacebar as the delimiter for parameters.
Type 'help' for a list of commands or 'q'/quit'/'e'/exit' for stopping this process.
> # Hey there! This is a comment. I'm now about to demo a bit of the tiles and edges that create the world for the Cipher engine.
> % This is also a comment. Anyway, here are some actions that are currently implemented to interact with the underlying PostgreSQL db:
> help
== Cipher command line help ==
{opt1/opt2} indicates options opt1 and opt2 as feasible choices.
List of parameter types are shown in square brackets following the parameter list itself.
If you want to comment, start the line with character '#' or '%'
...
{help/h/commands}: this help file
create {tile/edge}: Create a tile or an edge depending on the first parameter (further parameters required as indicated below)
create tile x y z symbol [INT INT INT CHAR(1)]
create edge x y z face symbol [INT INT INT INT CHAR(1)]
delete {tile/edge}: Delete a tile or an edge depending on the first parameter (further parameters required as indicated below)
delete tile x y z [INT INT INT]
delete edge x y z face [INT INT INT INT]
render {tile/edge/map}: Create a PNG representation of the object
render tile x y z [INT INT INT]: - -
render edge x y z face [INT INT INT INT]: - -
render map: - -
print {map/tiles/edges}
verbosity {0/1/2/...} [INT]: Set level of verbosity (0 = silent, 1 = standard, 2 = debug)
> # Not entirely up to date, but gives the rough idea :/ so, I emptied the database for illustrative purposes; let's check!
> print map
Construcing a tile/edge map...
Fetching tiles...
Fetching edges...
Map x width 0, y depth 0, z height 0
Tiles in map:
Edges in map:
> # Uh oh. No tiles or edges. Tiles are the "cubes" or voxels that are essential building blocks of for the world.
> # Edges are the sides (2-dimensional surfaces really) that lie between all potential tiles. They can be interpreted to represent such objects as doors, fences, walls, etc.
> # For the time being only placeholder tiles and edges exist that do not inherently represent any characteristics yet (r13 atm)
> # So let's create a 2x2x1 "house" placeholder!
> create tile 0 0 0 #
Creating tile...
Create tile call returned with: true
> # A bit too verbose, let's reduce it a bit.
> v 0
> create tile 0 1 0 #
Create tile call returned with: true
> create tile 1 0 0 #
Create tile call returned with: true
> create tile 1 1 0 #
Create tile call returned with: true
> print map
Construcing a tile/edge map...
Fetching tiles...
Fetching edges...
Map x width 0, y depth 0, z height 0
Tiles in map:
Tile {1,1,0}
Tile {1,0,0}
Tile {0,1,0}
Tile {0,0,0}
Edges in map:
> # The world now has cubes at {x,y,z} positions indicated above, a placeholder for a future 2x2 house with a single unit height.
> # So, while tiles contain the cube, edges could be used to e.g. create a fence around the house. Let's create a fence against any potential intruders!
> # The last input right now is a symbol for both creating edges and tiles, which is deprecated. This was useful for me when I was inspecting my creations in ASCII, but now I'm using naive 2d rendering.
> # Let us begin; let's create a wall that points to the NORTH (an enum represented by value 0)
> create edge 0 2 0 0 -
Create edge call returned with: true
> create edge -1 2 0 0 -
Create edge call returned with: true
> create edge -2 2 0 0 -
Create edge call returned with: true
> create edge 1 2 0 0 -
Create edge call returned with: true
> create edge 2 2 0 0 -
Create edge call returned with: true
> # Now we have secured our northern perimeter! Let's check what is inside the database...
> print map
Construcing a tile/edge map...
Fetching tiles...
Fetching edges...
Map x width 5, y depth 3, z height 1
Tiles in map:
Tile {1,1,0}
Tile {1,0,0}
Tile {0,1,0}
Tile {0,0,0}
Edges in map:
Edge {2,2,0} with facing NORTH
Edge {1,2,0} with facing NORTH
Edge {0,2,0} with facing NORTH
Edge {-1,2,0} with facing NORTH
Edge {-2,2,0} with facing NORTH
> # Yup, it's there. Let us finish our fine little "castle" by covering it from each side. An enum class exists for the edge facings, with 0 = NORTH, 2 = EAST, 4 = SOUTH, 6 = WEST.
> create edge 2 2 0 2 -
Create edge call returned with: true
> create edge 2 1 0 2 -
Create edge call returned with: true
> create edge 2 0 0 2 -
Create edge call returned with: true
> create edge 2 -1 0 2 -
Create edge call returned with: true
> create edge 2 -2 0 2 -
Create edge call returned with: true
> # East wall is ready. Let's make the SOUTH and WEST walls too.
> create edge 2 -2 0 4 -
Create edge call returned with: true
> create edge 1 -2 0 4 -
Create edge call returned with: true
> create edge 0 -2 0 4 -
Create edge call returned with: true
> create edge -1 -2 0 4 -
Create edge call returned with: true
> create edge -2 -2 0 4 -
Create edge call returned with: true
> create edge -2 -2 0 6 -
Create edge call returned with: true
> create edge -2 -1 0 6 -
Create edge call returned with: true
> create edge -2 0 0 6 -
Create edge call returned with: true
> create edge -2 1 0 6 -
Create edge call returned with: true
> create edge -2 2 0 6 -
Create edge call returned with: true
> # Cool! We should have a 2x2 house surrounded from each side. Not very comfy maybe:
> print map
Construcing a tile/edge map...
Fetching tiles...
Fetching edges...
Map x width 5, y depth 5, z height 1
Tiles in map:
Tile {1,1,0}
Tile {1,0,0}
Tile {0,1,0}
Tile {0,0,0}
Edges in map:
Edge {2,2,0} with facing NORTH
Edge {2,2,0} with facing EAST
Edge {2,1,0} with facing EAST
Edge {2,0,0} with facing EAST
Edge {2,-1,0} with facing EAST
Edge {2,-2,0} with facing EAST
Edge {2,-2,0} with facing SOUTH
Edge {1,2,0} with facing NORTH
Edge {1,-2,0} with facing SOUTH
Edge {0,2,0} with facing NORTH
Edge {0,-2,0} with facing SOUTH
Edge {-1,2,0} with facing NORTH
Edge {-1,-2,0} with facing SOUTH
Edge {-2,2,0} with facing NORTH
Edge {-2,2,0} with facing WEST
Edge {-2,1,0} with facing WEST
Edge {-2,0,0} with facing WEST
Edge {-2,-1,0} with facing WEST
Edge {-2,-2,0} with facing SOUTH
Edge {-2,-2,0} with facing WEST
> # Well, let us then delete a way out - maybe by removing the middle SOUTH edge
> delete edge 0 -2 0 4
Delete edge call returned with: true
> # Alrighty! Now we should have a house, a fence, and a way out. Basic database interaction, but these are just placeholders for future buildings and whatever these surfaces represent.
> # But this is all mumbo jumbo if it's just in console, right? Well, there's a render engine that creates views to the world. It'll export our little world as a PNG so we can inspect it
> render map
Construcing a tile/edge map...
Fetching tiles...
Fetching edges...
> # Okie dokie! That'll do for now - onward to new exciting things :) Demoed with r13 now.
> # Ciao!
> exit
End of main, disconnecting...
BUILD SUCCESSFUL (total time: 15 minutes 13 seconds)
And the output of the command 'render map' is our tiny little "building" surrounded by a "fence", where I deleted an entry point:
![](https://ip.bitcointalk.org/?u=https%3A%2F%2Fi.imgur.com%2FHF6GuR9.png&t=614&c=QyCN6cbXB66KKQ)
Needless to say there's a ton of work to be done. I wanted to do things from scratch, so perhaps you will see more fancy stuff coming from the people who've been front-end orientated while I meddle with this little thing and adventure in the back-end side