ethanmoffat / EndlessClient

An open source client for Endless Online written in C#
MIT License
34 stars 16 forks source link
endless-online

EndlessClient

Build Status Nuget

An open source client for Endless Online written in C#

License Update

As of 2020-05-09, this project is relicensed under the MIT license. Older versions of the code are still licensed under the GNU GPLv2 license. The tag gplv2 has been added to the final commit for which this project is licensed under the GPLv2.

Jump to:

Getting started

Dependencies

Source builds require Visual Studio, the .Net 6.0 SDK, and the .Net 3.1 runtime (for building content with the MonoGame content builder pipeline tool). Other dependencies are installed via Nuget. MonoGame no longer needs to be installed ahead of time!

.Net 6.0 runtime is required to run the pre-built binary.

Pre-built binary

See releases on GitHub for Linux and Windows binaries. .Net 6.0 runtime must be installed.

How to play

Download the appropriate release for your platform, then copy the data directories (data, gfx, jbox, mfx, sfx) from whichever client you normally use to EndlessClient's unzip location. Run EndlessClient by double-clicking the icon (any platform) or running ./EndlessClient (Linux).

Building from source

After installing, clone (or fork+clone) this repository locally and open the solution in your IDE of choice for your platform.

⚠️ If you have previously built EndlessClient, you mean need to clear your dotnet tool cache and nuget package cache

Run the following commands:

  • dotnet nuget locals all --clear
  • Windows: rmdir -recurse -force $env:USERPROFILE\\.dotnet\\toolResolverCache
  • Linux: rm -rf ~/.dotnet/toolResolverCache

⚠️ If you get build errors due to formatting

Run the following commands:

  • Windows: dotnet format EndlessClient.sln
  • Linux: dotnet format EndlessClient.Linux.sln

Building on Mac

  1. Download and install the .NET 6.0 SDK (x64).
  2. Link the binary to so it's in path sudo ln -s /usr/local/share/dotnet/x64/dotnet /usr/local/bin/dotnet
  3. Install XCode from the AppStore
  4. Run dotnet build /p:PublishReadyToRun=false /p:TieredCompilation=false --self-contained EndlessClient
  5. The build will fail due to a using alias already being declared
  6. Run echo '' > EndlessClient/obj/Debug/net6.0-macos/osx-x64/EndlessClient.GlobalUsings.g.*.generated.cs
  7. Run the build again dotnet build /p:PublishReadyToRun=false /p:TieredCompilation=false --self-contained EndlessClient

Mac errors

Problem: error NETSDK1139: The target platform identifier macos was not recognized. Solution: run the command sudo dotnet workload restore EndlessClient/EndlessClient.csproj which will install the macos workload for you.

Todo list

See the Github issues for planned features. Anything marked with the 'in progress' label is actively being worked on.

New features (also todo)

Here's a working list of things I want to add that would be additional features on top of the original client specs:

Changes From Original Client

Command-line arguments

--host Overrides the server set in the config file with a different value. Convenient for testing against different servers from Visual Studio, since the build process will overwrite the configuration file in the output directory.

--port Overrides the port set in the config file with a different value.

--version Overrides the version set in the config file or hard-coded into the client. Convenient for connecting to different servers that might require different version numbers.

--account_delay_ms Sets the delay when creating an account. Some servers enforce a specific limit. Defaults to 2 seconds if unset.

Version Numbers

For easily switching servers, there's a version number config setting so it isn't limited to the hard-coded value build into the client by default. This can be set by server operators, or you can use the --version command line argument.

Map Transitions

Since the transition was pretty quick between maps, I added a cool little animation that slowly fades tiles in starting from the player and moving outward. This can be disabled in the config file if you don't like it.

Sound Files

Some of the audio files (sfx) from the original client are malformed. The WAV format includes in the header a length of the file in bytes - and for certain files, this length was different than the actual length of the audio data. The original client was able to read these without a problem, as were programs such as Windows Media Player and Audacity. However, the C# code for loading sound in XNA was throwing an exception for these audio files because of the improper length.

Part of the sound processing involves reading the audio data and rewriting the length to the WAV file if the length in the file is incorrect. This modification will occur for any invalid WAV files.

Music files on Linux

Activating background music on linux takes a bit of extra work, due to the fact that the music tracks are all MIDI files. The following process was tested on Ubuntu 22.04 (baremetal) and Ubuntu 23.10 (VM over RDP). ALSA driver is required - this should be included on any modern desktop Ubuntu installation.

  1. Install fluidsynth server and soundfont
    sudo apt-get install -y fluidsynth fluid-soundfont-gm
  2. Test that fluidsynth can play an MFX track
    fluidsynth --audio-driver=alsa /usr/share/sounds/sf2/FluidR3_GM.sf2 mfx/mfx001.mid
  3. Run the fluidsynth server in a separate terminal
    fluidsynth --server --audio-driver=alsa /usr/share/sounds/sf2/FluidR3_GM.sfx
    • Note that you must type quit at the terminal prompt to exit the process cleanly.
  4. Launch EndlessClient with music=on in the config/settings.ini file. Background music should start playing!

For troubleshooting purposes, follow the guide here: http://www.tedfelix.com/linux/linux-midi.html

Resizable Game Display (experimental)

The in-game experience can be modified for larger displays by setting the following configuration options in config/settings.ini:

[SETTINGS]
InGameWidth=1280
InGameHeight=720

This enables "resizable" mode, using the default window size specified. The game window can be further resized. The minimum window size is 640*480.

While resizable mode is enabled, hud panels may be toggled on/off. Multiple hud panels may be visible on-screen at once. Hud panels may also be rearranged by dragging and dropping the panel itself to a different area of the screen. Additionally pressing the keyboard shortcut alt+{num} will toggle the appropriate panel, with inventory = 1, minimap = 2, etc. alt+~ will bring the news panel back up, but this panel is subsequently hidden whenever another panel is toggled.

Removing either of these configuration options or setting them to zero will disable resizable mode and the in-game experience will remain unchanged.

Included Utility Projects

There are a few other projects included with the EndlessClient solution that are designed to make the development process much easier.

Core

The core projects are EndlessClient and the EOLib projects under the "Lib" solution directory. They are the only required projects in order for the game to run.

Test

Any projects with a ".Test" suffix in the name contain unit tests. These will be expanded for as much code coverage as possible.

BatchMap

BatchMap is designed to do batch processing and error correction on the original EMF files. When running EOSERV with the default map files, a number of warning messages during map loading will pop up. BatchMap processes files and corrects these errors so that the output of EOSERV is much less verbose when starting up.

BatchMap corrects for a number of errors, including:

BatchMap can easily be modified to take care of other batch processing tasks, such as dumping out values in map files for debugging or comparison.

BatchPub

BatchPub is designed to do batch processing of items within the EIF file. It can be used to bulk change properties in the pubs based on certain criteria.

EOBot

EOBot has recently been updated with an interpreter to make scripting of bots possible. The scripting language is the unholy offspring of javascript and php (really just inspired by the syntax of those languages). Run EOBot --help without any arguments to see more information on the command-line parameters it expects.

The default behavior of EOBot when not running in script mode is as a TrainerBot. See TrainerBot.cs for more details on the implementation.

EOBot is used by https://www.github.com/ethanmoffat/etheos to execute integration tests against server instances.