Author Topic: Empires of Eradia: The Cataclysm of Chaos - Alpha V48H3  (Read 139511 times)

Offline leeor_net

  • Administrator
  • Hero Member
  • *****
  • Posts: 2352
  • OPHD Lead Developer
    • LairWorks Entertainment
Re: Chaotic Planar Prison - Prototype V4
« Reply #25 on: April 06, 2018, 11:35:05 AM »
Few questions:

1) Why does it matter if I have a bunch of white spaces?

It's not that you have a bunch of white spaces, it's about consistency in which type of tabbing you use. I prefer tabs, many developers prefer spaces. In either case, choose one method of tabbing and stick with it.

2) Doesn't the compiler/interpreter skip over them, much like they ignore comments?

Yes, but white space isn't for the compiler, it's for the humans reading the code. And in the case of Python it's actually how you specify blocks of code.

3) I do intend to completely rebuild the codebase, with all my listed design requirements, at a later date (probably before the game reaches beta state), so why put all the effort into addressing white space/extra tabs with throwaway code?

Fair point. However in this case it's a matter of setting best practices and getting you used to doing the same thing to keep things consistent. If ultimately you're just going to throw it away who cares but it does make sense to pick a style and stick with it.

Offline lordpalandus

  • Banned
  • Hero Member
  • *****
  • Posts: 825
Re: Chaotic Planar Prison - Prototype V4
« Reply #26 on: April 06, 2018, 11:23:05 PM »
The code is written with 4 spaces, and is consistent throughout. Anytime I accidentally place a tab, it causes a syntax error.

There may be tabs in the blank white spaces or tabs in the #comments, but that isn't intentional on my part; they are added in by Notepad++. For the redesign, I intend to go for tabs, as I prefer tabs.

Well, for me, the code is perfectly readable, for me, as it currently stands. And as I'm the only one adding / modifying the prototyped code, as long as I can read it, it should be fine. I do want to have a more consistent and pleasant reading when I redesign the code, as I'll want the code to be moddable or even just easy for me to add things to the code. I am however, aware that some of my duct-tape code is starting to cause the prototype code to look like spaggetti code, and that is regrettable. Unfortunately, due to the way the tutorial made the roguelike code, everything is coupled with eachother and often information needs to be explicitly placed more than once in some places to make it work properly. Not an ideal solution, but it doesn't really matter at the moment as its just throwaway code.

I do intend to go with a consistent style, but my style isn't how the tutorial code was made, and thus I have to work with what I got for the time being, thus in several places it will have conflicting styles in the current codebase. I intend to have a consistent naming scheme (ie for functions, variables, classes, etc), comment methodology, and code structure philosophy in the redesigned code.

Currently working on Cataclysm of Chaos, Remade.
Link to OPU page = http://forum.outpost2.net/index.php/topic,6073.0.html

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Chaotic Planar Prison - Prototype V4
« Reply #27 on: April 08, 2018, 01:42:26 AM »
Leeor nailed it, in that it's an issue for people, not the compiler. It's one of those intangible things, likely badly indented C++ code. The compiler doesn't care, but it can make working on the file awkward.

Quote
3) I do intend to completely rebuild the codebase, with all my listed design requirements, at a later date (probably before the game reaches beta state), so why put all the effort into addressing white space/extra tabs with throwaway code?

The cost of a complete rewrite is high. In practice it rarely happens. People are more likely to give up on a project than perform a complete rewrite.

Quote
The code is written with 4 spaces, and is consistent throughout. Anytime I accidentally place a tab, it causes a syntax error.

There may be tabs in the blank white spaces or tabs in the #comments ...

Exactly. It's not consistent. Since indentation is part of the Python grammar, it will warn you, but only for code lines. Your comment lines and blank/spacer lines often start with tabs.

As for how this happens, typically it's when you try to backspace a seemingly empty line when the cursor is in the first column, yet the line already contains whitespace for indentation which can't be seen:

Code: [Select]
if True:
    operation()
|(<-blinking cursor)(whitespace)
    operation2()

Backspace:
Code: [Select]
if True:
    operation()|(<-blinking cursor)(whitespace)
    operation2()

This affects further editing. If you try to edit the end of that line, the cursor might now go to the end of the whitespace, rather than the last visible character. This can slow down editing as you now have to navigate that whitespace. It also makes it harder to plan ahead what keys to press if you can't see or predict where the cursor will go, which leads to more mistakes, revisions, and a higher mental load when you're already trying to remember multiple lines you have to edit.

This can also lead to messy diffs when version control is used. Instead of just changes to functional code, the diff might now show whitespace changes, making them harder to read and review. Worse, some editors, such as Atom (using default settings) will attempt to automatically "fix" these whitespace issues. Someone might try to make a one line edit, only to find the diff now contains changes throughout the entire file. The actual functional change gets lost in the noise of whitespace changes.


Finally, the find/replace all edit I suggested is an automated way to fix it all at once, and should take all of 10 seconds.  ;)

Though I do encourage you to play around with the find/replace box for a couple minutes to explore and fully understand what is happening and how it works.

Offline lordpalandus

  • Banned
  • Hero Member
  • *****
  • Posts: 825
Re: Chaotic Planar Prison - Prototype V4
« Reply #28 on: April 08, 2018, 01:54:34 AM »
It is true a complete rewrite is expensive to do. However, it can also be argued that fighting with code that is meant to be a prototype and not final code, and constantly bug fixing esoteric errors, can be even costlier.

However, I think that designing good code, from the start, takes practice. If you design good code from the start, and maintain that good code, then you don't have to do rewrites and you don't have to excessively bug hunt. I'm not quite at the stage where I can design code properly the first time, otherwise I would. I have to work with the skills and knowledge I know and work from there.

As far as the rewrite goes, I intend to do it in phases; rebuild one section of the code at a time, and build it into the current prototyped code. Then, continue to work at modularizing the code, and eventually have no prototype code left, as I've replaced it all. Basically, use the working prototype code as a "driver" to ensure my new, final code, has no immediately obvious bugs, and continue to replace prototype code with final code, until I have only final code left.

Actually Notepad++ adds those tabs whenever I hit Enter at the end of a line, thus ensuring that every time I try to do a line of code, I have to remember to delete those added tabs. Hence, why I want to switch over to purely tabs.

EDIT: As for this week's build, it will be a bit sparse on changes. I have gotten through more of the tutorial and fixed a couple little bugs I couldn't address before, as I had no idea how to implement them. I'll see what I can muster between now and tomorrow, to address the things on the list.
« Last Edit: April 08, 2018, 01:57:47 AM by lordpalandus »
Currently working on Cataclysm of Chaos, Remade.
Link to OPU page = http://forum.outpost2.net/index.php/topic,6073.0.html

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Chaotic Planar Prison - Prototype V4
« Reply #29 on: April 08, 2018, 02:08:16 AM »
What you're describing is code refactoring. Definitely a very important skill. Refactoring is lower cost than a complete rewrite, particularly from a psychological standpoint, and precisely because it's done in stages. You should always have working code, and so you can keep using, and extending the code, even with further cleanup coming. It also nicely addresses the issue of not having a perfect design the first time, and the importance of just starting, and fixing things along the way.

To do refactoring cleanly, code quality issues such as whitespace matter even more. Whitespace issues can add a lot of noise to the refactoring process. Hence, it is typically taken care of up front, in an automated way, and in its own commit. Functional changes would then follow in subsequent commits.


Edit: Notepad++ can be configured to use either tabs or spaces for the indent, as well as the indent width (4 spaces, 2 spaces, etc.). I believe it can be configured either globally, or per language.
« Last Edit: April 08, 2018, 06:12:00 AM by Hooman »

Offline lordpalandus

  • Banned
  • Hero Member
  • *****
  • Posts: 825
Re: Chaotic Planar Prison - Prototype V4
« Reply #30 on: April 08, 2018, 05:26:47 PM »
Hmm. Okay. I figured that as I intend to replace all of the existing code with new and modular code, that would be considered a full rewrite... its just that I'm doing the full rewrite in stages, to have working code to test out the new code to ensure that no new bugs are created with the new code.

Also good to know on the Notepad++ indenting. I'll look into it.

---

As for today's release, I have a few more things I'd like to try to implement, and once that is done, I'll release Prototype v5.
Currently working on Cataclysm of Chaos, Remade.
Link to OPU page = http://forum.outpost2.net/index.php/topic,6073.0.html

Offline lordpalandus

  • Banned
  • Hero Member
  • *****
  • Posts: 825
Re: Chaotic Planar Prison - Prototype V5
« Reply #31 on: April 08, 2018, 07:00:35 PM »
Prototype V5 has now been released.

I had a rough week, with several days of extreme mental exhaustion, and my osteoarthritis in my knees acted up this week, so I had a bad limp and a lot of unavoidable pain. So I didn't accomplish as much as I had hoped to this week, but this release still has a few interesting features. These are:

- Three new rare item types = Amulet of Energy (+25 Energy and 1 Energy Rejuvenation per turn), Elixirs of Attribute (+3 to a specific attribute), and Manuals of Attribute (provides 750 + 3*number of Manuals read before XP training for that attribute and each one read increases XP gained whenever you perform an activity).

- The first Primal Chaos creature is now in; the Primal Chaos Orc. It is capitalized and bright red. Also, activated the Chaos Portal, that will spawn these nasty critters too.

- The first Ranged combatant is now in; the Goblin/Orc Archers. They are bright yellow and will attack you at a range. They will also flee from you if you get too close. The AI is a bit stupid, and thus they don't pathfind easily around objects. They have half HP and half damage as a melee attacker of the same name (ie goblin)

- When you die and respawn, you will properly lose your entire inventory, forcing you to have a fresh start at life, at least in terms of equipment.

- Made some changes with items and item generation. Items now have a material tier (ie fine cloak or ironite coif) and you can see this by hovering the mouse over the item. Also, better equipment will only drop in later levels now, rather than at the very first level.

Hope you guys enjoy, and I hope I have a better week, next week!
Currently working on Cataclysm of Chaos, Remade.
Link to OPU page = http://forum.outpost2.net/index.php/topic,6073.0.html

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: Chaotic Planar Prison - Prototype V5
« Reply #32 on: April 09, 2018, 02:26:46 PM »
Sorry to hear about your knees acting up. Knee problems are pretty miserable to deal with.

I haven't tried Chaotic Planer Prison yet, but it sounds like you are making a lot of progress.

-Brett

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Chaotic Planar Prison - Prototype V5
« Reply #33 on: April 10, 2018, 04:40:07 AM »
I haven't managed to try it yet either, though mostly because I haven't gotten it working on Linux yet. Seems like the libtcod library author doesn't directly support Linux, instead deferring that to the community to support. I tried downloading the library source, compiling it, and installing it, though the game and any library sample code fails to find the library.

Seems like it should be an easy configuration fix, though I have yet to figure it out. Maybe some combination of PATH and PYTHONPATH will work.

Offline lordpalandus

  • Banned
  • Hero Member
  • *****
  • Posts: 825
Re: Chaotic Planar Prison - Prototype V5
« Reply #34 on: April 12, 2018, 01:48:35 AM »
No worries. It might be best that people passed on the earlier builds.

However, the newest build, is proceeding quite smoothly and have implemented a variety of desired features, that were on the backburner, into the game now. Such as:

You can now simply click on a target with the mouse to attack it with a ranged-based attack. LMB to shoot an arrow and RMB to zap them (new basic spell).
Currently working on Cataclysm of Chaos, Remade.
Link to OPU page = http://forum.outpost2.net/index.php/topic,6073.0.html

Offline lordpalandus

  • Banned
  • Hero Member
  • *****
  • Posts: 825
Re: Chaotic Planar Prison - Prototype V6
« Reply #35 on: April 14, 2018, 04:52:28 PM »
Released Prototype V6!

I was very productive this week, had only a slight limp from the osteoarthritis, and only had one day of mental exhaustion. The changes in this build are too numerous to list in a single post, so I suggest reading the Changelog and Readme file, that details the changes, particularly to the controls.

Enjoy!
Currently working on Cataclysm of Chaos, Remade.
Link to OPU page = http://forum.outpost2.net/index.php/topic,6073.0.html

Offline lordpalandus

  • Banned
  • Hero Member
  • *****
  • Posts: 825
Re: Chaotic Planar Prison - Prototype V7
« Reply #36 on: April 21, 2018, 07:28:56 PM »
Released Prototype V7!

Lots of new changes with this build, so definitely take a look at the changelog if you are interested, or read the first post, that highlights the biggest changes. Also, fixed I believe all of last week's bugs, for this build, including the flee code for mages/archers and melee related bugs.
Currently working on Cataclysm of Chaos, Remade.
Link to OPU page = http://forum.outpost2.net/index.php/topic,6073.0.html

Offline leeor_net

  • Administrator
  • Hero Member
  • *****
  • Posts: 2352
  • OPHD Lead Developer
    • LairWorks Entertainment
Re: Chaotic Planar Prison - Prototype V7
« Reply #37 on: April 22, 2018, 06:40:18 AM »
Ech, requires download and install of python interpreter. Yuck. :P

Should really make this a self contained package with everything that a user needs to run it without needing to download and install runtime environments.

Offline lordpalandus

  • Banned
  • Hero Member
  • *****
  • Posts: 825
Re: Chaotic Planar Prison - Prototype V7
« Reply #38 on: April 22, 2018, 05:48:06 PM »
I plan to. Eventually. I have higher priority stuff that needs doing first though.

I'll look into providing a Binary executable when I reach Alpha Status. At that point, the game will be more of a game, rather than a modified tutorial, and thus will be worth taking the time into looking at making it more new user friendly.
Currently working on Cataclysm of Chaos, Remade.
Link to OPU page = http://forum.outpost2.net/index.php/topic,6073.0.html

Offline leeor_net

  • Administrator
  • Hero Member
  • *****
  • Posts: 2352
  • OPHD Lead Developer
    • LairWorks Entertainment
Re: Chaotic Planar Prison - Prototype V7
« Reply #39 on: April 22, 2018, 06:16:10 PM »
Fair enough.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Chaotic Planar Prison - Prototype V7
« Reply #40 on: April 27, 2018, 11:35:02 AM »
And as a counter point, I'm less fond of having the entire Python environment distributed with the game. I tend to trust binaries more from the official source. Plus it's a large amount of data to add to the zip file, and would do me no good on Linux, which btw, already includes a Python install by default (as many system scripts use Python).

Though yes, for final end users who just want to play a game, having a complete install package is very appealing. But that's more of a version 1.0 problem.


Good to hear you're still making progress!

Offline lordpalandus

  • Banned
  • Hero Member
  • *****
  • Posts: 825
Re: Chaotic Planar Prison - Prototype V8
« Reply #41 on: April 28, 2018, 08:44:23 PM »
That is definitely a fair and good point, Hooman! I would prefer the same as well, just haven't figured out how to do so yet, as it hasn't been a priority.

Also:

Released V8 of the Prototype. This was another very productive week and managed to get several features in that I've been puzzling over, for the past several weeks on how to implement; ie Area of Effect highlighting for the area that a spell will affect, as well as the Knockout system. Other big changes are: a huge overhaul of the UI, Primals are significantly tougher now, Damage types, Different effects from each Portal, and fixed quite a few bugs.

Enjoy!
Currently working on Cataclysm of Chaos, Remade.
Link to OPU page = http://forum.outpost2.net/index.php/topic,6073.0.html

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Chaotic Planar Prison - Prototype V8
« Reply #42 on: April 29, 2018, 08:56:55 AM »
I took another quick look through the code, seeing if there are any shortcuts you could take. I noticed this part:
Code: [Select]
    #This function advances the player to the next level. You will regain 50% of your maximum HP before entering the next area.

    global dungeon_level, Attuned_Status, Activation_Timer, Difficulty_Level, Monsters_Spawned
    message('You take a moment to rest, and recover your strength.', libtcod.light_violet)
    player.fighter.hp = player.fighter.hp + (player.fighter.max_hp / 2) 
    player.fighter.ep = player.fighter.ep + (player.fighter.max_ep / 2)

    if player.fighter.hp > player.fighter.max_hp and player.fighter.ep > player.fighter.max_ep: #both above maximums
        player.fighter.hp = player.fighter.max_hp
        player.fighter.ep = player.fighter.max_ep
    elif player.fighter.hp > player.fighter.max_hp: #only hp over maximum
        player.fighter.hp = player.fighter.max_hp
    elif player.fighter.ep > player.fighter.max_ep: #only ep over maximum
        player.fighter.ep = player.fighter.max_ep

Looks like you're doing some value clamping, a very necessary and common operation. Consider using two independent if statements to reduce redundancy:
Code: [Select]
    if player.fighter.hp > player.fighter.max_hp:
        player.fighter.hp = player.fighter.max_hp
    if player.fighter.ep > player.fighter.max_ep:
        player.fighter.ep = player.fighter.max_ep

Another place you can remove some redundancy, is the section above that adds half the max value. Consider using += when you want to add to a value, so you can avoid having to write the same variable twice:
Code: [Select]
    player.fighter.hp += (player.fighter.max_hp / 2)  
    player.fighter.ep += (player.fighter.max_ep / 2)

Offline lordpalandus

  • Banned
  • Hero Member
  • *****
  • Posts: 825
Re: Chaotic Planar Prison - Alpha V1
« Reply #43 on: May 05, 2018, 03:53:12 PM »
Thanks for the suggestion Hooman. I also implemented that fix now in a few other spots in the code where I used similar code snippets.

EDIT: Released Alpha V1. Enjoy!
« Last Edit: May 05, 2018, 09:59:55 PM by lordpalandus »
Currently working on Cataclysm of Chaos, Remade.
Link to OPU page = http://forum.outpost2.net/index.php/topic,6073.0.html

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Chaotic Planar Prison - Alpha V1
« Reply #44 on: May 09, 2018, 08:00:11 PM »
Hmm, just noticed this is now Alpha. Is there a particular milestone you've hit?


I'm curious, is there any specific area of the code you have working, but might want to improve? Maybe shorten things up. Maybe make it more flexible or easier to edit, maintain, or extend.

Offline lordpalandus

  • Banned
  • Hero Member
  • *****
  • Posts: 825
Re: Chaotic Planar Prison - Alpha V1
« Reply #45 on: May 09, 2018, 09:11:42 PM »
Yes? Over the past 4 weeks I've been working on a 30 point list on the very first post of this thread, and finally managed to complete the last few points in the Proto9 / Alpha 1 build (whichever you prefer). Now, I have a 40 something point list of things I need to complete for the game to be considered "beta" on the first post of this thread.

Yes, and that applies to 90% of the codebase. Over the next few weeks, I intend to modularize the code into several specific files (ie Everything Player Character, All Global Stuff, etc), sort out the code so that everything for a particular thing is found in the same spot (ie Level up Code), work on reducing redundancy on several functions that are essentially duplicated, and could be all combined into a single function, improving code documentation with a consistent theme for comments and the inclusion of doc strings where applicable, and I am working on using a consistent theme for naming things (ie, my globally accessible variables will now be in all capitals to help me in noticing them)

EDIT: I've tried to do some of the modularization in Alpha V2, but with little success. Much of the codebase is heavily coupled with eachother, and even moving a class or function to another file causes the code to bork. So, a lot of the code is going to need to be heavily redesigned to accommodate multiple file modularization. Alpha V2 will contain the start of the modularization, with the GLOBALS module (contains all of the global variables and lists used by the game, all neatly sorted and almost all documented)
« Last Edit: May 11, 2018, 04:55:34 PM by lordpalandus »
Currently working on Cataclysm of Chaos, Remade.
Link to OPU page = http://forum.outpost2.net/index.php/topic,6073.0.html

Offline lordpalandus

  • Banned
  • Hero Member
  • *****
  • Posts: 825
Re: Chaotic Planar Prison - Alpha V2
« Reply #46 on: May 12, 2018, 05:17:55 PM »
Alpha V2 is released.

Due to having spent most of the week repairing the codebase, at my three separate attempts at performing a major refactor of the code and to start off the code modularization process, I didn't accomplish most of my task list. I did accomplish a lot of under-the-hood stuff, and figured out why those attempts at refactoring the code base failed, but the overall new content in this release is slim; three new Rare items are now available to be found (Rune of Recall, Rune of Mapping, and Holy Hand Grenade).

I'm now quite exhausted, so I'm going to go lie down. I intend to stay focused for next week, and make sure to complete my tasks before trying any other drastic code-base changes.
Currently working on Cataclysm of Chaos, Remade.
Link to OPU page = http://forum.outpost2.net/index.php/topic,6073.0.html

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Chaotic Planar Prison - Alpha V2
« Reply #47 on: May 13, 2018, 02:27:28 PM »
Quote
Holy Hand Grenade
Excellent  :D

Sounds like you've got a pretty good plan.

Offline lordpalandus

  • Banned
  • Hero Member
  • *****
  • Posts: 825
Re: Chaotic Planar Prison - Alpha V2
« Reply #48 on: May 15, 2018, 11:34:12 PM »
Yep.

Question (to anyone who reads this): Is there any particular reasons why there isn't any current interest to this game, in terms of feedback or replies to this thread? Is it because of compiling issues, or is it not enjoyable, or is it boring, or something else?

I ask because there is very few replies to this post, other than Hooman, and occasionally leeor_net, but yet some weeks downloads are only 1, and other weeks they are close to 10. For those weeks when there are few downloads, it would be useful to know why no one touched it; and on the other hand, when there are a lot of downloads, are people having any feedback for it?
Currently working on Cataclysm of Chaos, Remade.
Link to OPU page = http://forum.outpost2.net/index.php/topic,6073.0.html

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Chaotic Planar Prison - Alpha V2
« Reply #49 on: May 16, 2018, 01:34:25 AM »
For me it's compiling issues. Hence why most of my comments are about the source code.

With your other project, it was hosted on the web, so very easy to try out.