I’d like to know if it is possible to connect directly to a MySQL database using Blueprints?
I am aware that connecting directly from a client to a database is generally not a good idea but the few clients who will be using the application are trusted, so no need to make safety measurements for now.
I have never done anything like this before, I only know how to set up a connection from a C++ application but not within Unreal.
Any help or advice regarding this would be greatly appreciated.
I tried to look at some documents I found on the internet about Unreal plugins but I am quite confused now. I don’t know exactly what steps I need to accomplish to solve my problem, so it’s kinda hard to get started. Could you please summarize the required steps and the reasons behind them to get this working, and then I can start my research about how to actually implement it?
I am also interestedin connecting a dedicated Server to a MySQL-Database.
Its not important for me to connect directly to the Database, it could go through a PHP-Script, but i think a direct connection would be more efficient and less lag between the game and the datas.
there are some RPG-Game out there, based on UE4-Engine so i think their datas are coming from a database, too. I think its more easy to implement new content than hardcode it into the game.
Developers of those RPG games have implemented liteSQL or something similar in the server side. They use custom connection protocol to access that database. C++ Sockets or something else. Anyway it’s a complex custom build system. I would recommend UE4Client ->UE4Server->PHP_WebServer->MySQL or UE4Client → PHP_WebServer->MySQL
Wouldn’t it be a very lagful connection?
Well, i plan to do a mmorpg so there should all quest, items, NPC-Positions, Playerpositions, and Stats of Players to be in database.
Well playerpositions just for storage after connections lost and get after login again.
Quests are more easy to be in external database insteadof ingame. So i can input more Content like items and quests while server is up and running. It just get all of the datas everyminute or so on. or just incremental data refreshing.
I was thinking about to get all datas from database into the game into arrays.
So i have a internal database for active working with it. just if something hast to be saved into database the connection will be up for data transfere.
This could really go through php.
But i have to make a data parser to get that whole informations be parsed into game internal arrays.
The PHP-Side is not a problem for me, but the Gameside thing. So i had hoped for a easy-to-use plugin or whatever, to make a direct data connection, which can get only datas from database, which are needed.
If someone starts a quest, it will be written into its char stats. so there has just to be another connection to the database, if he gets an questitem in his inventory. so its stored if connection lost ors such thing.
There is the VaRest plugin and some other JSON based plugin for blueprints. You can use those to talk to your php web server. And Unreal 4 has save game system https://docs.unrealengine.com/latest/INT/Gameplay/SaveGame/Blueprints/
You can use this to save the data server side. If you get a lot of IO requests to MySQL, it will get slow anyways. In any kind of solution, if you send, write and read large amounts of data, it will slow down the system.
Well, i know, onlarge datas will be a ressource problem on the Server, this is because i would read/write the Datas if needed, and not at once on serverstart or something like that. While a fight with an NPC is ongoin, its not neccessary to read / write datas, just if the Mob is dead, server schould randomly chose a drop from database and get it.
VarRest and the accompanying JSON requests are for single player games only. It is commonly (and vaguely) recommended as a solution to multiplayer data storage when this is incorrect.