Coder Social home page Coder Social logo

noric-bot's Introduction

noric-bot

A bot written in Scala 3 to stress test text-based MMORPGs.

Join us on the MUD discord!

OSX Quickstart

  • git clone
  • run the precompiled OSX binary that was added to git repo
    • $ HOST=yourmud.com PORT=4000 bin/osx-noric-bot 17
    • ๐Ÿ‘‰ 17 bots will connect to yourmud.com:4000 and spam one cmd every 450ms
  • this program scales gracefully to 1000+ bots

How to support your MUD

  • PRs welcome!
  • MUD-specific support is provided by each MUD implementing LoginCmds and NextCmds for each MUD.
  • See NoricMud.scala, the cmds for the author's closed-source MUD.

Technology

noric-bot is written in Scala 3 and compiled to native using graalvm. Scala 3 has lots of new features and most aren't yet used in noric-bot.

(noric-bot uses some Java APIs in lieu of Scala libraries because the latter aren't yet available for Scala 3. It may be possible to use libraries compiled with Scala 2 within a Scala 3 codebase using libraryDependencies += ("a" %% "b" % "c").withDottyCompat(scalaVersion.value), see here.)

Are you a Scala expert? I'd greatly appreciate PRs that improve the "Scala-ness" of this project :-)

IDE support for this toolchain is provided by atom-ide-scala and Dotty's implementation of the Language Server Protocol.

Scala is my favorite language and I'm excited for Scala 3. I think Scala is the best mainstream language with a sophisticated type system. Sophisticated type systems are money in the bank. For me, from a type system perspective, going from TypeScript to Scala is like going from JavaScript to TypeScript. (I love TypeScript and write a lot of it!)

Scala 3 launches in 2020 after a new compiler was written over a five year period. The new compiler is named "Dotty".

See A Tour of Scala 3.

Roadmap

I'd like to improve the level of documentation/comments in the code.

Native compilation is cool. The binary starts up instantly, unlike the jvm. The current roadmap is to expand Config.scala to allow greater custom behavior without recompilation.

Compile & Run

  • install Scala brew install scala sbt lampepfl/brew/dotty
  • install graalvm and ensure native-image is on your PATH
    • ๐Ÿ‘‰ you can skip this step and run non-natively with sbt run
  • compile sbt compile
  • compile to native sbt show graalvm-native-image:packageBin or the alias sbt b
  • run with bin/noric-bot which is a symlink to the binary produced by the build

Personal notes from the author to himself

noric-bot is a port of noricmud's ruby bot.rb.

On my macbook pro use alias graalvm-enable and then run sbt b.

how to run a noricmud stress test

  1. compile noricmud with sanity checks disabled
  2. run noricmud locally outside of sbt:
run packaged MUD (without sbt) on OSX without using docker
    build in sbt with
        universal:packageBin
    run with
        cd target/universal && unzip noricmud-*zip && cd noricmud-*/
        JAVA_OPTS="-Xmx512m -Xms512m -Dgame.storage.init=init -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false" bin/noricmud
  1. run bin/noric-bot <# of bots to run>

  2. or use parallel: seq 100 | parallel --ungroup -j 100 -n0 bin/noric-bot 1 > /dev/null

gotchas

problem: hit limit of max open file handles

parallel: Warning: Only enough file handles to run 60 jobs in parallel.
parallel: Warning: Running 'parallel -j0 -N 60 --pipe parallel -j0' or
parallel: Warning: raising 'ulimit -n' or 'nofile' in /etc/security/limits.conf
parallel: Warning: or /proc/sys/fs/file-max may help.

solutions:

noric-bot's People

Contributors

ryanberckmans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

noric-bot's Issues

[E029] Pattern Match Exhaustivity Warning: ... ReceiveResult.MsgFromServer(_)

[warn] -- [E029] Pattern Match Exhaustivity Warning: noric-bot/src/main/scala/Bot.scala:21:35
[warn] 21 |    if (isConnected) socket.receive() match {
[warn]    |                     ^^^^^^^^^^^^^^^^
[warn]    |           match may not be exhaustive.
[warn]    |
[warn]    |           It would fail on pattern case: ReceiveResult.MsgFromServer(_)
[warn] -- Warning: noric-bot/src/main/scala/Bot.scala:23:11
[warn] 23 |      case m:MsgFromServer => {
[warn]    |           ^^^^^^^^^^^^^^^
[warn]    |        the type test for Bot.MsgFromServer cannot be checked at runtime
[warn] two warnings found

We can see that the type Bot.MsgFromServer is defined as export ClientSocket.MsgFromServer which itself is defined as export ReceiveResult._.

The intention is for the type Bot.MsgFromServer to be equal to ClientSocket.ReceiveResult.MsgFromServer without exposing the other values of the enum ReceiveResult.

I believe this warning is due to an interaction between export and pattern matching. There has been no runtime consequence.

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.