frandallfarmer / neohabitat

Repository for the NeoClassical Habitat Server Project
http://neohabitat.org
MIT License
229 stars 43 forks source link

WISH: Graphical region editor (in browser or standalone app) #439

Open StuBlad opened 6 months ago

StuBlad commented 6 months ago

Thanks to the work of Jeremy Penner (SpindleyQ) resolving issue #141 , we now have the ability to render out the original Habitat artwork and animate it from the original files.

This work could be leveraged to help create a region editing tool in order to make it simple to create regions for NeoHabitat.

My idea is pretty simple. Have a basic template region that could look something like this: image

Have a list of objects seperated by categories on the side of the screen that you can choose from and allow them to either drag and drop that object onto the screen, or click it and have it appear in the center of the screen.

image

This newly added object would have to conform to the grid boundaries of the original C64. Regions in this editor could consist of layers to make it easier to build with and when a layer is selected, information about the object would be displayed and tweakable from here.

image

This could allow you to change an objects colour to any of the C64 acceptable colours from a list (and if there is an issue with colour bleeding, that should be rendered how the C64 would've rendered it so a designer can see immediately that there would be an issue with their object placement).

This should allow you to simply place objects, colour them, tweak any specific settings like changing out a style or a graphic state, modifying the orientation to allow you to flip an object around or place it as a background/foreground object and finally whether this object can do anything else, such as if it's a magic object, allow you to select what kind of magic it uses.

My hope is that this tool would enable people to make NeoHabitat regions in minutes, be able to export the region as both a PNG or some other image format, and export the region in the NeoHabitat database JSON format so they could upload this region to their own NeoHabitat server or share it with others.

Here is a very basic gif I created using images saved from Jeremy's site, layered in Microsoft Paint and layer visibility turned on one at a time to show a very rough idea of how objects could simply be dragged and dropped and appear in situ as they would inworld: habi

Although I don't have the programming ability to write and implement this myself, I would be happy to work with someone that does to write up a more detailed spec for this graphical region editing program.

StuBlad commented 6 months ago

Here is some relevant code that will help anyone who might want to take this on.

The home repository of Jeremy/SpindleyQ's work is available here: https://git.information-superhighway.net/SpindleyQ/inhabitor

I've mirrored it here: https://github.com/StuBlad/inhabitor

An example of what a NeoHabitat region (Outside of the New You where you hatch) looks like in JSON format can be found here: https://github.com/frandallfarmer/neohabitat/blob/master/db/new_Downtown/Downtown_4d.json

The Habitat object manual detailing fields and values for different types of object class can be found here, although it isn't fully up to date (it covers mostly everything though): https://github.com/frandallfarmer/neohabitat-doc/blob/master/docs/devdocs/objman.pdf

The beta.mud muddle list from the C64 client source which lists all object types on the disk, including their associated image styles: https://github.com/Museum-of-Art-and-Digital-Entertainment/habitat/blob/master/sources/c64/beta.mud

StuBlad commented 6 months ago

There's also an opportunity to go via a historical route.

Per Randy from the Reno Project Discord regarding region creation in Habitat:

"There was a dev tool that allowed us to create regions interactively on a c64 and then capture the data to a binary format using the proprietary link technology to our unix dev boxes. That that was converted to text and manually adjusted for state that the visual editor didn't deal with, like text and some custom textures."

The tool Randy refers to is called Fred and it's source code is complete and exists here:

https://github.com/Museum-of-Art-and-Digital-Entertainment/habitat/tree/master/sources/tools/griddle

https://github.com/Museum-of-Art-and-Digital-Entertainment/habitat/blob/master/sources/tools/griddle/fred.c

This document explains how Fred works:

https://github.com/Museum-of-Art-and-Digital-Entertainment/habitat/blob/master/chip/habitat/docs/regiontools.t

The Reno program mentioned in that document exists as a binary in the Habitat archives and is available here:

https://github.com/Museum-of-Art-and-Digital-Entertainment/habitat/blob/master/sources/tools/griddle/reno.out

If the original Fastlink program can be replicated to download the Reno.out program to the C64 and maintain a connection, Fred could once again be used to design regions and output them to a griddle file, which can be ran through our Regionator tool to produce valid NeoHabitat region db JSON output.

jeremypenner commented 5 months ago

I've been taking a crack at this in recent days - https://frandallfarmer.github.io/neohabitat-doc/inspector/edit.html is incomplete, but should already be pretty useful.