Need help implementing a purchase system and branching...

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Message
Author
dufatron
Newbie
Posts: 15
Joined: Sat Apr 04, 2015 9:47 pm
Contact:

Need help implementing a purchase system and branching...

#1 Post by dufatron » Sun May 31, 2015 1:54 am

Ok, so I finally finished the prologue for my otome game last week and it ends with the player having to choose between four dudes who have completely different stories. I already wrote one of the guys stories on paper but just need to put it into ren'py. If my drawings turn out to be good enough, which I'm expecting them to be because I'm not going to be drawing most of them, I want to charge like $1.00 per dude. It's going to be modeled like most of the otome games on the app stores (which I plan on converting into someday), where you have to choose one guy and pay for him and then you get a separate story for each guy. My question is, how do I implement a paying system in the game? Basically you'll have to pay for it like right after you choose the dude you want but I have no idea how to put this in there. I'm not asking how to do an in app purchase yet, just how to have the player make a payment for an online game. In addition to this how the hell do I separate the different stories after the player pays for it? I know how to branch but I for some reason think that separating the four different stories will be harder than just simple branching. If anyone can help me can you please explain things to me in minute detail as I'm really not good at this? I know I'm asking for a lot and thank anyone in advance who tries to help me.

paktek123
Newbie
Posts: 13
Joined: Thu Jan 01, 2015 8:31 am
Completed: Raiser RPG Framework for Ren'Py
Github: paktek123
Contact:

Re: Need help implementing a purchase system and branching..

#2 Post by paktek123 » Sun May 31, 2015 7:20 am

One way maybe like this (complicated)

- in your game you have the link/url to where the player can make the purchase
- the player signs up and pays on the 'server' which sets the flag to True on the 'server' for that player
- in the game you can then do a HTTP request to the server to retrieve the player info which unlocks if the flag is set to True

Alternatively you just give access to a particular URL as described here by using the web updater (http://www.renpy.org/doc/html/updater.html). This would normally return a 401 (keeping content locked), if unlocked would return a 200 and allow the web update.

The above require a web server of some sort running. Maybe an alternative can be to just say have 1 route unlocked then you just pay $1.00 for other routes which can be a completely different game.

dufatron
Newbie
Posts: 15
Joined: Sat Apr 04, 2015 9:47 pm
Contact:

Re: Need help implementing a purchase system and branching..

#3 Post by dufatron » Sun May 31, 2015 1:28 pm

First of all paktek123, thank you so much for posting a reply! I'm willing to do anything it takes to have a paying system in my game but truthfully I'm really not good at coding and I don't know anyone who is. I am willing to pay for a coder if it comes to it but I'm really hoping that I can at least finish the computer version without having to because I know I'm probably going to need one for when I convert it to the app store. I have never played an otome game online only on the app store, so is the way you described how most of the otome games have a paying system? And would I have to implement the link in ren'py or is that something done outside of ren'py? I really don't understand at all how any of this would be done, is there any way you could describe to me how I would go about doing this, like step by step? Thank you again for trying to help me!

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Need help implementing a purchase system and branching..

#4 Post by trooper6 » Sun May 31, 2015 2:03 pm

I've never done this before, and it isn't something that is currently on the top of my brain to figure out.

If you want this sort of feature you will either have to learn how to code it yourself--which would involve not just someone telling you what to do (because then you can't fix things if there are errors, or customize things)--but actually learning how to do it. Or you can hire a coder who know how do do it all ready.

If you want to learn yourself. I recommend doing a search of the forums and the documentation. I have just done a quick search for you, and found these pages that may be of use for you as a starting point:

http://lemmasoft.renai.us/forums/viewto ... t=purchase
http://lemmasoft.renai.us/forums/viewto ... t=purchase
http://www.renpy.org/doc/html/iap.html
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

dufatron
Newbie
Posts: 15
Joined: Sat Apr 04, 2015 9:47 pm
Contact:

Re: Need help implementing a purchase system and branching..

#5 Post by dufatron » Sun May 31, 2015 3:27 pm

Trooper6 thank you again for helping me! Okay so I realize that I have to learn it myself, which I am currently trying to do, or hire a coder. When I ask someone to explain it to me step by step it's because I learn better that way, although I understand what you mean about learning how to fix issues and customize which would require me to gain more coding experience. I thought that most ren'py games were made for the internet and then you had to download a package to convert it to the app stores. I was under the assumption that the coding for the ren'py game to go on the internet would not be as hard as the converting of my game to fit the app store models. I am thankful that you found some sources for me (for some reason I couldn't find not one of those in my searches), but they all seem to be for in app purchases which will be very helpful for when I attempt to convert my game for the app stores. Is there a way to have a purchase system for an online game or do the links you gave me apply to online games too? Also how would I separate the four stories after the player makes a decision? Would this be done by branching within branching, like having a scene for each dude that has its own chapters and such, or is there something more complicated that I'm missing? Last question, do you think I should download the package to convert my game for the app store now and begin the process or should I wait until I finish my game and then download and convert it? Thank you again!

paktek123
Newbie
Posts: 13
Joined: Thu Jan 01, 2015 8:31 am
Completed: Raiser RPG Framework for Ren'Py
Github: paktek123
Contact:

Re: Need help implementing a purchase system and branching..

#6 Post by paktek123 » Sun May 31, 2015 3:42 pm

@dufatron this (http://www.renpy.org/doc/html/iap.html) is essentially what I was describing as posted by @trooper6 above.

An example can be something like this for android:

Code: Select all

init:
    $ iap.register('character1', google='com.your.game') # you set this when create your game via the RAPT
    $ iap.register('character2', google='com.your.game.character')

label buy_character1:
    if iap.has_purchased('character1'):
        "You have already purchased this character"
    else:
        $ price = iap.get_price('character1')
        menu:
             "Buy (price is [price])":
                 jump purchase_character1
             "Do not buy":
                 jump character_unlock_menu

label purchase_character1:
    "Buying now"
    $ iap.purchase('character1')
    "Character is now unlocked!"

label story:
    "Normal story"
    if iap.has_purchased('character1'):
        "Oh I see you have unlocked character1"

The contents of the product can even be just blank apps, I think the main premise is on having the correct flags in place.

In terms of doing the same on non-mobile platforms, that is more complicated. You will have to setup your own web server and have your game talk to it via HTTP. Best thing here would be hire a coder to do this (or learn yourself, will take time). Hope this helps.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Need help implementing a purchase system and branching..

#7 Post by trooper6 » Sun May 31, 2015 5:21 pm

dufatron wrote:I thought that most ren'py games were made for the internet and then you had to download a package to convert it to the app stores. I was under the assumption that the coding for the ren'py game to go on the internet would not be as hard as the converting of my game to fit the app store models.

...

Also how would I separate the four stories after the player makes a decision? Would this be done by branching within branching, like having a scene for each dude that has its own chapters and such, or is there something more complicated that I'm missing? Last question, do you think I should download the package to convert my game for the app store now and begin the process or should I wait until I finish my game and then download and convert it? Thank you again!
I've never played an online renpy game... I don't know of any. Though they may exist. All the renpy games I've played have been downloaded offline games...not internet games. Some of the professional folks here (Winter Wolves and Hanako Games) have worked out some sort of unlock mechanism...usually in the context of, you download a demo but after you pay money the full game is unlocked. I don't know how they do it. But renpy isn't an I browser game engine.

As for how to make the four stories (not counting the purchasing element)...that just sounds like a menu with jumps. You ask the player, which route do you want? They pick a route and then you jump to that route.

Code: Select all

label start:
    menu:
        "What boy do you want to pursue?"
        "Dwayne":
            jump dwayne_story
        "Jesse":
            jump jesse_story

label dwayne_story:
    "Here is Dwayne's story."
    return

label jesse_story:
    "Here is Jesse's story."
    return
How to write a story with branches is just something as basic as that.

Adding in the in app purchases for a non-app game is something I don't know much about.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

dufatron
Newbie
Posts: 15
Joined: Sat Apr 04, 2015 9:47 pm
Contact:

Re: Need help implementing a purchase system and branching..

#8 Post by dufatron » Sun May 31, 2015 6:07 pm

paktek123 and trooper6 thank you for your help! I originally wanted to make only mobile games with ren'py but I thought this was way more difficult so I decided that I would wait for this. I really don't care about making online games at all I just thought that the ren'py games were all online. When I went to the ren'py game list I assumed they were online, but I couldn't download not one of them for some reason. I will study the in-app purchase documentation you have listed and see what I can do with that. This is no doubt going to be a new low of stupidity for me but I have to ask, if the ren'py games are not online then where do they come from? That question legit makes me cringe but I seriously do not know and I think it's important info to understand so I had to ask. Thank you again!

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Need help implementing a purchase system and branching..

#9 Post by trooper6 » Sun May 31, 2015 6:26 pm

Well...many of the games are hosted online--either on the Renpy servers, or some other server--which you download and play offline. It is like any other sort of program that you get online, download from a website, install on your computer, and then play offline.

So am I to understand you have never played any Renpy games? You may want to play a few before diving into making your game so you can get a sense of the things that people have done. And some games are open so you can look at their code as you play along...which also helps in learning how to program.

I recommend Cyanide Tea's The Elevator as a first game to play with code to look at.

http://elevator.cyanide-tea.net
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

dufatron
Newbie
Posts: 15
Joined: Sat Apr 04, 2015 9:47 pm
Contact:

Re: Need help implementing a purchase system and branching..

#10 Post by dufatron » Sun May 31, 2015 7:50 pm

Thank you so much for explaining, I know it was a dumbass question but probably most of my questions are! I have played Winter Wolves games from the app store and "Get Dumped" but, no I have never played a ren'py game from the renpy list because everytime I try to it won't download. I will attempt to play The Elevator game today probably right now if it will download. Thank you so much for the help and recommendation!

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Need help implementing a purchase system and branching..

#11 Post by trooper6 » Sun May 31, 2015 10:59 pm

Are you on a Mac? If you are, the problem may be Mac's security protocols.
For example, I just read about OokamiKasumi's new NaNo game "The Walk" here: http://lemmasoft.renai.us/forums/viewto ... 11&t=30049
That post as a link to the game. So I downloaded it and it shows up on my desktop as a zip file.
I double click on that zip file to unarchive it.
There is a folder on my desktop called TheWalk-1.4-all.
I open the folder and double click on TheWalk.app (the Mac version).
I get a pop-up warning saying: "TheWalk.app" can't be opened because it is from an unidentified developer.
I click okay to dismiss that warning. But the program doesn't open.

So what do you have to do?
Right click on the program and click Open from the menu.
You will then get a warning pop up window that says: "TheWalk.app" is from an unidentified developer. Are you sure you want to open it?
You click open and then the game will run and you should be able to double click the game normally from then out.

If you can't even download the files in the first place, perhaps it is an issue with your computer's firewall? Can you download anything?
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

dufatron
Newbie
Posts: 15
Joined: Sat Apr 04, 2015 9:47 pm
Contact:

Re: Need help implementing a purchase system and branching..

#12 Post by dufatron » Mon Jun 01, 2015 1:07 am

I don't have a Mac I have a PC and I can download things. I downloaded ren'py and paint tool sai recently. I think the problem is that I'm truly an idiot when it comes to computers. I must have been living under a boulder for most of my life because I have some serious issues. I downloaded a few games a while ago from the ren'py game list and after I hit the download button and they downloaded I went under my downloads and clicked on them. There was a folder for both games and I opened the folder and clicked on the game which led me to a list of strange scripts for the game. I clicked on all of them and none of them would lead me to the actual game and I remember trying to open the game from the internet and the app store and other places but it wouldn't open so I figured it didn't download correctly. I tried again and nothing. I don't know if they didn't download or if there's a shockingly simple solution that I'm clueless about. But the good news is that "The Elevator" downloaded properly and I started playing it! Thanks again for helping me and if you know the reason the other games won't download can you tell me? Thank you!

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Need help implementing a purchase system and branching..

#13 Post by trooper6 » Mon Jun 01, 2015 1:19 am

Maybe you just aren't clicking on the right things in the download folder? If you could give an example of one of the games that didn't work for you, maybe one of the PC owners here could try to download and see what's up.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

dufatron
Newbie
Posts: 15
Joined: Sat Apr 04, 2015 9:47 pm
Contact:

Re: Need help implementing a purchase system and branching..

#14 Post by dufatron » Mon Jun 01, 2015 9:57 pm

Ok, if anyone here has a PC or can help me figure out why I couldn't play the games I'd really appreciate it. One of the games was Sunrise and when I clicked on the folder for the game I got this list: game, lib renpy, Sunrise. app, README, Sunrise, Sunrise, Sunrise.sh. So I clicked on the game button -I later clicked on all of them but got nothing- and then I got this list: archive.rpa, bytecode.rpyc, calling.rpyc, extras.rpyc, lc.rpyc, options.rpyc, readback.rpyc, screens.rpyc, script.rpyc, script_version, script_version.rpyc. So I clicked on all of those and none of them led me to the game. Does anyone know how I can play the game?

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Need help implementing a purchase system and branching..

#15 Post by trooper6 » Mon Jun 01, 2015 10:12 pm

I just downloaded Sunrise from here: http://luckysunscribes.itch.io/sunrise
Here is what is in the folder I unzipped: game, lib, README.html, renpy, Sunrise.app, Sunrise.exe, Sunrise.py, Sunrise.sh

Sunrise.exe is the one you want to click on to play the game if you are on a PC.
The list you gave had Sunrise.app, Sunrise.sh...and then two Sunrises with no extension. One of those two should be the Sunrise.exe
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Post Reply

Who is online

Users browsing this forum: Google [Bot], HypersDev, LilyValley98