Ranch Hand
The only real prerequisite for a game to be an adventure game is that it must take you on an adventure. That describes most games. Advsnture, an adventure game could be anything. If we missed any of the best adventure games for Android, tell us about them in the comments! You can also click here to check out our latest Android app and game lists!
posted 9 years agoI am currently writing a 'Create Your Own Adventure' game in Java. I know the basics of java, and I know how to write a story. There will be story, choices, then more story. Here is a chunk of the story so far
The year is 1917, and America has just entered the Great War. It is a cold morning a few miles off of the coast of New York,
and you can see the fog rolling across the water. You shiver and embrace yourself, only to fend off some of the cold. As you stare
off of the bow the fog begins to clear, and Lady Liberty comes into view. Your hear races in excitement, and you shake more.
///////////////////NEXT///////////////////////////
Your nose feels a sharp breeze, and starts to run. You wipe it off on the sleeve of your worn out jacket, the one your father
gave to you. You look around to see if anyone noticed, and you see a little girl around seven holding the hand of her mother. She is
staring right at you. What do you do?
///////////////Choice #1//////////////
1. Give her a look to frighten her.
2. Ignore her.
3. Give her a friendly smile and a wave.
/////////////NEXT/////////////////
The little girl looks embarrassed and turns away, a shy child obviously. You remember that age don't you? Clinging to your
fathers hand wherever you go, shy and afraid of the world. She isn't too different from you, now is she? Let's talk about your father
now, shall we?
//////////////NEXT////////////////////
Unlike most fathers, yours wasn't a drunk. He was all you had, you loved him. But you know that, don't you? He raised you
from birth, and made you into the man you are today. He loved your mother, and even though you killed her in child birth he never
blamed you. Never did he guilt you or look down on you for it, he viewed you as the last living thing of her. He gave you the best life
he could, which wasn't very much.
///////////////CHOICE #2////////////////
Growing up in poverty wasn't always easy, or ever easy. Your father loved you, and kept you out of the factories as long as he
could, but you two could only go so long without two sources of income. The three factories closest to your hometown where the
Steel Mill, the Lumber Mill and the Textile Mill. The working conditions where all terrible and kids died everyday working in these
factories. But you needed the money badly, so you got a job. Where did you work at?
1. Steel Mill
2. Textile Mill
3. Lumber Mill
Now, the problems is (I feel dumb) I have NO clue how to do this, or even how to start. If you can help me with how to write the code, or give me a tutorial (I couldn't find the right kind) it would really help. You've helped me before guys, lets see if you can help me again!
The year is 1917, and America has just entered the Great War. It is a cold morning a few miles off of the coast of New York,
and you can see the fog rolling across the water. You shiver and embrace yourself, only to fend off some of the cold. As you stare
off of the bow the fog begins to clear, and Lady Liberty comes into view. Your hear races in excitement, and you shake more.
///////////////////NEXT///////////////////////////
Your nose feels a sharp breeze, and starts to run. You wipe it off on the sleeve of your worn out jacket, the one your father
gave to you. You look around to see if anyone noticed, and you see a little girl around seven holding the hand of her mother. She is
staring right at you. What do you do?
///////////////Choice #1//////////////
1. Give her a look to frighten her.
2. Ignore her.
3. Give her a friendly smile and a wave.
/////////////NEXT/////////////////
The little girl looks embarrassed and turns away, a shy child obviously. You remember that age don't you? Clinging to your
fathers hand wherever you go, shy and afraid of the world. She isn't too different from you, now is she? Let's talk about your father
now, shall we?
//////////////NEXT////////////////////
Unlike most fathers, yours wasn't a drunk. He was all you had, you loved him. But you know that, don't you? He raised you
from birth, and made you into the man you are today. He loved your mother, and even though you killed her in child birth he never
blamed you. Never did he guilt you or look down on you for it, he viewed you as the last living thing of her. He gave you the best life
he could, which wasn't very much.
///////////////CHOICE #2////////////////
Growing up in poverty wasn't always easy, or ever easy. Your father loved you, and kept you out of the factories as long as he
could, but you two could only go so long without two sources of income. The three factories closest to your hometown where the
Steel Mill, the Lumber Mill and the Textile Mill. The working conditions where all terrible and kids died everyday working in these
factories. But you needed the money badly, so you got a job. Where did you work at?
1. Steel Mill
2. Textile Mill
3. Lumber Mill
Now, the problems is (I feel dumb) I have NO clue how to do this, or even how to start. If you can help me with how to write the code, or give me a tutorial (I couldn't find the right kind) it would really help. You've helped me before guys, lets see if you can help me again!
Ranch Hand
posted 9 years agoHow do you want to do this? Text based? From a console (like Zork, games like that)? With a GUI?
Which part are you having trouble with?
Which part are you having trouble with?
Ranch Hand
posted 9 years agoYes, it is going to be text based, and it is going to run as an exe JAR that will be downloaded.
I need help with... Heh... Everything I suppose. Well.... I need help getting it started and piecing it all together.
I need help with... Heh... Everything I suppose. Well.... I need help getting it started and piecing it all together.
![Adventure game java code Adventure game java code](http://mrpopat.in/admin/upload/game/201110221319266166325757895.jpg)
Ranch Hand
![Adventure.java Adventure.java](/uploads/1/2/5/7/125799558/857152752.jpg)
Start small. Very small. Break your problem up into separate pieces, and get those pieces working independently before you even think about putting them together.
Do you know how to output text to the console? Do you know how to get input? Those would be two solid places to start. Google is your friend.
If you get stuck, feel free to post an SSCCE demonstrating what you've tried and ask a specific question about that one piece.
Do you know how to output text to the console? Do you know how to get input? Those would be two solid places to start. Google is your friend.
If you get stuck, feel free to post an SSCCE demonstrating what you've tried and ask a specific question about that one piece.
Ranch Hand
posted 9 years agoPS- I'm not quite sure how you're going to do console IO with an executable JAR. But one thing at a time.
lowercase baba
posted 9 years agowhat you basically need is a state table or a tree. At each point in the story, the user has 2+ choices (do you want to define an upper limit or design it to be expandable to any number of choices?) So each node would have the current text of the story, and what the choices are. Then, you would go to the next node based on the choice the user makes, and print that stuff to the screen.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Saloon Keeper
posted 9 years agoYeah, a 'dialogue tree' would be a good way to do this. What you could do is make 'story nodes' that reference to a piece of the story, and that reference to a series of 'choice nodes'.
Make the 'choice nodes' reference to one other story node.
You can improve the choice nodes with conditions that determine when they appear, for instance, the main character has taken a particular path in the past, or is in possession of a certain item. You can also enhance both the choice nodes and the story nodes with effects, that will occur when a particular path is chosen, for instance, the main character is given a certain item when he takes a specific path.
http://en.wikipedia.org/wiki/Dialog_tree
Make the 'choice nodes' reference to one other story node.
You can improve the choice nodes with conditions that determine when they appear, for instance, the main character has taken a particular path in the past, or is in possession of a certain item. You can also enhance both the choice nodes and the story nodes with effects, that will occur when a particular path is chosen, for instance, the main character is given a certain item when he takes a specific path.
http://en.wikipedia.org/wiki/Dialog_tree
Ranch Hand
posted 9 years ago
lowercase baba
posted 9 years agoumm...what do you mean by 'like Zork'?
You'd do the exact same thing, except you need a language parser to figure out what the user types and what they mean. Then you have to check and see if it's valid. I.e. if they type 'put statue in backpack', you have to check and see if they have a statue, if they have a backpack, and if the statue will fit (there may be some items that aren't allowed in the backpack)
Your nodes will now have to be able to handle not only where they can go (if they are in the foyer, they can get to the bathroom (e), kitchen(s) and hall (n), but not the bedroom which is n of the hall), but weather the action makes sense there, and what the results would be. Swinging the sword in the kitchen might break a pot, but in the foyer might break the coat rack.
You'd do the exact same thing, except you need a language parser to figure out what the user types and what they mean. Then you have to check and see if it's valid. I.e. if they type 'put statue in backpack', you have to check and see if they have a statue, if they have a backpack, and if the statue will fit (there may be some items that aren't allowed in the backpack)
Your nodes will now have to be able to handle not only where they can go (if they are in the foyer, they can get to the bathroom (e), kitchen(s) and hall (n), but not the bedroom which is n of the hall), but weather the action makes sense there, and what the results would be. Swinging the sword in the kitchen might break a pot, but in the foyer might break the coat rack.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Ranch Hand
posted 9 years agoHi - It seems to me there are a number of ways you could organize this. I'm relatively new to Java myself, so some of the suggestions might not be the most efficient, or they might be at too basic a level.
First off, I'd avoid using the console. It could be done, but a lot of folks don't know how to deal with the consoles of their computers. There is no reason not to display the text via Swing, e.g., JFrame & either a single JPanel that gets updated, or a series of JPanel-based classes, e.g., class StoryStart extends JPanel, class Branch1 extends JPanel, class Branch1a extends JPanel, etc., but you end up with maybe a lot of duplication and 50 or 100 classes depending upon the size of the story!)
Since you are offering choices, rather than requiring inputs, you could consider using buttons for the choices. Alternatively, a JTextField could be made where one types in the choice, but you'd have to deal with parsing the typing. With JButtons, you would have to learn how to program a Listener for the Button. But this is a standard part of Swing, and thus covered in most any halfway decent beginning Java book. Also, adding and deleting text, images and buttons with labels for the buttons to and from a JPanel is very straightforward.
The code that executes when the JButton is pressed can either call the 'next' JPanel (if you produce this as a stack of JPanels) or it can call stored text or stored JButtons as needed and add them to the JPanel (after deleting the prior objects). JPanels, JTextAreas, JButtons can all be created and added or deleted from a JFrame or whatever container as part of what gets executed by the code called from the Button choice. Last step of any button code would be a repaint(), I'm assuming.
Also, you'll probably want to make some private class variables to hold 'state' information that might need to be referenced by the code the button triggers.
If you are updating a single JPanel, an option is to keep the same buttons but update what they do. If you check out the HF Design Patterns book, famous on this site, take a look at the 'Strategy' pattern (chapter 1) as a possible way to update the code that the buttons execute.
Sounds like a fun project, and I hope I get a chance to try it once it is complete!
--Phil Freihofner
First off, I'd avoid using the console. It could be done, but a lot of folks don't know how to deal with the consoles of their computers. There is no reason not to display the text via Swing, e.g., JFrame & either a single JPanel that gets updated, or a series of JPanel-based classes, e.g., class StoryStart extends JPanel, class Branch1 extends JPanel, class Branch1a extends JPanel, etc., but you end up with maybe a lot of duplication and 50 or 100 classes depending upon the size of the story!)
Since you are offering choices, rather than requiring inputs, you could consider using buttons for the choices. Alternatively, a JTextField could be made where one types in the choice, but you'd have to deal with parsing the typing. With JButtons, you would have to learn how to program a Listener for the Button. But this is a standard part of Swing, and thus covered in most any halfway decent beginning Java book. Also, adding and deleting text, images and buttons with labels for the buttons to and from a JPanel is very straightforward.
The code that executes when the JButton is pressed can either call the 'next' JPanel (if you produce this as a stack of JPanels) or it can call stored text or stored JButtons as needed and add them to the JPanel (after deleting the prior objects). JPanels, JTextAreas, JButtons can all be created and added or deleted from a JFrame or whatever container as part of what gets executed by the code called from the Button choice. Last step of any button code would be a repaint(), I'm assuming.
Also, you'll probably want to make some private class variables to hold 'state' information that might need to be referenced by the code the button triggers.
If you are updating a single JPanel, an option is to keep the same buttons but update what they do. If you check out the HF Design Patterns book, famous on this site, take a look at the 'Strategy' pattern (chapter 1) as a possible way to update the code that the buttons execute.
Sounds like a fun project, and I hope I get a chance to try it once it is complete!
--Phil Freihofner
Ranch Hand
posted 9 years agoJust remembered this layout maybe worth looking at: CardLayout. Might be a way to organize a lot of JPanels (one per story page) onto a single JPanel. I haven't tried this yet. Maybe have two panels on a frame, one with buttons and a button listener as a driver panel, the other with a display panel with a CardLayout and lots of story pages and data to update the buttons' 'labels' and 'strategies'. Just a thought.
Saloon Keeper
posted 9 years agoI think simplest would probably be a JTextArea that is uneditable, and simply clear it and fill it with new text with each new part of the story.
Ranch Hand
posted 9 years agoNot to take away from the whole gui idea here, but there's just that whole element of gameplay that you take away when setting everything in stone using a gui to present a limited set of choices. There's a fun factor in guessing what you have to type, like figuring out that you have to swing a sword in a room to break a pot, or use a certain key in a certain lock, as opposed to clicking one of three options (without having to think about it much) that will quickly progress you through the game. I'm all for approaching this from the command line, and even with having to code the parsing mechanism, it can be just as manageable of a solution as doing it through swing (in my opinion), and possibly even more fun. Or at least let the user type commands in through the gui, versus having a few button choices. That way you solve the problem of opening the command prompt from the executable jar.
Ranch Hand
posted 9 years agoMaybe a bit off topic, but you may want to take a look at inform (http://www.inform-fiction.org/I7/Welcome.html). I think it is pretty easy and has a lot of features to create this kind of adventure.
Greenhorn
posted 9 years agoHi everyone,
I've used directed graphs for making dialogue trees. I'm not sure if this is the best way to do this but it has worked for me.
Node (or Vertice) itself is an instance of a class that contains attributes such as pointers (or edges) to other nodes,
the dialogue text and the id of the node. I've included the edges in the Node class as a private subclass and then just created
instances from it to other nodes by their id.
http://en.wikipedia.org/wiki/Directed_graph
A simple way to search a graph is the breadth-first search (works for undirected graphs as well).
http://en.wikipedia.org/wiki/Depth-first_search
Cheers,
Sarah
Edit: Oh, and you can add as much scripted text (or any kind of attributes) into the nodes as you like.
I've used directed graphs for making dialogue trees. I'm not sure if this is the best way to do this but it has worked for me.
Node (or Vertice) itself is an instance of a class that contains attributes such as pointers (or edges) to other nodes,
the dialogue text and the id of the node. I've included the edges in the Node class as a private subclass and then just created
instances from it to other nodes by their id.
http://en.wikipedia.org/wiki/Directed_graph
A simple way to search a graph is the breadth-first search (works for undirected graphs as well).
http://en.wikipedia.org/wiki/Depth-first_search
Cheers,
Sarah
Edit: Oh, and you can add as much scripted text (or any kind of attributes) into the nodes as you like.
Greenhorn
posted 9 years ago[size=9]In a Zork type of game, there are lots of predefined, numbered rooms. The rooms have doors in and out, in all the directions, if you want. The numbers pertain to where in an array you place the room object.
You must first define your world by making a diagram, with your rooms (diagram as little square boxes) and pathways leading N,NE,E,SE,S,SW,W,NW, UP, and DOWN.
thus, if a player is in room x and types up, he/she will be in the connected room no.
Here's an easy way to make the rooms; it's busy but you wanted to write games, so...:
[/size]
So you can see where I'm going with this. make your diagram first, then encode it. I always loved these types of games, and probably still do but haven't the time to play. Others may do this differently, so look around.
Hope this helps though.
You must first define your world by making a diagram, with your rooms (diagram as little square boxes) and pathways leading N,NE,E,SE,S,SW,W,NW, UP, and DOWN.
thus, if a player is in room x and types up, he/she will be in the connected room no.
Here's an easy way to make the rooms; it's busy but you wanted to write games, so...:
[/size]
So you can see where I'm going with this. make your diagram first, then encode it. I always loved these types of games, and probably still do but haven't the time to play. Others may do this differently, so look around.
Hope this helps though.
Best of perman adventure java game download at KeywordSpace(Out of 18 in result | Last check 13 January 2019)
Description | Pos. | ||
---|---|---|---|
0 | 1 | ||
0 | 5 | ||
0 | 6 | 6(0) | |
Play Ben 10 games | Power Rangers games | Spiderman games GameGape is the premier games site where you can play over 20,000 free online games including all Ben10, Spiderman, Power Rangers, Mario, Sonic games | 0 | 8 | |
Mobile games. Free download java games for mobile phones. You can find many free java mobile games downloads here. The game catalog is daily updated with top mobile phone games. Download free jar jad games for your phone right now! | 39 | 9 | |
Gamezwap.Net :: Java Games Download For Nokia Samsung Wap.in Games Gameloft games gameswap gamewap Gamezwap.Net::Java Games Download For Nokia Samsung Wap.in Games Gameloft Games gameswap gamewap | 0 | 10 | |
GetJar - Download Free Apps, Games and Themes APK GetJar is the biggest open appstore in the world, currently listing 956000+ apps with more than 3M downloads per day. | 0 | 11 | 11(0) |
0 | 12 | ||
0 | 13 | 13(0) | |
0 | 14 | ||
Google Translate Google's free service instantly translates words, phrases, and web pages between English and over 100 other languages. | 0 | 15 | 15(0) |
0 | 16 | ||
onmedia.tk | 0 | 17 | |
0 | 18 | 18(0) |