modernuo / ModernUO

Ultima Online Server Emulator for the modern era!
https://www.modernuo.com
GNU General Public License v3.0
255 stars 156 forks source link

Generating doors #839

Open romanlysenko opened 3 years ago

romanlysenko commented 3 years ago

In the Admin gump/panel, "Doors" and "Decorations" buttons are two different mechanisms but they do the same things - creating doors. 1

If you press the "Doors" button, an algorithm from the "DoorGenerator" class will starting. As far as i understand, algorithm in class "DoorGenerator" analyzes the entire map and fills in empty spaces. For example, if there are 1-2 empty tiles, they will be filled with doors.

If you press the "Decoration" button, an algorithm from the "Decorate" class will starting. This method simply reads data (id, x, y, z) from .cfg/.json files located in Data/Decoration/* and places objects on defined maps.

The problem is that doors are also defined in the decoration files. Although doors are not created on doors, the latter method simply replaces the first method and the doors are recreated.

DoorGenerator.cs creates and places doors automatically. Decorate.cs creates and places doors manually.

Need to create/using only one mechanism for creating doors. We can remove all doors from decoration files. Thus, we will have 2 files "DoorGenerator" and "Decoration". But i want to draw your attention to the following lines in the code in DoorGenerator.cs file: 2

This is for partial optimization. This means that in some places the doors will not be generated, for example, in some dungeons in Britain. Therefore, we will need to check all the squares with coordinates where the map is analized. Or we can write line of code like this to capture the entire map (this is an example, coords are inaccurate): new(new Point2D(0, 0), new Point2D(4095, 4095));

Arthrutus commented 3 years ago

Hi. So one thing to clarify is that while these two generators "appear" to do the same thing.. two things should be noted. Door generators will not overwrite doors in decoration and decorator generator will overwrite doors that were spawned by door generator. You are correct that door generator will "fill" in empty spots where needed. However, some doors are special (e.g. hedge maze doors which are stacked gate doors). Decoration generator will overwrite these doors with the appropriate door type. Thus, these generators "appear" to do the same thing but they serve vastly different functions.

Additionally: Decoration generator allows for more customization for players who may prefer different door types as opposed to what the door generator offers. If for your own simplicity's sake, you yourself could simply erase all doors in the decoration JSON and this would achieve what you're looking for.

Arthrutus commented 2 years ago

After reviewing the information you provided, I have to disagree with the idea of simply utilizing 0,0 and 4095,4095 for "filling" all the missing doors. It is simpler to added in the coordination for a rectangle in areas that are missing doors. Forcing the server to inspect every tile for a missing door is a waste of resources and will result in slower performance during door generation.

Additionally, decorate only inserts doors that are custom or special, since door generator only utilizes the basic door types.

I request that this issue be closed.

Pumpk1ns commented 2 years ago

Both systems are horrible. Decoration system is a mess, it decorates the world with teleporters, traps, doors, trash, contains. One system that decorate everything. Why not create one system for teleporters and one for doors, where you can add, edit, view and export the information ingame? That all in one decoration system is very limited and just awful to work with. You can't even select what category you want to decorate, you need to manually remove stuff from the cfg file..

The doorgenerator is interesting but it just generates one kind of doors (at least for me), the default wood door. Castles, stables, jails, etc, all with wood doors.

Both systems need to go and a new one where you can create, edit, view and export the doors via a menu need to be created if we want to have something professional instead of that old mess.

kamronbatman commented 2 years ago

I would love for someone to help by building a new system.