Code Monkey home page Code Monkey logo

tapir's Introduction

Tapir

Tapir is a re-implementation project of RGSS/RGSS2/RGSS3 game runtimes. In other words, Tapir aims to run RPG Maker XP/VX/VX Ace games on Linux (and other platforms).

(日本語版READMEもあります。README.ja.mdを参照してください。)

How to build

Following is the instruction for Ubuntu 16.04. It may also work on another platforms.

$ sudo apt install build-essential autoconf automake bison flex libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libfontconfig1-dev libconfig-dev
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

Install RTPs

There are two ways to install RTP.

Installation using Windows or Wine

In Windows, RTPs will be installed to these directories by default:

  • C:\Program Files (x86)\Common Files\Enterbrain\RGSS\Standard
  • C:\Program Files (x86)\Common Files\Enterbrain\RGSS2\RPGVX
  • C:\Program Files (x86)\Common Files\Enterbrain\RGSS3\RPGVXAce

(In 32bit windows, Program Files (x86) becomes Program Files.)

Tapir currently looks for them in these directories:

  • /usr/local/share/Enterbrain/RGSS/Standard
  • /usr/local/share/Enterbrain/RGSS2/RPGVX
  • /usr/local/share/Enterbrain/RGSS3/RPGVXAce

Installation using scripts

You can even install RTPs without Windows or Wine.

Use the script at your own risk.

$ sudo apt install innoextract
$ cd rtp
$ ./install1.sh
$ ./install2.sh
$ ./install3.sh

Run tapir

Tapir looks for the current directory by default. You can change this by using -d option.

% tapir -h
Tapir: RGSS (RPG Maker XP, VX and VX Ace) compatible game engine

Usage: ./tapir [-h] [-d DIR] [-1] [-2] [-3] [test] [btest] [console]
    -h      show this help
    -d DIR  move to DIR before running the game
    -1      force RGSS version 1 (RPG Maker XP)
    -2      force RGSS version 2 (RPG Maker VX)
    -3      force RGSS version 3 (RPG Maker VX Ace)
    test    enable test mode
    btest   enable battle test mode
    console show console (not yet implemented)

Configuring tapir

Tapir reads configuration from /etc/tapir.cfg and $HOME/.tapir.cfg. This is in the libconfig format.

Below is an example configuration file:

# Put version-agnostic configs here
rgss:
{
  button1 = "A";
  button2 = "B";
  button3 = "C";
  button4 = "X";
  button5 = "Y";
  button6 = "Z";
  button7 = "L";
  button8 = "R";
  button9 = "";
  button10 = "";
  space = "C";
  enter = "C";
  esc = "B";
  num0 = "B";
  shift = "A";
  key_x = "B";
  key_v = "";
  key_b = "";
  key_a = "X";
  key_s = "Y";
  key_d = "Z";
  key_q = "L";
  key_w = "R";
};

# Put version-specific configs here
rgss1:
{
  key_z = "A";
  key_c = "C";
}

rgss2:
{
  key_z = "C";
  key_c = "";
}

rgss3:
{
  key_z = "C";
  key_c = "";
};

Extracting a game archive

Often a game is provided in a self-extracting form (i.e. *.exe).

If the archive was packed by RPG Maker, it can be extracted by cabextract.

$ sudo apt install cabextract
$ cabextract -dSakusaku Sakusaku.exe
(it will extract the game to Sakusaku/ directory.)

tapir's People

Contributors

qnighy 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tapir's Issues

RPG module

In fact, there's already an implementation -- .CHM help files for RPG Maker products contain the source codes of RPG! However, I don't know whether it can be just copied to our software.

Current strategy: newly implement it as necessary.

RGSS Base Library

  • Functions
    • rgss_main
    • rgss_stop
    • load_data
    • save_data
    • msgbox/print
    • msgbox_p/p
  • Basic data structures
    • Color
    • Rect
    • Table
    • Tone
  • Renderable objects
    • Plane
    • Sprite (#3)
    • Tilemap
    • Window (#20)
  • Bitmap (#2)
  • Font (#22)
  • Viewport (#4)
  • RGSSError
  • RGSSReset/Reset
  • Hangup (RGSS1 only)
  • Audio
  • Graphics
  • Input

Also: RPG (#8)

Window class

  • Window.new
  • Window#dispose, Window#disposed?
  • Window#update
  • Window#move
  • Window#open?
  • Window#close?
  • Window#contents
  • Window#stretch (RGSS1 only)
  • Window background
  • Window border
  • Window contents
  • Cursor, Window#active
  • Respect viewport
  • Respect Window#visible
  • Scrolling
  • Scroll arrow, Window#arrows_visible
  • Pause sign
  • Window position
  • Window Z
  • Contents origin Window#ox,oy
  • Padding, Window#padding Window#padding_bottom
  • Window opacity Window#opacity
  • Background opacity Window#back_opacity
  • Content opacity Window#contents_opacity
  • Half-open window
  • Tone

Game.ini options

Game.ini contains these parameters:

[Game]
; RTP names: XP have three
RTP=RPGVXAce
; RGSS version
Library=System\RGSS300.dll
; Script location
Scripts=Data\Scripts.rvdata2
; Title
Title=さくさくサーガ

I'm very unhappy with this ini file due to these reasons:

  • There are many existing ini-like-config parsers which are slightly incompatible with each other! Especially, GetPrivateProfileString -- the one RGSSes use -- treats \ as a mere character. What's worse, \ appears in all RPG Maker games in the world!
  • Windows ini format is encoding-dependent: it depends on their current locale called ANSI Code Page. In Japanese environment, it is assumed to be 932 -- one of the infamous problematic encoding.

TRGSSX support

There's a third-party script which comes with a special shared library called TRGSSX.dll. They contain additional support to draw onto a Bitmap. We'll have to implement compatible functionalities in order to run games which uses the script.

Other platform support

Tapir currently only supports Linux. In the long term, I want to support more platforms like Linux, macos, Android.

Case-insensitive file lookup and path delimiter

Windows allows to access e.g. Graphics/System/IconSet.png via a path Graphics\System\Iconset.png. This is problematic in these two cases:

  • When they try to access resources through RGSS functions like load_file, Bitmap.new, Graphics.transition, or
  • When they try to access files directly, like File.open.

Separate screen size and actual window dimensions (High-DPI support)

We want to separate actual window dimensions from screen size because

  • In high-DPI environments, true-to-life window size is too small.
  • Some RGSS scripts provide a way to change window size (keeping screen size) through Win32API.

Supporting different window sizes would require frame buffer objects in order to keep correct behavior of Graphics.snap_to_bitmap.

Viewport class

  • Viewport.new
  • Viewport#dispose, Viewport#disposed?
  • Viewport#flash, Viewport#update
  • All Viewport properties

RGSS Archive Data

Load data from archives like Game.rgssad, Game.rgss2a, Game.rgss3a.

Implementation strategy:

  • Implement a skeleton that issues "no decryption module" error.
  • Implement a decryption module in a private repo.
  • Prepare an infrastructure to provide a build with the decryption module.

List of working things

Would be great to have a list of things that are currently working and those that are not. I might be interested in working on this since the liberal licensing would allow this to go iOS, unlike mkxp (GPL)

Command line arguments

The original RGSSes accept several command line arguments. They allegedly have the following format:

  • XP: Game.exe [debug/btest]
  • VX: Game.exe [test/btest]
  • VX Ace: Game.exe [test/btest] [console]

My plan is to keep compatibility with these arguments, while adding several convenience options as hyphend arguments like --dir SOME_DIR.

Window arrows and pause sign

Scrolling arrows and pause sign in Window are not rendered for now -- I'd like to resolve it before 0.1.0 release. (part of #20)

Regex incompatibility

My friend pointed out that a game 魔法少年の迷宮 (trial version) fails to load because of regex compilation error.

The regex in question is /\s*+\s*/. It has nested */+s. It works in the latest Ruby version.

Why is this so problematic?

Because it may imply that the author of RGSS1/2 have replaced GNU-made regex.c in Ruby1.8.1 with some other engines, possibly due to licensing reason.

We'll have to figure out what engine was used as a substitution.

Log

unimplemented: kernel32.dll: RtlZeroMemory
unimplemented: kernel32.dll: MultiByteToWideChar
unimplemented: kernel32.dll: WideCharToMultiByte
unimplemented: user32.dll: MessageBoxA
unimplemented: kernel32.dll: GetPrivateProfileStringA
#∟Audio-EX 対応版:39: warning: already initialized constant DEBUG_CHECK
#∟Audio-EX 対応版:50: warning: already initialized constant DELETE_DEBUG_MESSAGE
#∟Audio-EX 対応版:925: warning: already initialized constant MB_OK
#∟Audio-EX 対応版:926: warning: already initialized constant MB_OKCANCEL
#∟Audio-EX 対応版:927: warning: already initialized constant MB_ABORTRETRYIGNORE
#∟Audio-EX 対応版:928: warning: already initialized constant MB_YESNOCANCEL
#∟Audio-EX 対応版:929: warning: already initialized constant MB_YESNO
#∟Audio-EX 対応版:930: warning: already initialized constant MB_RETRYCANCEL
#∟Audio-EX 対応版:932: warning: already initialized constant MB_ICONERROR
#∟Audio-EX 対応版:933: warning: already initialized constant MB_ICONQUESTION
#∟Audio-EX 対応版:934: warning: already initialized constant MB_ICONWARNING
#∟Audio-EX 対応版:935: warning: already initialized constant MB_ICONINFORMATION
#∟Audio-EX 対応版:936: warning: already initialized constant MB_SYSTEMMODAL
#∟Audio-EX 対応版:937: warning: already initialized constant MB_TASKMODAL
#∟Audio-EX 対応版:938: warning: already initialized constant MB_TOPMOST
#∟Audio-EX 対応版:939: warning: already initialized constant MB_FATAL
#∟Audio-EX 対応版:940: warning: already initialized constant MB_WARN
#∟Audio-EX 対応版:942: warning: already initialized constant IDOK
#∟Audio-EX 対応版:943: warning: already initialized constant IDCANCEL
#∟Audio-EX 対応版:944: warning: already initialized constant IDABORT
#∟Audio-EX 対応版:945: warning: already initialized constant IDRETRY
#∟Audio-EX 対応版:946: warning: already initialized constant IDIGNORE
#∟Audio-EX 対応版:947: warning: already initialized constant IDYES
#∟Audio-EX 対応版:948: warning: already initialized constant IDNO
#∟Audio-EX 対応版:952: warning: already initialized constant ERROR_SECTION_NUM
#∟Audio-EX 対応版:953: warning: already initialized constant ERROR_SECTION
#∟Audio-EX 対応版:954: warning: already initialized constant DOUBLE_CRLF
unimplemented: user32.dll: MessageBoxA
unimplemented: kernel32.dll: GetPrivateProfileStringA
∟ノベル用に改造:13: warning: found = in conditional, should be ==
ギルドシステム(Mission総まとめ:1063: warning: don't put space before argument parentheses
カレンダー:35: warning: don't put space before argument parentheses
+Window_Base2:12: warning: already initialized constant WLH
unimplemented: TRGSSX.dll: DllGetVersion
unimplemented: TRGSSX.dll: GetInterpolationMode
unimplemented: TRGSSX.dll: SetInterpolationMode
unimplemented: TRGSSX.dll: GetSmoothingMode
unimplemented: TRGSSX.dll: SetSmoothingMode
unimplemented: TRGSSX.dll: RopBlt
unimplemented: TRGSSX.dll: ClipBlt
unimplemented: TRGSSX.dll: BlendBlt
unimplemented: TRGSSX.dll: StretchBltR
unimplemented: TRGSSX.dll: SkewBltR
unimplemented: TRGSSX.dll: DrawPolygon
unimplemented: TRGSSX.dll: FillPolygon
unimplemented: TRGSSX.dll: DrawRegularPolygon
unimplemented: TRGSSX.dll: FillRegularPolygon
unimplemented: TRGSSX.dll: DrawSpoke
unimplemented: TRGSSX.dll: DrawTextNAA
unimplemented: TRGSSX.dll: DrawTextFastA
unimplemented: TRGSSX.dll: GetTextSizeNAA
unimplemented: TRGSSX.dll: GetTextSizeFastA
unimplemented: TRGSSX.dll: SaveToBitmapA
unimplemented: gdi32.dll: DeleteObject
unimplemented: gdi32.dll: CreateRectRgn
unimplemented: gdi32.dll: CreateRectRgnIndirect
unimplemented: gdi32.dll: CreateRoundRectRgn
unimplemented: gdi32.dll: CreateEllipticRgn
unimplemented: gdi32.dll: CreateEllipticRgnIndirect
unimplemented: gdi32.dll: CreatePolygonRgn
unimplemented: gdi32.dll: CreatePolyPolygonRgn
unimplemented: gdi32.dll: CombineRgn
多人数パーティ - KGC_LargeParty:358: warning: already initialized constant MAX_MEMBERS
装備拡張(魔法少年 魔石x5:94: warning: already initialized constant SHOW_STATUS_EP
装備拡張(魔法少年 魔石x5:95: warning: already initialized constant HIDE_ZERO_EP_COST
装備拡張(魔法少年 魔石x5:909: warning: already initialized constant EQUIP_TYPE_MAX
世界樹の迷宮風戦闘:隊列変更:436: warning: already initialized constant FORMATION_MEMBERS
\∟スプリット変更(,⇒★):8: warning: already initialized constant BDM_WORD
\∟スプリット変更(,⇒★):9: warning: already initialized constant ATK_WORD
\∟スプリット変更(,⇒★):10: warning: already initialized constant SPI_WORD
\∟スプリット変更(,⇒★):11: warning: already initialized constant SPD_WORD
\∟スプリット変更(,⇒★):14: warning: already initialized constant S_ATK_RE
\∟スプリット変更(,⇒★):15: warning: already initialized constant S_DEF_RE
\∟スプリット変更(,⇒★):16: warning: already initialized constant S_SPI_RE
\∟スプリット変更(,⇒★):17: warning: already initialized constant S_AGI_RE
ScriptSyntaxError: スキルレベル改:395compile error
スキルレベル改:129: nested *?+ in regexp: /\s*+\s*/
	from (eval):743
	from (eval):743
	from (eval):741:in `each'
	from (eval):741

Win32API problem

A number of games depend on Win32API or other DLLs -- often in a strange way. To mitigate this, I'm planning to implement a "fake" dl and Win32API.

Warn users about non-liability of original authors

It's good to warn users that the original authors of RGSS and the games have nothing to do with problems caused by tapir. I'd like to show messages like the following:

Warning: if you have a problem playing this game, DO NOT ASK ENTERBRAIN OR THE AUTHOR OF THE GAME. Most of the problems you will encounter are caused by tapir. Instead, we appreciate you file the issue to tapir developers.

It would be good to show this message at launch and when an error is raised.

Font class and draw_text

  • Font.new
  • Font.exist?
  • Font#name
  • Font#size
  • Font#bold
  • Font#italic
  • Font#outline
  • Font#shadow
  • Font#color
  • Font#out_color
  • Font.default_*
  • Font lookup from family name
  • Font lookup from multiple family names
  • Use font size
  • Use bold
  • Use italic
  • Use outline
  • Use shadow
  • Antialiasing
  • color
  • out_color
  • Font lookup from OS
  • Font lookup from Fonts directory (RGSS3 only?)
  • Cleverer font caching

Sprite class

  • Sprite.new
  • Sprite#dispose, Sprite#disposed?
  • Sprite#flash, Sprite#update
  • Sprite#width, Sprite#height
  • All Sprite properties
  • Render sprites
  • Respect viewport, z
  • Respect disposed?
  • Respect x, y
  • Respect ox, oy
  • Respect zoom_x, zoom_y
  • Respect angle
  • Respect wave_amp, wave_length, wave_speed, wave_phase
  • Respect mirror
  • Respect bush_depth, bush_opacity
  • Respect blend_type
  • Respect color, tone
  • Respect flash

Refactor windowskin

Currently we generate one texture from windowskin. However it is more natural to extract many textures from a windowskin. This will lead to some refactoring.

Bitmap class

  • Bitmap.new
  • Bitmap#dispose, Bitmap#disposed?
  • Bitmap#width, Bitmap#height, Bitmap#rect
  • Bitmap#blt
  • Bitmap#stretch_blt
  • Bitmap#fill_rect
  • Bitmap#gradient_fill_rect
  • Bitmap#clear, Bitmap#clear_rect
  • Bitmap#get_pixel, Bitmap#set_pixel
  • Bitmap#hue_change
  • Bitmap#blur
  • Bitmap#radial_blur
  • Bitmap#draw_text
  • Bitmap#text_size
  • Bitmap#font, Bitmap#font=

z-sorting

  • Implement z-sorting
  • Consider viewport.z when it exists
  • Also use y-coordinate
  • Also use generated order

RTP distribution problem

To run games, we definitely need the RTPs distributed by Enterbrain. It's not surprising that they're proprietary. We want a non-troublesome and legal way to install RTPs into user's /usr/local.

For now, the only possible way is to install RTPs in their Windows and copy it to their Linux machine (or use Wine).

Is it safe to create an installer for Linux, similarly to msttcorefonts? According to StackExchange, msttcorefonts are legal.

malloc: *** error for object 0x7fcc45001800: incorrect checksum for freed object - object was probably modified after being freed.

Got this after running
make

./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb "./tool/transcode-tblgen.rb" -vo "enc/trans/big5.c" "enc/trans/big5.trans"
miniruby(81325,0x7fff8ed82380) malloc: *** error for object 0x7fcc45001800: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
make[4]: *** [enc/trans/big5.c] Abort trap: 6
make[3]: *** [srcs-enc] Error 2
make[2]: *** [ruby192-build] Error 2
make[1]: *** [../ruby192-build] Error 2
make: *** [all-recursive] Error 1

Attempted on Mac OS 10.13.6 (High Sierra)

Non-negligible latency in SDL_mixer

Audio.se_play is finally implemented! However, at least in my environment, it produces non-negligible latency. It is estimatedly 0.5 seconds.

I tried several workarounds on Mix_OpenAudio found in the Internet, but no one helped me.

Perhaps we should test it on other environments.

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.