Md. Touhidur Rahman fdc7733054
Multiplayer Chat Support (#13599)
* basic chat ui

* improve chat infustructure

* implement websockets

* fix TODO crash

* delkt fixes & minor refactoring

* refactor civColor lookup

* set `ChatPopup` `Scrollability` to `None`

* refactor `chatLabel`

* move `ChatButton` update actions to its own file and refactor `WorldScreen`

* refactor `ChatPopup` - make it simple

* add `ChatPopup` layout explaination

* make `CloseButton` an `ImageButton`

* update .gitignore, try to ensure correct civName, close previous session on reconnect

* better `Message.Join()` usage

* update .gitignore entry for lasterror.txt

* improve chat message handling and color visibility

* refactor chat auth header handling and event filtering

* connection reliability improvements

* global messages for System and Server messages

* set `chatTable` cell defaults

* make flow work. remove internal keywords. fix chain job cancellation bug. extensively tested.

Made flow work, SomeHow.
Remove `internal` keywords, problematic.

One reconnect cancels another. This cancellation triggers another reconnect. Thus we get stuck in an infinite reconnect loop.

This was fixed by the force flag.

* added `Color.coerceLightnessAtLeast` and many comments

* faster `Color.coerceLightnessAtLeast`

* wait for `session` in `ChatWebSocketManager.requestMessageSend()`

* refactor some imports and simplify `ChatButton.updatePosition`

* move `Color.coerceLightnessAtLeast` with other `Color` extension functions

* remove `Event` suffix from event names and move events and files to better locations

* refactor multiplayer event handling and move event classes

Moved ServerUrlChanged, UserIdChanged, and PasswordChanged event classes from multiplayer/storage to models/metadata. Updated event dispatch logic for userId, server URL, and password changes to be handled within GameSettingsMultiplayer. Introduced ServerFeatureSetChanged event for feature set updates. Refactored usages and imports across chat, UI, and multiplayer modules to reflect these changes and removed redundant event dispatches.

* move `ServerFeatureSetChanged` to `ServerFeatureSet.kt`

* add chat and send icons, update atlas and chat ui elements

* make `Enter` key press work

* remove `yield()` calls

* refactor `WebSocket` error handling conditional branches

* remove unnecessary `ChatMessageSendRequested` event

* remove flow and reintroduce `yeild()`

* add translatable lines to `English.properties` and call `tr()`

* increase first session waiting time to `RECONNECT_TIME_MS * 2`

* add dynamically translatable global messages

* handle errors on `GlobalScope.launch`

* refactor `chatUrl` to `getChatUrl()` and remove the `yeild()` call after `delay()`

* add `ChatRestartException`

* implemented exponential backoff

* refactor chat error logging in `handleWebSocketThrowables`

* refactor `globalMessages` and revert unnecessary changes

* mark global messages as one time

* mark global messages that I forgot about as one time

* remove unnecessary event usage

* some necessary refactorings

1. start / stop chat based on `ChatButton` visibilty
2. fix `restart()` calls with `force = true` where needed
3. remove `try-catch` block from `restart()`

* fix websocket reconnection issues

* fix missing `}`

* fix problems for real

* fix import

* use `maxOf()`

* minor refactorings

* add support for `UncivServer.jar`

* get rid of `EventBus`

* rename and increase value to `60%` for `CIVNAME_COLOR_MIN_LIGHTNESS`

* get rid of setters

* fix 1

* fix `checkServerStatus()` not calling `setServer()`

* fix some issues

* fix crashes and remove redundant `ChatMessageReceived` data class

* fix some reviews

* remove `re-established` notification

* set type for `globalMessages` to `Queue`

* improve stability of `UncivServer.jar`
2025-07-23 22:20:41 +03:00
2025-07-23 22:20:41 +03:00
2025-07-21 23:45:43 +03:00
2025-07-23 22:20:41 +03:00
2025-07-21 23:47:17 +03:00
2025-07-23 22:20:41 +03:00
2024-08-08 14:24:24 +03:00
2025-07-23 22:20:41 +03:00
2025-07-21 23:47:17 +03:00
2025-04-15 19:35:11 +03:00

Unciv - Civ V remake for Android & Desktop

Google Play F-Droid itch.io Flathub AUR pi-apps Brew Chocolatey scoop-games

Build status Discord

What is this?

An open source, moddability-focused Android and Desktop remake of Civ V, made with LibGDX

Is this any good?

Depends what you're looking for. If you're in the market for high-res graphics, amazing soundtracks, animations etc, I highly recommend Firaxis's Civ-V-like game, "Civilization V".

If you want a small, fast, moddable, FOSS, in-depth 4X that can still run on a potato, you've come to the right place :)

How do I install?

What's the roadmap?

In this order:

  • Polish!
  • G&K mechanics - espionage, small other changes (see #4697)
  • BNW mechanics - trade routes, world congress, etc.

Contributing

Programmers start here!

Translators start here! Language completion status here

Modders start here!

You can join us in any of the open issue, or work on improving anything you want - once you're finished, issue a pull request and it'll go into the next version!

If not, you can help by spreading the word - vote for Unciv where you can, mention it on Reddit or Twitter etc, and help us with new ideas of how to get the word out!

FAQ

How about iOS?

I'm not planning on it. It means paying money to Apple, yet another release path, and since I don't have an iOS device it means I can't test it properly.

Steam release?

Steam has decided that they don't want to host Unciv, they probably don't want to risk legal issues with Firaxis (although those should be non-existent, see below)

Will you implement {feature}?

If it's in the original Civ V, then yes!

If not, then the feature won't be added to the base game - possibly it will be added as a way to mod the game, which is constantly expanding

Why not? This is its own game, why not add features that weren't in Civ V?

Having a clear vision is important for actually getting things done.

Anyone can make a suggestion. Not all are good, viable, or simple. Not many can actually implement stuff.

As an open source project, this stuff is done in our spare time, of which there isn't much.

We need a clear-cut criteria to decide what to work on and what not to work on.

Will you implement Civ VI?

Considering how long it took to get this far, no.

How can I learn to play? Where's the wiki?

All the tutorial information is available in-game at menu > civilopedia > tutorials

All the information is included in the amazing Civ V wiki

Since this is a Civ V clone, you can search Google for how to play Civ V and there are loads of answers =)

Alternatively, you could join us on Discord and ask there =D

According to the US Copyright Office FL-108, intellectual property rights do not apply to mechanics - as I'm sure you know, there are a billion Flappy Bird knockoffs

It is definitely illegal:

  • To use any assets from the original game (images, sound etc) - they belong to Firaxis

It is probably illegal (no solid sources on this):

  • To use the Civilization name
  • To impersonate the Civ games (so calling yourself civi|zation with a similar logo, for instance)

Interestingly, Civilization is a registered trademark, but it looks like it's only that particular logo which is trademarked, so technically you could make another game called "Civilization" and it'll stick. In any case we're not going there :)

Run with Docker Docker

If you have docker compose installed:

$ docker compose build && docker compose up

and then goto http://localhost:6901/vnc.html?password=headless

If just docker:

$ docker build . -t unciv && docker run -d -p 6901:6901 -p 5901:5901 unciv

Or just use our already built one:

$ docker run -d -p 6901:6901 -p 5901:5901 ghcr.io/yairm210/unciv

and then goto http://localhost:6901/vnc.html?password=headless

Credits and 3rd parties

Languages
Kotlin 99.4%
OpenEdge ABL 0.5%