Giter Site home page Giter Site logo

openra-ruby's Introduction

OpenRA Rubygem

Unofficial gem for OpenRA; a free, open-source real-time strategy game engine for early Westwood games such as Command & Conquer: Red Alert written in C#

Currently this gem implements the following commands:

  • replay-data - parse and extract data from replay files
  • detect-production-macros - parse replay data and attempt to detect production macro usage by players

If this is not what you're looking for, please see the Other tools section, perhaps what you need has already been implemented elsewhere.

Installation

gem install openra

NOTE: Requires Ruby (Installation guide)

Updating

gem update openra

Example usage

openra replay-data /path/to/replay.orarep [--format json|pretty-json|yaml]
openra replay-metadata /path/to/replay.orarep [--format json|pretty-json|yaml]

Other tools

A web visualisation tool created by dragunoff, designed to work with this gem, enter the output from the replay-data command with the json or pretty-json format to see a visualisation of the replay, including game information, clients and build orders.

Created by spanglel, a gem designed to strip extraneous data from OpenRA replay files, see the readme for installation and usage instructions.

openra-ruby's People

Contributors

amhol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jasper-lyons

openra-ruby's Issues

Duplicate structure placement

I've been parsing some release-20180923 replays and noticed that sometimes two nearly identical building placements happen in the span of a few seconds. For example:

        {
          "structure": "proc",
          "game_time": {
            "formatted": "00:03:30",
            "msec": 210000
          },
          "placement": {
            "x": 66,
            "y": 66
          }
        },
        {
          "structure": "proc",
          "game_time": {
            "formatted": "00:03:32",
            "msec": 212400
          },
          "placement": {
            "x": 65,
            "y": 66
          }
        },

Here's a replay where that occurs twice (with PROC and WEAP): http://openra.mine.nu/mIRROR/ora_replays/RAGL_Season_Six/R02/Master/RAGL-S06-MASTER-R02-NNG-ZXG-G1.orarep

Add command for macro detection

This should be pretty simple for production macros, just look for patterns in the "StartProduction" commands / target string and some calculation on the frametime.

`require': cannot load such file -- dry/transformer/all (LoadError)

Hello, I try to get your openra-ruby to run on Ubuntu 20.04 LTS.

I installed ruby as documented for Ubuntu and tried to run, but it failed at the point "`require': cannot load such file -- dry/transformer/all (LoadError)"

I updated to ruby 3.2.2 and still get the same error. I even build it from the source and still get the same error.

Do you have any advice how to solve this issue?

Thank you.

openra replay-data ca-Server-2023-04-11T165851Z.orarep --format pretty-json
<internal:/home/openra/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- dry/transformer/all (LoadError)
        from <internal:/home/openra/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /home/openra/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/openra-4.0.2/lib/openra/struct.rb:3:in `<top (required)>'
        from <internal:/home/openra/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/home/openra/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /home/openra/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/openra-4.0.2/lib/openra/replays.rb:9:in `<top (required)>'
        from <internal:/home/openra/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/home/openra/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /home/openra/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/openra-4.0.2/lib/openra/commands.rb:3:in `<top (required)>'
        from <internal:/home/openra/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/home/openra/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /home/openra/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/openra-4.0.2/lib/openra/cli.rb:7:in `<top (required)>'
        from <internal:/home/openra/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/home/openra/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /home/openra/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/openra-4.0.2/lib/openra-cli.rb:3:in `<top (required)>'
        from <internal:/home/openra/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/home/openra/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /home/openra/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/openra-4.0.2/bin/openra:4:in `<top (required)>'
        from /home/openra/.rbenv/versions/3.2.2/bin/openra:25:in `load'
        from /home/openra/.rbenv/versions/3.2.2/bin/openra:25:in `<main>'

gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 3.4.12
  - RUBY VERSION: 3.2.2 (2023-03-30 patchlevel 53) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/openra/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0
  - USER INSTALLATION DIRECTORY: /home/openra/.gem/ruby/3.2.0
  - RUBY EXECUTABLE: /home/openra/.rbenv/versions/3.2.2/bin/ruby
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /home/openra/.rbenv/versions/3.2.2/bin
  - SPEC CACHE DIRECTORY: /home/openra/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /home/openra/.rbenv/versions/3.2.2/etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - x86_64-linux
  - GEM PATHS:
     - /home/openra/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0
     - /home/openra/.gem/ruby/3.2.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => true
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/openra/.rbenv/versions/3.2.2/bin
     - /home/openra/.rbenv/libexec
     - /home/openra/.rbenv/plugins/ruby-build/bin
     - /home/openra/.rbenv/shims
     - /home/openra/.rbenv/bin
     - /home/openra/.rbenv/shims
     - /home/openra/.rbenv/bin
     - /home/openra/.rbenv/shims
     - /home/openra/.rbenv/bin
     - /home/openra/.local/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
gem list --local

*** LOCAL GEMS ***

abbrev (default: 0.1.1)
base64 (default: 0.1.1)
benchmark (default: 0.2.1)
bigdecimal (default: 3.1.3)
bindata (2.4.15)
bundler (2.4.12)
cgi (default: 0.3.6)
coderay (1.1.3)
concurrent-ruby (1.2.2)
csv (default: 3.2.6)
date (default: 3.3.3)
debug (1.7.1)
delegate (default: 0.3.0)
did_you_mean (default: 1.6.3)
diff-lcs (1.5.0)
digest (default: 3.1.1)
docile (1.4.0)
drb (default: 2.1.1)
dry-cli (1.0.0)
dry-core (1.0.0)
dry-inflector (1.0.0)
dry-logic (1.5.0)
dry-struct (1.6.0)
dry-transformer (1.0.1, 1.0.0, 0.1.1)
dry-types (1.7.1)
english (default: 0.7.2)
erb (default: 4.0.2)
error_highlight (default: 0.5.1)
etc (default: 1.4.2)
fcntl (default: 1.0.2)
fiddle (default: 1.1.1)
fileutils (default: 1.7.0)
find (default: 0.1.1)
forwardable (default: 1.3.3)
getoptlong (default: 0.2.0)
ice_nine (0.11.2)
io-console (default: 0.6.0)
io-nonblock (default: 0.2.0)
io-wait (default: 0.3.0)
ipaddr (default: 1.2.5)
irb (default: 1.6.2)
json (default: 2.6.3)
logger (default: 1.5.3)
matrix (0.4.2)
memory_profiler (1.0.1)
method_source (1.0.0)
minitest (5.16.3)
mutex_m (default: 0.1.2)
net-ftp (0.2.0)
net-http (default: 0.3.2)
net-imap (0.3.4)
net-pop (0.1.2)
net-protocol (default: 0.2.1)
net-smtp (0.3.3)
nkf (default: 0.1.2)
observer (default: 0.1.1)
open-uri (default: 0.3.0)
open3 (default: 0.1.2)
openra (4.0.2)
openssl (default: 3.1.0)
optparse (default: 0.3.1)
os (1.1.4)
ostruct (default: 0.5.5)
pathname (default: 0.2.1)
power_assert (2.0.3)
pp (default: 0.4.0)
prettyprint (default: 0.1.1)
prime (0.1.2)
pry (0.14.2)
pstore (default: 0.1.2)
psych (default: 5.0.1)
racc (default: 1.6.2)
rake (13.0.6)
rbs (2.8.2)
rdoc (default: 6.5.0)
readline (default: 0.0.3)
readline-ext (default: 0.1.5)
reline (default: 0.3.2)
resolv (default: 0.2.2)
resolv-replace (default: 0.1.1)
rexml (3.2.5)
rinda (default: 0.1.1)
rspec (3.12.0)
rspec-core (3.12.1)
rspec-expectations (3.12.2)
rspec-mocks (3.12.5)
rspec-support (3.12.0)
rss (0.2.9)
ruby2_keywords (default: 0.0.5)
rubygems-update (3.4.12)
securerandom (default: 0.2.2)
set (default: 1.0.3)
shellwords (default: 0.1.0)
simplecov (0.22.0)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
singleton (default: 0.1.1)
stackprof (0.2.25)
stringio (default: 3.0.4)
strscan (default: 3.0.5)
syntax_suggest (default: 1.0.2)
syslog (default: 0.1.1)
tempfile (default: 0.1.3)
test-unit (3.5.7)
time (default: 0.2.2)
timeout (default: 0.3.1)
tmpdir (default: 0.1.3)
tsort (default: 0.1.1)
typeprof (0.21.3)
un (default: 0.2.1)
uri (default: 0.12.1)
weakref (default: 0.1.2)
yaml (default: 0.2.1)
zeitwerk (2.6.7)
zlib (default: 3.0.0)

Add an identifier (hash) to parsed replay data

This would allow to quickly assert whether two JSON outputs were generated from the same replay file. This of course can be done later by the software that consumes the JSON but it would be faster to have it readily available in the output.

Timing is off

release-20230225-2.orarep outputs the time as 00:14:34, this is the time from the start of the replay recording to the end (including lobby time and post-game chat), should add a game_duration field with the actual game duration, but processing from the last PauseGame order gives a time of 14:38 when it should be 12:39 according to the OpenRA reply viewer - perhaps down to latency?

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.