[PATCH] Add tes3mp

  • Open
  • quality assurance status badge
Details
One participant
  • Michal Atlas
Owner
unassigned
Submitted by
Michal Atlas
Severity
normal
M
M
Michal Atlas wrote on 30 Nov 2022 04:59
(address . guix-patches@gnu.org)(name . Michal Atlas)(address . michal_atlas+git@posteo.net)
20221130035903.30800-1-michal_atlas+git@posteo.net
* gnu/packages/game-development.scm (tes3mp-server, tes3mp, tes3mp-corescripts, crabnet): New variables
* gnu/packages/game-development.scm (tes3mp-common-arguments): New private variable

Hello,

here is a patch to add Morrowind Multiplayer packages.
I wasn't sure if the client and server should be outputs of one package,
or separated, but there were enough differences, so I added them separately.

The server setup is also not entirely plug&play so I figured I'd mention that in the description,
I'm unsure as to where else to put it, and it should be included,
since the original wiki isn't excellent and
doesn't talk about the option of running the binary from a different directory than the data is in.

Lastly, I'm unsure if the set-default-server-home phase should exist,
either the server starts and then kicks a player the moment they are supposed to be saved to disk
(since the store isn't writeable),
or the server just errors out right away if the default config isn't overriden,
neither sounds like a good outcome,
I guess we shouldn't include it since it might end up being confusing.

Hopefully this patch isn't too bad.
Cheers!

---
gnu/packages/game-development.scm | 180 ++++++++++++++++++++++++++++++
1 file changed, 180 insertions(+)

Toggle diff (213 lines)
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 66d0ca316f..8136b22b3e 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -53,6 +53,8 @@ (define-module (gnu packages game-development)
#:use-module (guix git-download)
#:use-module (guix svn-download)
#:use-module (guix utils)
+ #:use-module (guix build-system)
+ #:use-module (guix build-system copy)
#:use-module (guix build-system cmake)
#:use-module (guix build-system gnu)
#:use-module (guix build-system python)
@@ -66,6 +68,7 @@ (define-module (gnu packages game-development)
#:use-module (gnu packages build-tools)
#:use-module (gnu packages compression)
#:use-module (gnu packages check)
+ #:use-module (gnu packages commencement)
#:use-module (gnu packages curl)
#:use-module (gnu packages documentation)
#:use-module (gnu packages fltk)
@@ -75,6 +78,7 @@ (define-module (gnu packages game-development)
#:use-module (gnu packages fribidi)
#:use-module (gnu packages dbm)
#:use-module (gnu packages gawk)
+ #:use-module (gnu packages gcc)
#:use-module (gnu packages gettext)
#:use-module (gnu packages gl)
#:use-module (gnu packages glib)
@@ -2838,3 +2842,179 @@ (define-public recastnavigation
progresses the level, or you may regenerate tiles as the world changes.")
(home-page "https://github.com/recastnavigation/recastnavigation")
(license license:zlib))))
+
+(define-public crabnet
+ (package
+ (name "crabnet")
+ (version "1.001")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/TES3MP/CrabNet")
+ (commit "19e66190e83f53bcdcbcd6513238ed2e54878a21")))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0l7sqz35jb5m40zqm82wpy1wvdwpjq4h7a5i9yyyk8174j8qk1jq"))))
+ (build-system cmake-build-system)
+ (arguments
+ (list
+ #:tests? #f))
+ (synopsis "CrabNet is a TES3MP specific fork of RakNet")
+ (description "CrabNet is a cross platform, open source,
+C++ networking engine for game programmers")
+ (home-page "https://github.com/TES3MP/CrabNet")
+ (license license:bsd-2)))
+
+(define-public tes3mp-corescripts
+ (package
+ (name "tes3mp-corescripts")
+ (version "0.8.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/TES3MP/CoreScripts")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "01p64494gsqyxx3v2nya5lfj9xyqz3bcviap257x2c0isapx4gzj"))))
+ (build-system copy-build-system)
+ (arguments
+ (list
+ #:install-plan #~`(("data" "/share/tes3mp/data")
+ ("lib" "/share/tes3mp/lib")
+ ("scripts" "/share/tes3mp/scripts"))))
+ (synopsis "Serverside Lua scripts used to implement core functionality in TES3MP")
+ (description "These are the scripts used to implement most
+of the essential server logic in TES3MP,
+including gameplay adjustments for multiplayer
+as well as state saving and loading")
+ (home-page "https://github.com/TES3MP/CoreScripts")
+ (license license:expat)))
+
+(define tes3mp-common-arguments
+ #~(list "-DBUILD_OPENCS=OFF"
+ "-DBUILD_BSATOOL=OFF"
+ "-DBUILD_ESMTOOL=OFF"
+ "-DBUILD_ESSIMPORTER=OFF"
+ "-DBUILD_LAUNCHER=OFF"
+ "-DBUILD_MWINIIMPORTER=OFF"
+ "-DBUILD_MYGUI_PLUGIN=OFF"
+ "-DBUILD_NIFTEST=OFF"
+ "-DBUILD_WIZARD=OFF"
+ (string-append
+ "-DLuaJit_INCLUDE_DIR="
+ #$(file-append
+ luajit
+ (string-append "/include/luajit-"
+ (package-version luajit))))
+ (string-append
+ "-DRakNet_LIBRARY_DEBUG="
+ #$(file-append crabnet "/build/lib/libRakNetLibStatic.a"))
+ "-DOPENMW_USE_SYSTEM_RECASTNAVIGATION=ON"))
+
+(define-public tes3mp-server
+ (package
+ (name "tes3mp-server")
+ (version "0.8.1")
+ (propagated-inputs (list tes3mp-corescripts))
+ (inputs (list
+ boost
+ crabnet
+ lua-5.1
+ luajit
+ openscenegraph
+ sdl2
+ lz4
+ ;; OpenGl and SDL2 are hard dependencies even for the server
+ ;; unless we do some patching
+ mesa
+ recastnavigation))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/TES3MP/TES3MP")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "09gd1zia27fa5phz0xx375y89rdsvf9pgfmw4n38pp108gh6002c"))))
+ (arguments
+ (list
+ #:tests? #f
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-before 'configure 'set-default-server-home
+ (lambda _
+ ; This lets the server always at least start up
+ (substitute* "files/tes3mp/tes3mp-server-default.cfg"
+ (("home = ./server")
+ (string-append
+ "home = "
+ #$(file-append tes3mp-corescripts "/share/tes3mp")))))))
+ #:configure-flags
+ #~(cons* "-DBUILD_OPENMW_MP=ON"
+ "-DBUILD_BROWSER=OFF"
+ "-DBUILD_OPENMW=OFF"
+ #$tes3mp-common-arguments)))
+ (build-system (build-system-with-c-toolchain
+ cmake-build-system `(("toolchain" ,gcc-toolchain-8))))
+ (synopsis "Multiplayer for OpenMW, a reimplementation of
+The Elder Scrolls 3: Morrowind's engine (Server Package)")
+ (description "TES3MP is a project adding multiplayer functionality to OpenMW,
+an open-source game engine that supports playing
+\"The Elder Scrolls III: Morrowind\" by Bethesda Softworks.
+To run the server copy /share/tes3mp/ into $XDG_CONFIG_HOME/openmw/
+(must be writeable),
+then copy /etc/openmw/tes3mp-server-default.cfg into this new directory
+under the name tes3mp-server.cfg.
+Set home to the $XDG_CONFIG_HOME/openmw/ directory, now run tes3mp-server and enjoy.
+Note that all server data is kept in this directory.")
+ (home-page "tes3mp.com")
+ (license license:gpl3)))
+
+(define-public tes3mp
+ (package
+ (name "tes3mp")
+ (version "0.8.1")
+ (source (package-source tes3mp-server))
+ (build-system cmake-build-system)
+ (inputs (list
+ boost
+ bullet
+ crabnet
+ ffmpeg
+ lz4
+ mesa
+ mygui
+ openal
+ openscenegraph
+ qtbase-5
+ recastnavigation
+ sdl2))
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ ;; The check always fails and reports
+ ;; version too old
+ (add-before 'configure 'remove-ffmpeg-version-check
+ (lambda _
+ (substitute* "CMakeLists.txt"
+ (("NOT FFVER_OK")
+ "FFVER_OK")))))
+ #:tests? #f
+ #:configure-flags
+ #~(cons* "-DBUILD_OPENMW_MP=OFF"
+ "-DBUILD_OPENMW=ON"
+ "-DBUILD_BROWSER=ON"
+ #$tes3mp-common-arguments)))
+ (synopsis "Multiplayer for OpenMW, a reimplementation of
+The Elder Scrolls 3: Morrowind's engine (Client Package)")
+ (description "TES3MP is a project adding multiplayer functionality to OpenMW,
+an open-source game engine that supports playing
+\"The Elder Scrolls III: Morrowind\" by Bethesda Softworks.
+For the setup wizard and general openmw tooling, use the openmw package.")
+ (home-page "tes3mp.com")
+ (license license:gpl3)))

base-commit: b4be83b6ac7e2139bec5d3eaafcf8af6cbe50856
--
2.38.1
M
M
Michal Atlas wrote on 1 Dec 2022 00:31
(address . 59716@debbugs.gnu.org)(name . Michal Atlas)(address . michal_atlas+git@posteo.net)
20221130233139.13425-1-michal_atlas+git@posteo.net
* gnu/packages/game-development.scm (set-openmw-commit-version): New private-variable
* gnu/packages/game-development.scm (set-commit-version): New phase in tes3mp and tes3mp-server

---

Sorry,
I didn't notice that the official release tarball was from
tag `tes3mp-0.8.1` and not `0.8.1`.

On that note, I forced in version information to be able to
connect to standard 0.8.1 server instances from the binary release.
They'd refuse connection due to "version mismatch" otherwise.

Hardcoding the COMMITHASH is certainly ugly,
but the TAGHASH probably needs to be as well anyways, since
cmake normally generates it by running `git rev-list --tags --max-count=1` on the repo,
which I'm not sure if we want to do or can do in the build itself,
this at least ensures that the correct tag is always chosen.

Cheers.

---
gnu/packages/game-development.scm | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)

Toggle diff (56 lines)
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 8136b22b3e..d1de36f93d 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -2914,6 +2914,16 @@ (define tes3mp-common-arguments
#$(file-append crabnet "/build/lib/libRakNetLibStatic.a"))
"-DOPENMW_USE_SYSTEM_RECASTNAVIGATION=ON"))
+(define set-openmw-commit-version
+ #~(substitute* "CMakeLists.txt"
+ ;; Used for version compatibility checks
+ ;; Commit the project was built with
+ (("set\\(OPENMW_VERSION_COMMITHASH \"\"\\)")
+ "set(OPENMW_VERSION_COMMITHASH \"68954091c54d0596037c4fb54d2812313b7582a1\")")
+ ;; points to 0.8.0 in 0.8.1 Release
+ (("set\\(OPENMW_VERSION_TAGHASH \"\"\\)")
+ "set(OPENMW_VERSION_TAGHASH \"000e8724cacaf0176f6220de111ca45098807e78\")")))
+
(define-public tes3mp-server
(package
(name "tes3mp-server")
@@ -2935,16 +2945,18 @@ (define-public tes3mp-server
(method git-fetch)
(uri (git-reference
(url "https://github.com/TES3MP/TES3MP")
- (commit version)))
+ (commit (string-append "tes3mp-" version))))
(file-name (git-file-name name version))
(sha256
(base32
- "09gd1zia27fa5phz0xx375y89rdsvf9pgfmw4n38pp108gh6002c"))))
+ "16k3l2ky0wciy0xaxxm1kvl1z3725l6ikirldiycjhrvrkidbxpk"))))
(arguments
(list
#:tests? #f
#:phases
#~(modify-phases %standard-phases
+ (add-before 'configure 'set-commit-version
+ (lambda _ #$set-openmw-commit-version))
(add-before 'configure 'set-default-server-home
(lambda _
; This lets the server always at least start up
@@ -2997,6 +3009,8 @@ (define-public tes3mp
(list
#:phases
#~(modify-phases %standard-phases
+ (add-before 'configure 'set-commit-version
+ (lambda _ #$set-openmw-commit-version))
;; The check always fails and reports
;; version too old
(add-before 'configure 'remove-ffmpeg-version-check

base-commit: b4be83b6ac7e2139bec5d3eaafcf8af6cbe50856
prerequisite-patch-id: d05b134d12be8b8184cd42f0d7cd435b0718894f
--
2.38.1
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 59716@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 59716
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch