Commit graph

38 commits

Author SHA1 Message Date
Eduardo Dantas
1fbc5b9113
perf: otbm load save and preview/map renderization (#188)
Improve OTBM load/save and map view performance

This change improves Remere's Map Editor performance in OTBM load/save paths,
object allocation, binary serialization, tile lookup, and idle map rendering.

Measured impact:

Object pool allocation:
- Slab refill events reduced from 17,830 to 2,230, about 87.5% fewer refills.
- 48-byte class refills reduced from 4,276 to 535, about 87.5% fewer refills.
- 64-byte class refills reduced from 5 to 1, about 80.0% fewer refills.
- 128-byte class refills reduced from 8,776 to 1,097, about 87.5% fewer refills.
- 1024-byte class refills reduced from 4,773 to 597, about 87.5% fewer refills.
- rme::allocatePooledObject sampled CPU share reduced from 20.01% to 14.62%,
  about 26.9% lower sampled share.
- Total pooled allocation calls stayed at 42,559,971 for the measured workload.
- Heap fallback allocations stayed at 0, confirming the hot load path remains pooled.

Latest mixed load/save profile:
- GUI::LoadMap remained the dominant sampled cost at 67.02%.
- IOMapOTBM::loadMap accounted for 60.23% total sampled CPU, with 56.34% in
  the inner load body.
- GUI::SaveMap and Editor::saveMap accounted for 28.16%.
- IOMapOTBM::saveMap accounted for 27.63%.
- BaseMap::forEachTileLocation during save accounted for 23.01%.
- Tile::Tile accounted for 11.53%.
- Tile::addLoadedItem accounted for 8.15%.
- Item::Create accounted for 6.99%.
- QTreeNode::createFloor accounted for 6.71%.
- BinaryNode::advance and BinaryNode::load accounted for 5.37% and 3.81%.

Map view idle and preview rendering:
- Static map-view sampled CPU dropped from 139,767 sampled units to 126 sampled
  units after overlay-only refresh reuse.
- MapCanvas::OnPaint dropped from 46,229 sampled units and 32.20% to 19 sampled
  units and 15.08%.
- GLRenderer::flushCommands dropped from 24,321 sampled units and 16.94% to
  4 sampled units and 3.17%.
- Performance stats refresh changed from a 16 ms scene-dirty timer to a 500 ms
  overlay-only timer.
- Show Preview changed from a 16 ms scene-dirty timer to a 250 ms scene-dirty
  timer.
- Position indicator keeps the 16 ms scene-dirty timer because it is expected
  to animate smoothly while active.

Main changes:
- Added cached floor and tile lookup while loading OTBM map data and spawn files.
- Added direct TileLocation assignment for parser paths that already resolved
  the destination location.
- Added BaseMap::forEachTileLocation for direct save traversal of existing tile
  locations.
- Added a small-object slab allocator for hot Item, Tile, and Floor allocations.
- Added pool owner-thread binding and diagnostics for allocation validation.
- Increased slab sizing to reduce refill pressure in large-map loads.
- Improved binary node writing by batching raw bytes and avoiding redundant cache
  renewal checks.
- Avoided rewriting XML sidecar files when serialized content only differs by
  line endings.
- Fixed invalid ground serialization so placeholder ground id 0 no longer drops
  the rest of the tile contents during save.
- Split map canvas refresh into scene-dirty and overlay-only paths.
- Adjusted animation timer behavior for position indicator, Show Preview, and
  performance stats.
- Scaled tooltip rendering with map zoom, clamped to 55% minimum.
- Kept review and Sonar cleanups away from hot path regressions with targeted
  NOSONAR annotations or FORCEINLINE where needed.
- Added AGENTS.md guidance for future Git, build, and PCH discipline.

Notes:
- The Visual Studio captures are sampling profiles, so percentages represent CPU
  sample share, not direct wall-clock speedup.
- The latest profile is a mixed interaction profile, not a strict load-only or
  save-only benchmark.
- The allocator counters are the strongest before/after measurement in this
  change.
- No OTBM format or map semantics are intended to change.
2026-05-22 15:14:34 -03:00
Victor
2f5cf89792
fix: correct start_frame type mismatch from protobuf loading (#163)
## What was changed  
  
Fixes an assertion failure in the `Animator` constructor caused by
`start_frame`
receiving the value `255` (uint32) from protobuf `default_start_phase`,
instead of
`-1` (int8) as expected.  
  
## Why  
  
The `.dat` loading path reads `start_frame` as `int8_t`, so the byte
`255` becomes
`-1`, which is a valid sentinel value for the `Animator`. However, the
protobuf
loading path stores `default_start_phase` as `uint32_t`,   
preserving the value `255`, which fails the assertion   
`ASSERT(start_frame >= -1 && start_frame < frame_count)`.  
  
## Changes  
  
- `source/items.h`: Changed `start_frame` type from `uint32_t` to
`int32_t`
- `source/items.cpp`: Added `static_cast<int8_t>` when reading
`default_start_phase` from protobuf
- `source/graphics.cpp`: Added `static_cast<int8_t>` in
`loadOutfitSpriteMetadata` and `static_cast<int>` in
`loadItemSpriteMetadata` when creating `Animator`

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Fixed animation frame value handling for items and sprite metadata to
ensure consistent initialization and proper animation playback
sequences.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-14 13:39:40 -03:00
Eduardo Dantas
6d501a5ad2
feat: support reading assets from client 11 or higher (#70)
feat: migrate Remeres to 12.x assets system and modernized item handling

• Migrated old Remeres .dat/.spr system to new 12.x client /assets/ appearance & sprite format
• Removed OTB dependency and outdated client version structures
• Integrated Protobuf-based sprite reader (credit: @nekiro)
• Major refactor on graphics.cpp structure and brush icon handling
• Updated brushes and tags system
• Fixed top order drawing bugs and missing brushes icons
• Fixed outfit color paint and correct offset handling for non-32x32 sprites
• Re-enabled map saving and loading
• Improved creature sprite rendering and brush previews
• Added new item properties window with toggle for legacy/new layout

Co-authored-by: Marcos <66353315+marcosvf132@users.noreply.github.com>
Co-authored-by: Pedro Henrique Alves Cruz <phac@cin.ufpe.br>
2025-05-10 16:38:45 -03:00
Pedro Cruz
f1f256bac7
fix: loading of fluid items (#116)
This fixes the loading of fluid items.
2024-08-27 21:23:41 -03:00
Pedro Cruz
cf8dd89611
fix: reload warnings (#80)
Fixes the warnings when reloading the RME (F5).
2024-06-11 04:55:19 -03:00
Pedro Cruz
669ab8116f
fix: sonar issues (#76) 2024-06-07 18:16:45 -03:00
Majesty
7ab4f119f0
feat: tilesets manager (#68)
---------

Co-authored-by: Pedro Henrique Alves Cruz <phac@cin.ufpe.br>
2024-06-07 15:03:37 -03:00
Luan Santos
2ee365e836
ci: add clang-format linter (#54) 2023-10-09 19:12:16 -07:00
Beats
6b55201a64
feat: synchronizing commits with the official rme repository (#36)
* Show indicators for pickupable and moveable items

* Fix: drawing always refreshing ui

* Fix crash on invalid friend for wallbrush

* Option to remove empty spawns

* Draws position indicator, some code cleanup

* Teleport copy/paste improvements

* Fix flood fill

* Add function to get minimap/8bit color

* Small code cleanup

* Cleanup Position

* Code cleanup and small optimizations

* Code cleanup

* Code cleanup and small optimizations (#406)

* Cleanup and cast functions.

* Avoid adding a new Unique ID if it already exists

* Code cleanup and small optimizations

* More changes and cleanup

* Changes and cleanup

* Some changes

* Fix copy position.

* Only show uid/aid alert if it really changed

* Add actions history panel

* Does not draw tooltips on minimap mode

* Use constexpr

* Replace items fix (#408)

* Draw grid small optimization

* Small change in selection box and Fix #409

* Fix some xpm

* Ingame box improvements, add lights support.

* Fix go to previous position (#410)

* Fix depot crash (#411)

* Fix XPMs

* Export minimap as .otmm (otclient format) or .png (#413)

* Fix glitch after drawing secondary map

* fix

* Update about_window.cpp

* sonar

* fix Minimap and progress bar

* fix erro load items.xml

* fix

* fix doodad brush

* fix: slightly more accurate house size estimation

* feat: update items.otb and items.xml

* fix: bad merge

* Revert "feat: update items.otb and items.xml"

This reverts commit 40f1edc70f.

---------

Co-authored-by: Nailson <Mignari@users.noreply.github.com>
Co-authored-by: wtver <51377408+maattch@users.noreply.github.com>
Co-authored-by: Majesty <32709570+majestyotbr@users.noreply.github.com>
Co-authored-by: Luan Santos <github@luan.sh>
2023-10-09 19:02:37 -07:00
Beats
17e42a5056
feat: improve cmake build and add pugixml integration (#40) 2023-09-08 03:04:02 -03:00
Eduardo Dantas
047113ade3 Merge branch 'master' 2022-08-19 02:43:27 -03:00
Eduardo Dantas
adef6c47c1
Change ids to clientid and organize data folder and tilesets (#6)
This only works with the canary server: https://github.com/opentibiabr/canary

Added support only for client .dat and .spr 11.00 outdated (10x), signature: data format="11" dat="0x4A10" spr="0x59E48E02"

Otb cllient 11, version 3, id 62

In addition to the ids being converted to client id (for compatibility with canary), the data folder has been completely reorganized for ease of understanding.
The organization of tilesets was also started, which will be further improved in other pulls.
2021-06-23 21:30:37 -03:00
Nailson
dca66a1309 Fix items xml reader 2021-06-16 18:38:18 -03:00
Nailson
fcbbf5e364 Load improvement avoiding bad lexical cast. 2021-06-06 23:45:46 -03:00
Evil Puncker
cfe36ce5b3
license headers (#315) 2020-07-30 11:42:28 -03:00
Mignari
96b65a3ccd Added search by 'floor change' property in the FindItemDialog. 2018-10-23 20:50:55 -03:00
Elime1
89cbf6cb7c Fix initialization order warning 2017-11-18 07:02:49 +01:00
Nailson
86470892b4 Hangable items are displayed wrongly. Fix #201 2017-06-26 07:34:32 -03:00
Nailson
37025eb636 Ignore Look flag for otb v3. 2017-05-20 19:26:16 -03:00
Nailson
63aebafe54 New Find/Jump to Item Dialog, some code cleanup. 2017-05-19 15:19:10 -03:00
Elime1
610aeeaeaa Remove use of wxT macro. Closes #141 2016-11-05 15:28:14 +01:00
Nailson
f6c84ed67b Rename global variable 'item_db' to 'g_items'. 2016-10-25 09:47:00 -03:00
Nailson
d6d7643176 Rename global variable 'settings' to 'g_settings'. 2016-09-29 20:37:43 -03:00
Nailson
6ab0f851a4 Rename global variable 'gui' to 'g_gui'. 2016-09-29 20:30:54 -03:00
Nailson
23a8fb15a1 Trim trailing whitespaces. 2016-09-29 19:24:45 -03:00
Nailson
d7a4254604 Code style and some cleanup. 2015-12-06 11:42:37 -03:00
Nailson
e45861a4cd Reading item attributes as lowercase, small cleanup. 2015-05-07 20:15:35 -03:00
Nailson
ee1aad49cd Fix #9 2015-05-07 19:56:13 -03:00
dalkon
c74b6dbeae Bug fix and misc
GUI::SetLoadDone was taking way too long to update and made any map load
very slowly.
Changed any "uint" to "uint32_t"
Fixed a bunch of warnings.
2014-02-28 22:34:25 +01:00
dalkon
4a729176c4 Fixes and changes.
Rewrote RME Live to use boost asio instead of wxSocket, this seemed to
fix random stops when using the function, some other things were fixed
aswell when using this.
Added 10.10 & 10.21+ (I have not added the otbs and such yet.)
Bug fix and some small cleanups.
2014-02-21 13:55:09 +01:00
dalkon
886cbc23a7 Lots of changes
Removed libxml2 to use pugixml.
Fixed a bug with the progress bar.
Changed some things in most xml files that pugixml did not like.
Updated the Visual Studio project.
Any NULL symbol has been changed to nullptr.
This most probably broke the CMake that was recently added.
And probably some other things.
2014-01-22 20:16:17 +01:00
Mark Samman
df4b43409e Fix wrong use of std::shared_ptr
Memory allocated with new[] should be free'd using delete[], the default
behavior of shared ptr is to free memory using delete.
2014-01-20 03:22:36 +01:00
Hampus Joakim Nilsson
7efd2a6d2e After conversion, asks for creature import.
When you swap map versions, if there are creatures on the map that were
not on the lats version, the user will be queried to import them from the
old version.
2012-07-05 17:32:36 +02:00
Hampus Joakim Nilsson
5ca6e724da Fixed 'writeable' / 'readable' items.xml tag loading. 2012-07-05 15:26:15 +02:00
Hampus Joakim Nilsson
bbd2aac7b6 Stores maps with magic numbers 'OTBM'.
Also loads otb with 'OTBI' as magic number and maps with 'OTBM' as magic
number.
2012-07-05 15:21:46 +02:00
Hampus Joakim Nilsson
c53e1e542d Fixed bug with 'fromid' and 'toid' not working properly.
Also fixed some crashbugs when the type of an item varied when you
performed a map conversion. (The item would be static_cast when copied,
which would crash if the type had changed).
2012-07-03 21:59:51 +02:00
Hampus Joakim Nilsson
5d496a685d Clients are now entirely data-based.
In the future, there will be no need for source updates to support new
versions, yay!
2012-07-01 13:41:59 +02:00
Hampus Joakim Nilsson
8dbc487ef2 Initial commit of RME 3.0.
Clean git repository since the old svn / git mess was pretty much
unrecoverable unfortunetly. I would have liked to keep the history
for posterity, but that proved to be a futile quest.
2012-06-29 16:45:30 +02:00