Spawning a message window without a custom ServerPackage?

Discussions about Coding and Scripting

Spawning a message window without a custom ServerPackage?

Postby Dizzy » Sun Jan 06, 2019 5:00 am

I'd like to spawn a little message box on players' screens when they join my server. Nothing fancy, just a box which displays a text message and an "OK" button.

Can I do this without creating an entire custom UWindow class, just using a ServerActor?

I have Nexgen installed on the server. It contains pop-up message windows. Could I somehow spawn a Nexgen message window on players' screens using my own code?
Image
Join our UT Discord chat server: https://www.bunnytrack.net/discord
User avatar
Dizzy
Experienced
 
Posts: 95
Joined: Tue May 21, 2013 3:57 pm
Personal rank: Oaf

Re: Spawning a message window without a custom ServerPackage

Postby JackGriffin » Sun Jan 06, 2019 7:59 am

Follow how server logos do that. It's probably the simplest implementation, just a texture and sound played on the client when they join. Not sure where you are going but it's not a great idea to place a click-through on someone when they are joining your server. If you are enforcing a unique ruleset just put that in server ads. Players super quickly tire of join-spam like server logos though. They are funny the first few times but then not so much.
"You damn kids, back in my time we made the items, maps and games ourselves with an unwieldy engine using counter-intuitive crash-prone tools and we liked it so much we built communities around this which nowadays look like cults because they're quasi-parallel societies based on the same old games." -Hellkeeper
User avatar
JackGriffin
Godlike
 
Posts: 3720
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: Hack coder

Re: Spawning a message window without a custom ServerPackage

Postby Dizzy » Sun Jan 06, 2019 5:38 pm

JackGriffin wrote:Follow how server logos do that. It's probably the simplest implementation, just a texture and sound played on the client when they join. Not sure where you are going but it's not a great idea to place a click-through on someone when they are joining your server. If you are enforcing a unique ruleset just put that in server ads. Players super quickly tire of join-spam like server logos though. They are funny the first few times but then not so much.

Would a server logo not require a ServerPackage, though, in order to provide the texture to the client?

What I want to do is display a one-off message to let players know of important changes being made to the server. I got it working with this client-side package but it took five class files to produce a simple pop-up window, and the message can't be changed without re-compiling the entire mod and re-uploading it to the server.

I want a ServerActor so the client doesn't have to download anything, if possible - with a message which I can update on-the-fly. I was thinking of pulling the text/message either from a server-side .ini file or a remote URL via HTTP request.

In my mind I'm imagining something super-simple like this fake code:
Code: Select all
event OnPlayerJoin(PlayerPawn PP) {
   PP.HUD.Spawn("Nexgen_v001.NexgenMessageWindow", "This is a message sent from the server to you, the client.");
}
Image
Join our UT Discord chat server: https://www.bunnytrack.net/discord
User avatar
Dizzy
Experienced
 
Posts: 95
Joined: Tue May 21, 2013 3:57 pm
Personal rank: Oaf

Re: Spawning a message window without a custom ServerPackage

Postby JackGriffin » Sun Jan 06, 2019 11:00 pm

Why are you making it difficult? Just use server ads. Trust me, no one is going to think your announcements are as important as you think they are. Put them in the ads and the players that care will see them.
"You damn kids, back in my time we made the items, maps and games ourselves with an unwieldy engine using counter-intuitive crash-prone tools and we liked it so much we built communities around this which nowadays look like cults because they're quasi-parallel societies based on the same old games." -Hellkeeper
User avatar
JackGriffin
Godlike
 
Posts: 3720
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: Hack coder

Re: Spawning a message window without a custom ServerPackage

Postby Dizzy » Tue Jan 08, 2019 7:46 pm

OK, forget about my specific use-case. My question is more a theoretical one and I want to figure out if it's possible or not to draw some kind of message window on a client without the client needing to download an extra package?

As you know, I'm new to UScript and used to other languages but in my mind it's crazy that in order to display a simple message box, you have to subclass 3/4/5 different things and force the client to download a package.
Image
Join our UT Discord chat server: https://www.bunnytrack.net/discord
User avatar
Dizzy
Experienced
 
Posts: 95
Joined: Tue May 21, 2013 3:57 pm
Personal rank: Oaf

Re: Spawning a message window without a custom ServerPackage

Postby JackGriffin » Wed Jan 09, 2019 3:39 am

I have the answer to your problem. How do you get that answer from me? I send it to you. If I don't then you will not just spontaneously get it.

This is the simplest explanation to your issue. Without sending something to the client how are they supposed to know you want to tell them something? The bottom line is that if you want to add something to the client that doesn't exist already then you have to send that information to them (in one form or another). There are ways to do this without making a server package entry but it's pretty limited. Server ads is the best way since it piggybacks on the broadcast message ability already in the source code. If you want to add something to the HUD though then you are for sure going to use a serverpackage to do that.

I'm curious D (and answer this privately if you'd rather): why the insistence in not wanting to use a mod for this? If you are looking for something discreet I can help you with that but you just can't get from A->B like you want to do it.
"You damn kids, back in my time we made the items, maps and games ourselves with an unwieldy engine using counter-intuitive crash-prone tools and we liked it so much we built communities around this which nowadays look like cults because they're quasi-parallel societies based on the same old games." -Hellkeeper
User avatar
JackGriffin
Godlike
 
Posts: 3720
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: Hack coder

Re: Spawning a message window without a custom ServerPackage

Postby Feralidragon » Wed Jan 09, 2019 2:21 pm

Dizzy wrote:OK, forget about my specific use-case. My question is more a theoretical one and I want to figure out if it's possible or not to draw some kind of message window on a client without the client needing to download an extra package?

As you know, I'm new to UScript and used to other languages but in my mind it's crazy that in order to display a simple message box, you have to subclass 3/4/5 different things and force the client to download a package.

Then please give an example of a language you're used to work with and the kind of things you generally do with it (at a high level, such as "sites", "apps", "games", you don't need to detail), so I can then maybe at least try to do an analogy between what you know and how stuff is supposed to work in languages like UScript (and similar ones, like Java, C#, etc).

However, I must say first that whichever language you use, if you don't have this concept on your mind, then probably you're doing stuff that only runs in a single machine, rather than a client-server architecture with RPCs, which is how most gaming engines work, or you're doing client-server stuff but you don't seem to understand how it actually works underneath since it may abstract some things for you, hence your confusion.

That is to say that either a client already has the necessary code and resources to be able to process a remote call from a server, or it has to get them somehow first before executing anything, either through downloading a client package (which is what engines generally do), or downloading the actual code to execute it (on-demand code, this could be something like a PHP server returning Javascript for the browser to run).
Otherwise, if the server does everything and just sends a view back to the client, instead of a client-server architecture, what you have at most is a terminal, not really a "client" per say in the context of client-server architectures.

In other words, if you want a UT99 server to draw something to a UT99 client, either the client must be already prepared to handle the exact task you want it to perform, or you need to provide the code and resources to it in order to do so, otherwise it's impossible.
But generally what you really want to do is not for the server to "draw" anything, what you want is for the server to send the message alone to the client (in other words, only the stuff that changes and is held by the server), and have the client just draw the window and show the message by itself (since the process of drawing and showing a message is always the same for the client).

But UT99 doesn't provide much for you to be able to do this (you can send messages themselves, but not really render a window from a server), so what you want it's quite impossible without creating a client package with the necessary code for the client to receive the message and render it.
However you seem to want to use Nexgen for this, therefore the question is then if whether or not Nexgen already has support to do something like that. In principle I would say so, but I don't know for sure since I never looked into it, but I have seen some servers doing some customization with it and such, but I don't remember if I had to download an extra package.

And if it cannot do what you want, and you're required to send a client package, it should be small enough to make no difference for the client to download it, be it a client package of your own or an existent mod/addon like Jack suggested, so I am not sure what your real worries are here either, I am not sure what problem you're trying to prevent here, and some insights on your reasoning would be helpful to understand what you're really struggling with.
User avatar
Feralidragon
Godlike
 
Posts: 5049
Joined: Wed Feb 27, 2008 6:24 pm
Location: Liandri
Personal rank: Work In Progress

Re: Spawning a message window without a custom ServerPackage

Postby PrinceOfFunky » Wed Jan 09, 2019 8:20 pm

Dizzy wrote:just a box which displays a text message and an "OK" button.

Well... this does exactly what you described, but I guess you want to add some text inside :D
EDIT: Wait, you can add some text inside, I forgot about it lol. The only problem is that it minimizes the window unless you're not in fullscreen
Image
User avatar
PrinceOfFunky
Inhuman
 
Posts: 996
Joined: Mon Aug 31, 2015 10:31 pm

Re: Spawning a message window without a custom ServerPackage

Postby Dizzy » Sun Jan 13, 2019 11:57 pm

@JackGriffin and @Feralidragon, thanks for your replies again.

Ferali, you're right in that I don't fully understand the client/server architecture of UT in the same way that I do understand web programming client/server relationships. However I understand the client has to "be told" how to render something such as a message box, because there's no built-in feature in UT like there is in browsers for JavaScript's "Alert()" function.

What I struggle to understand is the concept of using (or re-using) packages which the client has already loaded. In this case, Nexgen classes. There's plenty of Nexgen window classes in the Nexgen client-side package, so I'm wondering "why can't the server tell the client to spawn a NexgenMessageWindow class (for example!) and fill it with some text?

Like my fake code snippet I posted above, why can't it be as simple as this?

Code: Select all
event OnPlayerJoin(PlayerPawn PP) {
   PP.HUD.Spawn("Nexgen_v001.NexgenMessageWindow", "This is a message sent from the server to you, the client.");
}

The client already has Nexgen_v001.NexgenMessageWindow on its local disk, so why not just load it up and change the text message inside it? This is all an example, by the way - the actual Nexgen message window classes might not be able to accept text as a parameter like this, of course.

Anyway, I'm just lamenting because displaying a simple message window seems like a massive undertaking in UScript.

Like I said, it's taken a client-side package with FIVE different class files just to display a simple alert window! For me, a web developer who's used to writing a simple "alert("Message")" that's utter madness.

@JackGriffin: The only reason I want to do this server side is because I feel very strongly about not sending extra packages to clients whenever possible. I want my players to download as little crap from my server as possible. Plus, it's much, much easier to make changes to a server-side mod because the clients won't have to re-download packages each time.
Image
Join our UT Discord chat server: https://www.bunnytrack.net/discord
User avatar
Dizzy
Experienced
 
Posts: 95
Joined: Tue May 21, 2013 3:57 pm
Personal rank: Oaf

Re: Spawning a message window without a custom ServerPackage

Postby JackGriffin » Mon Jan 14, 2019 1:11 am

Dizzy wrote:@JackGriffin: The only reason I want to do this server side is because I feel very strongly about not sending extra packages to clients whenever possible. I want my players to download as little crap from my server as possible. Plus, it's much, much easier to make changes to a server-side mod because the clients won't have to re-download packages each time.

You are planting your flag on a hill that's at worst a very trivial matter. Even a fully fleshed out new version of something like Nexgen with all the features would be downloaded by the client before they could even get to the F10 button to cancel the redirected file being sent. Don't set limits for yourself on things that just don't matter. Working in UScript has enough of that on it's own.

I think you still don't get the core ideals here. Do you understand what you mean when you say "Server side mod"? Yes, you can change those without sending it to the clients but it also means you can't alter things that aren't replicated to the client and have them be aware of those changes. Server side mods are used to change settings on the server (hence the name) and you should stop thinking of them as a way to pass information to the players on the server. It's just not the way this whole thing works.

Food for thought: my main texture package on my coop server is 114MB. I send that to every player that joins, along with another 25Mb or so of mods/maps/extras. Aside from the botpack version issue that plagues Unreal I never lose a player to waiting on the downloads. It's not a problem any more provided you have a fast redirect. Worrying about a 200kb server mod that sends messages is way past trivial.
"You damn kids, back in my time we made the items, maps and games ourselves with an unwieldy engine using counter-intuitive crash-prone tools and we liked it so much we built communities around this which nowadays look like cults because they're quasi-parallel societies based on the same old games." -Hellkeeper
User avatar
JackGriffin
Godlike
 
Posts: 3720
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: Hack coder

Re: Spawning a message window without a custom ServerPackage

Postby Feralidragon » Wed Jan 16, 2019 4:08 pm

Dizzy wrote:What I struggle to understand is the concept of using (or re-using) packages which the client has already loaded. In this case, Nexgen classes. There's plenty of Nexgen window classes in the Nexgen client-side package, so I'm wondering "why can't the server tell the client to spawn a NexgenMessageWindow class (for example!) and fill it with some text?

That's because the server and client are 2 complete different entities with completely different roles, and which are expected to do things differently, and you're treating them as 1.

Specifically, in the case of Unreal Engine, it's not supposed for a server to tell the client to spawn a window, a server is only supposed to send the message it wants the client to show, then it's up to the client alone to receive and render it in its own way, potentially using those classes.

Furthermore, when you're using an "alert" in Javascript, you're not spawning a window class yourself either from the server, you're saying to the client to interpret and call a function with a specific string you have set which the browser then interprets as to open a box with a message.

Similarly, you could have a function in UScript called "alert" with a string parameter that, when called from the server with a given message, it could be executed in the client instead and there the client itself would do the window spawning to show the message.

However, if the client does not have that capability yet, since it may lack such a function, you have to create a client package with it.
Similarly, if a browser didn't support the "alert" call, you would also have some other code that the browser would have to download (either through a separate Javascript file or so) with this function declared in it, so it could be used (and which is not unusual for functions that only appeared in newer Javascript versions, these separate Javascript snippets with the missing functions are often called "polyfills").

The difference here in terms of packaging is that in a web environment you can just include the link to the Javascript file in your HTML page, which the browser will then fetch, while in UT you just have to add the package to your ServerPackages.
User avatar
Feralidragon
Godlike
 
Posts: 5049
Joined: Wed Feb 27, 2008 6:24 pm
Location: Liandri
Personal rank: Work In Progress


Return to Coding, Scripting

Who is online

Users browsing this forum: No registered users and 1 guest