mutgos / mutgos_server

MUTGOS, a modern MUD MUCK MUSH MOO MU* text game engine
MIT License
4 stars 2 forks source link

DESIGN: AngelScript API to support a basic chatroom with rooms and basic descriptions #19

Open zelerin opened 5 years ago

zelerin commented 5 years ago

The AngelScript API (what is used by the scripts) needs to be significantly overhauled since it is currently just a prototype. The idea suggested to me was to make the system usable as a basic chat room, except with rooms, descriptions, etc, and being able to manipulate those at a basic level along with basic administration like creating new players. This is of course not the final goal, but a good starting point for a first release.

This issue is to discuss the design needed to do this, using the wiki as needed. Once it is designed, the issue can be closed and new issue(s) written to do the implementation.

The API needs to have stuff like this:

zelerin commented 5 years ago

As this is the core issue needed to get v1.0 off the ground, let's get started on discussing this. There's a lot to cover here, and if it requires extra issues to cover specific pieces, then we should do so.

I think adding the functionality piece by piece will be relatively straightforward. What I want to establish up front is the structure. In particular:

The result of this will be a high level class hierarchy as seen from the scripts, and major categories of functions. After that point, the existing code can be reworked to fit and functions can be added as needed.

Also, while I think the capabilities are mostly complete, any changes to those (and their associated operations) can be done as API is added. I definitely don't want an excessive number of capabilities, otherwise it gets too hard to figure out what permissions something needs.

zelerin commented 5 years ago

Also, there's the topic of throwing exceptions vs returning a status boolean upon error, for anything not security or resource related. I'm inclined to stay with the boolean, although the new version of AngelScript that I integrated has very basic in-language exception support.

zelerin commented 5 years ago

Attached is a sample starting point for the API. Let's see if this is something workable? Unfortunately I can't upload it as markdown, though it's in the right syntax.

as_api_design.txt

hyena commented 5 years ago

Reading through this, it looks on the level but it has some FuzzBallisms that we should probably consider before we get too far along as well as other questions:

Rooms could be made special but it would mean revisiting the Environment room model of FB.

zelerin commented 5 years ago

Good questions, all. Here's my answers:

zelerin commented 5 years ago

I just realized I wasn't sure if you were commenting about the C++ hierarchy or the AngelScript (AS) API I listed above. It could have been either. The AS flattening provided above means that, for Programs for instance, not all methods in Entity will apply to them. The developer would have to know they can't teleport a program around, for instance. The tradeoff is that they do less casting. I also don't have puppets/vehicles specifically listed in the flattened hierarchy; they would fall under Thing.

This does admittedly make the AS API resemble FuzzBall a bit more, which may or may not be a good thing. It's at least easier to understand (less types), but perhaps it's too simple.

Also, locks, etc are again wide open to being redesigned. I have a 'lock' class in dbtypes, but it can be rewritten as needed. What ideas do you have?