Skip to content

Repository files navigation

Welwise Hub Example Project

The project is a sample multiplayer WebGL hub built on the Welwise SDK, made with Unity 2022.3.30f1. It brings all the hub modules together in one playable project, so third-party developers can see how to plug them into their own games

Players walk around a shared online space: they chat, use emotes, customize their character, buy items, get pets and play mini-games. Meanwhile, bots wander between points of interest


What a player can do

  1. Move with the keyboard or a mobile joystick - the hub also works on phones in the browser
  2. Talk in the chat with chat zones and emoji; messages also show above the player
  3. Change their nickname, adjust clothes and colors, pick a pet
  4. Choose and play emotes from a radial menu
  5. Spend soft and hard currency in the shop
  6. Play mini-games: Block Tower, Doodle Jump, Flappy Bird and Helicopter
  7. Claim daily rewards, enter portals and go through the tutorial, where arrows show the way

Modules

All modules live in Assets/MainHub/Modules, and each has its own README with a step-by-step guide on adding it to another project

  1. WelwiseChatModule - chat with an authoritative server, chat zones and a banned-word filter
  2. WelwiseEmotionsModule - choosing, saving and playing emotes online
  3. WelwiseHubBotsModule - server-side bots on NavMesh: they walk between portals, the bar and the shop, play emotes, and change their nickname and appearance
  4. WelwiseMiniGamesModule - four mini-games, each with its own scene, assembly and reward range
  5. WelwisePetsModule - pet selection synced through the server
  6. WelwiseCurrenciesModule - soft and hard currency, stored through the SDK's player data
  7. WelwiseItemInShopModule - shared base for shop items: popups, buttons and syncing the selection
  8. WelwiseClothesSharedModule, WelwiseLoadingClothesModule, WelwiseChangingClothesModule - clothes on skinned meshes, changing clothing and skin colors
  9. WelwiseChangingNicknameModule, WelwiseNicknameSharedModule - nickname changes validated on the server
  10. WelwiseCharacterModule - movement, camera, joystick, mobile HUD and device detection
  11. WelwiseChangingAnimationModule - spots where the player triggers an animation, synced between clients
  12. WebGLMobileKeyboardModule - native mobile keyboard for input fields in WebGL, also available as a separate repository
  13. WelwiseUICircleItemModule - a generic radial menu
  14. WelwiseDailyModule - daily rewards popup
  15. WelwiseSharedModule - shared base: a lightweight DI container, event bus, loading from Addressables or Resources, helpers for UI, networking and localization
  16. WelwiseHubExampleModule - the hub itself: scenes, bootstrap and the game state machine

Networking

  1. FishNet with the Bayou WebSocket transport, over WSS in builds - this is how browser clients connect to the server
  2. Authoritative server: chat, emotes, nicknames, pets, currency and bots are all decided on the server, and clients get the results through FishNet broadcasts
  3. Dedicated server: a separate Linux build with the SERVER define. The port is read from network_settings.json next to the server build, 7777 by default

Architecture

  1. Modules split by role: each has separate Client, Server and Shared assemblies, so server logic never ships to the browser
  2. Explicit composition root: the ServicesScope classes create and wire up all services through a lightweight DI container
  3. Game state machine: Bootstrap → Initialization → Hub → Reconnection
  4. MVC / MVP: logic is split into controllers, views, models, factories and provider services
  5. ScriptableObject configs for items, pets, mini-games and everything else
  6. Addressables with a Resources fallback: switched by the ADDRESSABLES define, and assets are moved between them in the Editor - Tools/WelwiseHubExample/Settings
  7. Async code on UniTask, animations on DOTween

How to run

  1. Open the project in Unity 2022.3.30f1
  2. Open the Assets/MainHub/Modules/WelwiseHubExampleModule/Runtime/Shared/Scenes/Initial.unity scene
  3. SDK settings are in Assets/Resources/sdk_settings.json. In the Editor the SDK modules run on mocks, so no backend is needed
  4. The client reads the server address from Assets/StreamingAssets/network_settings.json. To run the server and client side by side, open a second Editor through ParrelSync

Build scenes: Initial, HubScene. WebGL template: Assets/WebGLTemplates/Welwise SDK


Stack

Unity 2022.3 LTS, C#, WebGL, FishNet, Bayou, Welwise SDK, UniTask, DOTween, Addressables, Unity Localization, Shader Graph, ParrelSync, NavMesh

The repository includes third-party assets under their own licenses: FishNet, Bayou, ParrelSync, Epic Toon FX and ZerinLabs CartoonSky. The Welwise SDK is installed from Welwise-Games/WelwiseGamesSDK


Happy to hear any feedback or questions! :)

About

Multiplayer WebGL hub on FishNet: chat, emotes, bots, mini-games, dedicated server

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages