fheroes2 icon indicating copy to clipboard operation
fheroes2 copied to clipboard

Editor preparations

Open ihhub opened this issue 1 year ago • 14 comments

Preliminary checks

Describe the problem requiring a solution

The next major goal of the project is deliver an in-game editor. This issue serves as a collection of tasks related to the main task.

Describe the possible solution

This is a list of tasks we have to complete in order to deliver a base version of the Editor:

  • [x] remove usage of quantity1 and quantity2 in the code. Make them more readable without the calculation magic present in the code.
  • [x] Tiles class should just have a stack of all TilesAddon. Move the same members of the Tiles class away from the class. This will make the code much cleaner and easier to maintain
  • [x] Move all auxiliary methods outside of the Tiles class. Tiles class is designed just to store information about a tile in general, not about specific objects
  • [x] Create an information table for each object in the game: which images are used to determine the object, its properties, passabilities
  • [x] Remove unused structures in mp2.h file and expand the code with necessary explanations within comments where we actually read data for these structures
  • [x] add a shortcut key (E) to open an Editor main menu and add there needed buttons like it is done in the original Editor (for now only for debug mode). The main menu image must be resizable
  • [x] add a new mode within interface_area to enable Editor mode (something similar what we did for view world
  • [x] add UI elements to handle terrain types and change cursor type based on a chosen type
  • [x] change terrain type using terrain brush (enable support for keeping objects on terrain as well as selecting an area for terrain)
  • [x] add historical changes support: undo and redo functionality
  • [x] propose a map format which stores objects as whole and their data. For example, a castle must have only 1 main tile while in the editor and the game it will populate the needed number of tiles.
  • [x] add required helper functions into the code to load new map format. These functions should be shared among the Editor and the game
  • [x] add a UI toolset to handle objects within the Editor. It should be a different way than in the original game
  • [x] display passabilities for objects on the map
  • [x] figure out text encoding support for maps
  • [x] investigate whether it is required to have a separate format for campaign scenarios
  • [x] change MapObjectType type to uint16_t to support new objects
  • [x] add a window to change Hero properties
  • [x] add a window to change Castle / Town properties
  • [x] add a window to change Sphinx properties
  • [x] add a window to change Bottle / Sign properties
  • [x] add a window to change Jail properties
  • [x] add a window to change Random Hero properties
  • [x] add a window to change Random Town properties
  • [ ] add a window to change Event properties
  • [x] add a window to change Monster properties
  • [x] add a window for map properties
  • [x] add a window for saving a map
  • [x] add a a structure to store Event properties
  • [x] add a a structure to store Bottle / Sign properties
  • [x] add a a structure to store Sphinx properties
  • [x] add a a structure to store Random Hero properties
  • [x] add a a structure to store Random Town properties
  • [x] handle all original map winning and loosing conditions
  • [x] add code to load every object properties
  • [x] update the conditions for object placement
  • [x] update object layers, mostly for background layer
  • [x] fix cursor rendering in File Options window when Animation is stopped
  • [x] implement the main menu button for the Editor
  • [x] properly connect roads and castles
  • [x] fix radar rendering for heroes and castles
  • [x] remove beta Editor tag
  • [x] add zlib compression to the map format
  • [x] fix river delta placement
  • [x] add a shortcut to go to Main Menu from the Editor
  • [x] add daily event support
  • [x] add logic to place random ultimate artifact
  • [x] add a window to modify random ultimate artifact radius
  • [x] update objects while changing terrains under them
  • [x] add rumours into the map format

The above list is going to be expanded based on the progress and discoveries.

Additional info

No response

ihhub avatar Mar 16 '23 00:03 ihhub

Moved this from this closed issue: https://github.com/ihhub/fheroes2/issues/8232 Changing the game resolution in the Editor gives unexpected behavior of the side panel and map area.

Open the editor and change the resolution via the settings. Different unexpected behavior happens depending on how you are changing the resolution, whether you're going up or down in resolution.

For example, here is what happens when going from 940x540 (2.0x) to 640x480: image

Note that the panel on the side is absent.

Changing resolution when in the editor can be useful, like having a larger viewing area when making maps, or zooming in on areas.

zenseii avatar Jan 05 '24 14:01 zenseii

I'm putting here a quote of @Branikolog's comment not to forget to fix it in future:

Here are few issues I've found. Could you, please, look if they are valid and could be fixed?

I believe, that we should always place "no objects" like ground cracks under roads, streams and all other objects. image

The hole, though, looks well placed both under or above roads/streams, but while placing some streams over it we should preserve the overlay of the existing stream nearby: image

Cracks and holes shouldn't be allowed to be placed on a water: image

Originally posted by @Branikolog in https://github.com/ihhub/fheroes2/issues/8280#issuecomment-1894668603

Districh-ru avatar Jan 18 '24 16:01 Districh-ru

I've found an application crash when selecting mines in the map editor:

https://github.com/ihhub/fheroes2/assets/55348946/6a732edf-f4da-4172-be0b-02ef779025c1

@Districh-ru , could you, please, look into this issue? It is reproduceable in both master branch and your latest PR(#8395).

Branikolog avatar Mar 06 '24 20:03 Branikolog

Hi, @ihhub ! I think we also need to add windows to adjust monsters, treasures, artifacts, graveyards, mines/sawmills/alchemist labs, shipwrecks, derelict ships, shrines. I also suggest to make it possible to adjust even dwellings, trees of knowledge, genies lamps, campfires, flotsams, shipwreck survivors, skeletons.

Branikolog avatar Mar 20 '24 11:03 Branikolog

Hi @Branikolog , we aren't going to add windows to objects in the first version of the Editor that are not modifiable in the original Editor.

ihhub avatar Mar 20 '24 11:03 ihhub

Hi @Branikolog , we aren't going to add windows to objects in the first version of the Editor that are not modifiable in the original Editor.

So at least monster window requires adjustment fields then.

Branikolog avatar Mar 20 '24 12:03 Branikolog

Hi @Branikolog , we aren't going to add windows to objects in the first version of the Editor that are not modifiable in the original Editor.

So at least monster window requires adjustment fields then.

What do you mean by adjustment? The number of creatures? It is going to be present as it is in the original Editor.

ihhub avatar Mar 20 '24 12:03 ihhub

What do you mean by adjustment? The number of creatures? It is going to be present as it is in the original Editor.

This item is missed in the list in the header of the thread.

Branikolog avatar Mar 20 '24 12:03 Branikolog

Hi, @ihhub, we can also expand the TODO list by the next items. What do you think?

  • Implement the main menu button tor the Editor;
  • Allow to place heroes over the passable parts of the objects;
  • Place roads and streams directly to Editor's Map_Format, not world.tiles;
  • Properly connect roads and castles;
  • Expand road tiles by combining some of existing tiles to cover more road connection cases;
  • Display some object's metadata in the quick info (by the right mouse button);
  • Show the selected object's passability while placing it (e.g. like in original editor);
  • Fix radar rendering for heroes and castles;
  • Implement the alternative "Kingdom Overview" (maybe we can call it "Map Summary") for Editor to show all castles, heroes, mines (and maybe some other objects) on the map with ability to edit these object's details.

Districh-ru avatar Mar 20 '24 17:03 Districh-ru

Hi @Branikolog and @Districh-ru , thank you for your insights! I've updated the list. Now we have a clear picture what to do.

ihhub avatar Mar 21 '24 14:03 ihhub

Just found a few issues with scrolls. Artifact-scroll does not save the spell on map loading. Artifact also couldn't be adjusted once placed on the map with a "detail" brush. Artifact-scroll placed in hero inventory disappears each time I close hero window.

https://github.com/ihhub/fheroes2/assets/55348946/25ab71b4-203a-4d57-a164-05410f4560a8

Branikolog avatar Apr 12 '24 11:04 Branikolog

Undo function is not working, when I switch "show passability" mode:

https://github.com/ihhub/fheroes2/assets/55348946/ecb2acb3-61e7-4b93-9b9c-2f25da347521

Branikolog avatar May 01 '24 14:05 Branikolog

Any random spell scroll, placed in hero adjustment window in editor, appears to be generated instantly. It should be indicated as "random" and generated on each map start.

Branikolog avatar May 11 '24 11:05 Branikolog

@Branikolog , we will address it in post 1.1 release.

ihhub avatar May 11 '24 14:05 ihhub

Encountered a crash: we allow placing Magic Books on the adventure map, and trying to pick it up with the hero crashes the engine.

Found a bug: Restrict mode for towns/castle doesn't actually restrict buildings. Is it wip for after 1.1? If so, should we add a dialog popup explaining that?

Latest snapshot on Android.

zenseii avatar May 16 '24 17:05 zenseii

I've encountered a small passability difference with the original game. Sorry, if it was mentioned somewhere before. OG: image fheroes2: image This results in allowing to place the object in slightly unnatural place for it: image

Branikolog avatar May 20 '24 09:05 Branikolog

Hi @Branikolog , we mentioned that mountains are going to have unified passability. Therefore, we have a difference with the OG.

ihhub avatar May 20 '24 09:05 ihhub

@ihhub It is sadly to admit, that the idea of changing the passability for a consistency with similar (but still different) object was not that good. 😅
While this similar object looks nice, while placing it close to the water... image The problem object looks kind of out of the logic: image

Branikolog avatar May 20 '24 10:05 Branikolog

I am closing this issue as all major tasks have been completed.

ihhub avatar May 21 '24 03:05 ihhub