• Advertisement

Text Based RPG

Recommended Posts

Hello everyone! First if you are taking the time to read this "Thank You!" I'm new to programming (Java and C), and I would like to learn/practice more by making a Text-Based RPG. I have an idea in mind and I kinda started to code it in Java but I'm not sure how to put my bits of code together and would like some help. I'm not asking to make the game for me, but to guide me in the right direction... maybe some books, tutorials or even some one on one if you don't mind.

The game I have in mind is going to contain:

A player, world, leveling system, melee combat system(with some skills), monsters, inventory system, intractable objects(like a tree that you can cut down), item storage system, NPC's that interact maybe a store or something, and a saving and loading system.

After that maybe I would like to add some more Non-Combat skills, a mage and range combat system along with some more skills, and make the world a bit larger with some interesting stuff in it...

Anyways that's a lot so thank you for taking your time to read this, let me know if I can explain anything better or if I didn't explain something enough!

Share this post


Link to post
Share on other sites
Advertisement

The most important thing in any challenging project is to write down exactly what your goals are so every step of the way you know what you're trying to achieve. Any effort you put into a project when your goals are fuzzy is potentially wasted effort. It often happens that people will start work on a game and never finish because they end up wasting their effort working toward fuzzy goals. To avoid that fate, write down in full detail exactly what you expect from the game, and that process will focus your mind on the specific problems you must overcome and help you find ways to implement your design.

Here's a link to a guide to writing game design documents: How (and Why) to Write a Great Game Design Document

Share this post


Link to post
Share on other sites

If you're writing it in C and you are new, I find the difficult part to be using structs and pointers to create a 'database' of the world. It can get surprisingly complicated very quickly if you aren't thoroughly grounded in that type of stuff. So I personally would make sure you fully understand and do a few test programs involving linked lists and the like.

If you're really impatient and just want to get some exposure and write a small game quickly. you can cheat like I did and just have a function for every room, then a switch statement for player choice. Although this results in a lot of copy and paste ugly code and is not to be recommended.

Let us know how you get on as I'm still trying to find the best way of doing this in C too.

Share this post


Link to post
Share on other sites

There is so much structure in this kind of programs that the only sane option is to evolve to an OO-way of writing the code.

You make structs for each kind of data, then for each struct you have a set of functions that take a pointer to "its" struct as the first argument. For keeping track of what function does what, use a name convention for the function name, eg "structname_function(structname *this, ...)".

I found this pattern already before OO was invented (likely I have been writing code too long :P ).

The simple form of the above supports single inheritance, by putting the base struct as its first member. You don't get overloading or polymorphism easily, but usually that's not needed.

 

Now, if you evolve to this kind of code structure anyway, I don't see the point of not simply switching to a language that has "class" in its vocabulary where you get all the above out of the box, inclusive extensive error checking by the compiler.

Share this post


Link to post
Share on other sites
11 hours ago, Scouting Ninja said:

Start here learn how to create a player class and how to set it's stats.

 

So far I have a very basic player class with all its stats, leveling system, and some other incomplete stuff! I'll attach the file for my player class. Thanks!

Player.java

10 hours ago, ICanC said:

Let us know how you get on as I'm still trying to find the best way of doing this in C too.

I'm doing it in java since its a more "advance language"...

Edited by rafael rodriguez

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Advertisement
  • Advertisement
  • Popular Now

  • Advertisement
  • Similar Content

    • By CosmicMeatloaf
      Hey guys, I recently made this post, I recommend skimming for a quick gist and look at the results at the bottom of the post : 
      (I felt that post misrepresents what I've turned the language into as of right now, so here's this post.)
       
      Where I described my proposition for a language to replace CSS (for good reasons, in my view).
      Well I've gone ahead and create a Jar for it, and a GitHub wiki with a syntax specification (I recommend reading that instead of the syntax in the post I linked), and a quick-start guide to start making your own UX Library compatible with the language, if you want something a little less... shipoopi to work with. More organized, and robust.
      Here is the GitHub for anyone who is interested:
      https://github.com/BetterBe/Kiss-lang/wiki
       
    • By Philippe Vaillancourt
      tldr: This is a community project to help aspiring solo game developers and designers, through small assignment projects, gain the knowledge and skills required to make a video game. If you are interested in contributing to the discussion, head to https://github.com/Neoflash1979/learn-gamedev/issues.
      The problem with tutorials
      With the number of great courses, tutorials and other learning resources found online, more and more people teach themselves programming. Many will do so with the intent of making video games. But there is much more to designing and making video games than mere programming.
      Animation, anthropology, architecture, brainstorming, business, cinematography, communication, creative writing, economics, engineering, games, history, management, mathematics, music, psychology, public speaking, sound design, technical writing, visual arts AND programming; knowledge and skills in these areas can be invaluable to a game designer/developer. Thankfully, there is an abundance of resources available online that can help one acquire knowledge and skills in each of these areas individually. But for the aspiring solo dev, it’s not just a matter of acquiring knowledge in these areas, it’s also important to understand how to use all of that together, for the express purpose of making a video game.
      There is a plethora of tutorials available online that will guide you from A to Z on how to make such or such a game. In the process you will acquire a certain amount of technical knowledge, and that’s great. But you won’t really learn about the process of designing and developing a video game. The same can be said about the numerous lists that tells you the type of games you should be making, and in what order, in order to learn gaming making; first you make a Breakout clone, then you make a Tetris clone, then you make a Mario clone, then you make Wolfenstein 3D clone, etc. Again, this kind of advice will help you progress in certain technical skills, but you won’t have learned all that much about the process of designing and developing a video game.
      Making a video game is about making decisions. When you follow tutorials, or clone an existing game, the decisions are largely already made for you. To really learn to design and develop video games, you have to build them, from scratch, on your own (or with a friend or two). All aspiring game dev/designer realizes this at some point and so sets out to build their first game. Their REAL first game. One where THEY have to decide, design and build EVERYTHING. And that’s where everything goes to sh*t.
      Making video games is hard
      You see, making a video game is hard. I mean, REALLY making a game, from scratch. It is a daunting task and it can be overwhelming. So naturally, you turn to Google, and you learn expressions like “scope”, “minimum viable product”, “rapid prototyping”, “find the fun” and “start small”. All those two minutes videos and articles are very enlightening but in the end, it’s still very hard to understand how to keep a small scope when you have never REALLY made a game and you are invariably imbued with grand game-making aspirations. How small is small? What aspects of game making should I focus on? How many hours should I invest in making that first game? Those are just a few of the questions that an aspiring game dev/designer might have.
      Despite all the great resources out there for learning all the bits and pieces involved in designing and making a game, there is a complete void in terms of helping aspiring dev learning to put it all together in a progressive, manageable, way. What we, aspiring self-taught devs, are missing is a guide. Something that will guide us, progressively, on our game making path. Something that will help us focus on the right things, at the right time, while we progress on our learning journey – “yeah, maybe you should leave researching the use of Octrees in collision avoidance AI for later and first focus on figuring out how to make that white ball go from point A to point B, Phil”.
      What we really need are assignments, with deadlines and requirements. Oddly enough, if your Google “game making assignments” you will find a few examples of exactly what we need, but only for board games, or children Phys Ed games. Here is an example: http://www.cobblearning.net/kentblog/files/2015/11/Project-27w5me1.pdf
      This is exactly what we need. Exercises that help us focus our creativity and give us a set of guidelines, requirements and constraints. Allowing us to make MOST or at least MANY of the creative and technical decisions that go into making a game, while at the same time ensuring that we keep the scope small and that we focus on a few new concepts/skills. Every assignment would, gradually, expose the learner to new and more advanced concepts/skills, expanding the scope a little, culminating in a final, 2 to 6-month-long assignment where the learner is really making a game he can be proud of and call his own. Alas, this resource does not exist. At least I have found it. So, let’s do something about it.
      I propose that we create an open-source project on Github and create a “Game development and design self-education” curriculum. Basically, a list of game making assignments that would guide an aspiring game dev through the process of learning the required skills, methods and processes required to put a game together. The onus would be on the aspiring game dev to find the resources needed to learn the creative and technical skills required to meet each assignment’s requirements. If you are interested in contributing to the discussion, head to https://github.com/Neoflash1979/learn-gamedev/issues.
    • By SilkTouch
      Hey guys, I am totally new to game dev and member here since today. I have been learning Java since 3 years now in school and have not done any bigger projects, but now i want to make the next step and start to develop a little game. Although i got a lot of ideas, i am not sure about a lot of basic game specific questions and i would appreciate it if you helped me there.
       
      The game should be about an shift supervisor at a nuclear power plant, that has to deal with problems like replacing the fuel rods (where some complications could show up), an automated reactor shutdown or a generator on fire. I am not exactly sure how deep and real life compliant this game should be, but at least more realistic than just adjust the amount of coolant and how deep the control rods are in the water. The second problem here is that i have so many ideas that it would have more content than any game on the market and i can not decide what to include to my project.
      Another point where i am not sure are the graphics (I heard that coding the game functions has prior 1 and the graphics should be done when the game functions are already working), I think 2d graphics would be easier to do, sure there are engines for 3d, but i have no experience with them and i do not instantly want to do a game with AAA graphics. Then i remembered the game X-COM: UFO Defense and i guess that type of graphic would be totally enough for my little simulator but i have no idea about the difficulty of making this (My only graphical experience is Window Builder). So there should be the control buttons and levers on the bottom of the interface, in the middle displays and the lights that you have to react to and on the upper side i would like to give a very very small and basic overview (more for your eyes than with real purposes) about your power plant where you for example can see smoke coming out of the cooling tower or a small fire burning down your transformer. 
       
      What do you think about my idea, what should i change, what do you think about my problems?
      General feedback would be great as well. And no i do not want to learn C and do this in C, i want to do it with Java
       
      And sorry if my English is not the best, it is not my mother tongue.
    • By CosmicMeatloaf
      The title is vague, so I'll explain.
      I was frustrated with UI dev (in general), and even more-so when working with a application that needed OpenGL with embedded UI. What if I wanted to make a full application with OpenGL? (Custom game engine anyone?)
      Well I did want to. And I'm working on it right now. But it started me onto making what I think is a great idea of a styling language;
      I present KSS (pron. Kiss) The multitudes more programmable version of CSS.... (only for desktop dev)
      /* It has all the 'normal' styling stuff, like you'd expect. */ elementName { /*This is a styling field.*/ font-color: rgb(0,0,0), font: "Calibri", font-size: 12px } .idName { color: rgba(255,255,255,0) } uiName : onMouse1Click{ color: vec3(0,0,0) } BUT 
      It also has some cool things. I've taken the liberty to add variables, templates (style inheritance), hierarchy-selection, events (as objects), native function calls, in-file functions.
      var defaultColor: rgb(0,0,0) var number : 1.0 /*Types include: rgb, rgba, vec2, vec3, vec4, number, string, true, false, none (null), this*/ fun styleSomeStuff{ .buttons{ color: defaultColor, text-color: rgb(number,255,number) } } template buttonStyle{ color: rgb(255,255,0) } .buttons{ use: buttonStyle, otherTemplateName /*copies the templates styling field*/ color: defaultColor; } .buttons : onMouse1Click{ /* events not assigned as a value are initialized when read from file*/ styleSomeStuff();*/* call the in-file function*/ *nativeFunctionCall();/*call a native function that's binded*/ var a : 2; /*assign a variable, even if not initially defined.*/ } /*storing an event in a 'value' will allow you to operate on the event itself. It is only ran when 'connected', below.*/ val ON_CLICK2 = .buttons : onMouse2Click{ use: templateName } connect ON_CLICK2; disconnect ON_CLICK2; /*you can make a function to do the same.*/ fun connectStuff{ connect ON_CLICK2; }  
      But wait, you ask... what If I need to select items from a hierarchy? Surely using element names and id's couldn't be robust enough!
      Well:
      /*We use the > to indicate the item next element is a 'child' to itemA in the hierarchy*/ itemA > itemAChild : onMouse1Click{ } .itemId > .itemAChild > itemAChildsChild{ } /*want to get all children of the element at hand?*/ elementName > .any{ /*this will style all the elements children*/ } /*What about if we want to use conditional styling? Like if a variable or tag inside the element is or isnt something?*/ var hello : false; var goodbye : true; itemA [var hello = false, var goodbye != false] { /*passes*/ } itemA [@tagName = something]{ /*passes is the tag is equal to whatever the value u asked.*/ } The last things to note are event-pointers, how tagging works, 'this', and general workflow.
      Tagging works (basically) the same as Unity, you say @tagName : tagValue inside a styling field to assign that element a tag that's referable in the application.
      You have the ability to refer to any variable you assign within the styling sheet, from say.. source-code. The backend. As such, being able to set a variable to 'this' (the element being styled) allows you to operate with buttons who are currently in focus, or set the parent of an item to another element.
      All elements are available to use as variables inside and outside the styling sheet, so an event can effectively parent an element or group of elements to a UI you specify. Ill show that in a figure below,
      Event pointers are so that you can trigger an event with a UI component, but affect another, below-
      /*We use the -> to point to a new element, or group of elements to style.*/ .buttons : onMouse1Click -> .buttons > childName{ visible : false parent: uiName; } /* In this case, we style something with the name "childName" whos parented to anything with the id 'buttons'. Likewise, we if there was a element with the name 'uiName', it would parent the childName element to it. */  
      Lastly: The results/workflow.
      I'm in the process of building my first (serious) game engine after learning OpenGL, and I'm building it with Kotlin and Python. I can bind both Kotlin and Python functions for use inside the styling sheet, and although I didn't show the layout-language (cause its honestly not good), this is the result after a day of work so far, while using these two UI languages I've made (In the attachments.)
      It's also important to note that while it does adopt the CSS Box-model, it is not a Cascading layout.
      That's all I had to show. Essentially, right now Its a Kotlin -backed creation, but can be made for Java specifically, C++, C#, etc. I'm planning on adding more into the language to make it even more robust. What's more, it doesn't need to be OpenGL backed- it can use Java paint classes, SFML, etc etc. I just need to standardize the API for it. I guess what I'm wondering is, if I put it out there- would anyone want to use it for desktop application dev? 
      P.S. Of course the syntax is subject to change, via suggestion.
      P.S.[2] The image in the middle of the editor is static, but wont be when I put 3D scenes in the scene-view.

    • By theelephant
      So, I asked for advice on game engines. I know this is asked here ALL the time. I am reading the posts. However, there are so many engines, how does one choose? They all have their own pros and cons depending on one's needs, budget, and genre of game. Is the idea just to choose one and learn from there?
      Here is a list that I compiled.
      GameSalad App Game Kit Corona Godot Buildbox Construct 2 and 3 Clickteam Fusion 2.5 RPG Maker Stencyl GameMaker Studio 2 GameGuru Monogame/XNA CopperCube 5 Torque Leadwerks Unity  ChilliWorks  Clickteam Fusion Cocos libGDX Trublenz V-Play  
      Hello everyone,
      I am very new here and new to actually starting to develop games. I realize what I am embarking on is probably going to be many years in the making. It is not something I haven't considered before. I recall wanting to make my own game as a child when I read about a contest in Nintendo Power. The winner of this game was J. Scott Campbell who went on to draw for comic books.
      I think a lot of people who play games wax philosophic about what they would like to see in a game. But I digress.
      I want to start with a 2D game and I have been reading here and on other websites about the best engine/software to use for newbies who do not have a lot of programming experience. The issue is I read similar and conflicting information on websites, so I thought I would ask people who have used them. 
      I know Game Maker Studio is popular, but I am not fond of the high price add-ons for export. I don't know if I am being picky or limiting myself.
      Unity seems to be an option but I am new to this so I certainly would need the Plus option rather than Pro; however, I read that Unity's 2D uses the 3D engine and that makes 2D game clunky, buggy, and bloated. Is this true?  I don't know what perks the free version has.
      There are Defold and Godot as well as a bunch of other free development tools, but I am unsure how many require a lot of programming knowledge. I hear App Game Kit is a bit program heavy. And I don't hear a lot about Guru. 
      I plan to learn programming as I go along over the years, but for now, I want to see how well I can do and how much patience I will have. 
      There are a host of engines out there. Some are free and some are not.  I don't know what is best to start on especially if I want to eventually export to platforms other than PC. Ultimately, one has to try some out to know what is best.
      Since I am new, is exporting to multiple platforms putting the cart before the horse? Is this something I should worry about later? 
      I read some posts that answer similar questions, and I plan to read more. I just wanted to ask my own question here.
      Any direction or advice would be appreciated.
  • Advertisement