Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to only load entities from chunk and use it for genPOI, resulting in roughly 1/3 runtime reduction. #1225

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
0fdd241
Add option to only load entities from chunk and use it for genPOI, re…
markfickett Mar 21, 2015
0aef9b4
[webassets] Updated jQuery version
CounterPillow May 4, 2015
ddfd88a
Update signs.rst
eminence Jun 6, 2015
d6d488c
Add c_overveiwer_includes to the list of source files
eminence Jun 24, 2015
253f78c
Revert "Add c_overveiwer_includes to the list of source files"
eminence Jun 24, 2015
dec9aad
Hopefully a better fix for the sdist problem.
eminence Jun 24, 2015
788d90b
Small documentation bug for StructureOverlay.
enaut Jul 3, 2015
ebc54a5
Merge pull request #1240 from enaut/docfixesStructureOverlay
CounterPillow Jul 3, 2015
afc1c4f
Don't call save_cache if running with --skip-players
eminence Aug 14, 2015
a8c71d0
Fix mingw-w64 build
CounterPillow Aug 15, 2015
9ae3ac2
Add mingw-w64 build documentation
CounterPillow Aug 15, 2015
48cd0c4
Let's whack travis with a wrench for a bit
CounterPillow Aug 15, 2015
b8fb765
More Travis whacking
CounterPillow Aug 15, 2015
0ba0c60
Catch TypeErrors as well when loading player dat files
eminence Oct 6, 2015
270741e
genpoi UUID improvements
eminence Dec 27, 2015
6843033
JSObserver: Add missing string formatting param
eminence Dec 27, 2015
bd1b3d0
Update README.rst
tcyrus Jan 15, 2016
a076697
Merge pull request #1270 from tcyrus/patch-1
eminence Jan 15, 2016
c7f8cfe
rcon: Wait for buffer to fill
CounterPillow Jan 30, 2016
9fc050c
genPOI: Use "with" statement to close gzip files
CounterPillow Jan 30, 2016
8f08b3b
rcon: Throw more helpful exception if proto error
CounterPillow Jan 30, 2016
2e34507
Use FileReplacer to manage the uuid cache file
eminence Feb 1, 2016
d849f25
Merge pull request #1267 from overviewer/uuidcache
eminence Jan 14, 2016
4e77ba8
genpoi: Fix GzipFile closing on python 2.6
CounterPillow Feb 13, 2016
3d3ef0c
Remove inline for estimate_blocklevel
Mirclus Feb 13, 2016
525d193
Merge Mirculus' inline changes.
CounterPillow Feb 17, 2016
68955c7
Fix redstone dust for Minecraft 1.9
eminence Mar 2, 2016
8d3d8dc
Fix command block for Minecraft 1.9
eminence Mar 2, 2016
bc9a097
Add some new blocks for Minecraft 1.9
eminence Mar 2, 2016
81be4bc
Bump mc version in travis and textures.py error msg. also force rebuild
eminence Mar 2, 2016
5f9276a
Implement path blocks
eminence Mar 4, 2016
e4e2bae
add end_gateway
Lother Mar 4, 2016
75a3ee5
fix command block
Lother Mar 4, 2016
0f33b65
add beetroot
Lother Mar 4, 2016
1ba8342
fix purpur pilar orientation
Lother Mar 4, 2016
404ef9f
add frosted ice, structure_block
Lother Mar 4, 2016
2c5971b
fix typo
Lother Mar 4, 2016
210f2b4
Add some missing pixel between blocks (Issue #992)
Socolin Mar 5, 2016
db3c79a
Tweak crop rendering
eminence Mar 6, 2016
9879bc9
Implement beetroot crops
tazorax Mar 5, 2016
6682b91
Merge PR #1285
eminence Mar 6, 2016
a325820
Fix beetroots duplication
tazorax Mar 6, 2016
fbede10
Add option to only load entities from chunk and use it for genPOI, re…
markfickett Mar 21, 2015
4c0f1a3
Merge branch 'master' of https://github.com/markfickett/Minecraft-Ove…
markfickett May 14, 2016
95f8c18
Add chorus plants and chorus flowers
tazorax Mar 6, 2016
4814837
Fix chorus plants
tazorax Mar 6, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ python:
- "2.7"
# - "3.2"
env:
- MC_VERSION=1.8
- MC_VERSION=1.9
before_install:
- wget http://hg.effbot.org/pil-117/raw/f356a1f64271/libImaging/Imaging.h
- wget http://hg.effbot.org/pil-117/raw/f356a1f64271/libImaging/ImPlatform.h
- wget https://raw.githubusercontent.com/python-pillow/Pillow/master/libImaging/Imaging.h
- wget https://raw.githubusercontent.com/python-pillow/Pillow/master/libImaging/ImPlatform.h
install:
- pip install -q pillow
- pip install -q numpy
Expand All @@ -22,8 +22,7 @@ notifications:
email: false
irc:
channels:
- "irc.freenode.org#overviewer"
skip_join: true
- "chat.freenode.net#overviewer"
template:
- "\x0313Minecraft-Overviewer\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"
# matrix:
Expand Down
12 changes: 6 additions & 6 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ include CONTRIBUTORS.rst
include overviewer.py
include contribManager.py
include sample_config.py
recursive-include overviewer_core/ *.py
recursive-include overviewer_core/src/ *.c *.h
recursive-include overviewer_core/src/primitives/ *.c *.h
recursive-include overviewer_core/data/ *
recursive-include contrib/ *.py
recursive-include docs/ *
recursive-include overviewer_core *.py
recursive-include overviewer_core/src *.c *.h
recursive-include overviewer_core/src/primitives *.c *.h
recursive-include overviewer_core/data *
recursive-include contrib *.py
recursive-include docs *
prune docs/_build
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ https://github.com/overviewer/Minecraft-Overviewer/issues
Feel free to comment on issues, report new issues, and vote on issues that are
important to you.

.. |Build Status| image:: https://secure.travis-ci.org/overviewer/Minecraft-Overviewer.png?branch=master
.. |Build Status| image:: https://secure.travis-ci.org/overviewer/Minecraft-Overviewer.svg?branch=master
30 changes: 30 additions & 0 deletions docs/building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,36 @@ then try the following::

If the build was successful, there should be a c_overviewer.pyd file in your current working directory.

Building with mingw-w64 and msys2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is the recommended way to build on Windows without MSVC.

1. Install msys2 by following **all** the instructions on
`the msys2 installation page <https://msys2.github.io/>`_.

2. Install the dependencies::

pacman -S git mingw-w64-x86_64-python2-numpy mingw-w64-x86_64-python2-Pillow mingw-w64-x86_64-python2 mingw-w64-x86_64-toolchain

3. Clone the Minecraft-Overviewer git repository::

git clone https://github.com/overviewer/Minecraft-Overviewer.git

The source code will be downloaded to your msys2 home directory, e.g.
``C:\msys2\home\Potato\Minecraft-Overviewer``

4. Close the msys2 shell. Instead, open the MinGW64 shell.

5. Build the Overviewer by changing your current working directory into the source
directory and executing the build script::

cd Minecraft-Overviewer
python2 setup.py build

After it finishes, you should now be able to execute ``overviewer.py`` from the MINGW64
shell.

Building with mingw
~~~~~~~~~~~~~~~~~~~

Expand Down
6 changes: 3 additions & 3 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1172,13 +1172,13 @@ StructureOverlay

Example::

MineralOverlay(minerals=[(((0, 0, 0, 66), (0, -1, 0, 4)), (255, 0, 0, 255)),
(((0, 0, 0, 27), (0, -1, 0, 4)), (0, 255, 0, 255))])
StructureOverlay(structures=[(((0, 0, 0, 66), (0, -1, 0, 4)), (255, 0, 0, 255)),
(((0, 0, 0, 27), (0, -1, 0, 4)), (0, 255, 0, 255))])

In this example all rails(66) on top of cobblestone are rendered in
pure red. And all powerrails(27) are rendered in green.

If ``minerals`` is not provided, a default rail coloring is used.
If ``structures`` is not provided, a default rail coloring is used.

BiomeOverlay
Color the map according to the biome at that point. Either use on
Expand Down
3 changes: 3 additions & 0 deletions docs/signs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ POI markers. For example::
.. note::
A --genpoi run will NOT generate a map render, it will only generate markers.

If all went well, you will see a "Markers" button in the upper-right corner of
your map.

genPOI.py
---------

Expand Down
38 changes: 29 additions & 9 deletions overviewer_core/aux_files/genPOI.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@
import sys
import time
import urllib2
import datetime

from collections import defaultdict
from contextlib import closing
from multiprocessing import Pool
from optparse import OptionParser

from overviewer_core import logger
from overviewer_core import nbt
from overviewer_core import configParser, world
from overviewer_core.files import FileReplacer

UUID_LOOKUP_URL = 'https://sessionserver.mojang.com/session/minecraft/profile/'

Expand Down Expand Up @@ -161,7 +164,7 @@ def handleEntities(rset, config, config_path, filters, markers):
if numbuckets == 1:
for (x, z, mtime) in rset.iterate_chunks():
try:
data = rset.get_chunk(x, z)
data = rset.get_chunk(x, z, entities_only=True)
for poi in itertools.chain(data['TileEntities'], data['Entities']):
if poi['id'] == 'Sign': # kill me
poi = signWrangler(poi)
Expand Down Expand Up @@ -210,19 +213,35 @@ class PlayerDict(dict):
def load_cache(cls, outputdir):
cache_file = os.path.join(outputdir, "uuidcache.dat")
if os.path.exists(cache_file):
gz = gzip.GzipFile(cache_file)
cls.uuid_cache = json.load(gz)
logging.info("Loaded UUID cache from %r with %d entries", cache_file, len(cls.uuid_cache.keys()))
try:
with closing(gzip.GzipFile(cache_file)) as gz:
cls.uuid_cache = json.load(gz)
logging.info("Loaded UUID cache from %r with %d entries",
cache_file, len(cls.uuid_cache.keys()))
except (ValueError, IOError):
logging.warning("Failed to load UUID cache -- it might be corrupt")
cls.uuid_cache = {}
corrupted_cache = cache_file + ".corrupted." + datetime.datetime.now().isoformat()
try:
os.rename(cache_file, corrupted_cache)
logging.warning("If %s does not appear to contain meaningful data, you may safely delete it", corrupted_cache)
except OSError:
logging.warning("Failed to backup corrupted UUID cache")

logging.info("Initialized an empty UUID cache")
else:
cls.uuid_cache = {}
logging.info("Initialized an empty UUID cache")

@classmethod
def save_cache(cls, outputdir):
cache_file = os.path.join(outputdir, "uuidcache.dat")
gz = gzip.GzipFile(cache_file, "wb")
json.dump(cls.uuid_cache, gz)
logging.info("Wrote UUID cache with %d entries", len(cls.uuid_cache.keys()))

with FileReplacer(cache_file) as cache_file_name:
with closing(gzip.GzipFile(cache_file_name, "wb")) as gz:
json.dump(cls.uuid_cache, gz)
logging.info("Wrote UUID cache with %d entries",
len(cls.uuid_cache.keys()))

def __getitem__(self, item):
if item == "EntityId":
Expand Down Expand Up @@ -280,7 +299,7 @@ def handlePlayers(worldpath, filters, markers):
data.use_uuid = useUUIDs
if isSinglePlayer:
data = data['Data']['Player']
except IOError:
except (IOError, TypeError):
logging.warning("Skipping bad player dat file %r", playerfile)
continue

Expand Down Expand Up @@ -513,7 +532,8 @@ def main():
logging.info("Done handling POIs")
logging.info("Writing out javascript files")

PlayerDict.save_cache(destdir)
if not options.skipplayers:
PlayerDict.save_cache(destdir)

with open(os.path.join(destdir, "markersDB.js"), "w") as output:
output.write("var markersDB=")
Expand Down
2 changes: 1 addition & 1 deletion overviewer_core/data/web_assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<link rel="stylesheet" href="overviewer.css" type="text/css" />

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>

<script type="text/javascript" src="underscore.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion overviewer_core/observer.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def __init__(self, outputdir, minrefresh=5, messages=False):
else:
raise Exception("JSObserver: messages parameter must be a dictionary with three entries: totalTiles, renderCompleted and renderProgress")
if not os.path.exists(outputdir):
raise Exception("JSObserver: Output directory specified (%s) doesn't appear to exist. This should be the same as the Overviewer output directory")
raise Exception("JSObserver: Output directory specified (%s) doesn't appear to exist. This should be the same as the Overviewer output directory" % outputdir)

self.logfile = open(os.path.join(outputdir, "progress.json"), "w+", 0)
self.json["message"]="Render starting..."
Expand Down
8 changes: 7 additions & 1 deletion overviewer_core/rcon.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ def send(self, t, payload):
if not toread:
raise RConException(self.rid, "Request timed out.")

res_len, res_id, res_type = struct.unpack("<iii", self.sock.recv(12))
try:
res_len, res_id, res_type = \
struct.unpack("<iii", self.sock.recv(12, socket.MSG_WAITALL))
except Exception as e:
raise RConException(self.rid,
"RCon protocol error. Are you sure you're " + \
"talking to the RCon port? Error: %s" % e)
res_data = self.sock.recv(res_len - 4 - 4)
res_data = res_data[:-2]

Expand Down
1 change: 1 addition & 0 deletions overviewer_core/src/iterate.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ is_stairs(int block) {
case 163: /* acacia wood stairs */
case 164: /* dark wood stairs */
case 180: /* red sandstone stairs */
case 203: /* purpur stairs */
return 1;
}
return 0;
Expand Down
4 changes: 3 additions & 1 deletion overviewer_core/src/overviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@

// increment this value if you've made a change to the c extesion
// and want to force users to rebuild
#define OVERVIEWER_EXTENSION_VERSION 49
#define OVERVIEWER_EXTENSION_VERSION 50

/* Python PIL, and numpy headers */
#include <Python.h>
#include <numpy/arrayobject.h>
#include <Imaging.h>
/* Fix Pillow on mingw-w64 which includes windows.h in Imaging.h */
#undef TRANSPARENT

/* like (a * b + 127) / 255), but much faster on most platforms
from PIL's _imaging.c */
Expand Down
10 changes: 6 additions & 4 deletions overviewer_core/src/primitives/lighting.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ calculate_light_color_fancy_night(void *data,
* may (and probably should) pass NULL.
*/

inline unsigned char
unsigned char
estimate_blocklevel(RenderPrimitiveLighting *self, RenderState *state,
int x, int y, int z, int *authoratative) {

Expand Down Expand Up @@ -138,7 +138,7 @@ estimate_blocklevel(RenderPrimitiveLighting *self, RenderState *state,
blocklevel = get_data(state, BLOCKLIGHT, x, y, z);

/* no longer a guess */
if (!(block == 44 || block == 53 || block == 67 || block == 108 || block == 109 || block == 180 || block == 182) && authoratative) {
if (!(block == 44 || block == 53 || block == 67 || block == 108 || block == 109 || block == 180 || block == 182 || block == 205) && authoratative) {
*authoratative = 1;
}

Expand All @@ -160,7 +160,8 @@ get_lighting_color(RenderPrimitiveLighting *self, RenderState *state,
/* special half-step handling, stairs handling */
/* Anvil also needs to be here, blockid 145 */
if (block == 44 || block == 53 || block == 67 || block == 108 || block == 109 || block == 114 ||
block == 128 || block == 134 || block == 135 || block == 136 || block == 145 || block == 156 || block == 163 || block == 164 || block == 180 || block == 182) {
block == 128 || block == 134 || block == 135 || block == 136 || block == 145 || block == 156 ||
block == 163 || block == 164 || block == 180 || block == 182 || block == 203 || block == 205) {
unsigned int upper_block;

/* stairs and half-blocks take the skylevel from the upper block if it's transparent */
Expand All @@ -171,7 +172,8 @@ get_lighting_color(RenderPrimitiveLighting *self, RenderState *state,
upper_block = get_data(state, BLOCKS, x, y + upper_counter, z);
} while (upper_block == 44 || upper_block == 53 || upper_block == 67 || upper_block == 108 ||
upper_block == 109 || upper_block == 114 || upper_block == 128 || upper_block == 134 ||
upper_block == 135 || upper_block == 136 || upper_block == 156 || upper_block == 163 || upper_block == 164 || upper_block == 180 || upper_block == 182);
upper_block == 135 || upper_block == 136 || upper_block == 156 || upper_block == 163 ||
upper_block == 164 || upper_block == 180 || upper_block == 182 || upper_block == 203 || upper_block == 205);
if (is_transparent(upper_block)) {
skylevel = get_data(state, SKYLIGHT, x, y + upper_counter, z);
} else {
Expand Down
Loading