Early in the development of Broadside I was still learning the networking API and was just trying to get something to work. The intention at the time was to get ships sailing, cannonballs flying, and prove the game was possible. Getting things working at all was put as a priority over getting things to work the most efficient way, with the idea being that I would revisit these systems at a later date to optimize them.
Unfortunately that time has come. As time has gone on, more systems have been added to the game that need to be synced to the clients. From crew to cargo to city markets, there's added up a good amount of data now that needs to be sent to the clients and kept in sync. After adding some larger ships, which necessitate even more data to sync, I hit a brick wall that took a little while to understand.
I was getting errors on the server where a client would no longer receive any server updates. I tracked the issue down to something I'll call "reliable message pressure", where reliable messages are attempted to be sent to the clients at a rate faster than the server can actually send them (number of messages here is more important than the amount of data in each message, as the amount of data in most messages is actually incredibly small) and that would result in messages being delayed and ultimately available buffers for either storing new messages to send or waiting for acknowledgement messages to be returned, would be filled and no new data could be sent. This would prevent even unreliable messages from sending as well. This would appear on the client as if it froze, but it didn't actually disconnect.
At first I simply attempted to increase the buffer space, but that just resulted in delaying the issue. Then I went and did a proper investigation and found it had to do with how I implemented syncing the state of the ships in the first place - mostly code that has been in place since the beginning of the project and had forgotten exactly what I had done for expediency.
I was syncing a timer every frame over the reliable channel that the clients weren't even using. I was syncing data like crew allocations to every client when only the owner of the ship cares about that data. I was sending requests from the client to the server to turn the ship every frame over the reliable channel. I was syncing data like a ship's cargo to the owner of the ship every few seconds even if the contents had not changed. And much more.
So I've eliminated the error now by going through and syncing any data only the owner of the ship cares about just to that client, instead of all clients. I've moved any non-critical syncing or commands from the player, such as turning the ship, over to the unreliable channel (if you're holding a turn key it doesn't matter if a frame or two gets lost, and there is no need to send an acknowledgement back to the client).
So just in what I've been able to improve in a day has cut the amount of sync messages by over 60% as seen by the client, and probably much higher than that when taking into account dropped messages the server never even was putting on the wire due to reliable message pressure on that client's connection. I'm continuing to work on the issue to reduce the amount by another 50% by calculating things like ship speed and wind angle on the clients for all ships instead of syncing that from the server, and improving my in house network transform syncing script.
Currently I use my in house network transform syncing script to sync the position of cannonballs while reducing the frequency of position/velocity updates needed in comparison to the script built into the networking API. With my own custom script I only need to update cannonballs about 4 times per second compared to at least 15 with the built in version. Unfortunately in testing it doesn't work smoothly when attached to ships so I'm still using the built in script for those. The built in script needs to sync position 29 times per second to get a smooth movement and turning effect without any noticeable jitter or snapping, but my goal to be able to drop that to 10 or less per second. This will be worked on again in the near future.
The slow rocking of the ship is also something currently synced entirely from the server to all clients. I'm going to change that to being calculated locally on the clients, with periodic updates to keep in sync with the server. So instead of several times per second the rocking with be updated by the server maybe once per minute. We'll see how that works in testing and adjust from there.
So the ultimate goal is to be able to support approximately 60 players connected per zone, with at least a dozen AI controlled ships. Actual play testing so far has been limited to far fewer numbers, but as more improvements are implemented we'll be involving more play testers and monitoring performance. At this point I'm pretty confident we'll be able to hit those numbers.
Sail the world in this exciting MMO by Joe Censored Games.
Under active development, ETA late 2021
Internal development builds available on Steam by request for a Steam beta key. Note that many features are currently not implemented, buttons may exist but do not work, there are no tutorials available.
Tuesday, June 26, 2018
Wednesday, June 20, 2018
Firing a full broadside
Now that the majority of functionality for what you can do when docked at the cities has been implemented, as well as making market purchases, development is moving on to implementing additional ships and items into the game, implementing more combat mechanics, filling out NPC ship AI behavior, and gathering items in the game.
Part of the updates to the combat mechanics is an alternate way to fire your ship's cannons. The standard way of firing cannons is to select a side of your ship, aim the cannons, and press the space bar to fire an individual cannon. You can hold down the space bar for continuous fire.
Some ships have multiple gun decks on the port and starboard sides. This allows for installing different guns on these decks. All guns on a single deck need to be of the same type, and load the same ammunition, but multiple gun decks allows for varying your weaponry on the same side of the ship. When firing using the space bar you manually switch between gun decks.
The new "Full Broadside" button, available under the Guns status tab in the lower left of the screen, ignores most of that and automatically queues up all guns on the entire side of the ship to fire as fast as possible. This has advantages and disadvantages compared to firing using the space bar. Normally guns on a single deck are fired in sequence starting from the front of the ship and working their way to the rear. When firing a full broadside, all guns are fired in a random order. In addition, when firing by space bar you can continually adjust your aim for each shot. In full broadside mode, the aim of all guns is set when you press the Full Broadside button and can't be adjusted again until all guns have fired.
Those are some of the disadvantages, but on to the advantages. Once you initiate a full broadside, you can switch to an alternate camera, either out to 3rd person or looking down another cannon sight. You can even fire from a second side of the ship while your crew is still firing your broadside from the first side. It is even possible to initiate what is called a double broadside, where you do a full broadside from both port and starboard simultaneously.
Another large advantage is specifically for ships with multiple gun decks on the sides. Gun decks are limited to a rate of fire, but when you have more than one gun deck firing at once, the overall rate of fire is increased. If you have 3 gun decks firing at once, the effective time between shots is cut to 1/3 of normal.
This all adds up to a way to effectively deal a fast volley of damage, most effective at close range due to limitations to your aim.
Part of the updates to the combat mechanics is an alternate way to fire your ship's cannons. The standard way of firing cannons is to select a side of your ship, aim the cannons, and press the space bar to fire an individual cannon. You can hold down the space bar for continuous fire.
Some ships have multiple gun decks on the port and starboard sides. This allows for installing different guns on these decks. All guns on a single deck need to be of the same type, and load the same ammunition, but multiple gun decks allows for varying your weaponry on the same side of the ship. When firing using the space bar you manually switch between gun decks.
The new "Full Broadside" button, available under the Guns status tab in the lower left of the screen, ignores most of that and automatically queues up all guns on the entire side of the ship to fire as fast as possible. This has advantages and disadvantages compared to firing using the space bar. Normally guns on a single deck are fired in sequence starting from the front of the ship and working their way to the rear. When firing a full broadside, all guns are fired in a random order. In addition, when firing by space bar you can continually adjust your aim for each shot. In full broadside mode, the aim of all guns is set when you press the Full Broadside button and can't be adjusted again until all guns have fired.
Those are some of the disadvantages, but on to the advantages. Once you initiate a full broadside, you can switch to an alternate camera, either out to 3rd person or looking down another cannon sight. You can even fire from a second side of the ship while your crew is still firing your broadside from the first side. It is even possible to initiate what is called a double broadside, where you do a full broadside from both port and starboard simultaneously.
Another large advantage is specifically for ships with multiple gun decks on the sides. Gun decks are limited to a rate of fire, but when you have more than one gun deck firing at once, the overall rate of fire is increased. If you have 3 gun decks firing at once, the effective time between shots is cut to 1/3 of normal.
This all adds up to a way to effectively deal a fast volley of damage, most effective at close range due to limitations to your aim.
Saturday, June 2, 2018
Current Progress
Just a quick update. Implementation of the City UI for all things regarding moving items and outfitting ships is now completed. This was a complicated and time consuming feature that is pretty central to the game. Development is now on finishing the market system and implementing its UI.
Tuesday, April 3, 2018
Markets and Trading
Current development is still surrounding the various systems that are involved in the port cities. The primary functions of ports is a place to store excess items and ships, and to provide a local marketplace for trade, among other functions.
In Broadside the trader will have plenty of opportunities to succeed. There will be hundreds of ports across the globe to visit. Every port will have its own market, where any item in the game can potentially be bought or sold.
Items in the game generally fall along two categories, items that can be used directly by players (ships, cannons, ammunition, equipment, etc), and what can be referred to as "trade goods" which are generally purchased by NPC's in the ports themselves (jewelry, fine china, spices, tobacco, etc).
Demand for player items is largely driven by the player base itself. These items can be found in item drops, Treasure Chests, or manufactured by the players, and can be bought and sold on the market in the port cities.
At the game's launch many player base items will be seeded by NPC sales in the markets until player manufacturing can take over the demand. Profitability of these items will depend largely on what is in demand by the players.
The trade goods can be bought and sold between players, but their primary purpose is to be sold to the population of one of the ports through the market.
Every port will have at least one item that it produces in mass quantity, and every port that doesn't produce that item will have some level of demand for it.
The price of trade goods bought and sold to NPCs in the port city markets will be driven by a suppply and demand system. All items will have a "base price", which is the lowest price NPC's will buy or sell it for. The maximum price will be a multiple of that base price, which will be determined through game balancing, but the current multiple being tested is 20x the base price.
So the ultimate goal with trading in the trade goods is to find a port that produces that trade good with high supply, which will drive the price down to or near its base price, and to then transport that trade good to a city with high demand for it, which then will buy that item at a high multiple of the base price.
The supply/demand of a trade good item is recalculated after every purchase or sale in that port that involves an NPC buy/sell order. How much it is affected depends on the size of the order and the size of the market itself. Supply/demand for a trade good will slowly recover the longer the port goes without purchases of the item. How long this will take will depend on game balancing, but currently going from exhaustion for full supply/demand for an item is being tested as taking a 48 hour period without activity as an example.
Every port has a "Market Size" value that represents the population that the market services. This not only includes the port itself, but the entire surrounding area (what we would call today the suburbs and surrounding rural area). The larger the Market Size, the higher quantity of items produced in that city, and the higher number of items in demand. That means that the supply or demand of items is less affected by individual purchases in a high Market Size port in comparison to a low Market Size port.
Every port has its Market Size value, which generally goes alone with the 3 types of ports you will find. City, Town, and Settlement. Cities have the largest Market Size, while Settlements have the smallest.
In addition to the Market Size, the supply and demand of items by the local population will be greatly affected by its Market Profile. This generally refers to the economics of the port. Each port will be assigned one of the following Market Profiles.
In Broadside the trader will have plenty of opportunities to succeed. There will be hundreds of ports across the globe to visit. Every port will have its own market, where any item in the game can potentially be bought or sold.
Items in the game generally fall along two categories, items that can be used directly by players (ships, cannons, ammunition, equipment, etc), and what can be referred to as "trade goods" which are generally purchased by NPC's in the ports themselves (jewelry, fine china, spices, tobacco, etc).
Player Base Items
Demand for player items is largely driven by the player base itself. These items can be found in item drops, Treasure Chests, or manufactured by the players, and can be bought and sold on the market in the port cities.
At the game's launch many player base items will be seeded by NPC sales in the markets until player manufacturing can take over the demand. Profitability of these items will depend largely on what is in demand by the players.
Trade Goods
The trade goods can be bought and sold between players, but their primary purpose is to be sold to the population of one of the ports through the market.
Every port will have at least one item that it produces in mass quantity, and every port that doesn't produce that item will have some level of demand for it.
Supply and Demand
The price of trade goods bought and sold to NPCs in the port city markets will be driven by a suppply and demand system. All items will have a "base price", which is the lowest price NPC's will buy or sell it for. The maximum price will be a multiple of that base price, which will be determined through game balancing, but the current multiple being tested is 20x the base price.
So the ultimate goal with trading in the trade goods is to find a port that produces that trade good with high supply, which will drive the price down to or near its base price, and to then transport that trade good to a city with high demand for it, which then will buy that item at a high multiple of the base price.
The supply/demand of a trade good item is recalculated after every purchase or sale in that port that involves an NPC buy/sell order. How much it is affected depends on the size of the order and the size of the market itself. Supply/demand for a trade good will slowly recover the longer the port goes without purchases of the item. How long this will take will depend on game balancing, but currently going from exhaustion for full supply/demand for an item is being tested as taking a 48 hour period without activity as an example.
Market Size
Every port has a "Market Size" value that represents the population that the market services. This not only includes the port itself, but the entire surrounding area (what we would call today the suburbs and surrounding rural area). The larger the Market Size, the higher quantity of items produced in that city, and the higher number of items in demand. That means that the supply or demand of items is less affected by individual purchases in a high Market Size port in comparison to a low Market Size port.
Every port has its Market Size value, which generally goes alone with the 3 types of ports you will find. City, Town, and Settlement. Cities have the largest Market Size, while Settlements have the smallest.
Market Profile
In addition to the Market Size, the supply and demand of items by the local population will be greatly affected by its Market Profile. This generally refers to the economics of the port. Each port will be assigned one of the following Market Profiles.
- Metropolitan
- A city with a high number of wealthy people and industry. Wealthy trade goods will be in high demand for its Market Size, as well as goods needed for manufacturing, while goods needed for things like farming will be in low demand for its size. Trade goods produced here will generally be manufactured and be indicative of the local area.
- Cosmopolitan
- A busy trade port with traders from many far away lands. Demand for most any trade good will be high for its Market Size. Trade goods produced by the city may be unexpected for the city's location, as they are generally found in more distant lands.
- Mixed
- A general mix of wealth and industry with a surrounding agrarian base. Demand for most trade goods will be moderate. Trade goods produced by the port can be manufactured or farm related, but will be indicative of the local area.
- Agrarian
- A primarily rural farming community. Demand for most items of wealth will be low for its Market Size, while demand for goods relating to farming or harvesting local resources will be high for its size. Trade goods produced by the port will generally be raw materials or a farmed product, and will be indicative of the local area.
- Impoverished
- This is a desperately poor community with the majority of the population living hand to mouth on a daily basis, and largely lacking the skills needed to build up much of a local industry. Demand for most items will be very low for its Market Size. Demand for food and water will be exceptionally high for its size. Trade goods produced here will either be raw materials or speak to the desperateness of the local people, and will be indicative of the local area. Raw materials produced here though can still be of considerable value, even if the majority of the population is not reaping the benefits of their sale.
Broadside Premium, Real Money Purchases, and Treasure Chests
Broadside is being released as a Free to Play game, that will in no way require any purchases in order to play. The game is being balanced with the assumption that the majority of players will never pay a dime for the game, and that is fine. The idea is to make a great and fun game first, something fun enough where players will want to get their friends to play as well, and bank on at least someone in your group of friends seeing the value in some additional purchases which are what supports the costs and continued development of the game.
Free players are in no way looked down on, or considered lesser players.
One of the two primary ways the game will be funded will be through the Broadside Premium DLC. This will be an optional DLC that provides a handful of benefits for the owner.
Treasure Chests mentioned above will be available in a number of places in the game, such as in item drops when sinking NPC ships. There will be multiple types of Treasure Chests, and will require an associated type of key for that chest to open. KEYS WILL NOT BE A MICROTRANSACTION ITEM! Keys will also be available in item drops, in roughly the same number as the chests themselves. This differs from the now standard "loot box" system seen in many free to play or even premium games, where loot boxes are free but you need to purchase keys with real money.
Feedback from early play testing is that everyone wants optional color choices for their ships. These are generally referred to as skins in other games, so I'll use that name here. These skins will be some of the higher value items dropped from Treasure Chests. A skin will be a 1 time use consumable item applied to a ship, and stays with the ship until the player either removes the skin or the ship is sunk. Changing to a new skin or removing a skin will not return the old skin to your inventory.
Besides Broadside Premium, the only other means of real money purchasing currently planned is for the Pieces of Eight in game currency (the primary in game currency). This is available for several reasons. Some people may enjoy the PVP aspect of the game, but not the trading, some people may have lost their ships through a string of bad choices or bad luck and would like to quickly get back what they had, some people may just want a much larger inventory of ships than their current amount of play time allows, some people may want to quickly fund a large expansion to their manufacturing or trading. Whatever the reason, the game will allow for the purchase of the Pieces of Eight (Po8) in game currency for real money. There will not be any alternate "premium currency" in the game.
Free players are in no way looked down on, or considered lesser players.
Broadside Premium
One of the two primary ways the game will be funded will be through the Broadside Premium DLC. This will be an optional DLC that provides a handful of benefits for the owner.
- Skill training speed will be increased
- The amount will be determined during balancing, but the expectation is between 20% to 50% over the standard game
- Treasure Chests will drop 2 items instead of 1
- Effectively like opening 2 Treasure Chests at the same time
- You'll be able to equip new skins to your ships
Broadside Premium will be a 1 time purchase, not a subscription, and will be applied to your game client and not a specific account. That means if you have multiple accounts with their own characters, or if multiple players share the same computer, all those accounts used will benefit from Broadside Premium.
The expected price for the Broadside Premium DLC will be between $10 to $20 USD.
The expected price for the Broadside Premium DLC will be between $10 to $20 USD.
Treasure Chests
Treasure Chests mentioned above will be available in a number of places in the game, such as in item drops when sinking NPC ships. There will be multiple types of Treasure Chests, and will require an associated type of key for that chest to open. KEYS WILL NOT BE A MICROTRANSACTION ITEM! Keys will also be available in item drops, in roughly the same number as the chests themselves. This differs from the now standard "loot box" system seen in many free to play or even premium games, where loot boxes are free but you need to purchase keys with real money.
It will be possible for players to sell both Treasure Chests and their keys in the in game market places for in game currency. So if you enjoy them, you can purchase them in game from other players.
The only encouragement that Treasure Chests provide for a real money purchase is the above mentioned benefit of the Broadside Premium DLC in doubling the items dropped from Treasure Chests.
The only encouragement that Treasure Chests provide for a real money purchase is the above mentioned benefit of the Broadside Premium DLC in doubling the items dropped from Treasure Chests.
Skins
Feedback from early play testing is that everyone wants optional color choices for their ships. These are generally referred to as skins in other games, so I'll use that name here. These skins will be some of the higher value items dropped from Treasure Chests. A skin will be a 1 time use consumable item applied to a ship, and stays with the ship until the player either removes the skin or the ship is sunk. Changing to a new skin or removing a skin will not return the old skin to your inventory.
Skins, like Treasure Chests can also be bought or sold on the in game market places. Skins though can only be applied to a ship where the player has the Broadside Premium DLC. It is specifically allowed for players to temporarily trade their ships to a Broadside Premium player for the purpose of applying a skin and trading it back, where it will stay equipped and be usable by the non-premium player. In that way, it is possible for everyone in your group to have skins on their ships, while only a single player has purchased Broadside Premium.
Note that the in game market places do not handle the sale of fitted ships, only packaged items such as an empty ship hull, so it will not be possible to buy or sell ships on the market with skins already applied. When you sell a fitted ship on the in game market, all fittings on the ship and items in its hold are transferred to your storage at port. Since equipped skins cannot be removed from a ship for reuse, they are destroyed in this process.
Purchasing Pieces of Eight with Real Money
Besides Broadside Premium, the only other means of real money purchasing currently planned is for the Pieces of Eight in game currency (the primary in game currency). This is available for several reasons. Some people may enjoy the PVP aspect of the game, but not the trading, some people may have lost their ships through a string of bad choices or bad luck and would like to quickly get back what they had, some people may just want a much larger inventory of ships than their current amount of play time allows, some people may want to quickly fund a large expansion to their manufacturing or trading. Whatever the reason, the game will allow for the purchase of the Pieces of Eight (Po8) in game currency for real money. There will not be any alternate "premium currency" in the game.
Purchasing Po8 with real money will in no way require the Broadside Premium DLC. The various means of generating your own Po8 in game are being balanced with the assumption that the player will never purchase Po8 for real money, nor is any game item or system being designed in a way to specifically encourage its purchase. The adventurous trader, manufacturer, or privateer should be able to generate ample Po8 on their own with a little planning and some good execution, making real money purchases of Po8 unnecessary for the vast majority of players. A primary design goal of Broadside is it will not be a "Pay to Win" economy.
Monday, March 19, 2018
Current Status
Just a quick update as to the overall status of Broadside development
The game will start focusing more on game play testing and player feedback starting about 3 months from now. The current plan is to follow that with an official closed beta before the end of this year. Whether to go with a soft launch open beta off our own site, an official "early access" release through Steam, or just a regular full on release will depend on how well the closed beta goes.
- Art Assets
- 100% Complete
- Coding
- 66% Complete
- Major features yet to be implemented are city markets, the city ship fitting interface, player zone transfers, and player created trading companies
- There's lots of minor code work in virtually all the other features still to do as well, but pretty much all of the high level features other than listed above have been more or less implemented
- Implementing all ships and items in the game
- 10% Complete
- Has lots of dependencies on uncompleted code still, the market system being the majority of it
- Building out all the terrain for the whole world for all zones
- 1% Complete
- The only dependency this is waiting on is the code for determining when a player should be moved to a new zone to be written, which is planned after the market system is complete
The game will start focusing more on game play testing and player feedback starting about 3 months from now. The current plan is to follow that with an official closed beta before the end of this year. Whether to go with a soft launch open beta off our own site, an official "early access" release through Steam, or just a regular full on release will depend on how well the closed beta goes.
Wednesday, March 14, 2018
Universal Game Time and the Day/Night Cycle
Recent development has all been around ship combat, and most recently creating item drops. Next in that development is adding the UI interface to access item drops and choosing what you may want to move to your cargo hold, and the same interface will be used for gathering resources from the sea, such as fishing or whaling. Following that will be a similar interface for managing cargo at ports, and outfitting your ship, and after that is done work will begin on the market system for buying and selling items at port.
I call what I've been in lately "item hell", because even though these are central components of the game, they are not very satisfying to work on, let alone extremely complicated and delicate systems. After responding to a thread on the Unity forums about implementing a day/night cycle, I decided to go off on a tangent and do the same in Broadside right now instead of later. A day/night cycle was always in the required features list for Broadside, so this was getting done sometime soon no matter what. It also bothered me that this was the last remaining feature of the early prototype version of Broadside Online that has not been implemented in the current iteration.
So the world in Broadside is chopped up into a long series of zones, each managed by their own server instance. Broadside is a game that will cover the entire world, at least what is accessible from the oceans, so I wanted the day/night cycle to reflect that. So when you are in the same zone as London, it will be a completely different time of day than in Bombay.
Most zone servers though are not active at any given time. The world is so huge, that it is silly to be wasting server resources simulating a zone if no player is currently occupying it. So zones will be started and stopped all the time as players move around the game world. There needs to be some central authority on the time of day for the game world even when a zone server is offline, so it will know what time of day it is when it eventually starts up. The Tracker server mentioned in an early blog entry is that server.
So the Tracker server will maintain what I call Universal Game Time. This is the time of day in seconds at longitude 0. Effectively London time for this discussion. When the Tracker server starts up it will always be UGT 0, which is midnight in London, and the Tracker server continually increments this at a multiple of real time. Right now the plan is to have an entire day/night cycle take 2 hours, but that is easily adjustable when getting to the later polishing phase of development.
When a zone server starts up, it already makes a connection to the Tracker server for other reasons, such as player chat functionality and character skills updates. Now when a zone server first connects, the Tracker server will respond with the current UGT. The zone server then applies an offset to the UGT based on roughly what longitude the contents of the zone server represent. The zone server then increments its own local time independently using its TimeController. To avoid drift from UGT over long running periods, the Tracker server will periodically send updates to all active zone servers.
When a client connects to the zone server, one of the last things it does is spawn the player's ship object. This occurs after everything else is set up, including the client copy of the TimeController, so is the perfect time to tell the client what local time it is. Once the client receives the local time, it orients the directional light (the sun), and adjusts global illumination and fog colors to match the current time. The client copy of TimeController then increments local time on its own, receiving updates at noon and midnight from the zone server to correct any drift. The TimeController on the client continually adjusts the sun direction and all other day/night cycle variables, and also handles requests from objects with torches to tell them whether they should be lit or not.
Not too complicated, just thought you might think it was a bit interesting how the system works.
I call what I've been in lately "item hell", because even though these are central components of the game, they are not very satisfying to work on, let alone extremely complicated and delicate systems. After responding to a thread on the Unity forums about implementing a day/night cycle, I decided to go off on a tangent and do the same in Broadside right now instead of later. A day/night cycle was always in the required features list for Broadside, so this was getting done sometime soon no matter what. It also bothered me that this was the last remaining feature of the early prototype version of Broadside Online that has not been implemented in the current iteration.
Universal Game Time
So the world in Broadside is chopped up into a long series of zones, each managed by their own server instance. Broadside is a game that will cover the entire world, at least what is accessible from the oceans, so I wanted the day/night cycle to reflect that. So when you are in the same zone as London, it will be a completely different time of day than in Bombay.
Most zone servers though are not active at any given time. The world is so huge, that it is silly to be wasting server resources simulating a zone if no player is currently occupying it. So zones will be started and stopped all the time as players move around the game world. There needs to be some central authority on the time of day for the game world even when a zone server is offline, so it will know what time of day it is when it eventually starts up. The Tracker server mentioned in an early blog entry is that server.
So the Tracker server will maintain what I call Universal Game Time. This is the time of day in seconds at longitude 0. Effectively London time for this discussion. When the Tracker server starts up it will always be UGT 0, which is midnight in London, and the Tracker server continually increments this at a multiple of real time. Right now the plan is to have an entire day/night cycle take 2 hours, but that is easily adjustable when getting to the later polishing phase of development.
When a zone server starts up, it already makes a connection to the Tracker server for other reasons, such as player chat functionality and character skills updates. Now when a zone server first connects, the Tracker server will respond with the current UGT. The zone server then applies an offset to the UGT based on roughly what longitude the contents of the zone server represent. The zone server then increments its own local time independently using its TimeController. To avoid drift from UGT over long running periods, the Tracker server will periodically send updates to all active zone servers.
When a client connects to the zone server, one of the last things it does is spawn the player's ship object. This occurs after everything else is set up, including the client copy of the TimeController, so is the perfect time to tell the client what local time it is. Once the client receives the local time, it orients the directional light (the sun), and adjusts global illumination and fog colors to match the current time. The client copy of TimeController then increments local time on its own, receiving updates at noon and midnight from the zone server to correct any drift. The TimeController on the client continually adjusts the sun direction and all other day/night cycle variables, and also handles requests from objects with torches to tell them whether they should be lit or not.
Not too complicated, just thought you might think it was a bit interesting how the system works.
Subscribe to:
Posts (Atom)