Skip to content

Commit

Permalink
- updated AlienInvaders example game
Browse files Browse the repository at this point in the history
  • Loading branch information
sven1977 committed Jan 18, 2018
1 parent d31f3d9 commit ede779a
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 385 deletions.
8 changes: 0 additions & 8 deletions examples/UE4Games/Alien Invaders/Config/DefaultGame.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,3 @@ CompanyDistinguishedName=Mhousse1247
Homepage="http://ue4resources.com/"
SupportContact="https://twitter.com/HoussineMehnik"

[/Script/Engine2Learn.DucanduSettings]
Address=localhost
Port=6025

[/Script/Engine2Learn.Engine2LearnSettings]
Address=localhost
Port=6025

Binary file not shown.
Binary file not shown.
Binary file modified examples/UE4Games/Alien Invaders/Content/Maps/Map_MainGame.umap
Binary file not shown.
Binary file not shown.
Binary file not shown.
414 changes: 51 additions & 363 deletions examples/UE4Games/Alien Invaders/Content/Scripts/ducandu_server.py

Large diffs are not rendered by default.

13 changes: 3 additions & 10 deletions examples/UE4Games/Alien Invaders/Content/Scripts/example_ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,12 @@
from unreal_engine.classes import DumbActor_C
from unreal_engine.classes import GameplayStatics
from unreal_engine import FVector
from .server_utils import get_playing_world

def get_playing_world():
playing_world = None
for world in ue.all_worlds():
if world.get_world_type() in (1, 3):
playing_world = world
break
return playing_world

world = get_playing_world()
if not world:
raise Exception('no playing world found')
raise Exception("no playing world found")

dumb_actor = None
for actor in world.all_actors():
Expand All @@ -34,7 +28,6 @@ def get_playing_world():
GameplayStatics.SetGamePaused(world, True)
print(dumb_actor.get_actor_location())

# just for safety
# just for safety
GameplayStatics.SetGamePaused(world, True)


Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('127.0.0.1', 6025))

message = {'cmd':'step'}
message = {'cmd': 'step'}

s.send(msgpack.packb(message))

message = {'cmd':'reset'}
message = {'cmd': 'reset'}

s.send(msgpack.packb(message))

message = {'cmd':'step', 'delta_time': 0.33, 'num_ticks': 1}
message = {'cmd': 'step', 'delta_time': 0.33, 'num_ticks': 1}

s.send(msgpack.packb(message))

message = {'cmd':'step', 'delta_time': 0.33,
message = {'cmd': 'step', 'delta_time': 0.33,
'keys': [{'name': 'X', 'pressed': True}, {'name': 'Y', 'pressed': False}],
'axis': [{'name': 'Left', 'value': 1.0}, {'name': 'Right', 'value': 0.0}]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import asyncio
import unreal_engine as ue


loop = asyncio.new_event_loop()

asyncio.set_event_loop(loop)


def ticker_loop(delta_time):
try:
loop.stop()
Expand All @@ -15,3 +17,4 @@ def ticker_loop(delta_time):


ticker = ue.add_ticker(ticker_loop)

0 comments on commit ede779a

Please sign in to comment.