Code Monkey home page Code Monkey logo

rguplayer's Introduction

Logo RGU Player Core

项目概述

  • RGU是一款兼容RGSS 1/2/3,使用SDL3作为底层,OpenGL ES(2.0) 图像标准编写渲染部分的异步多线程2D游戏引擎。
  • RGU在提供兼容原版RGSS的同时提供跨平台与性能提升支持,同时提供诸如自定义着色器与网络扩展在内的加强功能。
  • 本项目使用BSD-3协议开源。
  • 本项目语法风格与代码结构与The Chromium Project相似。

项目结构

  • 运行结构为多线程架构,程序内存在多个线程worker,每个worker都有任务投递的接口,引擎将事件处理,逻辑渲染处理,音频播放处理,视频解码处理,网络处理等分解为多个线程。

  • 源码结构分为逻辑实现,图像渲染实现,基础库实现,封装组件实现与脚本引擎绑定实现,

  • 整个程序的入口在app文件夹中

  • content文件夹中存放负责组织引擎全部内容(图像,输入,音频)功能的代码,是引擎的核心实现

  • components中存放引擎中的某些特定组件实现(如IO系统,fps计数器等)

  • base文件夹中存放跨平台的基础代码

  • binding文件夹中存放与cruby,mruby等第三方解释器进行绑定的代码

  • buildtools中存放所有的python自动化代码

  • renderer文件夹存放了GLES2.0渲染器的初级封装代码

  • third_party中为使用的第三方代码库,base/third_party中也有部分第三方库

  • ui文件夹存放了SDL窗口的封装代码,用于与input模块进行配合操作

  • 游戏的图像渲染采用OpenGL ES(2.0)标准以获得最大兼容

  • 用户可以选择使用ANGLE运行其他渲染器后端(D3D9 D3D11 Vulkan Metal 软渲染等)以应对显卡驱动兼容问题

  • 引擎的输入处理基于SDL的事件处理

  • 引擎的音频处理基于SoLoud库,音频数据通过Soloud核心处理后输出到SDL的音频设备接口

  • 引擎的脚本处理部分使用了Ruby 3.2.2的解释器

截图

编译项目

  • 本项目使用CMake管理编译。
  • 第三方依赖库部分使用Git拉取,部分需要用户自行编译处理。
  • 项目中需要使用Python3来生成自动编译文件,请确保系统中已安装Python3。

Windows (测试环境:Windows 11 23H2 & Visual Studio 2019 & Clang-LLVM)

  • 可以直接使用vs内置的cmake功能进行快捷构建

Linux (测试环境:Ubuntu23.10 & Visual Studio Code & GCC 13)

  • 首先通过git clone拉取项目源码: git clone https://github.com/Admenri/rguplayer.git
  • 接着git clone在third_party中用到的第三方库源码: git submodule init | git submodule update
  • 注意SDL_ttf中还有freetype
  • 然后保证系统安装了opengl开发库和ruby开发库
  • 在目录执行:cmake -S . -B out 以生成工程
  • 之后执行cmake --build out执行构建

Android (测试环境:Android 13.0 & Android Studio & Windows 11 23H2)

  • 确保系统安装了Android Studio,Android NDK,CMake
  • 确保可以在开发环境下编译出成品程序(例如Windows下先编译出exe)
  • 然后使用Android Studio打开 “android-project” 文件夹
  • 之后即可直接执行 Build Project 开始构建

系统支持

  • Microsoft Windows 7 及以上
  • GNU/Linux 6.5.0 及以上
  • Android 8.0 及以上
  • 目前不支持Apple系的任何操作系统(macOS,iOS),欢迎有mac设备的同志贡献代码

思路来源

  • Chromium
  • RGM
  • MKXP
  • SDL

第三方库使用

联系方式

© 2015-2024 Admenri

rguplayer's People

Contributors

admenri avatar

Stargazers

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

Watchers

 avatar

rguplayer's Issues

Sprite Drawing Benchmark

As it is still in development, it may help you, LiteRGSS2 seems to be the fastest of the bunch for now

Engine Sprites Frames per Second
MKXP-Z 20,000 34
RGM 50,000 33
LiteRGSS2 50,000 47
class SpriteGenerator
  DEFAULT_SPRITE_COUNT = 20_000
  SCREEN_WIDTH = 640
  SCREEN_HEIGHT = 480
  SPRITE_SIZE = 32

  def initialize
    @sprite_count = DEFAULT_SPRITE_COUNT
    @viewport = Viewport.new(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)
    @bitmap = nil
  end

  def run
    initialize_sprites
    loop do
      Graphics.update
    end
  rescue StandardError
    puts "\nEND\n"
  end

  private

  def initialize_sprites
    puts "Sprite Count: #{@sprite_count}"

    @sprites = @sprite_count.times.map do |i|
      initialize_bitmap if (i % 100).zero?
      initialize_sprite
    end
  end

  def initialize_bitmap
    @bitmap = Bitmap.new(320, 320)
    @bitmap.fill_rect(0, 0, 320, 320, random_color)
  end

  def initialize_sprite
    sprite = Sprite.new(@viewport)
    sprite.bitmap = @bitmap
    sprite.x = rand(SCREEN_WIDTH) - SPRITE_SIZE
    sprite.y = rand(SCREEN_HEIGHT) - SPRITE_SIZE
    set_sprite_src_rect(sprite)
    sprite
  end

  def set_sprite_src_rect(sprite)
    j = @sprite_count % 100
    sprite.src_rect.set(32 * (j / 10), 32 * (j % 10), SPRITE_SIZE, SPRITE_SIZE)
  end

  def random_color
    Color.new(rand(256), rand(256), rand(256), 32)
  end
end

SpriteGenerator.new.run

Reference from other functional RGSS implementations

Build Instructions

It's better to add a few, otherwise people won't know how to build it, a workflow to build it is also an option

[Feature] Shaders

RGD has this cool thing where you can apply shaders to Graphic/Sprites/Viewports, it would be really cool to see something like that here

[Feature] Geometry API Extension

After reviewing common extensions to the Bitmap class, it's evident that shapes such as lines, circles, triangles, polygons, isogons, and ellipses are frequently added. As RGU already includes a Geometry class, extending it to handle common geometry shapes beyond just triangles seems beneficial.

  • Line
  • Circle
  • Polygon
  • Isogon
  • Ellipse

[Feature] Graphics API Extension

Properties

  • Graphics.fullscreen

    • Check if it is in fullscreen with Graphics.fullscreen and toggle it to true or false with Graphics.fullscreen=.
  • Graphics.scale

    • Scaling feature allowing users to adjust the game window/screen size dynamically with Graphics.scale= such as scaling it by 2x or 0.5x.
  • Graphics.vsync

    • Toogle it to true or false with Graphics.vsync=.

Methods

  • Graphics.capture_screen

    • Capture in-game screenshots, enabling sharing of memorable moments or troubleshooting assistance through visual representation.
  • Graphics.delta_time

    • Graphics.delta_time is exceptionally useful for modifying your game to stop synchronizing with the frame rate, ensuring consistent gameplay regardless of variations in frame rate.
  • Graphics.shader

    • Applying global shaders that will affect all Viewports/Sprites such as xBRZ, scalefx, GameBoy Color...

Angle on Linux

It appears that it is unable to detect the .so related to Angle (tested putting it in ANGLE/amd64, ANGLE/i32 and in the root folder), i was trying to test running Angle with Vulkan on Linux

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.