Adventure game framework

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.
Post Reply
Message
Author
Anarchy
Veteran
Posts: 331
Joined: Mon Sep 12, 2011 1:51 am
Projects: Fairy Tales of Innocent Children
Contact:

Adventure game framework

#1 Post by Anarchy »

Well, maybe not quite a full framework, but I do want to make an adventure game/visual novel hybrid. The old school point-and-click adventure games, I mean.

The way I was going to do it is to have image maps whenever I want the user to interact with objects on the screen, but whenever an image map comes up, the text window at the bottom disappears, doesn't it? Also I wanted to have a separate screen, like a selection of actions (like "touch", "scan", "pick up", "inventory") that would be superimposed over the main game.

Would this be plausible, or is there an easier way to go about this?

QotC
Regular
Posts: 54
Joined: Thu Feb 17, 2011 8:53 pm
Contact:

Re: Adventure game framework

#2 Post by QotC »

Hey, that's kinda like what I'm doing! :D (current project is roomescape/dating sim) Want to join forces?

I haven't gotten anything perfect yet, but I can tell you it's definitely plausible. Didn't think to use image map; I've been trying it with individual image buttons.

ETA: For the record, here's how you would have your separate screen:

At the beginning of your code, define something like

Code: Select all

screen myscreen:  # defines your screen
    frame:  # Now you can put things like frames and buttons in it
        xalign 1.0
        yalign 0.0
        vbox:
            $ui.imagebutton("button_right.PNG", "button_right.PNG", clicked = ui.jumps(right)) #example python-statement button
Then somewhere in the beginning or pre-beginning of your game script...

Code: Select all

label start:

    show screen myscreen

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

    e "Once you add a story, pictures, and music, you can release it to the world!"
    
   
That'll give you a screen that you can fill with things like buttons and inventory slots. :)

KimiYoriBaka
Miko-Class Veteran
Posts: 636
Joined: Thu May 14, 2009 8:15 pm
Projects: Castle of Arhannia
Contact:

Re: Adventure game framework

#3 Post by KimiYoriBaka »

oh, how interesting. I just put my previous project on hold so I could work on a similar type of game. good to have some competition, lol.

anyway, some advice: unless you're trying to make something really programming heavy, drop the ui functions and just use screen language equivalents. It's much easier.

as for the imagemaps, yes, they do make the dialogue box disappear, but I don't see why you would want a dialogue box at the same time as you click on things anyway. that would get really messy. personally, I prefer imagebuttons, but that's just cause I'm going to be doing a lot of things that absolutely require them.

Also, how much of the game do you want as a vn and how much as an adventure game?

Anarchy
Veteran
Posts: 331
Joined: Mon Sep 12, 2011 1:51 am
Projects: Fairy Tales of Innocent Children
Contact:

Re: Adventure game framework

#4 Post by Anarchy »

Sorry, I'm a complete noob at this - what are screen language equivalents?

Also, how would you use imagebuttons to make an adventure game VN? I'm not sure how they work.

Ahh, at this point, I'm not sure. But the game itself isn't going to be very long - ten minutes of gameplay at the most.

EDIT: Thanks so much for the help with inserting the screen!

QotC
Regular
Posts: 54
Joined: Thu Feb 17, 2011 8:53 pm
Contact:

Re: Adventure game framework

#5 Post by QotC »

If it's at all comforting, Anarchy, I'm still noobish myself and am still learning how and when to use Screen Language. ^_~ As such, someone else can field that one. :p
(Personally, I have an easier time with the python bits, but only because that part of the manual is easier to copy/paste into my code)

As for imagebuttons...well, they're like an imagemap, except that instead of one big set of buttons, you have lots of little individual buttons. I'm sorry if that is not helpful, lemme try again:

Suppose I had a rope sitting on a shelf at a certain position on the screen. Co-ordinates: X .25, Y .25, that'd put in somewhere in the upper left, I think. Anyway, I'd make an image button like so:

Code: Select all

$ ui.imagebutton("rope.jpg", "rope.jpg", xpos = .25, ypos = .25, clicked = [None])
That button will give you a picture of a rope (assuming "rope.jpg" is, in fact, a picture of a rope. You have to define the images yourself, and you might decide to take a picture of your cat and call it "rope.jpg" for whatever reason. I'm not here to judge.) Xpos and Ypos will put it in the co-ordinates I just mentioned.

Clicked...will do nothing, because it is set to None. If you want to do something, you'll have to figure out a function or method or what-have-you that will do something to the game. Maybe you have a variable called "got_rope", then you can have

Code: Select all

clicked = [SetVariable("got_rope", True)]
Frankly, this is another part I'm still working out in my own project, so good luck. I hope this helps at least a little. :p

One advantage imagebuttons have over imagemaps is that you can customize each little button better. For example; suppose you wanted an accordian that squeezes or unsqueezes when you click it:

Code: Select all

if accordian_squeezed = False:
    $ ui.imagebutton("accordian1.jpg", "accordian1.jpg", xpos = .25, ypos = .25, clicked = [SetVariable("accordian_squeezed", True)])
else
     $ ui.imagebutton("accordian2.jpg", "accordian2.jpg", xpos = .25, ypos = .25, clicked = [SetVariable("accordian_squeezed", False)])
That'd give you two alternating buttons, based on whether the accordian is in the squeezed position.

Sorry if this isn't very coherent; like I said, I'm still learning too.

Edit: No problem! :D

KimiYoriBaka
Miko-Class Veteran
Posts: 636
Joined: Thu May 14, 2009 8:15 pm
Projects: Castle of Arhannia
Contact:

Re: Adventure game framework

#6 Post by KimiYoriBaka »

Code: Select all

if accordian_squeezed = False:
    $ ui.imagebutton("accordian1.jpg", "accordian1.jpg", xpos = .25, ypos = .25, clicked = [SetVariable("accordian_squeezed", True)])
else
     $ ui.imagebutton("accordian2.jpg", "accordian2.jpg", xpos = .25, ypos = .25, clicked = [SetVariable("accordian_squeezed", False)])
sl equivalent:

Code: Select all

 if accordian_squeezed == False:
    imagebutton idle "accordian1.jpg" xpos .25 ypos .25 action SetVariable("accordian_sqeezed", True)
else:
    imagebutton idle "accordian2.jpg" xpos .25 ypos .25 action SetVariable("accordian_sqeezed", False)
Pretty similar in this case, other than that I don't think you need to define hover (could be wrong, though). It would also be placed in the same position in the screen definition. The main difference as I see it is if you needed to have an imagebutton do multiple things when clicked, you can list them in order with the sl version, whereas the ui version would need a python function that does them all.
Ahh, at this point, I'm not sure. But the game itself isn't going to be very long - ten minutes of gameplay at the most.
what I mean is, do you want the player to be able to move and explore on they're own, or just click on things in the background whenever they notice them? if you want the player to explore, then your game will need a different structure then a normal vn.

Anarchy
Veteran
Posts: 331
Joined: Mon Sep 12, 2011 1:51 am
Projects: Fairy Tales of Innocent Children
Contact:

Re: Adventure game framework

#7 Post by Anarchy »

How would you list the multiple things in order in the sl version?

I think there will be sections where there's going to be more exploring, and sections where it's going to be more story/dialogue-choice-based.

KimiYoriBaka
Miko-Class Veteran
Posts: 636
Joined: Thu May 14, 2009 8:15 pm
Projects: Castle of Arhannia
Contact:

Re: Adventure game framework

#8 Post by KimiYoriBaka »

to make the imagebutton do multiple things, you just give a list of the actions it needs to do. for example, if you want a button to change a variable, then switch a variable between true or false

Code: Select all

imagebutton idle "image.png" action [SetVariable("variable1", "somevalue"), If("variable2", true=SetVariable("variable2", False), false=SetVarible("variable2", True)]
for your exploration parts, all you need to do is make a label that shows the character's actions (as you said, "touch" "scan" etc) and then have the label jump to itself. that way you can have the buttons jump to the necessary parts of your code, then jump back when the player needs to choose another action.

Anarchy
Veteran
Posts: 331
Joined: Mon Sep 12, 2011 1:51 am
Projects: Fairy Tales of Innocent Children
Contact:

Re: Adventure game framework

#9 Post by Anarchy »

Is there a way to get the button to call a label when clicked? If so, how does that happen?

KimiYoriBaka
Miko-Class Veteran
Posts: 636
Joined: Thu May 14, 2009 8:15 pm
Projects: Castle of Arhannia
Contact:

Re: Adventure game framework

#10 Post by KimiYoriBaka »

when you say, "call" do you mean go to the new label, or the actual call statement?

if you just want to go to the label, that's what the action Jump() is for (with the label's name in quotes). If you want to call a label, there's renpy.call_in_new_context(), but I'm not really sure how that one works. Also, if you just want to call another screen, there ShowTransient().

Anarchy
Veteran
Posts: 331
Joined: Mon Sep 12, 2011 1:51 am
Projects: Fairy Tales of Innocent Children
Contact:

Re: Adventure game framework

#11 Post by Anarchy »

Awesome, thanks!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]