Skip to content

Commit

Permalink
- pre-load MLObserver class due to startup error in ue_site.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sven1977 committed Feb 20, 2018
1 parent 6a3fc76 commit fd4d1a9
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Plugins/MaRLEnE/MaRLEnE.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{
"Name": "MaRLEnE",
"Type": "Runtime",
"LoadingPhase": "PostDefault"
"LoadingPhase": "PreDefault"
}
]
}
20 changes: 20 additions & 0 deletions Plugins/MaRLEnE/Scripts/kill_all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""
-------------------------------------------------------------------------
MaRLEnE - Machine- and Reinforcement Learning ExtensioN for (game) Engines
Plugins/MaRLEnE/Scripts/marlene_server.py
The server running inside UE4 (UnrealEnginePython) and listening on a
port for incoming ML connections.
Handles incoming commands from the ML environment such as stepping
through the game, setting properties, resetting the game, etc..
created: 2017/10/26 in PyCharm
(c) 2017-2018 Roberto DeLoris (20tab) & Sven Mika (ducandu)
-------------------------------------------------------------------------
"""

import asyncio

# cleanup previous tasks
for task in asyncio.Task.all_tasks():
task.cancel()
4 changes: 2 additions & 2 deletions Plugins/MaRLEnE/Scripts/marlene_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ async def new_client_connected(reader, writer):
orig_len = int(data)
received_len = 0
while True:
data = reader.read(min(orig_len - received_len, 8192))
data = await reader.read(min(orig_len - received_len, 8192))
if not data:
send_message({"status": "error",
"message": "No data of len {} received by socket.recv in call to method `recv`!".
Expand All @@ -293,7 +293,7 @@ async def new_client_connected(reader, writer):
send_message(response, writer)
# async calls -> do nothing here (async will handle it)

ue.log('Client {0} disconnected'.format(name))
ue.log("Client {0} disconnected".format(name))


# this spawns the server
Expand Down
1 change: 1 addition & 0 deletions Plugins/MaRLEnE/Scripts/ue_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
# load the GeneralProjjectSettings class
# (could be that classes are not loaded yet when ue_site (this script) is executed)
ue.load_class("/Script/EngineSettings.GeneralProjectSettings")
ue.load_class("/Script/MaRLEnE.MLObserver")

import marlene_server
2 changes: 1 addition & 1 deletion docker/ue4_exec_game/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# to build a final game image that only contains the cooked game executable

ARG base_img=ducandu/ue4_alien_invaders
ARG base_img=ducandu/ue4_alien_invaders:build

# the base image to copy from
FROM $base_img AS game_img
Expand Down
2 changes: 1 addition & 1 deletion docker/ue4_game/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# provide build-args:
# game=[the project's name, e.g. AlienInvaders (default)]
# base_img=[the base image to use: `ue4` for initial build, or `ue4_alien_invaders` for an already built game]
# base_img=[the base image to use: `ducandu/ue4` for initial build, or `ducandu/ue4_[some_game]:build` for a previously built game]

ARG base_img=ducandu/ue4

Expand Down
6 changes: 5 additions & 1 deletion docker/ue4_game/build_game_incr.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#!/bin/sh

echo "incremental build"
echo "GAME=$GAME"
echo "UE4PYTHON_TAG=$UE4PYTHON_TAG"

cd /home/ue4/marlene
git pull
git pull origin master
cd ../UnrealEnginePython
git checkout tags/${UE4PYTHON_TAG}
git pull


# copy (update; only newer files) the example game and the two plugins into UnrealEngine
cd
cp -r -u marlene/examples/UE4Games/${GAME} UnrealEngine/.
Expand Down
1 change: 1 addition & 0 deletions docker/ue4_game/build_game_init.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh

echo "init build (from scratch)"
echo "GAME=$GAME"
echo "UE4PYTHON_TAG=$UE4PYTHON_TAG"

Expand Down

0 comments on commit fd4d1a9

Please sign in to comment.