Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Need help designing a Visual Novel/Tactical RPG (kinda like Fire Emblem)  (Read 4967 times)
0 Members and 1 Guest are viewing this topic.
Offline Indignation211

Senior Newbie





« Posted 2011-08-06 01:09:58 »

So Im making a game that's a mix of Visual Novel and Tactical RPG. Essentially the game flows from one event to another based on a script. Decisions along the way can alter the path the player takes through the story. There are two general types of events: Story events which tell the story, and Battle events in which the player must fight enemies in a Tactical RPG fashion. Basically its like Fire Emblem but with branching paths.

So what i need help with is:
1) Getting the game to go along with the story as well as player decisions (namely the branching paths).
2) Getting the game to switch from "Story mode" to "Battle mode"
3) Getting all of the above to display on the screen.
3.5) To be more specific on number 3, theres an awful lot of data related to graphics (like monster sprites) that are all the way down in Battle that need to be brought up to the Main class to be displayed, while Battle is running a loop and without interfering with said loop.
4) Making sure i dont get something like the screen not updating until the battle loop is finished (I have a funny feeling that my current main class will end up doing this).
5) How would I go about getting, say, PNG files to display using the opengl Display?

Right now the problem is more of overall design rather than actual programming, so for now i just need general suggestions like what kinds of classes to make and how to have them interact with each other and ultimately how to get the main class shown below to work with them. Also I pretty much already have the battle system designed, so im good on everything that takes place WITHIN a "Battle Event"; its just everything outside that i need help with. Thanks to anyone who can help.

The work ive done so far:
For numbers 1 and 2, my idea is to have a Script class, which contains an Array of Scenes (Scene is an interface with one method play()) and has a method to read them called read(). Two classes, Story and Battle, implement Scene. When play() is called on a Story, it reads through the dialogue until it runs out of dialog to display, at which point read() moves on to the next Scene. When play() is called on a Battle, the game goes through a battle (it should be noted that in this setup, Battle.play() contains the battle system.).

Here's the main class (there is some lwjgl and opengl involved, but just a little bit)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
package game;

import org.lwjgl.Sys;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;

public class Game {

    /** The title of the game that appears in the top of the Display */
    public static final String GAME_TITLE = "My Game";
    /** The desired frame rate */
    private static final int FRAMERATE = 60;
    /** Exit the Game */
    private static boolean finished;

    /**
     * Start application
     * @param args the Commandline args
     */

    public static void main(String[] args) {
        try {
            init();
            run();
        } catch (Exception e) {
            e.printStackTrace(System.err);
            Sys.alert(GAME_TITLE, "An error occured and the game will close.");
        } finally {
            cleanup();
        }
    }

    /**
     * Start the game
     * @throws Exception if init fails
     */

    public static void init() throws Exception {
        Display.setTitle(GAME_TITLE);
        Display.setVSyncEnabled(true);
        Display.create();
    }

    /**
     * Run the game (this is the "main loop")
     */

    public static void run() {
        while (!finished) {
            Display.update();
            if (Display.isCloseRequested()) {
                finished = true;
            } else if (Display.isActive()) {
                Display.sync(FRAMERATE);
            } else {
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                }
            }
        }
    }

    /**
     * Do any game-specific cleanup
     */

    public static void cleanup() {
        Display.destroy();
    }
}
Offline theagentd
« Reply #1 - Posted 2011-08-06 01:48:41 »

Use a state machine.

Myomyomyo.
Offline Cero
« Reply #2 - Posted 2011-08-06 01:50:24 »

First thing: I would suggest just taking Slick, because then you dont have to worry too much about most lower level stuff, while still being able to access lwjgl if needed.

Well I'm having a hard time visualizing how you game would play out - since there aren't really any RPG visual novel hybrids I know of
Battle & Story (Dialog scenes), also map screens ?

maybe concept screenshots or something =D

The scripting approach I use for dialogs and cutscenes aswell; how to implement it depends really on the game

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Indignation211

Senior Newbie





« Reply #3 - Posted 2011-08-06 02:10:36 »

Like I said, the game would pretty much be like Fire Emblem with branching paths. Another (possibly more accurate comparison) would be Record of Agarest War for the PS3 (minus the map screen... although that IS still a possibility), lesser known by far but it almost fits my game's concept to a T.

Also what's Slick (never heard of it)?
Offline ra4king

JGO Kernel


Medals: 347
Projects: 3
Exp: 5 years


I'm the King!


« Reply #4 - Posted 2011-08-06 02:20:55 »

Slick is a 2D library built on LWJGL. It has a syntax similar to Java2D. It's only downside is that it uses immediate mode rendering so you can't do extensive graphics with it.

Offline Cero
« Reply #5 - Posted 2011-08-06 02:50:52 »

Like I said, the game would pretty much be like Fire Emblem with branching paths. Another (possibly more accurate comparison) would be Record of Agarest War for the PS3 (minus the map screen... although that IS still a possibility), lesser known by far but it almost fits my game's concept to a T.

No relation to Record of Lodoss War =P

I think what you're trying to do is almost exactly like Disgaea series.
You have dialog scene's conveying the story (no choices in disgaea though) and then battle. And battle is turn based tactical, similar to ff tactics, only way over the top, which I like.

Yea well basically you would have 2 modes, at least, battle and dialog. You can split those into separate classes and do your interface stuff and such, but...  well these kinds of implementations are up to you - there is no one way to do it.
I have different modes, like MENU, INGAME etc, controlling whats actually going on. In my case however cutscenes and dialogs are an extension of the gameplay, which isn't the case for you, unless you want some dialog during the battle aswell - which is rather rare
you definitely wanna write a script system in which you have the dialog text, which background image, artworks of the character, which music, maybe sound effects (some modern visual novels have them), maybe visual effects and maybe even voice playback
branching or not - a script like that is just like a movie script: the actors talk, stuff happens, from top to bottom in the script

Offline theagentd
« Reply #6 - Posted 2011-08-06 02:59:39 »

Yea well basically you would have 2 modes, at least, battle and dialog. You can split those into separate classes and do your interface stuff and such, but...  well these kinds of implementations are up to you - there is no one way to do it.
I have different modes, like MENU, INGAME etc, controlling whats actually going on. In my case however cutscenes and dialogs are an extension of the gameplay, which isn't the case for you, unless you want some dialog during the battle aswell - which is rather rare
you definitely wanna write a script system in which you have the dialog text, which background image, artworks of the character, which music, maybe sound effects (some modern visual novels have them), maybe visual effects and maybe even voice playback
branching or not - a script like that is just like a movie script: the actors talk, stuff happens, from top to bottom in the script
Exactly. Use a state machine.  Tongue

Concerning scripting: I've made a normal visual novel as a school project, and the script engine was probably the most time consuming because I wrote it from scratch, which was a pain in the ass. I had to implement my own if-statements and everything... T__T Try to avoid it if you can, but if you really want to make your own script language use Java Reflection. That way you can easily call normal Java functions from your script and avoid insanely long if/else or switches.

Myomyomyo.
Offline Indignation211

Senior Newbie





« Reply #7 - Posted 2011-08-06 03:02:29 »

Exactly. Use a state machine.  Tongue

Now what is a state machine?
Offline theagentd
« Reply #8 - Posted 2011-08-06 05:34:23 »

You generalize your game loop to hold a State object, which is updated and rendered. Examples of states for you: Main menu, Visual novel, Battle, Credits, Save menu, etc etc etc. You can split them up as you want, but the goal is to keep your classes less generalized. You should have a State class that all game states extend which contains basic functions like update(double delta) and render(). Maybe callbacks for mouse and keyboard input.

Myomyomyo.
Offline Cero
« Reply #9 - Posted 2011-08-06 12:52:38 »

Concerning scripting: I've made a normal visual novel as a school project, and the script engine was probably the most time consuming because I wrote it from scratch, which was a pain in the ass. I had to implement my own if-statements and everything... T__T Try to avoid it if you can, but if you really want to make your own script language use Java Reflection. That way you can easily call normal Java functions from your script and avoid insanely long if/else or switches.

Mhh... can't say that I've had as many problem with it. But using a existing scripting language seems pro professional.
I wrote my own and parser and stuff... and you have long if else... obviously, but I mean must stuff a script can do is packed into methods anyway.
For a extremely simple example
"change music: bla.ogg" calls changeMusic("bla.ogg");   thats it
and the talking it self is extremely simple... you just fill a string (2 if you display the name of the talker aswell) with something from the script, display it.
"change char-artwork: John" sets the artwork image to this picture, and this picture is being displayed all the time anyway during talking

and so on, its not hard

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ReBirth
« Reply #10 - Posted 2011-08-07 03:39:10 »

I have played Fire Emblem. For you who haven't it's some kind of TBS (turn-based strategy) like Onimusha Tactics. Use state machine to provide story, battling zone, and actual battle state. Actual battle state (when your char strikes target with animation) should be easy but battling zone. It needs to be implemented carefully since using grid. Story state is nothing but a bunch of text slide show.

Offline theagentd
« Reply #11 - Posted 2011-08-07 21:10:01 »

You really want to avoid if-else statements in your script parser. You'll have way more functions than you think. For my visual novel I had functions for:
 - Loading images and animations ~5 functions
 - Building and manipulating objects ~10 functions
 - Math (add, subtract etc) 4 functions
 - Movement ~5 functions
 - Text displaying ~5 functions
Add sound, script changing etc and it ends up on about 100 functions.
For branching you also need some kind of if-functionality. I made my script language Java-like. I also recursively checked statements, so my code could handle lines like this:
1  
showText("Character Name", aStringVariable, getTextSpeed());

My script parser class is over 400 lines long. You're gonna end up on over 1k lines if you try to do what I did with if-statements. -.-

Myomyomyo.
Offline Cero
« Reply #12 - Posted 2011-08-07 22:25:51 »

well my scripting system is very high level, each script command equals 1-5 lines of java code in the parser, mostly just one, everything is prepared.
Depends on design...

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Pippogeek (36 views)
2014-09-24 07:13:29

Pippogeek (29 views)
2014-09-24 07:12:22

Pippogeek (18 views)
2014-09-24 07:12:06

Grunnt (41 views)
2014-09-23 05:38:19

radar3301 (24 views)
2014-09-21 14:33:17

BurntPizza (60 views)
2014-09-20 17:42:18

BurntPizza (30 views)
2014-09-20 16:30:30

moogie (35 views)
2014-09-20 15:26:15

UprightPath (48 views)
2014-09-20 11:14:06

BurntPizza (52 views)
2014-09-18 18:14:18
List of Learning Resources
by Longor1996
2014-08-16 01:40:00

List of Learning Resources
by SilverTiger
2014-08-05 10:33:27

Resources for WIP games
by CogWheelz
2014-08-01 07:20:17

Resources for WIP games
by CogWheelz
2014-08-01 07:19:50

List of Learning Resources
by SilverTiger
2014-07-31 07:29:50

List of Learning Resources
by SilverTiger
2014-07-31 07:26:06

List of Learning Resources
by SilverTiger
2014-07-31 02:54:12

HotSpot Options
by dleskov
2014-07-07 16:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!