Giter VIP home page Giter VIP logo

Comments (6)

realkinetix avatar realkinetix commented on May 23, 2024

In main.js:

//console.log(`${process.cwd()}`);
const bbs = `${process.argv[3]}`;

Was my replacement, and my bash script that starts the game (mine is start-dd.sh) from synchronet runs:

exec /home/sbbs/.nvm/versions/node/v16.13.1/bin/node /sbbs/xtrn/dankdomain/game/main $1 $2

(my system-wide nodejs is too old)

From synchronet, I'm calling the door with "start-dd.sh %1 %f" - the %f provides the path to the door.sys file, the path to which varies depending on which system node the user is on - such as /sbbs/node1/door.sys or /sbbs/node2/door.sys etc.

from dankdomain.

theflyingape avatar theflyingape commented on May 23, 2024

Interesting, the BBS sysop pursuing this added feature said running a node app as a "door" is launched from a script, and as such, it's the responsibility of the BBS app to position a fixed file "door.sys" for the node app to consume, regardless of number of concurrent users. I figured it was yet another arcane thing with DOS and the single-user/ single-task posture.

The README here was just a shell of a simple example (pun):

#!/bin/sh
pwd; [ -s door.sys ] || exit 1
node /usr/local/games/dankdomain/main 0

... but it could be made to do:

#!/bin/sh
pwd; [ -s "$2" ] || exit 1
cp "$2" /usr/local/games/dankdomain/
node /usr/local/games/dankdomain/main "$1"

... whereas your %f out is passed as $2 in here, essentially copying the generated door.sys into the game folder for main / lib to consume, right?

from dankdomain.

realkinetix avatar realkinetix commented on May 23, 2024

That's right - I'm surprised, if the other BBS sysop that was persuing it was using Mysic, that it would use a fixed door.sys for multiple users. Or, maybe I'm just presuming what was going on based on how the Readme reads about it.

So yes, the %f (full path to the door.sys file) is passed to the script as $2, which I have main.js reading in rather than presuming where it is.

That part, for this type of setup for synchronet, is working fine. Running output tests of user[19], etc, was working (once I'd hacked the EOL parsing for the door.sys file).

from dankdomain.

realkinetix avatar realkinetix commented on May 23, 2024

I suppose a test could be run to provide both options - if process.argv[3] exists, test that as a door.sys dropfile, if that fails, test process.cwd()'s door.sys if it exists.

from dankdomain.

theflyingape avatar theflyingape commented on May 23, 2024

Good. Sounds like this is in a manageable state, closing.

from dankdomain.

realkinetix avatar realkinetix commented on May 23, 2024

I think my 'that's right' may have been misleading? The %f is passed in to the script, but it is not copying the door.sys file anywhere. In fact, I think the door.sys file winding up in the game directory may cause a potential race condition if 2 people were to enter the game at the same time. Are we sure the door.sys would get read appropriately?

If the BBS keeps the door.sys files in other locations unique to the user session, would it not make sense to have or allow the game to read the door.sys file from that location?

That's why I was suggesting it might be an idea to have the game test and read in process.argv[3] as well as this other method. Oh, and I guess I should tack on to that - at least in this case, it should eliminate the need for an in-between script at all.

(edit: successfully running without in-between script now with my replacement in main.js to read in process.argv[3])

from dankdomain.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.