Pyrel dev log, part 3

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • Magnate
    replied
    Originally posted by AnonymousHero
    Wait, what? One of those contains a cycle in the dependency graph of the calculations, the other does not.
    Sorry, I didn't mean there was no difference mathematically; I meant in terms of game design. If we're allowing 'primary' stats to be influenced by 'skills' which are in turn based off those same primary stats - my point was that DEX/INT are interchangeable in the example.
    finding the optimal way to break a cycle is probably NP-hard even if you have a criterion for optimization (which you don't... is it maximizing the sum of all stats, maximizing two of the status, what, exactly?).
    I think this is precisely why Derakon suggested that the person best placed to decide this is the player.

    Nothing is immutable. We can try whatever Derakon thinks is best at this point and revisit it later on in development if we think it can be improved. I suspect quite a lot of things will be improved once they've come into contact with other bits.

    Leave a comment:


  • AnonymousHero
    replied
    Originally posted by Magnate
    The important point here is that circularities are inevitable: if we allow DEX to modify MDS and then MDS to modify INT, that is fundamentally no different to allowing INT to modify MDS and then, via whatever route, MDS to end up modifying INT.
    Wait, what? One of those contains a cycle in the dependency graph of the calculations, the other does not.

    I still don't understand why cycles are supposedly unavoidable. Cycles would imply ill-defined results unless you (extremely luckily) happen upon a convergent series. Unless you want that you have to have some way of preventing (or breaking, amounts to the same thing) cycles. Having the user do it would be insanely bad UI and finding the optimal way to break a cycle is probably NP-hard even if you have a criterion for optimization (which you don't... is it maximizing the sum of all stats, maximizing two of the status, what, exactly?).

    The only reasonable thing to do is to prevent the cycles (by construction) in the first place.

    EDIT: ... and there is such a thing as "too general". Simply breaking this into a set of N tiers is a very simple solution that has proven itself in lots of games and variants. The exact value of N is debatable, but AFAICT N=10 would accomodate basically any variant that I've seen, certainly.

    Leave a comment:


  • Derakon
    replied
    Okay, I think we've about accomplished all we can with the stats discussion. Everyone understands the problem, so now we're just bickering over premises.

    Changing the subject, I spent some time examining why dungeon generation was so slow (~6s to make a 360x120 dungeon on my pretty speedy computer). It broke down to roughly 4s spent on deciding how to draw every tile (even the ones not visible) and 2s spent on instantiating 43000 granite walls. I've fixed the latter problem by making one granite wall and then pretending that it's in 43000 different tiles -- this required tweaking how we interact with terrain but otherwise appears to be completely functional. The former problem is soluble by re-optimizing the drawing logic. Previously it had been tracking the state of every tile on the map, and in a very inefficient way (causing the GameMap to generate 3 synthetic Containers for every drawn tile). By optimizing this, I have dungeon generation and initial drawing down to .8s...but I've somehow broken the drawing logic -- I'm doing the right amount of work but it's not resulting in the right symbols being drawn. That's why this hasn't been pushed yet.

    Note that if we want to do a full-detail map of the entire dungeon (which I fully support), then we're going to have to optimize this again. There's noticeable lag whenever we have to redraw the entire display. I haven't profiled the code yet to find out why.

    Meanwhile, mtadd and noz have been busy making improvements to the Qt UI and refactoring a lot of code that was duplicated across the various UI frontends. Pyrel development is busy!

    Leave a comment:


  • fizzix
    replied
    Originally posted by Magnate
    So we have two options: we either explicitly disallow this, or find a way to make it work. I'm with Derakon on not disallowing anything where possible.
    Actually, I'm with buzzkill on this one. Normally, what Magnate is saying is good practice, except when it creates major confusions in either the code or from the player's side. I think it makes sense to have some reasonable tiering and not allow things to be only modified by tiers above it. MDS is below INT, so INT can modify MDS but MDS does not modify INT. This is clear and very easy for a player to understand. MDS modifying INT does not make sense to me, and honestly I can't imagine the desire to allow for such a silly (to me) idea, especially when it seems to cause as much headaches, and double-especially if it creates hard to understand code.

    Percentage modifiers can all be calculated simultaneously after the additional modifiers. I don't see this being a problem.

    I'm all for removing the limitations from the current code base, but I don't see this as a major limitation. If you want a stat that modifies INT, then you just add another tier above it.

    Leave a comment:


  • Magnate
    replied
    Originally posted by Nick
    Because if DEX increases MDS and MDS increases DEX, your graph is no longer acyclic. Which is like perpetual motion, unless I'm missing something.

    EDIT: Which, looking at your previous post, I must be.

    I'll have another go. If you have a magic device which improves your DEX when used (ie a temporary effect), then the player is in a different state after using the device, and that should be regarded as a different vertex of the graph, I think. Or something. Probably just ignore me.
    The important point here is that circularities are inevitable: if we allow DEX to modify MDS and then MDS to modify INT, that is fundamentally no different to allowing INT to modify MDS and then, via whatever route, MDS to end up modifying INT.

    So we have two options: we either explicitly disallow this, or find a way to make it work. I'm with Derakon on not disallowing anything where possible. To make it work, there needs to be a point at which all calculations are resolved, before moving on to the next set of calculations - i.e. we calculate MDS including a modifier based on INT, then we recalculate INT including a modifer based (somehow) on the previously-calculated MDS. IMO Derakon's idea of allowing the user to choose the order of calculation achieves this.

    Leave a comment:


  • Nick
    replied
    Originally posted by Derakon
    You're suggesting basically the "tiered stats" approach I mentioned earlier, and I still think that approach is too limiting. Why shouldn't magic device skill be able to affect DEX?
    Because if DEX increases MDS and MDS increases DEX, your graph is no longer acyclic. Which is like perpetual motion, unless I'm missing something.

    EDIT: Which, looking at your previous post, I must be.

    I'll have another go. If you have a magic device which improves your DEX when used (ie a temporary effect), then the player is in a different state after using the device, and that should be regarded as a different vertex of the graph, I think. Or something. Probably just ignore me.
    Last edited by Nick; October 10, 2012, 08:06.

    Leave a comment:


  • Derakon
    replied
    Remember the context here. MDS isn't directly improving a stat; it's improving your ability to use an item that improves a stat. It makes perfect sense that the better you are at using magical devices, the better the results you would get from them, and magical devices that improve your statistics are a time-honored tradition.

    Of course stats shouldn't automatically boost each other in the absence of any other effects.

    Leave a comment:


  • buzzkill
    replied
    Originally posted by Derakon
    Why shouldn't magic device skill be able to affect DEX?
    Because MDS (as it exists now, unless I'm mistaken) is a skill, not a stat. Stats determine skills, not the other way around. Wearing glasses will (in some cases) make you a better reader, which in turn may raise your intelligence, but wearing glasses doesn't in and of itself make you any smarter. So, glasses could increase you reading skill (more logical), or they could increase INT (less logical), or both (impractical).

    Why not have WIS modify INT and vice-versa??? It makes perfect sense. STR, DEX and CON should all modify one another too, shouldn't they???

    It seems to me that having MDS modify INT, is a lot like having INT modify INT. If someone, in the future, wants to implement such an insane system, they can, but it's not a feature one should expect given the illogic. Trying to please all the people all the time... well. Any system that does what you're trying to accomplish will be imperfect or lacking in some respect, so why not just the maintainer that wants to do such a thing, hack it in there themselves. At the very least, if they write the code themselves, it will do exactly what they want it to do.

    Emulord makes a lot of sense.

    Leave a comment:


  • emulord
    replied
    Either way, how are you going to determine order?
    If its general, having
    Dex = f(Dex)
    Dex = g(Dex)

    in general is different than the other ordering. Thats why I separated % and constant changes into separate tiers. I suppose if you had loop detection and did all constant changes first, then all % based changes it could work fine.

    Unfortunately this prevents effects like AC = 110% AC, which are exponential increases, unless you had another layer. The problem is some functions are not associative. Unless you have some way to order it, you're going to have min-maxing like taking off equipment and putting it on in a different order to maximize gains, and thats just horrible.

    Leave a comment:


  • emulord
    replied
    That kind of thing would be doable in this system. A "on movement" effect determining distance from altar and modifying AC by a % for example. It might be slow I guess, but with that much recalculation I don't see how you could avoid that.

    The problem is that its terribly obscure for a player. Players can see loops like "wait, my magi helm increases dex by 40% Magic Device, and my Gloves of wand use increase Magic device by 40% dex. Its a converging sequence, but my calculation seems off from what the game is telling me..."

    And thats a best case scenario.

    That "classes get different benefits from equipment" is definetly possible! If you mostly use % improvement items, then Gloves of slaying improve % damage and % Strength, and amulets give %Int and so on.

    If its specifically a Magic device skill, alter the tiers of everything.
    You need a transparent and simple method to get rid of looped effects anyway. If you're set on the flexible approach, I suggest limiting equipped items to prevent loops with a CastleOfTheWinds message. The polarity of the magical items prevents you from using both. I suppose temporary items and terrain effects wouldn't be too bad with just one layer, and terminated when it detects any looping.

    Leave a comment:


  • Derakon
    replied
    Originally posted by emulord
    We would just ban things affecting higher or equal tiers. Magic device skill would NEVER affect dex, because why would it? A temporary item could increase dex, but it wouldnt be able to be based off of Magic device skill, because you might be able to make unbounded increases in stats.
    You're suggesting basically the "tiered stats" approach I mentioned earlier, and I still think that approach is too limiting. Why shouldn't magic device skill be able to affect DEX? In this system it would represent your ability to properly use magical equipment. I could readily imagine a game system where different classes got different benefits from their gear -- warriors would have great innate powers and would be good at using weapons and armor, but benefit relatively little from jewelry; the reverse would be true for mages, who want to pile on as many magical trinkets as possible because they simply can't use "real" gear effectively.

    Also, this:
    Innate Dex -> Modified Dex -> % Modified Dex -> AC -> % modified AC.
    ignores that stat mods can invoke arbitrary functions to decide what the modifier is. For example, there could be an altar on the level, and the closer you got to the altar, the better your AC was (because your god protects you). Or if it was not a coaligned altar, then the closer you got, the weaker you'd become...until you finally got close enough to smash it, anyway. Again, interesting potential mechanics that can only be supported if we err on the side of flexibility.

    Leave a comment:


  • emulord
    replied
    We would just ban things affecting higher or equal tiers. Magic device skill would NEVER affect dex, because why would it? A temporary item could increase dex, but it wouldnt be able to be based off of Magic device skill, because you might be able to make unbounded increases in stats.

    Here are the total tiers imo. Maybe these could be compile time decided? Or hardcoded, whichever is easier.

    1. Gold, Exp
    2. Level
    3. Str, Dex, Int, Con, Wis, Chr
    4. Social Class, Weight, Height, Available spells, Max Mana, Max Health, Stealth, Speed, Magic device, disarming, AC, saving throw

    I feel like having (+Chr bonus based on current Con) items is silly. Removing the possibility is fine.

    Or you could do Castle of the winds style where it prevents you from putting on a item that would cause a loop. In that case its nesting bags of holding or items within themselves. Just say "the item's magic prevents you from putting this on while you're wearing the __Other offending item".
    Idk how you'd prevent potion or temporary item use.

    Leave a comment:


  • emulord
    replied
    I feel like rather than trying to figure out if its looping and stuff like that, instead we should have a strict ordering of stats. It makes more sense to a player.

    Innate Dex -> Modified Dex -> % Modified Dex -> AC -> % modified AC.

    So you can have things that affect Dex and AC.
    Gloves of Agility [+1 AC] (+3 dex), +(70% Dex into AC) gets parsed like this:
    so with a naked character with 15 dex equipping this gets:
    On equip, 15 innate dex -> 18 modified dex -> 18 % modified dex -> 1 AC -> 13.6 AC

    Since other things can affect dex independently, affecting the dex, when you equip anything, recalculate all stats = to and below affected tiers. Its probably simpler and faster than figuring out dependencies dynamically.

    Leave a comment:


  • Magnate
    replied
    Originally posted by Derakon
    Making a system that can deal with the current reality is pretty straightforward, because the current reality is not capable of doing anything especially complicated. But part of the reason to write Pyrel in the first place was to free ourselves from the limitations of the old system. You can bet that as soon as Pyrel 1.0 goes out (if not sooner) we'll be working on Pyrel v4 and playing around with all the special effects it can handle. So I don't think this situation is unlikely at all.
    There's also the issue of people only being able to modify the source if it's sufficiently well-designed to allow them to accomplish what they want. If we don't solve this problem, whoever does will have to completely rewrite this bit of code, not just modify it. This is the problem with the current codebase - way too many things need completely rewriting for it to support any serious creativity. Heading this off with good low-level design is one of the main reasons for creating Pyrel - it's certainly the reason I'm working on it.

    So, I'm glad I was right about the problem being in the derived tier, but I'm actually not sure I see a need for the before/after chargen split. If we're going to let the player decide, we should let them decide at chargen too, should the circularity ever come up.

    Leave a comment:


  • AnonymousHero
    replied
    Originally posted by Derakon
    This is certainly doable and could possibly be useful for simplifying any UI we write about this problem, but it doesn't change the fact that we have to resolve loops somehow. It'd just tell us "Yep, you have an INT->MDS->DEX issue, you'll need an extra tier to handle that."
    I was actually think that you could just let all the calculations happen lazily and detect loops while doing them. For display you can do the tiering thing I outlined above.

    What I mean is that the calculation for "DEX" simply calls to the calculation to "MDS" which in turn simply calls to the calculation for "INT". Detecting a loop is as simple as having a counter on each stat which is incremented by one every time you call the calculation is is decremented by one once the calculation finished. If the counter ever reaches 2, then there's a loop and the calculation will never finish.

    Leave a comment:

Working...
😀
😂
🥰
😘
🤢
😎
😞
😡
👍
👎
☕