摘要:HTTP协议(HyperText Transfer Protocol,超文本传输协议)是因特网上应用最为广泛的一种网络传输协议,UE4源代码中内置了HTTP模块,并且已经涵盖了HTTP请求的所有功能。由于该模块的函数并未暴露给蓝图系统,对于使用蓝图进行开发的程序员来说,处理HTTP请求(Http Request)时可能遇到很大的困难。本教程旨在讲解使用HttpWizard插件,纯蓝图方式处理HTTP请求的方法,以及使用泛型蓝图节点解析HTTP响应(Http Response)的Json数据。

关键字:虚幻引擎;HTTP;Json;泛型

HTTP Of UE4 Network Communication

Abstract:HTTP protocol (HyperText Transfer Protocol) is the most widely used network transmission protocol on the Internet. The HTTP module is built into the source code of Unreal Engine 4, and it has covered all the functions of HTTP requests. Since the functions of this module are not exposed to the Blueprint system, programmers who use blueprints for development may encounter great difficultieOfs when processing HTTP requests. This tutorial aims to explain the use of the HttpWizard plugin, the method of processing HTTP requests in pure blueprint way, and the use of generic blueprint nodes to parse the Json data of the HTTP response (Http Response).

Key words: Unreal Engine; HTTP; Json; Generic

1. Motivation -Why Http Wizard ?

HTTP网络通信在UE4开发中有着举足轻重的地位,特别是在登陆验证、文件传输、数据驱动等逻辑中有着广泛的应用;熟练掌握UE4 HTTP模块,对于项目开发几乎是不可或缺。

虚幻商城已经有多款HTTP请求的插件,大多存在功能不全、使用困难等问题。

VaRest插件不足

https://unrealengine.com/marketplace/zh-CN/product/varest-plugin

解析Json数据十分繁琐;

Http请求和Json解析混合,逻辑较为混乱

Json解析功能不全,

2. Introduction

3. Feature

跨平台

模块化

功能全

解析(泛型解析)

轻量高效,无崩溃(稳定性好),强壮的,封装(源代码)

4. Usage

通常的http网络

python 本地服务器

Http request 参数设置

蓝图节点

5. Conclusion

类图

UHttpRequest UHttpResponse