Skip to content

Commit

Permalink
add some more screenshots of final results
Browse files Browse the repository at this point in the history
  • Loading branch information
ScholliYT committed Mar 16, 2023
1 parent da3e954 commit e648063
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 6 deletions.
Binary file modified MGAIA-Minecraft.zip
Binary file not shown.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,20 @@ Below are short descriptions on how to use the most important scripts
that `e2e_brickhouse.py` is composed of.


### End 2 End (start here)
See `e2e_brickhouse.py`

1. Set the build area in Minecraft using `/setbuildarea ~ ~ ~ ~99 ~ ~99` (or similar)
2. Run `e2e_brickhouse.py`
3. Wait for the process to finish which may take a few minutes

### Building Placement
See `buildregion_finder.py`

1. Set the build area in Minecraft using `/setbuildarea ~ ~ ~ ~99 ~ ~99` (or similar)
2. Run `buildregion_finder.py`
3. The selected buildregion will be marked with white and red wool blocks.

### Structure Scanning and Building

1. Set the build area in Minecraft using `/setbuildarea ~1 ~ ~ ~11 ~6 ~10` (or similar)
Expand Down
4 changes: 2 additions & 2 deletions assignment/buildregion_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def get_heights(editor, buildArea):
return heights


def select_solutioin(solutions):
def select_solution(solutions):
# normalize terraform distance by build area
# solution = min(solutions, key=lambda r: float(r[3])/(r[1][0]*r[1][1]))
if not isinstance(solutions, list):
Expand Down Expand Up @@ -141,7 +141,7 @@ def select_solutioin(solutions):

buffer=2
solutions = score_all_possible_buildregions(heights, square_sidelenght=11, min_adjecent_squares=2, max_adjecent_squares=5, buffer=buffer)
best_solution = select_solutioin(solutions)
best_solution = select_solution(solutions)

first = setY(buildArea.offset,0) + addY(ivec2(*best_solution[0]), best_solution[2])
last = first + addY(ivec2(*best_solution[1]), 0)
Expand Down
6 changes: 3 additions & 3 deletions assignment/e2e_brickhouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from glm import ivec2, ivec3

from assignment.brickhouse import build_brickhouse, random_building, wfc_state_to_minecraft_blocks
from assignment.buildregion_finder import get_build_area, get_heights, select_solutioin
from assignment.buildregion_finder import get_build_area, get_heights, select_solution
from assignment.utils.buildregion import score_all_possible_buildregions
from assignment.utils.wave_function_collaplse_util import (
print_state,
Expand All @@ -25,14 +25,14 @@ def main():

buffer=2
square_sidelenght = 11
min_adjecent_structures=3
min_adjecent_structures=2
max_adjecent_structures=6
solutions = list(score_all_possible_buildregions(heights,
square_sidelenght=square_sidelenght,
min_adjecent_squares=min_adjecent_structures,
max_adjecent_squares=max_adjecent_structures,
buffer=buffer))
solution = select_solutioin(solutions)
solution = select_solution(solutions)
region_origin, region_size, region_y, distance = solution

first = setY(buildArea.offset,0) + addY(ivec2(*region_origin), region_y)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/report.pdf
Binary file not shown.
45 changes: 44 additions & 1 deletion docs/report.tex
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,16 @@ \section{Overall Results}
involving the search for a build area and the generation of the building.
The results can be seen in \autoref{fig_generated_medium_building_real_world}.
There is also a video\footnote{\url{https://cloud.fachschaften.org/s/c5NKyaDjYeLwEer}} of the generation process.
The algorithm is also capable to build buildings on more challenging
environments as shown in \autoref{fig_generated_medium_building_real_world_medium}.
The algorithm also handles already existing structures, e.g. villages,
very well and does not deconstruct them (see \autoref{fig_generated_medium_building_real_world_difficult}).
However, the algorithm also sometimes generates unwanted results such as
multiple unconnected houses.
This can happen if the build area is "too" large.
Additionally, the algorithm places buildings on a surface which is assumed to be flat,
resulting in overhangs (see \autoref{fig_generated_medium_building_real_world_difficult}).


\begin{figure}[ht]
\centering
Expand All @@ -563,10 +573,40 @@ \section{Overall Results}
\includegraphics[width=\textwidth]{images/end2end/generated_medium_building.png}
\caption{Medium-sized building.}
\end{subfigure}
\caption{Buildings generated with the WFC algorithm and placed in a realistic Minecraft world.}
\caption{Buildings generated with the WFC algorithm and placed in a realistic Minecraft world (easy).}
\label{fig_generated_medium_building_real_world}
\end{figure}

\begin{figure}[ht]
\centering
\begin{subfigure}[t]{0.48\textwidth}
\includegraphics[width=\textwidth]{images/end2end/generated_medium_building_on_island.png}
\caption{Medium-sized building on a small island.}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.48\textwidth}
\includegraphics[width=\textwidth]{images/end2end/generated_medum_building_next_to_forest.png}
\caption{Medium-sized building next to a forest.}
\end{subfigure}
\caption{Buildings generated with the WFC algorithm and placed in a realistic Minecraft world (medium).}
\label{fig_generated_medium_building_real_world_medium}
\end{figure}

\begin{figure}[ht]
\centering
\begin{subfigure}[t]{0.48\textwidth}
\includegraphics[width=\textwidth]{images/end2end/generated_large_building_next_to_village.png}
\caption{Large-sized building next to a Village. The building does not intersect with the existing buildings.}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.48\textwidth}
\includegraphics[width=\textwidth]{images/end2end/generated_double_house_overhang.png}
\caption{Two small-sized building in forest. Note the overhang of one building.}
\end{subfigure}
\caption{Buildings generated with the WFC algorithm and placed in a realistic Minecraft world (hard).}
\label{fig_generated_medium_building_real_world_difficult}
\end{figure}

\newpage
\section{Discussion}
% Summarize results
Expand All @@ -584,6 +624,9 @@ \section{Discussion}
The structure scanner and builder introduced in \autoref{sec_strucutre_building_blocks}
struggle to handle stateful blocks like a burning campfire
or blocks that require other blocks to stick to like lamps or banners.
The next step, placement, currently struggles to find "the largest reasonable" area
and sometimes generates way to large houses (because of the random selection).
If one could find good coefficients for the normalized terraform distance, it would work better.
Another point is the limited expressiveness of the rule set, with which it is not possible to define global rules.
For example, it would be advisable to define that there must be at least one element with a staircase when a second floor is built.
This is currently not possible as only direct adjacency relationships can be expressed.
Expand Down

0 comments on commit e648063

Please sign in to comment.