Coder Social home page Coder Social logo

ue4_communicate_with_python's Introduction

Unreal Engine 4 Communicate with Python

Sorry for my bad English. :)

Since UE4 can't have multiple sessions on one GSI(Game Server Instance), we need to use multiple GSIs to meet players' requirements.

Then we face a problem, how we gonna manange these game server instances?

The ideal way is make a master server in charge of :

  • Spawn GSI.
  • Communcate with GSI.
  • Supervise on GSIs status, such as CPU, memory, bandwidth usage, how many players.
  • Shutdown GSI.
  • And etc.

But, how to build this master server?

Use UE4 to create one? Maybe. How about use python. Assume we created a Python Master Server and all the GSIs are its Nodes, and first step we need to figure out is how can we make UE4 communicate with Python?

There're some links here and there, some of them obsoleted, and some of them just not work, that's why this simple echo example come out.

Requirements

  • Unreal Engine 4.14.3
  • Python 2.7.13

What's in the project?

  • UE4 TCP Server <-> Python Simple Client
  • UE4 TCP Client <-> Python Simple Server

How to test it?

  1. Clone or just download project zip file.
git clone https://github.com/hexcola/UE4_Communicate_With_Python.git
  1. Go to UE4_Network_Socket folder, which is the root of UE4 project, find UE4_Network_Socket.uproject and right click choose Generate Visual Studio project files.

  2. Open UE4_Network_Socket.sln solution, and build UE4_Network_Socket, after that, open this project with UE4 editor.

You should only care about 5 files: ActorTCPClient.h, ActorTCPClient.cpp, ActorTCPServer.h, ActorTCPServer.cpp and the UE4_Network_Socket.Build.cs which add Sockets and Networking dependencies.

  1. There're two maps, TCP_Server, TCP_Client, simple enought since both of them just have one actor.
    • If you treate UE4 instance as tcp server, then open TCP_Server map, and hit the Play button, then use Python simple_tcp_client.py to connect
    • If you treate UE4 instance as tcp client, then fisrt use Python simple_tcp_server.py to launch the tcp server, then open TCP_Client map, hit the play button to connect.

Reference

ue4_communicate_with_python's People

Contributors

hexcola avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jonike

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.