GithubHelp home page GithubHelp logo

asfdfdfd / renpy-live2d Goto Github PK

View Code? Open in Web Editor NEW
78.0 8.0 13.0 4.17 MB

Live2D module for RenPy

CMake 0.09% C 63.30% C++ 26.65% Python 0.57% HTML 9.28% CSS 0.11% Shell 0.01%
renpy live2d python python2 python27 gamedev gamedevelopment opengl

renpy-live2d's Introduction

DEPRECATED

RenPy has native Live2D support now. Use it.

Introduction

This is attempt to create Live2D module for RenPy. This is WIP and not production version. Project has no ETA. This source code is invitation to developers that are willing to help with development of module.

This module works only with OpenGL renderer.

Installing

As for now prebuild version of this module available only for macOS and Windows.

  1. Go to the 'release' section and download latest release.
  2. Extract files and place 'live2d' folder to the 'game' folder of your RenPy project.
  3. Download Cubism Native SDK and replace 'CubismSDK/Core' folder of this library with 'Core' folder from downloaded SDK.
  4. You are ready to go.

Usage example

define h = Character("Hiyori")

init python:
    from live2d.displayable import Live2DDisplayable
    from renpy.loader import transfn

    sprite_live2d = Live2DDisplayable()

init:
    image sprite_live2d = sprite_live2d

label start:

    show sprite_live2d

    $ live2d_model_hiyori = sprite_live2d.scene.create_model(transfn(u'live2d_resources/Hiyori/'), u'Hiyori.model3.json')

    $ live2d_model_hiyori.start_random_motion(group = u"Idle", priority = 3)

    h "You've created a new Ren'Py game."

    $ live2d_model_hiyori.start_motion(group = u"TapBody", no = 0, priority = 3)

    h "Once you add a story, pictures, and music, you can release it to the world!"

    return

Building

This section is for those who wants to participate in extension development. If you do not want to participate in development and just want to use your Live2D models in RenPy โ€” read 'Installing' section.

macOS

Extensions for RenPy should be built with custmoized Python 2.7.10 version that is configured for RenPy. The most convenient way is to use pyenv.

  1. Install pyenv.
brew install pyenv

If you want want to integrate pyenv into your shell read 'installation' section in pyenv manual. I assume that you want to use pyenv just to build module and do not want to make deep integration.

  1. Install python.
PYTHON_CONFIGURE_OPTS="--enable-unicode=ucs4 --enable-shared" pyenv install 2.7.10

If it fails with error read pyenv common build problems.

If you need to have multiple Python 2.7.10 installs use pyenv-alias plugin.

  1. Create folder to store python virtual environment. It will be mentioned as %TARGET_DIR%.
  2. Create virtual environment and install required packages.
cd %TARGET_DIR%
pyenv local 2.7.10
$(pyenv root)/versions/2.7.10/bin/pip install --upgrade pip
$(pyenv root)/versions/2.7.10/bin/pip install virtualenv
$(pyenv root)/versions/2.7.10/bin/virtualenv .
bin/pip install pyasn1==0.1.7 rsa==3.1.4 altgraph==0.12 macholib==1.7 cython==0.29.7

Now you have special Python build that is suitable for building Live2D module for RenPy:

  1. Download Cubism Native SDK and replace 'CubismSDK/Core' folder of this library with 'Core' folder from downloaded SDK.
  2. Open console and go to the folder where you placed content of this repository
  3. Launch
%TARGET_DIR%/bin/python setup.py build_ext --inplace
  1. Module is ready. Now you could launch RenPy game.

Linux

Should be similar to macOS but i could not confirm.

Windows

  1. Download and install Microsoft Visual C++ Compiler for Python 2.7
  2. Download and install x86 version of Python 2.7.10
  3. Download Cubism Native SDK and replace 'CubismSDK/Core' folder of this library with 'Core' folder from downloaded SDK.
  4. Launch 'Visual C++ 2008 32-bit Command Prompt' from 'Start' menu and go to 'CubismSDK/Core/dll/windows/x86' folder.
  5. Launch
dumpbin /EXPORTS Live2DCubismCore.dll > Live2DCubismCore.exports
  1. Edit 'Live2DCubismCore.exports' to create 'Live2DCubismCore.def' file. Also you could get ready 'def' file here but it may be a bit outdated so i recommend to create it by yourself.
  2. Launch
lib /def:Live2DCubismCore.def /out:Live2DCubismCore.lib
  1. Go to root module folder and launch
%PATH_TO_PYTHON%\python.exe setup.py build_ext --inplace --compiler=msvc
  1. Module is ready. Now you could launch RenPy game.

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.