Python + Funscript

I’ve been thinking about making an visuel novel with renpy for month. I already started but it’s so much work. I don’t know if i am able to work enough on this project.

My newest plan is… maybe a combination of renpy and funscript is the holy grail. Ren’Py is written in the Python programming language and includes support for including Python inside Ren’Py scripts. Maybe there is a way to do this?

I am still in research mode but maybe someone here has an ideas?

5 Likes

Do you want to play scripts or just control a toy? Which one?

One idea that could work if your python can access external elements:
You could use HandyControl’s command line support to control Handy with renpy during play. You load your script that contains everything. Then you can jump to certain script timestamps with Python or just send basic stroke and speed commands.

I will be following this progress with great interest :face_with_monocle:

If you’re going the traditional visual novel format of “text + still images”, funscript might not seem like a good fit, since it is generally intended for video and all. However… if you want to do something like most of the games that support the Cyclone X10, which triggers different patterns as you play, funscript could be part of the solution.

I would probably suggest emulating the Whirligig timecode server in your program. That way, you can let existing software handle the fine details of playing a script for any given device, and all your code has to do is send a message in a standard format saying what script to play. (Well, and possibly having a background task that tells it to return to the start periodically, because I don’t think they’d loop on their own using this method.) You can make whatever patterns you want to use in one of the existing editors, and then everything should just work from there.

1 Like

This is a completely different idea, but if you’re looking to put code into something, perhaps you could add buttplug.js support to Milovana’s webtease software? If the webteases on there could actually work a fleshlight launch or handy, that would open up a ton of new content.

Then you could put a visual novel on Milovana using what they already have, it would be win-win!

I don’t know about how the Launch and Keon work, but I know that to control the Handy, all you need to do is to send HTTP requests to various endpoints on handyfeeling.com

If you’re talking about a Visual Novel, where synchronizing with animation isn’t important (assuming that you aren’t having animations), then this becomes easy - you can send stroke length / stroke speed commands at any point to match what’s happening in the story, as well as give the player some amount of control if you wanted.

I haven’t worked with RenPy before, but I assume you can just run normal Python code inside of it, which means you can make the necessary HTTP requests.

The Launch is similar. The user runs Intiface which exposes a local HTTP endpoint. Demo/sample here: https://playground.buttplug.world/

Works with all sorts of other vibes and things too.

Thank you guys for all the great input on my idea.

I know this is old but, i was thinking about maybe coming up with a solution we can use to create interactive content for renpy games. I was looking into it on my own and found out how to control my handy device through RenPy.

Was wondering if you’re still interested in this?

It doesn’t look too difficult to maybe coming up with an “api” of sorts that people can just dump in their script folder and then call functions from where the scenes are being played.

    from urllib.request import Request, urlopen
    import json
    handyConnectionKey = 'XXXXXXXX'
    api = 'https://www.handyfeeling.com/api/handy/v2/'
    requestResponse = 'NONE'
    velocity = 'NONE'

    def debug_GetHandyStatus():
        req = Request(api + 'connected')
        req.add_header('accept', 'application/json')
        req.add_header('X-Connection-Key', handyConnectionKey)
        req.method = 'GET'
        requestResponse = json.loads(urlopen(req).read())
        print(requestResponse)
        if requestResponse['connected'] == True:
            print('Connected!')
        return

    def handy_SetVelocity(velocity):
        requestData = {'velocity': velocity}
        req = Request(api + 'hamp/velocity')
        req.add_header('accept', 'application/json')
        req.add_header('X-Connection-Key', handyConnectionKey)
        req.add_header('Content-Type', 'application/json')
        req.data = json.dumps(requestData)
        req.method = 'PUT'
        urlopen(req)
        return

Both urllib and json are included with a base renpy installation.

So in this case if i wanted my device to go full speed in some scene, i’d find where that scene’s text is and put handy_SetVelocity(100). I’m sure we can come up with a way to make it play scripts made for each scene as well, requires more tinkering.

1 Like

Keeping on eye on this thread for sure.

If Renpy ever updates to Python 3… there’s a buttplug.io library for python 3, and then I’d think it would be super easy to roll it straight into your VN.

1 Like

well would you look at at that…

https://www.renpy.org/
Ren’Py 8 is a big deal, as it’s the first version of Ren’Py that supports Python 3.
At the same time, it doesn’t require big changes to your games.
Many games run unchanged on Ren’Py 8, while others will require minor changes.