Graphics-based 1v1 Combat System

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
menostorpe
Newbie
Posts: 15
Joined: Tue Jan 06, 2009 10:01 am
Contact:

Graphics-based 1v1 Combat System

#1 Post by menostorpe »

EDIT: I'm not sure I explained this clearly. Please see post #3 for my best attempt and further questions.

Original Post:
Basically, I have some artistic talent, but I'm in over my head on the coding side. To play to my strengths, I would like to make a simple combat system that relies on nice visuals more than a deep strategic system. The problem is that I lack the knowledge to get my pictures up on screen in a good way. I've looked at the combat systems in the cookbook and haven't found anything I'm capable of modifying to be what I want. My vision of this is pretty simple:

Two characters face each other taking up much of the screen, just like they usually do in conversations. Each has an HP/MP bar over their head, ideally called from an image I'd create instead of generated automatically. The two would then take turns attacking, the player choosing from a menu (also an image) in between them. I'd like to be able to have this menu vary based on variables, like if the player has a weapon or skill. I'd also like to be able to show damage as a popup image, so that I could make things more visually dynamic.

This feels like it should be relatively simple (compared to multi-character battles or systems with complex formulas), but I lack the Python knowledge to put those pieces on the screen correctly. I also lack the skill to put together a good battle loop that wouldn't be an ugly kludge. If I had a framework in place, I feel like I could modify it to my liking, but everything I've seen so far has a lot of pieces hard-coded beyond my ability to work with.

Is this just too overambitious? I suppose that might be the case and I'd need to reassess plans. But if anyone wants to take pity on me and point me in the right direction or even just show a basic example of how you'd place these things on the screen dynamically, it would be a huge help.
Last edited by menostorpe on Mon Jan 18, 2016 11:05 pm, edited 1 time in total.

User avatar
firecat
Miko-Class Veteran
Posts: 540
Joined: Sat Oct 25, 2014 6:20 pm
Completed: The Unknowns Saga series
Projects: The Unknown Saga series
Tumblr: bigattck
Deviantart: bigattck
Skype: bigattck firecat
Soundcloud: bigattck-firecat
Contact:

Re: Graphics-based 1v1 Combat System

#2 Post by firecat »

i know from experience that the stuff you asking will require you to learn to code. my code can help remove the textbox, add image button, hp/mp image bar or text, custom image menu, and hit system. however stuff like having a weapon (working on the inventory system), skill, and image number popup will require to learn python.

its no too overambitious, its just that different games require different codes.
Image


Image


special thanks to nantoka.main.jp and iichan_lolbot

menostorpe
Newbie
Posts: 15
Joined: Tue Jan 06, 2009 10:01 am
Contact:

Re: Graphics-based 1v1 Combat System

#3 Post by menostorpe »

Ah, sorry, I may not have expressed my problem clearly enough. I did my very best to make a basic framework, let me show what I have to demonstrate my coding ability or lack thereof:

Code: Select all

(clipped because outdated)    
        
        
So you see how I'm just setting up the character images and stats before each battle. It's very ugly, I feel like this is the sort of thing real programmers don't recommend for all kinds of reasons. It's just going to get uglier when I give the enemies proper stats, like attack and defense.

Another very basic thing I can't do: this system just uses the default menus for attack choices, which are very wide and cover the characters. I would like to use custom images, but I don't know how and I haven't found the right tutorial yet.

Finally, the "damage" and "healing" images are just placeholders. Ideally I'd like the actual number of damage to pop up over the characters. Is there a way I can define a special font type and have it display the damage variable?

So yes, I feel like these might be some pretty basic things I'm missing. Any help?
Last edited by menostorpe on Fri Jan 22, 2016 1:27 pm, edited 1 time in total.

philat
Eileen-Class Veteran
Posts: 1926
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Graphics-based 1v1 Combat System

#4 Post by philat »

1. There's nothing wrong with setting up things by hand unless you need a really dynamic system. If you only have two characters for each battle, the benefit of setting up classes and such seems like it would be negligible, although obviously much would depend on what you really want to do. If you just get your loop down with all the variables you need, the only thing you have to for each battle is change the variables in the front.

2. There probably isn't any framework that does what you want exactly, but most of your issues seem fairly straightforward cases of modifying screens and, in particular, passing parameters to screens.

For instance, showing damage numbers:

Code: Select all

screen damagepopup(damage, position):
    text str(damage) at position

transform leftchar:
    xpos 0.25  ypos 0.17
    yoffset 0
    easein 0.25 yoffset -100
    easeout 0.25 yoffset 0
    easein 0.2 yoffset -30
    easeout 0.2 yoffset 0
    easein 0.15 yoffset -10
    easeout 0.15 yoffset 0
    easein 0.1 yoffset -4
    easeout 0.1 yoffset 0

transform rightchar:
    xpos 0.75  ypos 0.75
    yoffset 0
    easein 0.25 yoffset -100
    easeout 0.25 yoffset 0
    easein 0.2 yoffset -30
    easeout 0.2 yoffset 0
    easein 0.15 yoffset -10
    easeout 0.15 yoffset 0
    easein 0.1 yoffset -4
    easeout 0.1 yoffset 0

label start:
    $ damage = 10
    show screen damagepopup(damage, leftchar)
    pause
    $ damage = 12
    show screen damagepopup(damage, rightchar)
    pause
You can also pass images to screens to show player / enemy sprites as well rather than using show/hide. Same goes for modifying the menu screen -- I don't know how fancy you want to get, but you can make your own screen with imagebuttons (look for the imagebutton GUI framework in the cookbook as a good tutorial) or just add a background to the default menu buttons (discussed in some detail here: http://lemmasoft.renai.us/forums/viewto ... 68#p399244).

menostorpe
Newbie
Posts: 15
Joined: Tue Jan 06, 2009 10:01 am
Contact:

Re: Graphics-based 1v1 Combat System

#5 Post by menostorpe »

Yes, passing things to screens was one of the parts I just didn't grasp. I think I understand the basics now, thank you for helping.

Post Reply

Who is online

Users browsing this forum: giorgi1111, Google [Bot]