Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (755)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (842)
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  
  GUI Dialouges  (Read 2026 times)
0 Members and 1 Guest are viewing this topic.
Offline Mads

JGO Ninja

Medals: 26
Projects: 3
Exp: 6 years

One for all!

« Posted 2011-06-26 08:45:09 »


You may've seen my WIP (If not,
I'm at a point where I'd really much like chatting with NPC's. This is hard though, because both NPC's needs to be able to chat, aswell as signs, and other objects that has text written on them in-game.
I'm planning on not making the player talk at all.

Here's how I want the dialouges to be: When the player interracts with something a box comes up with text it in. The box can upon input be refreshed to that the player can view the next line of text. I also want actions available like different directions of the dialouge depending on simple input like yes/no, and items given to the player upon reaching a point in a dialouge (a line).

I'm using a design pattern where data objects are not responsable for drawing themselves, instead I have a different object (screen) that draws all the things to the screen. My problem is, how do I attack this?
I'm sure I want some kind of dialouge object that both NPCs and Tiles can posses, and I might want a different object, in the screen, that draws the currenty active dialouge.

Thing is I have never done anything like that before, and I'm very unsure how I craft the system, because I obviously need to be able to modify the player from the dialouges, and I also need to be able to get input from the player (the screen has access to both the player, and the input).

Offline evilfrenchguy

Junior Devvie

Medals: 3

« Reply #1 - Posted 2011-07-07 21:24:12 »

I would have a DialogBox class. In the class, have an Array of Strings, where each element is another sentence or w/e, and a nextLine() method to move the dialog forward. Each NPC would be their own class with all of them inheriting an abstract talk() method. Inside talk(), call the dialog box's nextLine() method. You can program certain NPCs to give an item at a certain point in the conversation by tinkering with their specific talk method.

Just off the top of my head, so it might not be perfect.
Offline Salonika

Junior Newbie

while(alive) { code; play; }

« Reply #2 - Posted 2011-07-09 09:49:47 »

It so happens that i am trying to design a more general user interface api for my game that the input will be this of pokemon like games. A and B buttons and arrow buttons from a keyboard. My idea is to use a class to model all kind of ui elements i.e Component that will be able to update its state based on input and redraw it self. And a second class called Manager  that would hold a list of all the "alive" Components and its task will be to collect the input, send it to all the elements so that they can update their state and finally call their draw methods. Based on this model i plan to design all the ui elements i will need.

If you are interested in the idea why not work together? Let me know  Wink
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Skarion

Senior Devvie

Medals: 2
Projects: 1

« Reply #3 - Posted 2011-08-16 10:19:55 »

Depends if you want it to show up as in a regular RPG in the bottom (then I'd use a general borderlayout and then just show a jpanel at south when needed which populated from model), though if you want it to pop up next to the tile/player which fire said dialogue I'd use JPopupMenu which pops up when fired. Can easily be modified the way you wish it to be and should be populated from the model.

If you consider either of those suggestions sounds interesting you can just post a reply and I'll see if I can post a quick mock-up code of it.
Pages: [1]
  ignore  |  Print  

DesertCoockie (36 views)
2018-05-13 18:23:11

nelsongames (82 views)
2018-04-24 18:15:36

nelsongames (74 views)
2018-04-24 18:14:32

ivj94 (755 views)
2018-03-24 14:47:39

ivj94 (85 views)
2018-03-24 14:46:31

ivj94 (626 views)
2018-03-24 14:43:53

Solater (101 views)
2018-03-17 05:04:08

nelsongames (182 views)
2018-03-05 17:56:34

Gornova (408 views)
2018-03-02 22:15:33

buddyBro (1068 views)
2018-02-28 16:59:18
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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‑
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!