This week I continued working on that chat system and added a new set of ruins to the Burning Sands
This week I continued work on the chat system, and decided to take things in a slightly different direction than I went with the MMO.
The chat window (on left) as it continues to evolve in development.
The wider chat box that I presented last week was crashing into the hotbar at lower resolutions when placed in the bottom left like we had it in the MMO. To resolve that I decided to move things around a bit and place the chat panel centered on the left side of the screen. We'll see how well that works out in time. In addition to the "active" mode you see in the image above there will also be a thinner "passive" mode when the chat box doesn't have focus which will be more translucent and hide everything but the chat messages. Perhaps it could fade or slide in/out when new messages arrive.
Server Home Channel, Images and Documents
The first icon at the top of the channels list is the new Server Home channel. This will be a read-only channel that the admin of a server can post announcements in.
In the first image above you may have noticed that images can appear in the chat now, or the "View Document" button. I don't plan for these to work the way you might expect them to based on apps like Discord (I don't think it would be a good idea to allow users to share images and documents by dragging them onto the Antilia chat window), but these are features that can be used by admins hosting their own multiplayer servers. I expect the "View Document" feature will be useful for things like server rules or information about special game modes or events running on a server.
When the "View Document" button is clicked a pop-up window appears showing the contents of the document.
The next icon down isn't technically a chat channel, it is in fact the Users List. It provides a list of online users and their characters. With players having multiple characters this will hopefully provide some reference as to who is controlling who. Perhaps some game modes might want to hide this - I'll have to think on that.
The users channel shows the currently logged in users and the characters they control.
Next down the line are the Server Chat and Local Chat channels. In server chat you'll appear to post via your login and those messages will appear to anyone else who is logged in, even if they are on the other side of Forra. On the other hand messages posted to the local-area chat will be displayed under your currently controlled character, and only players who are close enough to see the character will see them. Local-area chat might tend to be useful in team-based or role-playing scenarios, while server-wide chat is the more "casual" chat.
The chat channel list on the left also has a functioning "new messages" indicator now. I'm working on a few ideas for Team Chat, or alternatively a system where custom channels can be added in-game and players invited to join those channels.
Sample of server-wide chat.
For the chat messages themselves I have some basic emojis working, and I would like to make it easy for those who run servers to add more by simply adding images to an emoji's folder inside the save game folder.
Scripting is something I avoided when building Antilia as an MMO, primarily over concerns regarding performance. I gave that topic some more thought last week and came to a different conclusion now that Antilia is no longer an MMO. Having some form of scripting would be really useful for customizing the game (within limits) and running special events. After a quick look at the options I decided to give Lua integration a try, and got it working pretty quickly. For now the scripting engine is only used by the chat system, but in the future I'd like to add support for other scenarios to use scripting. These could include in-world triggers, conversation dialog options, and in the use for quests and special events. I don't think it's a good idea for scripts to be executed every frame - but for high-level triggers and events scripts can help provide a richer experience than would be practical to do with c++ alone.
The "Server Message" you saw in the first screenshot above was generated by one of these Lua scripts. It looks like this:
-- This function is called automatically when a user logs in
local channel = "server-home"
-- Welcome Message
local message = "Welcome to the Antilia Development Server, " .. loginid .. "!"
SendServerChatMessageToUser(loginid, channel, message)
-- Community Guidelines Document
message = "This is a moderated community. Please read the Community Guidelines and familiarize yourself with the server rules."
local document = "server-rules.txt"
SendServerChatMessageToUserExt(loginid, channel, message, nil, document)
-- Fishing Announcement
message = "Fishing contest this week! Visit Torliila's Fishing Boutique in Tasii Garden for contest rules!"
local image = "event/fishing-1.png"
SendServerChatMessageToUserExt(loginid, channel, message, image, nil)
-- This function is called automatically when a user logs out
|Tip:||In Lua two hyphens in a row denotes a comment. |
Each time a new player joins the game, the OnUserJoins function is executed, which in the case of the code above sends a few messages to be displayed in the user's "Server Home" channel.
I've started on a permissions system for running these scripts - we wouldn't want everyone to be able to run scripts intended for only the admin or moderators. Each channel has it's own set of permissions, and functions can be whitelisted for different roles.
The script files are saved in a directory containing the save game data, along with a folder for images and documents, and can be easily edited in a basic text file editor (even notepad.exe). At the bottom of the channel list on the left is a Script Console channel that can be used to interactively test and debug scripts directly on a server (admins only).
While working on the scripting system I developed a couple fun little scripts, and I am curious if the Antilia community will develop more scripts like these that can be shared via open source.
Sample output of scripts I wrote to test that the scripting system works.
The first script is a bit silly, any user with permission can post !fish and the script will respond with a random image of a fish! There isn't a whole lot of code behind it, so here's a look:
function fish(loginid, characterid, channelid)
message = "Fish for " .. loginid .. "!"
local image = "fish/fishing_" .. math.random(1,54) .. ".png"
PostServerChatMessageExt(channelid, message, image, nil)
The second script is a simple dice rolling script. With that script enabled you can type something like !roll 4d6+2 into chat and the server will respond with your dice rolls and the total. The script for that is more complicated with the dice roll parsing, but if anyone is curious to see the script for that ask me in the #development channel on Discord.
New Ruins in the Burning Sands
This week I also started work on a new set of ruins in the Burning Sands region. Admittedly I not entirely happy with the results. The meshes I chose have some bad UV mapping in places and the textures aren't great. I'd like to go back and either fix those or find another set of ruins. For now this set will probably stick around for a while, as it does at least provide a few more points of interest in the Burning Sands - especially if I add a few more of these buildings scattered around.
Thew new ruins in the Burning Sands. The pad I'm standing on would make a good location for a Takadynn.
From another angle - I do rather like this circular "sundial" like feature.
An overview of the ruins.
The chat system is pretty functional now, but there are still a few things I have yet to do:
- Cleaner messages-only display when the chat window is not being used
- Split off additional chat windows that can be resized
- Get local-area chat relaying messages only to players in range
- Team channels or custom channels with invites
- Improve logging, user roles & permissions, and customization more
That's all for this week, thanks for reading!