Closed sinfulspartan closed 1 year ago
Querying everytime when attacking it or just when initializing the game server?
Just on initializing.
ᐧ
On Thu, Nov 18, 2021 at 6:15 PM Ittipon Teerapruettikulchai < @.***> wrote:
Querying everytime when attacking it or just when initializing the game server?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/suriyun-production/mmorpg-kit-docs/issues/1278#issuecomment-973400864, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVNV2KJOMQ3EXJK3O573SKDUMWCJ7ANCNFSM5IKXLMZQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You may create extension function to load your data like this:
namespace MultiplayerARPG
{
public partial class GameInstance {
[DevExtMethods("LoadedGameData")]
protected void ReplaceGameData() {
// Connect to your service and load data
}
}
}
Okay. But I don't see how to query the data from the sql database?
What I'm attempting to do is have the HavestableSpawnArea run a query to the SQL database when the server starts to get its world location data and other stats that I have stored in the SQL database.
But it seems that there may be several steps to make this work and I can't find any examples of this in the code. Or at least I don't understand how this is working if it is coded somewhere.
You should create a service externally for that part, don't have to do everything in Unity. In my opinion, it's a lot easier than doing everything in Unity. But if you want to do everything in Unity, based on this project and you want to follow whats I did, you will have to create messages in Database Network Manager
, notice in Database Network Manager
there is a RegisterMessages
function which contains codes which uses RegisterRequestToServer
to register message handlers which will do something when the server receives messages from client to do something, you can find message handler functions in DatabaseNetworkManager_RequestHandlers.cs
and can see how to send messages from client to server in DatabaseNetworkManager_Requests.cs
.
So I'm trying to figure out how to have a server side game object query the database?
The specifics of what I'm trying to do is to have the HavestableSpawnArea query the database for a new table that I've created.