Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web editor for structured data #64

Open
Seifert69 opened this issue Sep 27, 2020 · 28 comments
Open

web editor for structured data #64

Seifert69 opened this issue Sep 27, 2020 · 28 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@Seifert69
Copy link
Owner

Seifert69 commented Sep 27, 2020

I'm wondering if there might be a good online editor for structured data. It could also be an editor that can be included as JS on the client. That's actually preferable.

For example to edit an object, NPC or room.

The editor preferably might be able to have a formatted input design. So we can configure how the data is entered.

Data exchange format can be anything, JSON, XML, etc

@Seifert69 Seifert69 added help wanted Extra attention is needed question Further information is requested labels Sep 27, 2020
@Thridi
Copy link

Thridi commented Sep 28, 2020

In my opinion the editor (the www/ directory) should be in it's own repository. While it is indeed a part of this package, it's rather a beast of it's own.

I wasn't sure where to put this idea, if it belongs elsewhere, or just gone, let me know.

@chrisspanton
Copy link
Collaborator

Worth discussing, but I’m going to disagree. Abstracting this particular project it’s effectively saying front-ends should be contained in their own repo separate from
back-ends, which I completely disagree with. Coming back around to this particular project, I certainly understand that HTML and CSS feel alien to the rest of the MUD code, however even so I think it’s rather important to keep it there given the scale of impact on the overall project.

@Seifert69
Copy link
Owner Author

I think if we can find a good recommendation / example of how it could be built in the browser then it'll be easy to judge the scope and ultimately how to best integrate it into what we have.

PS. My previous comment was because I had not seen both posts

@Seifert69
Copy link
Owner Author

What about something in this direction?

https://www.cssscript.com/tag/form-builder/

@Seifert69
Copy link
Owner Author

This looks like an upgrade of the previous link

https://github.com/videsk/DynForms

Probably can't deal easily with arrays I suspect

@Thridi
Copy link

Thridi commented Sep 28, 2020

I can see your point, and you aren't wrong, though I don't 100% agree. (But that's almost always the case, there can always be arguments made both fronts).

As for the front-end, it all depends on how deep you are willing to go on the mud end for advancement of the web. If the mud can pass a structure (maybe a data file storage of the necessary structures) then the web aspect will be pretty simple to build. You obviously do not want the web to be able to parse mud files.

Personally, I think there should be a secondary communications port for this web front-end. Simply for data transfer between the web and the mud, most likely a daemon.

@Seifert69
Copy link
Owner Author

Seifert69 commented Sep 28, 2020 via email

@Thridi
Copy link

Thridi commented Sep 28, 2020

I was planning on it! 👯

@Seifert69
Copy link
Owner Author

Cool. Then give me a little time and I'll do a basic sample.
What format do you want? JSON?

@Seifert69
Copy link
Owner Author

And one more question. If I have a list of pick values with non sequential integers, how do you want that represented?

@Thridi
Copy link

Thridi commented Sep 28, 2020

JSON works fine for me, extremely simple.

Can you give an example of the values?

@Seifert69
Copy link
Owner Author

Seifert69 commented Sep 28, 2020 via email

@Seifert69
Copy link
Owner Author

I did a quick sample of what base unit data could look like in JSON. My first JSON ever so bear with me if something should be done differently.

{
"idx": "cityguard@midgaard",
"namelist": [
"city guard",
"guard"
],
"inside_descr": "",
"outside_descr": "A City Guard wanders about here, trying to keep the peace.",
"bright": 0,
"wizi": 0,
"manipulate" : 0,
"flags" : 0,
"hitpoints-max" : 100,
"alignment" : 0,
"keyname": "",
"openflags" : 0,
"opendiff" : 0,
"baseweight" : 250,
"capacity" : 0,
"size" : 175,
"extralist": [
{"namelist": [],
"descr": "The guard looks strong and has a scar.",
"values": []},
{"namelist": ["scar"],
"descr": "The scar is pretty big.",
"values": [1,2]},
]
}

"openflags", "flags" and "manipulate" are bitvectors. E.g. openflags can assume these values:

#define EX_OPEN_CLOSE 0x01
#define EX_CLOSED 0x02
#define EX_LOCKED 0x04
#define EX_PICKPROOF 0x08
#define EX_INSIDE_OPEN 0x10
#define EX_HIDDEN 0x20
#define EX_CLIMB 0x40
#define EX_FALL_THIS_WAY 0x80

There's no drop-down selector here, but e.g. on the race of a NPC the final result is an integer, but a very small part of the list is here:

#define RACE_KINGRAITH 120
#define RACE_GOBLIN 121
#define RACE_HOBGOBLIN 122
#define RACE_KOBOLD 123
#define RACE_DRACONIAN 124
#define RACE_OGRE 125
#define RACE_ORC 126
#define RACE_TROLL 127
#define RACE_SKAVEN 128
#define RACE_TANNARI 129
#define RACE_DROW 130
#define RACE_GIANT 131 /* use with morph only */
#define RACE_GIANT_MOB 132
#define RACE_DRIDER 133
#define MAX_HUMANOID_NPC 200 // Not a race

/Ants, beetles, butterflies,lobsters, shrimp, crabs,scorpions, spiders, ticks/
#define RACE_ARTHROPODA_MIN 220 // Not a race

#define RACE_BEE 221
#define RACE_BEETLE 222
#define RACE_BUTTERFLY 223
....

Not sure if you'd hard code these into the client? Guess we could also generate an include file somehow from the .h C files.

Please LMK what you'd like to see to be able to work with it.

@Thridi
Copy link

Thridi commented Sep 28, 2020

The JSON structure you provided will work fine for me.

As long as i'm provided with the desired output and such, I can always code the mud parts easily enough. :D

@Seifert69
Copy link
Owner Author

Seifert69 commented Sep 28, 2020 via email

@Thridi
Copy link

Thridi commented Sep 28, 2020

Absolutely, no data from the client should be assumed to be valid... which I know I am stating the obvious

@Seifert69
Copy link
Owner Author

How would you like text strings encoded (they can contain e.g. HTML characters, newlines, etc.) ? Base64? URLEncode?

@Seifert69
Copy link
Owner Author

Here's a programatically generated JSON example for web form editing. Not yet encoded until I hear if you have a preference. I removed the invalid line breaks by hand.

{
"idx": "temple@udgaard",
"namelist": [],
"title": "Temple of Udgaard",
"inside_descr": " You are inside the small and humble village temple in Udgaard. A simple stone altar, with strange stone carvings, is placed against the north wall. A small humble donation room is to the east. The temple exit is south to the Village Square.",
"outside_descr": "",
"extralist": [
{
"namelist": [
"stone altar",
"altar"
],
"descr": "The stone altar is very simple and engraved in it are a lots of strange symbols. Perhaps the symbols are worth examining.",
"intlist": []
},
{
"namelist": [
"symbols",
"stone carvings",
"carvings"
],
"descr": "Some of the symbols clearly represents various Gods while other appear to be normal text. The symbols you do understand looks like this: Pray to odin if you are new and helpless.",
"intlist": []
}
],
"manipulate": 32768,
"flags": 50160,
"baseweight": 10,
"capacity": 30000,
"size": 180,
"key": "",
"openflags": 0,
"opendiff": 0,
"bright": 0,
"minv": 0,
"maxhp": 100,
"hp": 100,
"alignment": 0,
"room": {
"roomflags": 0,
"movementtype": 0,
"resistance": 0,
"mapx": 424,
"mapy": 420,
"north": {
"toroom": "heal_room@udgaard",
"namelist": [],
"difficulty": 0,
"exitflags": 0,
"key": ""
},
"east": {
"toroom": "udonate@udgaard",
"namelist": [],
"difficulty": 0,
"exitflags": 0,
"key": ""
},
"south": {
"toroom": "square@udgaard",
"namelist": [],
"difficulty": 0,
"exitflags": 0,
"key": ""
}
}
}

@Thridi
Copy link

Thridi commented Sep 30, 2020

I'm not sure they need to be encoded. If they are able to be json-encoded then it should be fine. Any loading/saving in the editor can be handled there, as either way they will need to be.

@Seifert69
Copy link
Owner Author

Seifert69 commented Oct 1, 2020 via email

@Seifert69
Copy link
Owner Author

Figured out I primarily just need to transform newlines to \n. I'll get that done and hook it into the client one of these days :)

@Seifert69
Copy link
Owner Author

I pushed the latest so you can pull & compile & launch.

As immortal type:

wedit room

for example and the json data is sent to the client. I made a receiving function for you in the JS. And you can also see it in the console.log

LMK what you need plz :)

Not tested thoroughly ! I just realize I only tested that wedit room works :))

@Thridi
Copy link

Thridi commented Oct 4, 2020

How do we plan on handling "access"? Is it going to be handled by the MUD or the client or a combination? I can send a username+password packet to the server and request a simple boolean return value to determine a valid user. I'm just not entirely sure the end-goal for the web editor. Is it direct integration with the mud or is it separated entirely? I can pretty much build whatever is wanted, I just need to be clear on what is wanted.

@Seifert69
Copy link
Owner Author

Seifert69 commented Oct 4, 2020 via email

@Seifert69
Copy link
Owner Author

The changes are now also live on test and production. Only full data for rooms so far, I didn't get around to objects and NPCs yet.

@Thridi
Copy link

Thridi commented Oct 8, 2020

This is an extremely early draft of the editor so far.
editor-v1

@Seifert69
Copy link
Owner Author

Super nice! Looks clean and simple.

The IDX field is read only. Feel free to email me with questions on field types, drop down values, etx

@Seifert69
Copy link
Owner Author

I'm in the middle of moving. Next week I'll add data fields for objects and NPCs. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants