Index | Thread | Search

From:
Fabien Romano <fabienromano@gmail.com>
Subject:
Re: update games/recoil-rts
To:
Thomas Frohwein <tfrohwein@fastmail.com>
Cc:
ports@openbsd.org, thfr@openbsd.org
Date:
Sun, 14 Jul 2024 12:14:22 +0100

Download raw body.

Thread
On 13/07/2024 22:29, Thomas Frohwein wrote:
> On Tue, Jul 09, 2024 at 09:56:45PM +0100, Fabien Romano wrote:
>>
>>>
>>> I'm still getting this error after deleting all those files. Seems to
>>> me that there is a missing step, but I find pr-downloader stuff very
>>> opaque... do you have any ideas?:
>>>
>>> Dependent archive "byar chobby test-2934-d9c546c" (resolved to "BYAR Chobby test-2934-d9c546c") not found
>>
>> I also find pr-downloader stuff very opaque. Maybe you also have ~/.spring ?
>>
>> Isolation mode could help to reduce the scope. After spending some time reading
>> I finally understand we could just set --isolation-dir to
>> /usr/local/share/games/spring/ and avoid going crazy with
>> rts/System/FileSystem/DataDirLocater.cpp.
>>
>> There is actualy one setting missing from the official launcher.
>> Not sure what RapidTag is (pr-downloader stuff I guess) but this could be
>> related to your issue.
>>
>>> RapidTagResolutionOrder = repos-cdn.beyondallreason.dev;repos.beyondallreason.dev
>>
>> I raise limits to 8g.
>>
>> I replaced ~/.local/state/Beyond\ All\ Reason with ~/.local/state/BAR, mainly to
>> compare with the official launcher. Both are ok with me.
>>
>> If someone asking, the official launcher is electron based. The two could be
>> compatible to start the game so I choosed ~/.local/state/Beyond\ All\ Reason in
>> first place.
>>
>> The script now append RapidTagResolutionOrder to springsettings.cfg.
>>
>> I also set REVISION so if this works this could go in.
>>
>> Cross fingers. Please send me byar-chobby output if there is an issue.
> 
> I can confirm this works to launch Beyond All Reason on the first run. I can
> log in and spectate an online multiplayer. It downloads maps and engine
> versions as needed which is how the game lobby is designed. (Haven't tested
> singleplayer or active multiplayer yet.)
> 
> One thing I notice is "sync error" showing up regularly while spectating.
> Have you also observed this? According to compilation this could be related
> to the compiler flags being different from the standard Linux build...?

I don't remember any "sync error" but now I see those. No idea yet, maybe I
wasn't carefull enough to notice before.

> A few concerns about the script below though...

Thanks, better.

> This way it doesn't needlessly rewrite the same file every time.

Sure, I don't think they are going to change this any time soon. If that happens
we have to update the script anyway so this is not an issue atm.

> Doesn't this mean that the file will grow with the same line appended with
> every launch?

Spring will read and rewrite springsettings.cfg on each run. It will reorder all
settings and remove duplicates.

I wrote both files this way to ensure settings are updated whatever happens, in
case we want to update them or if the user messes up with those. I don't think
the lobby allows to reset RapidTagResolutionOrder so writing it only once should
be ok. Same for chobby_config.json.

Let me know what you think about the updated README. Using ":stable" doesn't
work anymore so I kept only ":test" examples but I have done only limited testing.


Index: Makefile
===================================================================
RCS file: /cvs/ports/games/recoil-rts/Makefile,v
diff -u -p -r1.7 Makefile
--- Makefile	7 Jul 2024 21:27:10 -0000	1.7
+++ Makefile	14 Jul 2024 11:03:00 -0000
@@ -13,8 +13,9 @@ MN =			1.1
 BLD =			2511
 HASH =			g747f18b
 V =			${MJ}.${MN}pl${BLD}
+REVISION =		0
 # ${IN_ENGINE_V} is what recoil uses/displays internally
-IN_ENGINE_V =           "${MJ}.${MN}-${BLD}-${HASH} BAR${MJ}"
+IN_ENGINE_V =		"${MJ}.${MN}-${BLD}-${HASH} BAR${MJ}"

 # Prefix '0.' to avoid future EPOCH. Upstream has indicated future versioning
 # with YY.MM; once that has happened, remove '0.'
@@ -110,5 +111,9 @@ SUBST_VARS +=		IN_ENGINE_V

 pre-configure:
 	${SUBST_CMD} ${WRKSRC}/rts/build/cmake/ConfigureVersion.cmake
+
+post-install:
+	${SUBST_PROGRAM} ${FILESDIR}/beyond-all-reason \
+		${PREFIX}/bin/beyond-all-reason

 .include <bsd.port.mk>
Index: files/beyond-all-reason
===================================================================
RCS file: files/beyond-all-reason
diff -N files/beyond-all-reason
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/beyond-all-reason	14 Jul 2024 11:03:00 -0000
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+GAME_DIR=~/.local/state/BAR
+CONFIG_FILE=${GAME_DIR}/chobby_config.json
+SETTINGS_FILE=${GAME_DIR}/springsettings.cfg
+DATASIZE="8388608" # 8G
+
+xm_log() {
+	echo -n "$@\nDo you want to run Beyond All Reason anyway?\n\
+(If you don't increase these limits, spring might fail to work properly.)" | \
+		${X11BASE}/bin/xmessage -file - -center -buttons yes:0,no:1 -default no
+}
+
+if [ $(ulimit -Sd) -lt ${DATASIZE} ]; then
+	ulimit -Sd ${DATASIZE} || \
+		xm_log "Cannot increase datasize-cur to at least ${DATASIZE}"
+		[ $? -eq 0 ] || exit
+fi
+
+# setup
+[[ -d ${GAME_DIR} ]] || mkdir -p ${GAME_DIR}
+[[ -f ${CONFIG_FILE} ]] || cat > ${CONFIG_FILE} <<EOF
+{
+  "server": {
+    "address": "server4.beyondallreason.info",
+    "port": 8200,
+    "protocol": "spring",
+    "serverName": "BAR"
+  },
+  "game": "byar"
+}
+EOF
+[[ -f ${SETTINGS_FILE} ]] || cat > ${SETTINGS_FILE} <<EOF
+RapidTagResolutionOrder = repos-cdn.beyondallreason.dev;repos.beyondallreason.dev
+EOF
+
+# update
+PRD_HTTP_SEARCH_URL=https://files-cdn.beyondallreason.dev/find
+PRD_RAPID_USE_STREAMER=false
+PRD_RAPID_REPO_MASTER=https://repos-cdn.beyondallreason.dev/repos.gz
+export PRD_HTTP_SEARCH_URL PRD_RAPID_USE_STREAMER PRD_RAPID_REPO_MASTER
+${TRUEPREFIX}/bin/pr-downloader \
+	--filesystem-writepath ${GAME_DIR} \
+	--download-game byar:test \
+	--download-game byar-chobby:test
+
+# start
+${TRUEPREFIX}/bin/spring --write-dir ${GAME_DIR} \
+	--isolation --isolation-dir ${TRUEPREFIX}/share/games/spring/ \
+	--menu rapid://byar-chobby:test
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/games/recoil-rts/pkg/PLIST,v
diff -u -p -r1.1.1.1 PLIST
--- pkg/PLIST	5 May 2024 17:18:13 -0000	1.1.1.1
+++ pkg/PLIST	14 Jul 2024 11:03:00 -0000
@@ -1,3 +1,4 @@
+bin/beyond-all-reason
 @bin bin/mapcompile
 @bin bin/mapdecompile
 @bin bin/pr-downloader
Index: pkg/README
===================================================================
RCS file: /cvs/ports/games/recoil-rts/pkg/README,v
diff -u -p -r1.1.1.1 README
--- pkg/README	5 May 2024 17:18:13 -0000	1.1.1.1
+++ pkg/README	14 Jul 2024 11:03:00 -0000
@@ -6,39 +6,65 @@ Datasize
 ========

 ${PKGSTEM} needs datasize of at least 4-6G to launch, see login.conf(5) and
-ksh(1).
+ksh(1). Recommended datasize is 8G.
+
+How to play
+===========
+
+${PKGSTEM} itself only provides the building blocks, so in order to run
+anything, you need to add an engine and a lobby. Depending on the lobby you may
+also need to install maps. Each game built on ${PKGSTEM} may have special
+requirements and may depend on different tools to download and install.
+
+https://springrts.com/wiki/Games
+
+Beyond All Reason
+-----------------
+
+https://www.beyondallreason.info/
+
+${PKGSTEM} comes with a helper script named beyond-all-reason.
+
+	$ beyond-all-reason
+
+The script take care of required settings and update to last engine and lobby
+version available before running the game. It will install and run with
+isolation in ~/.local/state/BAR.
+
+Building blocks samples
+=======================
+
+Home directories
+----------------
+
+${PKGSTEM} may install files and settings into:
+
+	1. $XDG_CONFIG_HOME/spring
+	2. ~/.config/spring
+	3. ~/.spring

 Installing Engines
-==================
+------------------

-Different engines are built with ${PKGSTEM}. ${PKGSTEM} itself only provides
-the building blocks, so in order to run anything, you need to add an engine.
 The best known and best supported engines for ${PKGSTEM} are Zero-K and
 Beyond All Reason. For example, install Zero-K this way:

-	$ pr-downloader zk:stable
+	$ pr-downloader zk:test

 And Beyond All Reason:

-	$ pr-downloader byar:stable
+	$ pr-downloader byar:test

 It will then show up as an engine that can be selected in the ${PKGSTEM} GUI.

-Setting up Lobbies
-==================
-
-Running ${PKGSTEM} without a lobby set up will allow testing of maps, engines,
-and settings. To add a lobby, you need to download it and then launch it with:
-
-	1. use `--menu <menu>' argument to spring, or
-
 Installing Lobbies
 ------------------

+Running ${PKGSTEM} without a lobby set up will allow testing of maps, engines,
+and settings.
+
 To install Chobby lobby, run the following:

-	$ pr-downloader chobby:stable	# latest stable version
-		or
 	$ pr-downloader chobby:test	# latest test version

 Then launch it for example with:
@@ -49,7 +75,7 @@ Or set it as the default by adding `Defa
 ~/.config/spring/springsettings.cfg.

 Installing Maps
-===============
+---------------

 Maps can be installed in one of three ways: via the lobby interface, with
 pr-downloader, or by manually downloading the map and placing it in