• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to implement a basic text-based rpg game in a website?  RSS feed

 
Filipe Madureira
Ranch Hand
Posts: 44
1
Chrome Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody!

I started programming some time ago and i recently finished a game i've been programming in Java just to get used to the code.
The game is a simple text-based RPG where almost everything is random except the character movement.
I've been thinking about learning HTML and CSS because i'm really interested in building webpages. I have no one to ask this question so here i am.

Is there a way to implement my game in a webpage?

I imagine a black window exactly like a classic OS terminal where the text is streamed and the user can play the game with keyboard inputs.
I made the game with 5 different classes, i used Eclipse and i have my project there, but i have no idea what to do with the code now. I'd also share the code but i don't know why, exept for the "code" form here in the forums.
Should i use a service like Github to share works like this one? I don't know anything about all this! Any ideas?

I hope i've been clear with my question, thank you in advance guys.
 
Stevens Miller
Bartender
Posts: 1445
30
C++ Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Felipe, it would probably be safe to say that pretty much everything you can do with Java can also be done, one way or another, as a Web application. That's probably not much help to you, as you may be looking for some way to convert an existing Java program that is not Web-based to something that is Web-based. While I don't know of anything to do that (someone else might), I can tell you that, if your interface is just a command-line style of input, output, input, output, then, yes, definitely this can be done as a Web application.

More useful might be for you to look into how existing Web applications are created. HTML and CSS are necessary skills for the Web, but you'll probably want to learn more if you want to develop serious applications. I have not yet learned HTML 5, but I hear it does support writing games. The earlier HTMLs were barely what I think people would call "programming languages," however.

Rather than think in terms of converting your Java application as a way to start learning Web coding, I'd say you should start with the basics. HTML and CSS are definitely basics, so you're already on the right track. But don't make converting your Java program your starting point. I am pretty sure that will just become frustrating and lead you to develop bad habits as you focus more on getting your program to work when you should be focused on developing good general technique.

Good luck!
 
Filipe Madureira
Ranch Hand
Posts: 44
1
Chrome Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the precious advice. I have no idea what web-based and not web-based means in the code. I imagine you mean that i'd have to convert from Java to another language that's available to use on browsers?

I started the HTML/CSS courses from Codeacademy.com and they're awesome! Which direction should i move after?
 
Stevens Miller
Bartender
Posts: 1445
30
C++ Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hard to suggest anything in particular (maybe someone with more Web experience can do that). For now, keep going with HTML and CSS, the have a look in particular at the gaming capabilities in HTML 5. The more you dig into this sort of thing, the more the answers to your early questions will become apparent to you.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For just text there's no real "gaming" involved and so advanced HTML5 using SVG or the canvas is vast overkill. Basic HTML, CSS and JavaScript can be used to supply the front-end, while the backbend engine is powered by Java.

So not only do you need to learn the HTML family of front-end technologies, but also servlets and JSP for the Java backend.

You can start with this article which explains what JSP is all about, and then this article which details the way to properly structure Java-based web apps.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!