Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (774)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (856)
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  
  Labyrinth Quest - A text-based roguelike  (Read 441 times)
0 Members and 1 Guest are viewing this topic.
Offline TheLzyDev

Junior Newbie


Medals: 1
Exp: 2 years



« Posted 2018-09-13 04:05:08 »

I'm new to this site and game development in general, but I've been working on this pet project of mine (in between highschool classes) for a few months now. I plan on it being a quirky rougelike adventure that can be played completely in any terminal. So far, this is the work I have to show for it: https://github.com/FaceFreakedStudios/Labyrinth-Quest.git ( All criticism welcomed! :p )
Offline ral0r2
« Reply #1 - Posted 2018-09-13 08:39:13 »

Hey and welcome! Really intresting and goob job so far!

I just took a quick look at your code and could give you some hints what i found noticeable:
This feedback is depending on a quick look, so I'm sorry already in case I misunderstood anything or did not read correctly.

1. Packages
If you take a look at https://github.com/FaceFreakedStudios/Labyrinth-Quest/tree/master/LQ/src/main/java/com/facefreakedstudios/app/lq
I can see that you are not using any packages to divide the classes of your game. You have all your stuff under lq. I'm not sure where you want to go with your game but I only can recommened to use some packages to divide your game into small parts. This will help you a lot to keep track of your game structure and your code when your games grows. Right now it's totally fine but keep in mind that your codebase will increase if you want to add new functionalities and your code is not structured very well it's hard to maintain. You could for instance create a package with items, actors, engine/game.
 
I also saw that you are using a lot of protected attributes, there is no point in using procted attributes if you have no packages. Also clean code often suggests to not use protected variables for various reasons:

https://softwareengineering.stackexchange.com/questions/162643/why-is-clean-code-suggesting-avoiding-protected-variables

2. Attribute and Class Naming
I'm assuming you are developing this game by yourself and not in a team, but naming is really important in development. When reading your code I was a bit confused by your class names for example, if you are planning to work in a team intuitive naming of everything is really important. I had to do some research what you mean by LQ, LQCLI, LQIS, LQOS, pop, etc.

3. Switches
I'm seeing that you are using a lot of switches, eventhough they might be okay sometimes I'd usually try to avoid them. Especially in the cases you are using them. Let's take this method for example:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
    void addEnemy(int positx, int posity, String ene_type) throws IOException
    {
        switch(ene_type)
        {
            case "rotter":
                for(pop = 0; CUR_ENES.containsKey("rotter" + pop); ++pop);
                CUR_ENES.put("rotter" + pop, new Rotter());
                CUR_ENES.get("rotter" + pop).spawn(CUR_ENES.get(
                    "rotter" + pop).SYMBOL, positx, posity);
        }
    }


You did something similiar with Items for example. So each time you create a new item or enemy (same with removing) you need to adapt your switch case. This might result in a really, really long switch case depending on where you are planning to go with your game. You maybe should consider working serialisation and deserialisation, meaning you store the information for enemy and items not directly in your code but for instance in a .json or .txt file. This will help you to adapt stats, add and remove objects.

4. Readability / Logic
If we take a look at the following:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
 static void outDMG(String name, String dmg_name, long dmg)
    {
       
        System.out.printf("\n\u001B[1m%s\u001B[0m: used %s, "
            + "\u001B[31m%d damage dealt\u001B[0m\n\u001B[32m---", name, dmg_name, dmg);
    }
   
    static void outDia(String name, String dialog)
    {
        System.out.printf("\n\u001B[1m%s\u001B[0m: %s"
            + "\u001B[0m\n\u001B[32m---", name, dialog);
    }


I'm assuming that you wrote these methods by hand? This is aiming at the same spot as my advice with naming, switches packages etc. Keeping your code maintainable through intuitive naming and a good structure. This code is really, really hard to read and to maintain. I'm guessing these are colours or something? Me as an outstander of your project only has a little idea what it is about but it really looks confusing.

another thing is:

1  
class Lucas extends Movement


This is counter intuitive as well for me. I'm assuming Lucas is the protagonist of the game? But why does he if he is the hero of the game extends Movement? That would mean he is childtype of movement, not the protragonist. Maybe you should consider using an interface called Moveable or extending him from a class named MoveableGameObject or something. Again if your code bases becomes bigger such things might be confusing. Same thing for Weightend? Why does it extend Movement?

Abstraction of your classes is really important otherwise you will get lost in too many classes if you are trying to add a new feature.
Think about your game structure. What objects does my game contain? Are they really a child of some sort of other objects?
This for example would make much more sense to me:

1  
Lucas extends Player implements Moveable extends GameObject


Ofcourse this feedback depends on where you want to go with your game. If you are planning to finish the development as soon as possible and keep it rather small that's totally fine. But if your codebase gets bigger make sure it's maintainable this will ease the development a lot.

In addition this is only my humble opinion. I'm not that experienced myself but I'm sure one of the more experienced guys here could maybe correct me or give you some better more suitable advices. Also I just took a quick look at your code. As well keep in mind that game released with bad code is still better then a game which is not released at all. Gamedev is hard and finishing and releasing a game is major undertaking. Keep it up and don't mind asking me if you have any questions Smiley

PS. I just saw you are using a .txt file to keep track on your todos, that's good! Maybe you should consider using a real tasktracker if this helps you. Something like trello.
https://trello.com/
Offline TheLzyDev

Junior Newbie


Medals: 1
Exp: 2 years



« Reply #2 - Posted 2018-09-14 01:26:06 »

Thanks for the help! I'll definitely try and implement some of the advice you gave me in my code. My aim with this project isn't so much as to push out a game as it is to learn the ins and outs of Java as well as the conventions that come along with it. Don't get me wrong though, pushing out a game is always an added bonus Wink
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline CoDi^R
« Reply #3 - Posted 2018-09-14 07:15:33 »

My aim with this project isn't so much as to push out a game as it is to learn the ins and outs of Java as well as the conventions that come along with it.

As we talk about conventions..  you should accustom yourself to properly "break;" your switch statement blocks. Many of them are not, and w/o having more insight to your code I can only assume that's a bug in most cases.

This means to:

- "break;" every case, even the last one. If you add another case, and forget to adjust the now-not-last-anymore block, you are in trouble
- if the fall-through case is intended, I prefer to leave a comment at the place to remind future-me or any other passer-by about it
- the only exception is if the block ends with a return statement -> the break only adds visible noise in this case

Robotality - steamworks4j - @code_disaster - codi^r @ #java-gaming
Pages: [1]
  ignore  |  Print  
 
 

 
EgonOlsen (1865 views)
2018-06-10 19:43:48

EgonOlsen (1888 views)
2018-06-10 19:43:44

EgonOlsen (1256 views)
2018-06-10 19:43:20

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

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

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

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

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

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

Solater (1088 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
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!