https://github.com/y785/moe-miho
Basic 2d spacial data for MapleStory🍁. Also includes a neat QuadTree & Binary Search Tree.
https://github.com/y785/moe-miho
java maplestory
Last synced: 8 months ago
JSON representation
Basic 2d spacial data for MapleStory🍁. Also includes a neat QuadTree & Binary Search Tree.
- Host: GitHub
- URL: https://github.com/y785/moe-miho
- Owner: y785
- License: mit
- Created: 2019-10-07T22:37:54.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-20T13:14:11.000Z (over 6 years ago)
- Last Synced: 2023-07-05T04:14:51.229Z (almost 3 years ago)
- Topics: java, maplestory
- Language: Java
- Homepage:
- Size: 186 KB
- Stars: 19
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Miho
Basic 2d spacial data for maplusitoree. Also includes a cute QuadTree & Binary Search Tree.
I recommend using the Binary Search Tree for footholds as it usually has better results and is more memory efficient.
### Maven
```
moe.maple
miho
1.2.0
```
### Why?
Odin's quadtree is quite bad. Really bad. In fact, just simply iterating an array shows higher benchmark scores. This has plagued every source for a long time now.
```
public Foothold findBelow(Point p){
List relevants = getRelevants(p);
List xMatches = new LinkedList();
for(Foothold fh : relevants){
if(fh.x1() <= p.x() && fh.x2() >= p.x()){
xMatches.add(fh);
}
}
....
```
Miho's quadtree and bst are better. Example:
```
public Foothold getFootholdUnderneath(int x, int y) {
var result = Result.of((Foothold) null);
root.searchDown(match -> {
if (!match.isWall() && match.below(x, y))
result.setIf(res -> res.compareY(match) == 1, match);
}, x, y);
return result.get();
}
```
### Benchmarks
The benchmarks are by no means perfect, but they show some promising results. These were run with a mix of regular points and sloped points using ellinia's footholds. BST is the clear winner and is the 2nd most fault tolerant. The first obviously being the array iteration.
```
Benchmark Mode Cnt Score Error Units
Bst thrpt 20 2153434.103 ± 36622.564 ops/s
Quad thrpt 20 748475.970 ± 21468.748 ops/s
LiterallyAnArray thrpt 20 167335.920 ± 59497.594 ops/s
Odin thrpt 20 22285.210 ± 768.409 ops/s
```
### Images
[Quad/BST Album for Ellinia](https://imgur.com/a/RB26Gw1)