2018-05-15 17:58:09 +00:00
|
|
|
#ifndef OPENMW_WORLDSTATEAPI_HPP
|
|
|
|
#define OPENMW_WORLDSTATEAPI_HPP
|
|
|
|
|
2018-07-26 17:03:42 +00:00
|
|
|
#include <components/openmw-mp/Base/BaseWorldstate.hpp>
|
2018-05-15 17:58:09 +00:00
|
|
|
#include "../Types.hpp"
|
|
|
|
|
2018-12-24 20:36:57 +00:00
|
|
|
#include <Script/Platform.hpp>
|
|
|
|
|
2018-05-15 17:58:09 +00:00
|
|
|
#define WORLDSTATEAPI \
|
2018-07-12 23:33:50 +00:00
|
|
|
{"ReadReceivedWorldstate", WorldstateFunctions::ReadReceivedWorldstate},\
|
2018-06-07 09:49:12 +00:00
|
|
|
\
|
2018-07-12 23:33:50 +00:00
|
|
|
{"CopyReceivedWorldstateToStore", WorldstateFunctions::CopyReceivedWorldstateToStore},\
|
2018-06-26 23:00:16 +00:00
|
|
|
\
|
2018-06-07 09:49:12 +00:00
|
|
|
{"ClearMapChanges", WorldstateFunctions::ClearMapChanges},\
|
|
|
|
\
|
|
|
|
{"GetMapChangesSize", WorldstateFunctions::GetMapChangesSize},\
|
|
|
|
\
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
{"GetWeatherRegion", WorldstateFunctions::GetWeatherRegion},\
|
|
|
|
{"GetWeatherCurrent", WorldstateFunctions::GetWeatherCurrent},\
|
|
|
|
{"GetWeatherNext", WorldstateFunctions::GetWeatherNext},\
|
|
|
|
{"GetWeatherQueued", WorldstateFunctions::GetWeatherQueued},\
|
|
|
|
{"GetWeatherTransitionFactor", WorldstateFunctions::GetWeatherTransitionFactor},\
|
|
|
|
\
|
2018-06-07 09:49:12 +00:00
|
|
|
{"GetMapTileCellX", WorldstateFunctions::GetMapTileCellX},\
|
|
|
|
{"GetMapTileCellY", WorldstateFunctions::GetMapTileCellY},\
|
|
|
|
\
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
{"SetAuthorityRegion", WorldstateFunctions::SetAuthorityRegion},\
|
|
|
|
\
|
|
|
|
{"SetWeatherRegion", WorldstateFunctions::SetWeatherRegion},\
|
|
|
|
{"SetWeatherForceState", WorldstateFunctions::SetWeatherForceState},\
|
|
|
|
{"SetWeatherCurrent", WorldstateFunctions::SetWeatherCurrent},\
|
|
|
|
{"SetWeatherNext", WorldstateFunctions::SetWeatherNext},\
|
|
|
|
{"SetWeatherQueued", WorldstateFunctions::SetWeatherQueued},\
|
|
|
|
{"SetWeatherTransitionFactor", WorldstateFunctions::SetWeatherTransitionFactor},\
|
|
|
|
\
|
2018-05-27 13:05:40 +00:00
|
|
|
{"SetHour", WorldstateFunctions::SetHour},\
|
|
|
|
{"SetDay", WorldstateFunctions::SetDay},\
|
|
|
|
{"SetMonth", WorldstateFunctions::SetMonth},\
|
|
|
|
{"SetYear", WorldstateFunctions::SetYear},\
|
|
|
|
{"SetDaysPassed", WorldstateFunctions::SetDaysPassed},\
|
|
|
|
{"SetTimeScale", WorldstateFunctions::SetTimeScale},\
|
2018-05-25 00:33:12 +00:00
|
|
|
\
|
2018-05-27 13:05:40 +00:00
|
|
|
{"SetPlayerCollisionState", WorldstateFunctions::SetPlayerCollisionState},\
|
|
|
|
{"SetActorCollisionState", WorldstateFunctions::SetActorCollisionState},\
|
|
|
|
{"SetPlacedObjectCollisionState", WorldstateFunctions::SetPlacedObjectCollisionState},\
|
|
|
|
{"UseActorCollisionForPlacedObjects", WorldstateFunctions::UseActorCollisionForPlacedObjects},\
|
2018-05-24 06:38:06 +00:00
|
|
|
\
|
2018-06-28 01:53:00 +00:00
|
|
|
{"AddEnforcedCollisionRefId", WorldstateFunctions::AddEnforcedCollisionRefId},\
|
|
|
|
{"ClearEnforcedCollisionRefIds", WorldstateFunctions::ClearEnforcedCollisionRefIds},\
|
|
|
|
\
|
2018-06-28 00:48:16 +00:00
|
|
|
{"SaveMapTileImageFile", WorldstateFunctions::SaveMapTileImageFile},\
|
|
|
|
{"LoadMapTileImageFile", WorldstateFunctions::LoadMapTileImageFile},\
|
|
|
|
\
|
2018-06-07 09:49:12 +00:00
|
|
|
{"SendWorldMap", WorldstateFunctions::SendWorldMap},\
|
2018-05-27 13:05:40 +00:00
|
|
|
{"SendWorldTime", WorldstateFunctions::SendWorldTime},\
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
{"SendWorldWeather", WorldstateFunctions::SendWorldWeather},\
|
2018-07-12 23:33:50 +00:00
|
|
|
{"SendWorldCollisionOverride", WorldstateFunctions::SendWorldCollisionOverride},\
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
{"SendWorldRegionAuthority", WorldstateFunctions::SendWorldRegionAuthority},\
|
2018-07-12 23:33:50 +00:00
|
|
|
\
|
|
|
|
{"ReadLastWorldstate", WorldstateFunctions::ReadLastWorldstate},\
|
|
|
|
{"CopyLastWorldstateToStore", WorldstateFunctions::CopyLastWorldstateToStore}
|
2018-05-15 17:58:09 +00:00
|
|
|
|
2018-12-09 06:36:33 +00:00
|
|
|
namespace WorldstateFunctions
|
2018-05-15 17:58:09 +00:00
|
|
|
{
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION mwmp::BaseWorldstate CDECL *readWorldstate;
|
|
|
|
EXPORT_APIFUNCTION mwmp::BaseWorldstate CDECL writeWorldstate;
|
2018-07-26 17:03:42 +00:00
|
|
|
|
2018-05-15 17:58:09 +00:00
|
|
|
/**
|
2018-06-07 09:49:12 +00:00
|
|
|
* \brief Use the last worldstate received by the server as the one being read.
|
|
|
|
*
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL ReadReceivedWorldstate() noexcept;
|
2018-06-07 09:49:12 +00:00
|
|
|
|
2018-06-26 23:00:16 +00:00
|
|
|
/**
|
|
|
|
* \brief Take the contents of the read-only worldstate last received by the
|
|
|
|
* server from a player and move its contents to the stored worldstate
|
|
|
|
* that can be sent by the server.
|
|
|
|
*
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL CopyReceivedWorldstateToStore() noexcept;
|
2018-06-26 23:00:16 +00:00
|
|
|
|
2018-06-07 09:49:12 +00:00
|
|
|
/**
|
|
|
|
* \brief Clear the map changes for the write-only worldstate.
|
|
|
|
*
|
|
|
|
* This is used to initialize the sending of new WorldMap packets.
|
|
|
|
*
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL ClearMapChanges() noexcept;
|
2018-06-07 09:49:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Get the number of indexes in the read worldstate's map changes.
|
|
|
|
*
|
|
|
|
* \return The number of indexes.
|
|
|
|
*/
|
2019-01-02 19:01:09 +00:00
|
|
|
EXPORT_APIFUNCTION unsigned int CDECL GetMapChangesSize() noexcept;
|
2018-06-07 09:49:12 +00:00
|
|
|
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
/**
|
|
|
|
* \brief Get the weather region in the read worldstate.
|
|
|
|
*
|
|
|
|
* \return The weather region.
|
|
|
|
*/
|
2019-01-02 19:01:09 +00:00
|
|
|
EXPORT_APIFUNCTION const char *CDECL GetWeatherRegion() noexcept;
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Get the current weather in the read worldstate.
|
|
|
|
*
|
|
|
|
* \return The current weather.
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION int CDECL GetWeatherCurrent() noexcept;
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Get the next weather in the read worldstate.
|
|
|
|
*
|
|
|
|
* \return The next weather.
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION int CDECL GetWeatherNext() noexcept;
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Get the queued weather in the read worldstate.
|
|
|
|
*
|
|
|
|
* \return The queued weather.
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION int CDECL GetWeatherQueued() noexcept;
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Get the transition factor of the weather in the read worldstate.
|
|
|
|
*
|
|
|
|
* \return The transition factor of the weather.
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION double CDECL GetWeatherTransitionFactor() noexcept;
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
|
2018-06-07 09:49:12 +00:00
|
|
|
/**
|
|
|
|
* \brief Get the X coordinate of the cell corresponding to the map tile at a certain index in
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
* the read worldstate's map tiles.
|
2018-06-07 09:49:12 +00:00
|
|
|
*
|
2018-07-24 17:14:51 +00:00
|
|
|
* \param index The index of the map tile.
|
2018-06-07 09:49:12 +00:00
|
|
|
* \return The X coordinate of the cell.
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION int CDECL GetMapTileCellX(unsigned int index) noexcept;
|
2018-06-07 09:49:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Get the Y coordinate of the cell corresponding to the map tile at a certain index in
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
* the read worldstate's map tiles.
|
2018-06-07 09:49:12 +00:00
|
|
|
*
|
2018-07-24 17:14:51 +00:00
|
|
|
* \param index The index of the map tile.
|
2018-06-07 09:49:12 +00:00
|
|
|
* \return The Y coordinate of the cell.
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION int CDECL GetMapTileCellY(unsigned int index) noexcept;
|
2018-06-07 09:49:12 +00:00
|
|
|
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
/**
|
|
|
|
* \brief Set the region affected by the next WorldRegionAuthority packet sent.
|
|
|
|
*
|
|
|
|
* \param region The region.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SetAuthorityRegion(const char* authorityRegion) noexcept;
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Set the weather region in the write-only worldstate stored on the server.
|
|
|
|
*
|
|
|
|
* \param region The region.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SetWeatherRegion(const char* region) noexcept;
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Set the weather forcing state in the write-only worldstate stored on the server.
|
|
|
|
*
|
|
|
|
* Players who receive a packet with forced weather will switch to that weather immediately.
|
|
|
|
*
|
|
|
|
* \param forceState The weather forcing state.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SetWeatherForceState(bool forceState) noexcept;
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Set the current weather in the write-only worldstate stored on the server.
|
|
|
|
*
|
|
|
|
* \param currentWeather The current weather.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SetWeatherCurrent(int currentWeather) noexcept;
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Set the next weather in the write-only worldstate stored on the server.
|
|
|
|
*
|
|
|
|
* \param nextWeather The next weather.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SetWeatherNext(int nextWeather) noexcept;
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Set the queued weather in the write-only worldstate stored on the server.
|
|
|
|
*
|
|
|
|
* \param queuedWeather The queued weather.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SetWeatherQueued(int queuedWeather) noexcept;
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Set the transition factor for the weather in the write-only worldstate stored on the server.
|
|
|
|
*
|
|
|
|
* \param transitionFactor The transition factor.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SetWeatherTransitionFactor(double transitionFactor) noexcept;
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
|
2018-06-07 09:49:12 +00:00
|
|
|
/**
|
|
|
|
* \brief Set the world's hour in the write-only worldstate stored on the server.
|
2018-05-15 17:58:09 +00:00
|
|
|
*
|
|
|
|
* \param hour The hour.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SetHour(double hour) noexcept;
|
2018-05-15 17:58:09 +00:00
|
|
|
|
|
|
|
/**
|
2018-06-07 09:49:12 +00:00
|
|
|
* \brief Set the world's day in the write-only worldstate stored on the server.
|
2018-05-23 05:31:25 +00:00
|
|
|
*
|
|
|
|
* \param day The day.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SetDay(int day) noexcept;
|
2018-05-23 05:31:25 +00:00
|
|
|
|
|
|
|
/**
|
2018-06-07 09:49:12 +00:00
|
|
|
* \brief Set the world's month in the write-only worldstate stored on the server.
|
2018-05-15 17:58:09 +00:00
|
|
|
*
|
|
|
|
* \param month The month.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SetMonth(int month) noexcept;
|
2018-05-15 17:58:09 +00:00
|
|
|
|
2018-05-25 00:33:12 +00:00
|
|
|
/**
|
2018-06-07 09:49:12 +00:00
|
|
|
* \brief Set the world's year in the write-only worldstate stored on the server.
|
2018-05-25 00:33:12 +00:00
|
|
|
*
|
|
|
|
* \param year The year.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SetYear(int year) noexcept;
|
2018-05-25 00:33:12 +00:00
|
|
|
|
2018-05-24 11:02:04 +00:00
|
|
|
/**
|
2018-06-07 09:49:12 +00:00
|
|
|
* \brief Set the world's days passed in the write-only worldstate stored on the server.
|
2018-05-24 11:02:04 +00:00
|
|
|
*
|
|
|
|
* \param daysPassed The days passed.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SetDaysPassed(int daysPassed) noexcept;
|
2018-05-24 11:02:04 +00:00
|
|
|
|
2018-05-15 17:58:09 +00:00
|
|
|
/**
|
2018-06-07 09:49:12 +00:00
|
|
|
* \brief Set the world's time scale in the write-only worldstate stored on the server.
|
2018-05-15 17:58:09 +00:00
|
|
|
*
|
|
|
|
* \param pid The player ID.
|
2018-05-23 05:31:25 +00:00
|
|
|
* \param timeScale The time scale.
|
2018-05-15 17:58:09 +00:00
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SetTimeScale(double timeScale) noexcept;
|
2018-05-24 06:38:06 +00:00
|
|
|
|
2018-05-27 13:05:40 +00:00
|
|
|
/**
|
2018-06-07 09:49:12 +00:00
|
|
|
* \brief Set the collision state for other players in the write-only worldstate stored
|
|
|
|
* on the server.
|
2018-05-27 13:05:40 +00:00
|
|
|
*
|
|
|
|
* \param state The collision state.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SetPlayerCollisionState(bool state) noexcept;
|
2018-05-27 13:05:40 +00:00
|
|
|
|
|
|
|
/**
|
2018-06-07 09:49:12 +00:00
|
|
|
* \brief Set the collision state for actors in the write-only worldstate stored on the
|
|
|
|
* server.
|
2018-05-27 13:05:40 +00:00
|
|
|
*
|
|
|
|
* \param state The collision state.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SetActorCollisionState(bool state) noexcept;
|
2018-05-27 13:05:40 +00:00
|
|
|
|
|
|
|
/**
|
2018-06-07 09:49:12 +00:00
|
|
|
* \brief Set the collision state for placed objects in the write-only worldstate stored
|
|
|
|
* on the server.
|
2018-05-27 13:05:40 +00:00
|
|
|
*
|
|
|
|
* \param state The collision state.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SetPlacedObjectCollisionState(bool state) noexcept;
|
2018-05-27 13:05:40 +00:00
|
|
|
|
|
|
|
/**
|
2018-06-07 09:49:12 +00:00
|
|
|
* \brief Whether placed objects with collision turned on should use actor collision, i.e.
|
|
|
|
* whether they should be slippery and prevent players from standing on them.
|
2018-05-27 13:05:40 +00:00
|
|
|
*
|
|
|
|
* \param useActorCollision Whether to use actor collision.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL UseActorCollisionForPlacedObjects(bool useActorCollision) noexcept;
|
2018-05-27 13:05:40 +00:00
|
|
|
|
2018-06-28 01:53:00 +00:00
|
|
|
/**
|
|
|
|
* \brief Add a refId to the list of refIds for which collision should be enforced
|
|
|
|
* irrespective of other settings.
|
|
|
|
*
|
|
|
|
* \param refId The refId.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL AddEnforcedCollisionRefId(const char* refId) noexcept;
|
2018-06-28 01:53:00 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Clear the list of refIdsd for which collision should be enforced irrespective
|
|
|
|
* of other settings.
|
|
|
|
*
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL ClearEnforcedCollisionRefIds() noexcept;
|
2018-06-28 01:53:00 +00:00
|
|
|
|
2018-06-28 00:48:16 +00:00
|
|
|
/**
|
|
|
|
* \brief Save the .png image data of the map tile at a certain index in the read worldstate's
|
|
|
|
* map changes.
|
|
|
|
*
|
2018-07-24 17:14:51 +00:00
|
|
|
* \param index The index of the map tile.
|
2018-06-28 00:48:16 +00:00
|
|
|
* \param filePath The file path of the resulting file.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SaveMapTileImageFile(unsigned int index, const char *filePath) noexcept;
|
2018-06-28 00:48:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Load a .png file as the image data for a map tile and add it to the write-only worldstate
|
|
|
|
* stored on the server.
|
|
|
|
*
|
|
|
|
* \param cellX The X coordinate of the cell corresponding to the map tile.
|
|
|
|
* \param cellY The Y coordinate of the cell corresponding to the map tile.
|
|
|
|
* \param filePath The file path of the loaded file.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL LoadMapTileImageFile(int cellX, int cellY, const char* filePath) noexcept;
|
2018-06-28 00:48:16 +00:00
|
|
|
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
/**
|
|
|
|
* \brief Send a WorldRegionAuthority packet establishing a certain player as the only one who
|
|
|
|
* should process certain region-specific events (such as weather changes).
|
|
|
|
*
|
|
|
|
* It is always sent to all players.
|
|
|
|
*
|
|
|
|
* \param pid The player ID attached to the packet.
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SendWorldRegionAuthority(unsigned short pid) noexcept;
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
|
2018-05-24 06:38:06 +00:00
|
|
|
/**
|
2018-06-07 09:49:12 +00:00
|
|
|
* \brief Send a WorldMap packet with the current set of map changes in the write-only
|
|
|
|
* worldstate.
|
2018-05-24 06:38:06 +00:00
|
|
|
*
|
2018-06-07 09:49:12 +00:00
|
|
|
* \param pid The player ID attached to the packet.
|
|
|
|
* \param broadcast Whether this packet should be sent only to the attached player
|
|
|
|
* or to all players on the server.
|
2018-05-24 06:38:06 +00:00
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SendWorldMap(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
|
2018-05-15 17:58:09 +00:00
|
|
|
|
2018-05-27 13:05:40 +00:00
|
|
|
/**
|
2018-06-07 09:49:12 +00:00
|
|
|
* \brief Send a WorldTime packet with the current time and time scale in the write-only
|
|
|
|
* worldstate.
|
2018-05-27 13:05:40 +00:00
|
|
|
*
|
2018-06-07 09:49:12 +00:00
|
|
|
* \param pid The player ID attached to the packet.
|
2018-07-07 15:29:31 +00:00
|
|
|
* \param sendToOtherPlayers Whether this packet should be sent to players other than the
|
|
|
|
* player attached to the packet (false by default).
|
2018-07-07 17:16:36 +00:00
|
|
|
* \param skipAttachedPlayer Whether the packet should skip being sent to the player attached
|
|
|
|
* to the packet (false by default).
|
2018-06-07 09:49:12 +00:00
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SendWorldTime(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
|
2018-06-07 09:49:12 +00:00
|
|
|
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
/**
|
|
|
|
* \brief Send a WorldWeather packet with the current weather in the write-only worldstate.
|
|
|
|
*
|
|
|
|
* \param pid The player ID attached to the packet.
|
|
|
|
* \param sendToOtherPlayers Whether this packet should be sent to players other than the
|
|
|
|
* player attached to the packet (false by default).
|
|
|
|
* \param skipAttachedPlayer Whether the packet should skip being sent to the player attached
|
|
|
|
* to the packet (false by default).
|
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SendWorldWeather(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
|
[General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e226061d72f7b8931b8d4192a5327f47 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.
My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.
However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
2018-07-21 02:20:26 +00:00
|
|
|
|
2018-06-07 09:49:12 +00:00
|
|
|
/**
|
|
|
|
* \brief Send a WorldCollisionOverride packet with the current collision overrides in
|
|
|
|
* the write-only worldstate.
|
|
|
|
*
|
|
|
|
* \param pid The player ID attached to the packet.
|
2018-07-07 15:29:31 +00:00
|
|
|
* \param sendToOtherPlayers Whether this packet should be sent to players other than the
|
|
|
|
* player attached to the packet (false by default).
|
2018-07-07 17:16:36 +00:00
|
|
|
* \param skipAttachedPlayer Whether the packet should skip being sent to the player attached
|
|
|
|
* to the packet (false by default).
|
2018-05-27 13:05:40 +00:00
|
|
|
* \return void
|
|
|
|
*/
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL SendWorldCollisionOverride(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
|
2018-05-27 13:05:40 +00:00
|
|
|
|
2018-07-12 23:33:50 +00:00
|
|
|
|
|
|
|
// All methods below are deprecated versions of methods from above
|
|
|
|
|
2018-12-24 20:36:57 +00:00
|
|
|
EXPORT_APIFUNCTION void CDECL ReadLastWorldstate() noexcept;
|
|
|
|
EXPORT_APIFUNCTION void CDECL CopyLastWorldstateToStore() noexcept;
|
2018-12-09 06:36:33 +00:00
|
|
|
}
|
2018-05-15 17:58:09 +00:00
|
|
|
|
|
|
|
#endif //OPENMW_WORLDSTATEAPI_HPP
|