DoubleX RMMZ Skill Item Triggers

Purpose

Lets you run some codes set by your notetags on some action execution cases

Introduction

1. This plugin lets you use notetags to set what happens when an action’s just executed, and different cases like miss, evade, counter attack, magic reflection, critical hit, normal execution, substitute, right before starting to execute actions, and right after finished executing the actions, can have different notetags
2. You’re expected to write JavaScript codes directly, as there are so much possibilities that most of them are just impossible to be covered by this plugin itself, so this plugin just lets you write JavaScript codes that are executed on some important timings

Games using this plugin

None so far

Prerequisites

Plugins:
1. DoubleX RMMZ Enhanced Codebase
Abilities:

1. Some RMMV plugin development proficiency
(Basic knowledge on what RMMV plugin development does in general with several easy, simple and small plugins written without nontrivial bugs up to 1000 LoC scale but still being inexperienced)
Terms Of Use

1. Commercial use’s always allowed and crediting me’s always optional.

2. You shall keep this plugin’s Plugin Info part’s contents intact.

3. You shalln’t claim that this plugin’s written by anyone other than DoubleX or my aliases. I always reserve the right to deny you from using any of my plugins anymore if you’ve violated this.

4. If you repost this plugin directly(rather than just linking back), you shall inform me of these direct repostings. I always reserve the right to request you to edit those direct repostings.

5. CC BY 4.0, except those conflicting with any of the above, applies to this plugin, unless you’ve my permissions not needing follow so.

6. I always reserve the right to deny you from using this plugin anymore if you’ve violated any of the above.

Contributors

Authors:

1. DoubleX

Plugin Development Collaborators:

– None So Far

Bug Reporters:

– None So Far

Compatibility Issue Raisers:

– None So Far

Feature Requesters:

– None So Far

Changelog

{ codebase: “1.1.1”, plugin: “v1.01a” }(2020 Dec 26 GMT 1300):
1. Added the following notetag types:
subjectMiss
subjectEva
subjectCnt
subjectMrf
subjectCri
subjectNorm
subjectSubstitute
2. Added the following parameters:
subjectMissNotetagDataTypePriorities
subjectEvaNotetagDataTypePriorities
subjectCntNotetagDataTypePriorities
subjectMrfNotetagDataTypePriorities
subjectCriNotetagDataTypePriorities
subjectNormNotetagDataTypePriorities
subjectSubstituteNotetagDataTypePriorities
3. Fixed the eventEntry of all notetags not correctly accepting all intended suffixes and rejecting the unintended ones

{ codebase: “1.1.0”, plugin: “v1.00b” }(2020 Dec 2 GMT 0300):
1. You no longer have to edit the value of DoubleX_RMMZ.Skill_Item_Triggers.PLUGIN_NAME when changing this plugin file name

{ codebase: “1.0.0”, plugin: “v1.00a” }(2020 Aug 30 GMT 0900):

1. 1st version of this plugin finished

 

Download Link

Demo Link

DoubleX RMMZ State Triggers

Purpose

Lets you edit some database data on the fly and such edits will be saved

Introduction

1. This plugin lets you use notetags to set what happens when a state’s added/removed/expired/turn’s updated/turn’s reset on the battler involved
2. You’re expected to write JavaScript codes directly, as there are so much possibilities that most of them are just impossible to be covered by this plugin itself, so this plugin just lets you write JavaScript codes that are executed on some important timings

Games using this plugin

None so far

Prerequisites

Plugins:
1. DoubleX RMMZ Enhanced Codebase
Abilities:

1. Some RMMV plugin development proficiency
(Basic knowledge on what RMMV plugin development does in general with several easy, simple and small plugins written without nontrivial bugs up to 1000 LoC scale but still being inexperienced)
Terms Of Use

1. Commercial use’s always allowed and crediting me’s always optional.

2. You shall keep this plugin’s Plugin Info part’s contents intact.

3. You shalln’t claim that this plugin’s written by anyone other than DoubleX or my aliases. I always reserve the right to deny you from using any of my plugins anymore if you’ve violated this.

4. If you repost this plugin directly(rather than just linking back), you shall inform me of these direct repostings. I always reserve the right to request you to edit those direct repostings.

5. CC BY 4.0, except those conflicting with any of the above, applies to this plugin, unless you’ve my permissions not needing follow so.

6. I always reserve the right to deny you from using this plugin anymore if you’ve violated any of the above.

Contributors

Authors:

1. DoubleX

Plugin Development Collaborators:

– None So Far

Bug Reporters:

– None So Far

Compatibility Issue Raisers:

– None So Far

Feature Requesters:

– None So Far

Changelog

{ codebase: “1.1.0”, plugin: “v1.00b” }(2020 Dec 2 GMT 0400):
1. You no longer have to edit the value of DoubleX_RMMZ.State_Triggers.PLUGIN_NAME when changing this plugin file name

{ codebase: “1.0.0”, plugin: “v1.00a” }(2020 Aug 29 GMT 1300):

1. 1st version of this plugin finished

 

Download Link

Demo Link

DoubleX RMMZ Dynamic Data

Purpose

Lets you edit some database data on the fly and such edits will be saved

Introduction

1. This plugins lets you change some database data on the fly, and those changes will be saved in save files
2. Changing too many database data in the same save can lead to the save file being too big, so only make absolutely necessary changes
3. This plugin doesn’t work with dynamic map data, and I’ve no plans to support this, as it’s all too complicated and convoluted to make it work well without creating even greater troubles, like the game file being too big and map reload issues
4. CHANGING DATA ON THE FLY SHOULD NEVER BE TAKEN LIGHTLY, SO THIS PLUGIN’S SPECIFICALLY DESIGNED TO NOT HAVE RMMZ BEGINNERS IN MIND

Games using this plugin

None so far

Prerequisites

Plugins:
1. DoubleX RMMZ Enhanced Codebase
Abilities:

1. Nothing special for most ordinary cases

2. Little RMMZ plugin development proficiency to fully utilize this(Elementary Javascript exposures being able to write beginner codes up to 300LoC scale )

Terms Of Use

1. Commercial use’s always allowed and crediting me’s always optional.

2. You shall keep this plugin’s Plugin Info part’s contents intact.

3. You shalln’t claim that this plugin’s written by anyone other than DoubleX or my aliases. I always reserve the right to deny you from using any of my plugins anymore if you’ve violated this.

4. If you repost this plugin directly(rather than just linking back), you shall inform me of these direct repostings. I always reserve the right to request you to edit those direct repostings.

5. CC BY 4.0, except those conflicting with any of the above, applies to this plugin, unless you’ve my permissions not needing follow so.

6. I always reserve the right to deny you from using this plugin anymore if you’ve violated any of the above.

Contributors

Authors:

1. DoubleX

Plugin Development Collaborators:

– None So Far

Bug Reporters:

– None So Far

Compatibility Issue Raisers:

– None So Far

Feature Requesters:

– None So Far

Changelog

{ codebase: “1.0.0”, plugin: “v1.00a” }(2020 Aug 28 GMT 0700):

1. 1st version of this plugin finished

 

Download Link

Demo Link

DoubleX RMMZ Skill Item Cooldown

Purpose

Lets you set some skills/items to have battler and skill/item cooldowns

Introduction

1. This plugins lets you set 2 kinds of skill/item cooldowns:
– Skill/Item cooldown – The number of turns(battle turn in turn based individual turn in TPBS) needed for the skill/item to cooldown before it becomes usable again
– Battler cooldown – The number of turns(battle turn in turn based individual turn in TPBS) needed for the battler just executed the skill/item to cooldown before that battler can input actions again
2. If the skill/item cooldown is 1 turn, it means battlers with multiple action slots can only input that skill/item once instead of as many as the action slots allow
If the battler cooldown is negative, it means the TPB bar charging value will be positive instead of 0 right after executing the skill/item(So a -1 battler cooldown means the battler will become able to input actions again right after executing such skills/items)
When updating the battler individual turn count in TPBS, the decimal parts of the battler will be discarded, but those parts will still be used when actually increasing the time needed for that battler to become able to input actions again In the turn based battle system, the decimal parts of the battler cooldown counts as 1 turn
The decimal parts of the final skill/item cooldown value will be discarded
Skill/item cooldown can be set to apply outside battles as well Skill/item cooldown won’t be updated when the battler has fully charged the TPBS bar

Games using this plugin

None so far

Prerequisites

Plugins:
1. DoubleX RMMZ Enhanced Codebase
Abilities:

1. Nothing special for most ordinary cases

2. Little RMMZ plugin development proficiency for more advanced usages(Elementary Javascript exposures being able to write beginner codes up to 300LoC scale)
3. Some RMMV plugin development proficiency to fully utilize this(Basic knowledge on what RMMV plugin development does in general with several easy, simple and small plugins written without nontrivial bugs up to 1000 LoC scale but still being inexperienced)

Terms Of Use

1. Commercial use’s always allowed and crediting me’s always optional.

2. You shall keep this plugin’s Plugin Info part’s contents intact.

3. You shalln’t claim that this plugin’s written by anyone other than DoubleX or my aliases. I always reserve the right to deny you from using any of my plugins anymore if you’ve violated this.

4. If you repost this plugin directly(rather than just linking back), you shall inform me of these direct repostings. I always reserve the right to request you to edit those direct repostings.

5. CC BY 4.0, except those conflicting with any of the above, applies to this plugin, unless you’ve my permissions not needing follow so.

6. I always reserve the right to deny you from using this plugin anymore if you’ve violated any of the above.

Contributors

Authors:

1. DoubleX

Plugin Development Collaborators:

– None So Far

Bug Reporters:

– None So Far

Compatibility Issue Raisers:

– None So Far

Feature Requesters:

– None So Far

Changelog

{ codebase: "1.1.1", plugin: "v1.02a" }(2021 Feb 7 GMT 1300):
1. Added skillItemCooldownGaugeColor1 and skillItemCooldownGaugeColor2 to let you show the TPB battler cooldown bar inside battles with configurable colors
2. Added cancelBattlerCooldownHotkeys and cancelSkillItemCooldownHotkeys to let you set some hotkeys to cancel the battler/skill item cooldown of the corresponding actors* respectively
3. Added the following parameters:
   - canCancelBattlerCooldown
   - canCancelSkillItemCooldown
   - cancelBattlerCooldownFail
   - cancelSkillItemCooldownFail
   - cancelBattlerCooldownSuc
   - cancelSkillItemCooldownSuc
   - canCancelBattlerCooldownNotetagDataTypePriorities
   - canCancelSkillItemCooldownNotetagDataTypePriorities
   - cancelBattlerCooldownFailNotetagDataTypePriorities
   - cancelSkillItemCooldownFailNotetagDataTypePriorities
   - cancelBattlerCooldownSucNotetagDataTypePriorities
   - cancelSkillItemCooldownSucNotetagDataTypePriorities
4. Added the following plugin commands:
   - canCancelBattlerCooldown
   - canCancelSkillItemCooldown
   - cancelBattlerCooldown
   - cancelSkillItemCooldown
5. Added the following notetags:
   - canCancelBattler
   - canCancelSkillItem
   - cancelBattlerFail
   - cancelSkillItemFail
   - cancelBattlerSuc
   - cancelSkillItemSuc
{ codebase: "1.1.0", plugin: "v1.01b" }(2020 Nov 27 GMT 0500):
1. You no longer have to edit the value of DoubleX_RMMZ.Skill_Item_Cooldown.PLUGIN_NAME when changing this plugin file name
{ codebase: "1.0.2", plugin: "v1.01a" }(2020 Oct 11 GMT 0900):
1. Added the plugin query and command counterparts for the following script calls of this plugin:
   - battlerCooldown()
   - isBattlerCooldown()
   - skillItemCooldown(item)
   - isSkillItemCooldown(item)

{ codebase: “1.0.0”, plugin: “v1.00a” }(2020 Aug 27 GMT 0300):

1. 1st version of this plugin finished

 

Download Link

Demo Link

DoubleX RMMZ Targeting AI

Purpose

Lets you control some skills/items target selection AI behaviors by notetags

Introduction

1. The default RMMZ only lets you control the targeting AI by tgr, which is probabilistic rather than deterministic
2. This plugin lets you use some notetags on actors, classes, learnt skills/skills in action list, usable skills, posessed items, usable items, weapons, armors, enemies and states, to control the targeting AI by specifying some deterministic target filters
3. Targets passing the filters will still be affected by the probabilitic tgr when there are more than 1 such targets
4. This plugin only works for skills/items having 1 target, and it doesn’t work well 1 random target either
5. If a filter causes no target to pass, that filter will be discarded upon such use cases

Games using this plugin

None so far

Author Notes

1. All notetags of this plugins are just applying script calls in DoubleX RMMZ Unit Filters unit manipulation script calls, so you’re highly encouraged and recommended to have a basic knowledge on what they do in general, even though it’s not strictly needed to use this plugin

Prerequisites

Plugins:
1. DoubleX RMMZ Enhanced Codebase
2. DoubleX RMMZ Unit Filters

Abilities:

1. Nothing special for most ordinary cases

2. Little RMMZ plugin development proficiency to fully utilize this(Elementary Javascript exposures being able to write beginner codes up to 300LoC scale )

Terms Of Use

1. Commercial use’s always allowed and crediting me’s always optional.

2. You shall keep this plugin’s Plugin Info part’s contents intact.

3. You shalln’t claim that this plugin’s written by anyone other than DoubleX or my aliases. I always reserve the right to deny you from using any of my plugins anymore if you’ve violated this.

4. If you repost this plugin directly(rather than just linking back), you shall inform me of these direct repostings. I always reserve the right to request you to edit those direct repostings.

5. CC BY 4.0, except those conflicting with any of the above, applies to this plugin, unless you’ve my permissions not needing follow so.

6. I always reserve the right to deny you from using this plugin anymore if you’ve violated any of the above.

Contributors

Authors:

1. DoubleX

Plugin Development Collaborators:

– None So Far

Bug Reporters:

– None So Far

Compatibility Issue Raisers:

– None So Far

Feature Requesters:

– None So Far

Changelog

{ codebase: “1.1.0”, plugin: “v1.01b” }(2020 Dec 2 GMT 0400):
1. You no longer have to edit the value of DoubleX_RMMZ.Targeting_AI.PLUGIN_NAME when changing this plugin file name

{ codebase: “1.0.0”, plugin: “v1.01a” }(2020 Aug 28 GMT 0100):
1. Added the following notetags –
– memWithAnyUsableSkill
– memWithAllUsableSkills
– memWithoutAnyUsableSkill
– memWithoutAllUsableSkills

{ codebase: “1.0.0”, plugin: “v1.00a” }(2020 Aug 25 GMT 0400):

1. 1st version of this plugin finished

 

Download Link

Demo Link

DoubleX RMMZ Unit Filters

Purpose

Lets you use script calls to filter unit members with less codes and eventing

Introduction

1. Without any plugin, getting a member with specific conditions relative to the belonging unit, like finding the party member with the highest amount of hp, demands relatively heavy event setups, even with the aid of common events, which boost event reusability.

2. With this plugin, the same can be done using several easy, simple and small script calls instead of writing several common events from scratch, thus further improving effectiveness and efficiency.

(You’ll have to use DoubleX_RMMZ_Plugin_Query to use the plugin queries of this plugin)

Games using this plugin

None so far

Author Notes

1. This plugin’s meant to be a convenience tool to facilitate the use of some unit filters that aren’t already available from the default RMMZ codebase, so you’re still supposed to write some Javascript codes with the aid of the new script calls provided by this plugin.

Prerequisites

Abilities:

1. Nothing special for most ordinary cases

2. Little RMMZ plugin development proficiency to fully utilize this(Elementary Javascript exposures being able to write beginner codes up to 300LoC scale )

Terms Of Use

1. Commercial use’s always allowed and crediting me’s always optional.

2. You shall keep this plugin’s Plugin Info part’s contents intact.

3. You shalln’t claim that this plugin’s written by anyone other than DoubleX or my aliases. I always reserve the right to deny you from using any of my plugins anymore if you’ve violated this.

4. If you repost this plugin directly(rather than just linking back), you shall inform me of these direct repostings. I always reserve the right to request you to edit those direct repostings.

5. CC BY 4.0, except those conflicting with any of the above, applies to this plugin, unless you’ve my permissions not needing follow so.

6. I always reserve the right to deny you from using this plugin anymore if you’ve violated any of the above.

Contributors

Authors:

1. DoubleX

Plugin Development Collaborators:

– None So Far

Bug Reporters:

– None So Far

Compatibility Issue Raisers:

– None So Far

Feature Requesters:

– None So Far

Changelog

{ codebase: “1.0.2”, plugin: “v1.02a” }(2020 Oct 6 GMT 1600):
1. Added the plugin query and command counterparts for the script calls of this plugin

{ codebase: “1.0.0”, plugin: “v1.01a” }(2020 Aug 28 GMT 0000):
1. Added the following battler manipulation script calls –
– hasAnyUsableSkill(skillIds)
– hasAllUsableSkills(skillIds)

{ codebase: “1.0.0”, plugin: “v1.00a” }(2020 Aug 23 GMT 0400):

1. 1st version of this plugin finished

 

Download Link

Demo Link

My Predictions Of The Future Multiplayer Game Architectures

Descriptions

The following image briefly outlines the core structure of this whole idea, which is based on the idea of applying purely server-side rendering on games:

Note that the client side should have next to no game state or data, nor audio/visual assets, as they’re supposed to never leave the server side.

The following’s the general flow of games using this architecture(all these happen per frame):

1. The players start running the game with the client IO

2. The players setup input configurations(keyboard mapping, mouse sensitivity, mouse acceleration, etc), graphics configurations(resolution, fps, gamma, etc), client configurations(player name, player skin, other preferences not impacting gameplay, etc), and anything that only the players can have information of

3. The players connect to servers

4. The players send all those configurations and settings to the servers(those details will be sent again if players changed them during the game within the same servers)

5. The players makes raw inputs(like keyboard presses, mouse clicks, etc) as they play the game

6. The client IO captures those raw player inputs and sends them to the server IO(but there’s never any game data/state synchronization among them)

7. The server IO combines those raw player inputs and the player input configurations for each player to form commands that the game can understand

8. Those game commands generated by all players in the server will update the current game state set

9. The game polls the updated current game state set to form the new camera data for each player

10. The game combines the camera data with the player graphics configurations to generate the rendered graphics markups(with all relevant audio/visual assets used entirely in this step) which are highly compressed and obfuscated and have the least amount of game state information possible

11. The server IO captures the rendered graphics markups and send them to the client IO of each player(and nothing else will ever be sent in this direction)

12. The client IO draws the fully rendered graphics markups(without needing nor knowing any audio/visual asset) on the game screen visible by each player

The aforementioned flow can also be represented this way:

Differences From Cloud Gaming

Do note that it’s different from cloud gaming in the case of multiplayer(although it’s effectively the same in the case of single player), because cloud gaming doesn’t demand the games to be specifically designed for that, while this architecture does, and the difference means that:

1. In cloud gaming, different players rent different remote machines, each hosting the traditional client side of the game, which communicates with the traditional server side of the game in the same real server that’s distinct from those middlemen devices, meaning that there will be at most 2 round trips per frame(between the client and the remote machine, and between the remote machine and the real server), so if the remote machines isn’t physically close to the real server, and the players aren’t physically close to the remote machines, the latency can raise to an absurd level

2. This architecture forces games complying with it to be designed differently from the traditional counterparts right from the start, so it can install the client version(having minimal contents) directly into the device for each player, which directly communicates with the server side of the game in the same server(which has almost everything), thus removing the need of a remote machine per player as the middleman, and hence the problems created by it(latency and the setup/maintenance cost from those remote machines)

3. The full cycle of the communications in cloud gaming is the following:

– The player machines send the raw input commands to the remote machines

– The remote machines convert those commands into new game states of the client side of the game there

– The client side of the game in those remote machines synchronize with the server side of the game in the real server

– The remote machines draw new visuals on their screens and play new audios based on the latest game states on the client side of the game there

– The remote machines send those audio and visual information to the player machines

– The player machines redraw those new audios and visuals there

4. The full cycle of the communications of this architecture is the following:

– The player machines send the raw input commands directly to the real server

– The real server convert those commands into the new game states of the server side of the game there

– The real server send new audio and visual information to the player machines based on the involved parts of the latest game states on the server side of the game there

– The player machines draw those new audios and visuals there

3 + 4 means the rendering actually happens 2 times in cloud gaming – 1 in the remote machines and 1 in the player machines, while the same happens just once in this architecture – just the player machines directly, and the redundant rendering in cloud gaming can contribute quite a lot to the end latency experienced by players, so this is another advantage of this architecture over cloud gaming.

In short, cloud gaming supports games not having cloud gaming in mind(and is thus backward compatible) but can suffer from insane latency and increased business costs(which will be transferred to players), while this architecture only supports games targeting it specifically(and is thus not backward compatible) but removes quite some pains from the remote machine in cloud gaming(this architecture also has some other advantages over cloud gaming, but they’ll be covered in the next section).

On a side note: If some cloud gaming platforms don’t let their players to join servers outside of them, while it’d remove the issue of having 3 entities instead of just 2 in the connection, it’d also be more restrictive than this architecture, because the latter only restricts all players to play the same game using it.

Advantages

The advantages of this architecture at least include the following:

1. The game requirements on the client side can be a lot lower than the traditional architecture(although cloud gaming also has this advantage), as now all the client side does is sending the captured raw player inputs(keyboard presses, mouse clicks, etc) to the server side, and draws the received rendered graphics markup(without using any audio/visual assets in this step and the client side doesn’t have any of them anyway) on the game screen visible by each player

2. Cheating will become next to impossible(cloud gaming may or may not have this advantage), as all cheats are based on game information, and even the state of the art machine vision still can’t retrieve all the information needed for cheating within a frame(even if it just needs 0.5 seconds to do so, it’s already too late in the case of professional FPS E-Sports, not to mention that the rendered graphics markup can change per frame, making machine vision even harder to work well there), and it’d be a epoch-making breakthrough on machine vision if the cheats can indeed generate the correct raw player inputs per frame(especially when the rendered graphics markups are highly obfuscated), which is definitely doing way more good than harm to the mankind, so games using this architecture can actually help pushing the machine vision researches

3. Game piracy and plagiarisms will become a lot more costly and difficult(cloud gaming may or may not have this advantage), as the majority of the game contents and files never leave the servers, meaning that those servers will have to be hacked first before those pirates can crack those games, and hacking a server with the very top-notch security(perhaps monitored by network and server security experts as well) is a very serious business that not many will even have a chance

4. Game data and state synchronization should no longer be an issue(while cloud gaming won’t have this advantage), because the client side should’ve nearly no game data and state, meaning that there should be nothing to synchronize with, thus this setup not only removes tons of game data/state integrity troubles and network issues, but also deliberate or accidental exploits like lag switching(so servers no longer has to kick players with legitimately high latency because those players won’t have any advantage anymore, due to the fact that such exploits would just cause the users to become inactive for a very short time per lag in the server, thus they’d be the only ones being under disadvantages)

Disadvantages

The disadvantages of this architecture at least include the following:

1. The game requirements and the maintenance cost on the server side will become ridiculous – perhaps a supercomputer, computer cluster, or a computer cloud will be needed for each server, and I just don’t know how it’ll even be feasible for MMO to use this architecture in the foreseeable future

2. The network traffic in this architecture will be absurdly high, because all players are sending raw input to the same server, which sends back the rendered graphics markup to each player(even though it’s already highly compressed), all happening per frame, meaning that this can lead to serious connection issues with servers having low capacity and/or players with low connection speed/limited network data usage

3. The rendered graphics markup needs to be totally lossless in terms of visual qualities on one hand, otherwise it’d be a bane for games needing the state of the art graphics; It also needs to be highly compressed and obfuscated on the other, because the network traffic must be minimized and the markup needs to defend against cheats. These mean it’d be extremely hard to properly implement the rendered graphics markup, let alone without creating new problems

4. The inherent network latency due to the physical distance between the clients and the servers will be even more severe, because now the client has to communicate with the server per frame, meaning that the servers must be physically located nearby the players, and thus many servers across many different cities will be needed

How Disadvantages Diminish Over Time

Clearly, the advantages from this architecture will be unprecedented if the architecture itself can ever be realized, while its disadvantages are all hardware and technical limitations that will become less and less significant, and will eventually become trivial.

So while this architecture won’t be the reality in the foreseeable future(at least several years from now), I still believe that it’ll be the distant future(probably in terms of decades).

For instance, let’s say a player joins a server being 300km away from his/her device(which is a bit far away already) to play a game with a 1080p@120Hz setup using this architecture, and the full latency would have to meet the following requirements in order to have everything done within around 9ms, which is a bit more than the maximum time allowed in 120 FPS:

  1. The client will take around 1ms to capture and start sending the raw input commands from the player
  2. The minimum ping, which is limited by the speed of light, will be 2 * 300km / 300,000km per second = around 2ms
  3. The server will take around 1ms to receive and combine all raw input commands from all players
  4. The server will take around 1ms to convert the current game state set with those raw input commands to form the new game state set
  5. The server will take around 1ms to generate all rendered graphics markups(which are lossless, highly compressed and highly obfuscated) from the new camera state of all players
  6. The server will take around 1ms to start sending those rendered graphics markups to all players
  7. The client will take around 1ms to receive and decompress the rendered graphics markup of the corresponding player
  8. The client will take around 1ms to render the decompressed rendered graphics markup as the end result being perceived by the player directly

Do note that hardware limitations, like mouse and keyboard polling rate, as well as monitor response time, are ignored, because they’ll always be there regardless of how a multiplayer game is designed and played.

Of course, the above numbers are just outright impossible within years, especially when there are dozens of players in the same server, but they should become something very real after a decade or 2, because by then the hardware we’ve should be much, much more powerful than those right now.

Similarly, for a 1080p@120Hz setup, if the rendering is lossless but isn’t compressed at all, it’d need (1920 * 1080) pixels * 32 bit * 120 FPS + little bandwidth from raw inputting commands sent to the server = Around 1GB/s per player, which is of course insane to the extreme right now, and the numbers for 4K@240Hz and 8K@480Hz(assuming that it’ll or is always a real thing) setups will be around 8GB/s and 64GB/s per player respectively, which are just incredibly ridiculous in the foreseeable future.

However, as the rendering markups sent to the client should be highly compressed, the actual numbers shouldn’t be this large, and even if the rendering isn’t compressed at all, in the distinct future, when 6G, or even newer generations, become the new norm, these numbers, while will still be quite something, should become practical enough in everyday gaming, and not just for enthusiasts.

Nevertheless, there might be an absolute limit on the screen resolution and/or FPS that can be supported by this architecture no matter how powerful the hardware is, so while I think this architecture will be the distinct future(like after a decade or 2), it probably won’t be the only way multiplayer games being written and played, because the other models still have their values even by then.

Future Implications

If this architecture becomes the practical mainstream, the following will be at least some of the implications:

1. The direct one time price of the games, and also the indirect one(the need to upgrade the client machine to play those games) will be noticeably lower, as the games are much less demanding on the client side(drawing an already rendered graphics markup, especially without needing any audio nor visual assets, is generally a much, much easier, simpler and smaller task than generating that markup itself, and the client side hosts almost no game data nor state so the hard disk space and memory required will also be a lot lower)

2. The periodic subscription fee will exist in more and more games, and those already having such fee will likely increase the fee, in order to compensate for the increasing game maintenance cost from upgraded servers(these maintenance cost increments will eventually be cancelled out by hardware improvements causing the same hardware to become cheaper and cheaper)

3. The focus of companies previously making high end client CPU, GPU, RAM, hard disk, motherboard, etc will gradually shift their business into making server counterparts, because the demands of high end hardware will be relatively smaller and smaller on the client side, but will be relatively larger and larger on the server side

4. The demands of high end servers will be higher and higher, not just from game companies, but also for some players investing a lot into those games, because they’d have the incentive to build some such servers themselves, then either use them to host some games, or rent those servers to others who do

Anti-Cheating

In the case of highly competitive E-Sports, the server can even implement some kind of fuzzy logic, which is fine-tuned with a deep learning AI, to help report suspicious raw player input sets(consisted of keyboard presses, mouse clicks, etc) with a rating on how suspicious it is, which can be further broken down to more detailed components on why they’re that suspicious.

This can only be done effectively and efficiently if the server has direct access to the raw player input set, which is one of the cornerstones of this very architecture.

Combining this with traditional anti cheat measures, like having a server with the highest security level, an in-game admin having server level access to monitor all players in the server(now with the aid of the AI reporting suspicious raw player input sets for each player), another admin for each team/side to monitor player activities, a camera for each player, and thoroughly inspected player hardware, it’ll not only make cheating next to impossible in major LAN events(also being cut off from external connections), but also so obviously infeasible and unrealistic that almost everyone will agree that cheating is indeed nearly impossible there, thus drastically increasing their confidence on the match fairness.

Hybrid Models

Of course, games can also use a hybrid model, and this especially applies to multiplayer games also having single player modes.

If the games support single player, of course the client side needs to have everything(and the piracy/plagiarism issues will be back), it’s just that most of them won’t be used in multiplayer if this architecture’s used.

If the games runs on the multiplayer, the hosting server can choose(before hosting the game) whether this architecture’s used(of course, only players with the full client side package can join servers using the traditional counterpart, and only players with the server side subscription can join servers using this architecture).

Alternatively, players can choose to play single player modes with a server for each player, and those servers are provided by the game company, causing players to be able to play otherwise extremely demanding games with a low-end machine(of course the players will need to apply for the periodic subscriptions to have access of this kind of single player modes).

On the business side, it means such games will have a client side package, with a one time price for everything in the client side, and a server side package, with a periodic subscription for being able to play multiplayer, and single player with a dedicated server provided, then the players can buy either one, or both, depending on their needs and wants.

This hybrid model, if both technically and economically feasible, is perhaps the best model I can think of.

How Information Density And Volume Affect Codebase Readability

Abbreviations

HID – High Information Density

LID – Low Information Density

HIV – High Information Volume

LIV – Low Information Volume

HID/HIV – Those who can handle both HID and HIV well

HID/LIV – Those who can handle HID well but can only handle LIV well

LID/HIV – Those who can only handle LID well but can handle HIV well

LID/LIV – Those who can only handle LID and LIV well

 

TL;DR(The Whole Article Takes About 30 Minutes To Read In Full Depth)

Information Density

A small piece of information representation referring to a large piece of information content has HID, whereas a large piece of information representation referring to a small piece of information content has LID. Unfortunately, different programmers have different capacities on facing information density.

In general, those who can handle very HID well will prefer very terse codes, as it’ll be more effective and efficient to both write and read them that way for such software engineers, while writing and reading verbose codes are just wasting their time in their perspectives; Those who can only handle very LID well will prefer very verbose codes, as it’ll be easier and simpler to both write and read them that way for such software engineers, while writing and reading terse codes are just too complicated and convoluted in their perspectives. Ideally, we should be able to handle very HID well while still being very tolerant towards LID, so we’d be able to work well with codes having all kinds of information density. Unfortunately, very effective and efficient software engineers are generally very intolerant towards extreme ineffectiveness or inefficiencies, so all we can do is to try hard.

Information Volume

A code chunk having a large piece of information content that aren’t abstracted away from that code chunk has HIV, whereas a code chunk having only a small piece of information content that aren’t abstracted away from that code chunk has LIV. Unfortunately, different software engineers have different capacities on facing information volume, so it seems that the best way’s to find a happy medium that can break a very long function into fathomable chunks on one hand, while still keeping the function call stack manageable on the other.

In general, those who can handle very HIV well will prefer very long functions, as it’ll be more effective and efficient to draw the full picture without missing any nontrivial relevant detail that way for such software engineers, while writing and reading very short functions are just going the opposite directions in their perspectives; Those who can only handle very LIV well will prefer very short functions, as it’ll be easier and simpler to reason about well-defined abstractions(as long as they don’t leak in nontrivial ways) that way for such software engineers, while writing and reading long functions are just going the opposite directions in their perspectives. Ideally, we should be able to handle very HIV well while still being very tolerant towards LIV, so we’d be able to work well with codes having all kinds of information volume. Unfortunately, very effective and efficient software engineers are generally very intolerant towards extreme ineffectiveness or inefficiencies(especially when those small function abstractions do leak in nontrivial ways), so all we can do is to try hard.

Combining Information Density With Information Volume

While information density and volume are closely related, there’s no strict implications from one to the other, meaning that there are different combinations of these 2 factors and the resultant style can be very different from each other. For instance, HID doesn’t imply LIV nor vice versa, as it’s possible to write a very terse long function and a very verbose short function; LID doesn’t imply HIV nor vice versa for the very same reasons. In general, the following largely applies to most codebases, even when there are exceptions:

Very HID + HIV = Massive Ball Of Complicated And Convoluted Spaghetti Legacy

Very HID + LIV = Otherwise High Quality Codes That Are Hard To Fathom At First

Very LID + HIV = Excessively Verbose Codes With Tons Of Redundant Boilerplate

Very LID + LIV = Too Many Small Functions With The Call Stacks Being Too Deep

Teams With Programmers Having Different Styles

It seems to me that many coding standard/style conflicts can be somehow explained by the conflicts between HID and LID, and those between HIV and LIV, especially when both sides are being more and more extreme. The combinations of these conflicts may be:

Very HID/HIV + HID/LIV = Too Little Architecture vs Too Weak To Fathom Codes

Very HID/HIV + LID/HIV = Being Way Too Complex vs Doing Too Little Things

Very HID/HIV + LID/LIV = Over-Optimization Freak vs Over-Engineering Freak

Very HID/LIV + LID/HIV = Too Concise/Organized vs Too Messy/Verbose

Very HID/LIV + LID/LIV = Too Hard To Read At First vs Too Ineffective/Inefficient

Very LID/HIV + LID/LIV = Too Beginner Friendly vs Too Flexible For Impossibles

Conclusions

Of course, one doesn’t have to go for the HID, LID, HIV or LIV extremes, as there’s quite some middle grounds to play with. In fact, I think the best of the best software engineers should deal with all these extremes well while still being able to play with the middle grounds well, provided that such an exceptional software engineer can even exist at all. Nevertheless, it’s rather common to work with at least some of the software engineers falling into at least 1 extremes, so we should still know how to work well with them. After all, nowadays most of the real life business codebase are about teamwork but not lone wolves.

By exploring the importance of information density, information volume and their relationships, I hope that this article can help us think of some aspects behind codebase readability and the nature of conflicts about it, and that we can be more able to deal with more different kinds of codebase and software engineers better. I think that it’s more feasible for us to be able to read codebase with different information density and volume than asking others and the codebase to accommodate with our information density/volume limitations.

Also, this article actually implies that readability’s probably a complicated and convoluted concept, as it’s partially objective at large(e.g.: the existence of consistent formatting and meaningful naming) and partially subjective at large(e.g.: the ability to handle different kinds of information density and volume for different software engineers). Maybe many avoidable conflicts involving readability stems from the tendency that many software engineers treat readability as easy, simple and small concept that are entirely objective.

 

Information Density

A Math Analogy

Consider the following math formula that are likely learnt in high school(Euler’s Formula):

Most of those who’ve studied high school math well should immediately fathom this, but for those who don’t, you may want to try to fathom this text equivalent, which is more verbose:

The Euler number to the power of (the imaginary unit multiplied by theta in radian) equals cosine theta in radian plus the imaginary unit multiplied by sine theta in radian

I hope that those who can’t fathom the above formula can at least fathom the above text 🙂

This brings the importance of information density: A small piece of information representation referring to a large piece of information content has HID, whereas a large piece of information representation referring to a small piece of information content has LID. For instance, the above formula has HID whereas the above text has LID.

In this example, those who’re good at math in general and high school math in particular will likely prefer the formula over the text equivalent as they can probably fathom the former instantly while feeling that the latter’s just wasting their time; Those who’re bad at math in general and high school math in particular will likely prefer the text equivalent over the formula as they might not even know the fact that cisx is the short form of cosx + isinx.

For those who can handle HID well, even if they don’t know what Euler number is at all, they should still be able to deduce these corollaries within minutes if they know what cisx is:

But for those who can only handle LID well, they’ll unlikely be able to know what’s going on at all, even if they know how to use the binomial theorem and the truncation operator.

Now let’s try to fathom this math formula that can be fathomed using just high school math:

While it doesn’t involve as much math knowledge nor concepts as those in the Euler’s Formula, I’d guess that only those who’re really, really exceptional in high school math and math in general can fathom this within seconds, let alone instantly, all because of this formula having such a ridiculously HID. If you can really fathom this instantly, then I’d think that you can really handle very HID very well, especially when it comes to math 😀

So what if we try to explain this by text? I’d come up with the following try:

(The summation of m variables from x1 to xm) to the power of n equals the summation of (n elements, each being the combination of selecting r elements from n – 1 elements, where r is the outermost summation counter from 0 to n – 1, multiplied by the summation of (m elements, each being xi to the power of n – r, where i is the middle summation counter from 1 to m, multiplied by (the summation of m variables from x1 to xm except xi) to the power of r))

Maybe you can finally fathom what this formula is, but still probably not what it really means nor how to use it meaningfully, let alone deducing any useful corollary. However, with the text version, at least we can clearly see just how high the information density is in that formula, as even the information density for the text version isn’t actually anything low.

These 2 math examples aim to show that, HID, as long as being kept in moderation, is generally preferred over the LID counterparts. But once the information density becomes too unnecessarily and unreasonably high, the much more verbose versions seeming to be too verbose is actually preferred in general, especially when their information density isn’t low.

Some Examples Showing HID vs LID

There are programming parallels to the above math analogy: terse and verbose codes. Unfortunately, different programmers have different capacities on facing information density, just like different people have different capacities on fathoming math.

For instance, the ternary operator is a very obvious terse example on this(Javascript ES5):

var x = condition1 ? value1 : condition2 ? value2 : value3;

Whereas a verbose if/else if/else equivalent can be something like this:

var x;
if (condition1 === true) {
    x = value1;
} else if (condition2 === true) {
    x = value2;
} else {
    x = value3;
}

Those who’re used to read and write terse codes will likely like the ternary operator version as the if/else if/else version will likely be just too verbose for them; Those who’re used to read and write verbose codes will likely like the if/else if/else version as the ternary operator version will likely be just too terse for them(I’ve seen production codes with if (variable === true), so don’t think that the if/else if/else version can only be totally made up examples). In this case, I’ve worked with both styles, and I guess that most programmers can handle both.

Similarly, Javascript and some other languages support short circuit evaluation, which is also a terse style. For instance, the || and && operators can be short circuited this way:

return isValid && (array || []).concat(object || canUseDefault && default);

Where a verbose equivalent can be something like this(it’s probably too verbose anyway):

var returnedValue;
if (isValid === true) {
    var returnedArray;
    var isValidArray = (array !== null) && (array !== undefined);
    if (isValidArray === true) {
        returnedArray = array;
    } else {
        returnedArray = [];
    }
    var pushedObject;
    var isValidObject = (object !== null) && (object !== undefined);
    if (isValidObject === true) {
        pushedObject = object;
    } else if (canUseDefault === true) {
        pushedObject = default;
    } else {
        pushedObject = canUseDefault;
    }
    if (Array.isArray(pushedObject) === true) {
        returnedArray = returnedArray.concat(pushedObject);
    } else {
        returnedArray = returnedArray.concat([pushedObject]);
    }
    returnedValue = returnedArray;
} else {
    returnedValue = isValid;
}
return returnedValue;

Clearly the terse version has very HID while the verbose version has very LID. Those who can handle HID well will likely fathom the terse version instantly while needing minutes just to fathom what the verbose version’s really trying to achieve and why it’s not written in the terse version to avoid wasting time to read so much code doing so little meaningful things; Those who can only handle LID well will likely fathom the verbose version within minutes while probably giving up after trying to fathom the terse version for seconds and wonder what’s the point of being concise when it’s doing just so many things in just 1 line. In this case, I seriously suspect whether anyone fathoming Javascript will ever write in the verbose version at all, when the terse version is actually one of the popular idiomatic styles.

Now let’s try to fathom this really, really terse codes(I hope you won’t face this in real life):

for (var texts = [], num = min; num <= max; num += increment) {
    var primeMods = primes.map(function(prime) { return num % prime; });
    texts.push(primeMods.reduce(function(text, mod, i) {
        return (text + (mod || words[i])).replace(mod, "");
    }, "") || num);
}
return texts.join(textSeparator);

If you can fathom this within seconds or even instantly, then I’d admit that you can really handle ridiculously HID exceptionally well. However, adding these lines will make it clear:

var min = 1, max = 100, increment = 1;
var primes = [3, 5], words = ["Fizz", "Buzz"], textSeparator = "\n";

So all it’s trying to do is the very, very popular Fizz Buzz programming test in a ridiculously terse way. So let’s try this much more verbose version of this Fizz Buzz programming test:

var texts = [];
for (var num = min; num <= max; num = num + increment) {
    var text = "";
    var primeCount = primes.length;
    for (var i = 0; i < primeCount; i = i + 1) {
        var prime = primes[i];
        var mod = num % prime;
        if (mod === 0) {
            var word = words[i];
            text = text + word;
        }
    }
    if (text === "") {
        texts.push(num);
    } else {
        texts.push(text);
    }
}
return texts.join(textSeparator);

Even those who can handle very HID well should still be able to fathom this verbose version within seconds, so do those who can only handle very LID well. Also, considering the inherent complexity of this generalized Fizz Buzz, the verbose version doesn’t have much boilerplate, even when compared to the terse version, so I don’t think those who can handle very HID well will complain about the verbose version much. On the other hand, I doubt whether those who can only handle very LID well can even fathom the terse version, let alone in a reasonable amount of time(like minutes), if I didn’t tell that it’s just Fizz Buzz. In this case, I really doubt what’s the point of writing in the terse version when I don’t see any nontrivial issue in the verbose version(while the terse version’s likely harder to fathom).

Back To The Math Analogy

Imagine that a mathematician and math professor who’s used to teach postdoc math now have to teach high school math to elementary math students(I’ve heard that a very small amount of parents are so ridiculous to want their elementary children to learn high school math even when those children aren’t interested in nor good at math). That’s almost mission impossible, but all that teacher can do is to first consolidate the elementary math foundation of those students while fostering their interest in math, then gradually progress to middle school math, and finally high school math once those students are good at middle school math. All those students can do is to work extremely hard to catch up such great hurdles.

Unfortunately, it seems to me that it’d take far too much resources, especially time, when those who can handle very HID well try to teach those who can only handle very LID well to handle HID. Even when those who can only handle very LID well can eventually be nurtured to meet the needs imposed by the codebase, it’s still unlikely to be worth it, especially for software teams with very tight budgets, no matter how well intentioned it is.

So should those who can only handle very LID well train up themselves to be able to handle HID? I hope so, but I doubt that it’s similar to asking a high school student to fathom postdoc math. While it’s possible, I still guess that most of us will think that it’s so costly and disproportional just to apply actually basic math formulae that are just written in terse styles; Should those who can handle very HID well learn how to deal with LID well as well? I hope so, but I doubt that’s similar to asking mathematicians to abandon their mother tongue when it comes to math(using words instead of symbols to express math). While it’s possible, I still guess that most of us will think that it’s so excessively ineffective and inefficient just to communicate with those who’re very poor at math when discussing about advanced math.

So it seems that maybe those who can handle HID well and those who can only handle LID well should avoid working with each other as much as possible. But that’d mean all these:

  1. The current software team must identify whether the majority can handle HID well or can only handle LIV well, which isn’t easy to do and most often totally ignored
  2. The software engineering job requirement must state that whether being able to deal with HID well will be prioritized or even required, which is an uncommon statement
  3. All applicants must know whether they can handle HID well, which is overlooked
  4. The candidate screening process must be able to tell who can handle HID well
  5. Most importantly, the team must be able to hire enough candidates who can handle HID well, and it’s obvious that many software teams just won’t be able to do that

Therefore, I don’t think it’s an ideal or even reasonable solution, even though it’s possible.

Alternatively, those who can handle very HID well should try their best to only touch the HID part of the codebase, while those who can only handle very LID well should try their best to only touch the LID part of the codebase. But needless to say, that’s way easier said than done, especially when the team’s large and the codebase can’t be really that modular.

A Considerable Solution

With an IDE supporting collapsing comments, one can try something like this:

/*
var returnedValue;
if (isValid === true) {
    var returnedArray;
    var isValidArray = (array !== null) && (array !== undefined);
    if (isValidArray === true) {
        returnedArray = array;
    } else {
        returnedArray = [];
    }
    var pushedObject;
    var isValidObject = (object !== null) && (object !== undefined);
    if (isValidObject === true) {
        pushedObject = object;
    } else if (canUseDefault === true) {
        pushedObject = default;
    } else {
        pushedObject = canUseDefault;
    }
    if (Array.isArray(pushedObject) === true) {
        returnedArray = returnedArray.concat(pushedObject);
    } else {
        returnedArray = returnedArray.concat([pushedObject]);
    }
    returnedValue = returnedArray;
} else {
    returnedValue = isValid;
}
return returnedValue;
*/
return isValid && (array || []).concat(object || canUseDefault && default);

Of course it’s not practical when the majority of the codebase’s so terse that those who can only handle very LID well will struggle most of the time, but those who can handle very HID well can try to do the former some favors when there aren’t lots of terse codes for them. The point of this comment’s to be a working compromise between the needs of reading codes effectively and efficiently for those who can handle very HID well, and the needs of fathoming code easily and simply for those who can only handle very LID well.

Summary

In general, those who can handle very HID well will prefer very terse codes, as it’ll be more effective and efficient to both write and read them that way for such software engineers, while writing and reading verbose codes are just wasting their time in their perspectives; Those who can only handle very LID well will prefer very verbose codes, as it’ll be easier and simpler to both write and read them that way for such software engineers, while writing and reading terse codes are just too complicated and convoluted in their perspectives. Ideally, we should be able to handle very HID well while still being very tolerant towards LID, so we’d be able to work well with codes having all kinds of information density. Unfortunately, very effective and efficient software engineers are generally very intolerant towards extreme ineffectiveness or inefficiencies, so all we can do is to try hard.

 

Information Volume

An Eating Analogy

Let’s say we’re ridiculously big eaters who can eat 1kg of meat per meal. But can we eat all that 1kg of meat in just 1 chunk? Probably not, as our mouth just won’t be big enough, so we’ll have to cut it into digestible chunks. However, can we eat it if it becomes a 1kg of very fine-grained meat powder? Maybe, but that’s likely daunting or even dangerous(extremely high risk of severe choking) for most of us. So it seems that the best way’s to find a happy medium that works for us, like cutting it into chunks that are just small enough for our mouth to digest. There might still be many chunks but at least they’ll be manageable enough.

The same can be largely applied to fathoming codes, even though there are still differences.

Let’s say you’re reading a well-documented function with 100k lines and none of its business logic are duplicated in the entire codebase(so breaking this function won’t help code reuse right now). Unless we’re so good at fathoming big functions that we can keep all these 100k lines of implementation details in our head as a whole, reading such a function will likely be daunting or even dangerous(extremely high risk of fathom it all wrong) for most of us, assuming that we can indeed fathom it within a feasible amount of time(like within hours).

On the other hand, if we break that 100k line function into extremely small functions so that the function call stack can be as deep as 100 calls, we’ll probably be in really big trouble when we’ve to debug these functions having bugs that don’t have apparently obvious causes nor caught by the current test suite(no test suite can catch all bugs after all). After all, traversing such a deep call stack without getting lost and having to start all over again is like eating tons of very fine-grained meat powders without ever choking severely. Even if we can eventually fix all those bugs with the test suite updated, it’ll still unlikely to be done within a reasonable amount of time(talking about days or even weeks when the time budget is tight).

This brings the importance of information volume: A code chunk having a large piece of information content that aren’t abstracted away from that code chunk has HIV, whereas a code chunk having only a small piece of information content that aren’t abstracted away from that code chunk has LIV. For instance, the above 100k line function has HIV whereas the above small functions with deep call stack has LIV.

So it seems that the best way’s to find a happy medium that can break that 100k line function into fathomable chunks on one hand, while still keeping the call stack manageable on the other. For instance, if possible, breaking that 100k line function into those in which the largest ones are 1k line functions and the ones with the deepest call stack is 10 calls can be a good enough balance. While fathoming a 1k line function is still hard for most of us, it’s at least practical; While debugging functions having call stacks with 10 calls is still time-consuming for most of us, it’s at least realistic to be done within a tight budget.

A Small Example Showing HIV vs LIV

Unfortunately, different software engineers have different capacities on facing information volume, just like different people have different mouth size. Consider the following small example(Some of my Javascript ES5 codes with comments removed):

LIV Version(17 methods with the largest being 4 lines and the deepest call stack being 11) –

$.result = function(note, argObj_) {
    if (!$gameSystem.satbParam("_isCached")) {
        return this._uncachedResult(note, argObj_, "WithoutCache");
    }
    return this._updatedResult(note, argObj_);
};
$._updatedResult = function(note, argObj_) {
    var cache = this._cache.result_(note, argObj_);
    if (_SATB.IS_VALID_RESULT(cache)) return cache;
    return this._updatedResultWithCache(note, argObj_);
};
$._updatedResultWithCache = function(note, argObj_) {
    var result = this._uncachedResult(note, argObj_, "WithCache");
    this._cache.updateResult(note, argObj_, result);
    return result;
};
$._uncachedResult = function(note, argObj_, funcNameSuffix) {
    if (this._rules.isAssociative(note)) {
        return this._associativeResult(note, argObj_, funcNameSuffix);
    }
    return this._nonAssociativeResult(note, argObj_, funcNameSuffix);
};
$._associativeResult = function(note, argObj_, funcNameSuffix) {
    var partResults = this._partResults(note, argObj_, funcNameSuffix);
    var defaultResult = this._pairs.default(note, argObj_);
    return this._rules.chainedResult(
            partResults, note, argObj_, defaultResult);
};
$._partResults = function(note, argObj_, funcNameSuffix) {
    var priorities = this._rules.priorities(note);
    var funcName = "_partResult" + funcNameSuffix + "_";
    var resultFunc = this[funcName].bind(this, note, argObj_);
    return priorities.map(resultFunc).filter(_SATB.IS_VALID_RESULT);
};
$._partResultWithoutCache_ = function(note, argObj_, part) {
    return this._uncachedPartResult_(note, argObj_, part, "WithoutCache");
};
$._partResultWithCache_ = function(note, argObj_, part) {
    var cache = this._cache.partResult_(note, argObj_, part);
    if (_SATB.IS_VALID_RESULT(cache)) return cache;
    return this._updatedPartResultWithCache_(note, argObj_, part);
};
$._updatedPartResultWithCache_ = function(note, argObj_, part) {
    var result =
            this._uncachedPartResult_(note, argObj_, part, "WithCache");
    this._cache.updatePartResult(note, argObj_, part, result);
    return result;
};
$._uncachedPartResult_ = function(note, argObj_, part, funcNameSuffix) {
    var list = this["_pairFuncListPart" + funcNameSuffix](note, part);
    if (list.length <= 0) return undefined;
    return this._rules.chainedResult(list, note, argObj_);
};
$._nonAssociativeResult = function(note, argObj_, funcNameSuffix) {
    var list = this["_pairFuncList" + funcNameSuffix](note);
    var defaultResult = this._pairs.default(note, argObj_);
    return this._rules.chainedResult(list, note, argObj_, defaultResult);
};
$._pairFuncListWithoutCache = function(note) {
    return this._uncachedPairFuncList(note, "WithoutCache");
};
$._pairFuncListWithCache = function(note) {
    var cache = this._cache.pairFuncList_(note);
    return cache || this._updatedPairFuncListWithCache(note);
};
$._updatedPairFuncListWithCache = function(note) {
    var list = this._uncachedPairFuncList(note, "WithCache");
    this._cache.updatePairFuncList(note, list);
    return list;
};
$._uncachedPairFuncList = function(note, funcNameSuffix) {
    var funcName = "_pairFuncListPart" + funcNameSuffix;
    return this._rules.priorities(note).reduce(function(list, part) {
        return list.concat(this[funcName](note, part));
    }.bind(this), []);
};
$._pairFuncListPartWithCache = function(note, part) {
    var cache = this._cache.pairFuncListPart_(note, part);
    return cache || this._updatedPairFuncListPartWithCache(note, part);
};
$._updatedPairFuncListPartWithCache = function(note, part) {
    var list = this._pairFuncListPartWithoutCache(note, part);
    this._cache.updatePairFuncListPart(note, part, list);
    return list;
};
$._pairFuncListPartWithoutCache = function(note, part) {
    var func = this._pairs.pairFuncs.bind(this._pairs, note);
    return this._cache.partListData(part, this._battler).map(func);
};

HIV Version(10 methods with the largest being 12 lines and the deepest call stack being 5) –

$.result = function(note, argObj_) {
    if (!$gameSystem.satbParam("_isCached")) {
        return this._uncachedResult(note, argObj_, "WithoutCache");
    }
    var cache = this._cache.result_(note, argObj_);
    if (_SATB.IS_VALID_RESULT(cache)) return cache;
    // $._updatedResultWithCache START
    var result = this._uncachedResult(note, argObj_, "WithCache");
    this._cache.updateResult(note, argObj_, result);
    return result;
    // $._updatedResultWithCache END
};
$._uncachedResult = function(note, argObj_, funcNameSuffix) {
    if (this._rules.isAssociative(note)) {
        // $._associativeResult START
            // $._partResults START
        var priorities = this._rules.priorities(note);
        var funcName = "_partResult" + funcNameSuffix + "_";
        var resultFunc = this[funcName].bind(this, note, argObj_);
        var partResults = 
                priorities.map(resultFunc).filter(_SATB.IS_VALID_RESULT);
            // $._partResults END
        var defaultResult = this._pairs.default(note, argObj_);
        return this._rules.chainedResult(
                partResults, note, argObj_, defaultResult);
        // $._associativeResult START
    }
    // $._nonAssociativeResult START
    var list = this["_pairFuncList" + funcNameSuffix](note);
    var defaultResult = this._pairs.default(note, argObj_);
    return this._rules.chainedResult(list, note, argObj_, defaultResult);
    // $._nonAssociativeResult END
};
$._partResultWithoutCache_ = function(note, argObj_, part) {
    return this._uncachedPartResult_(note, argObj_, part, "WithoutCache");
};
$._partResultWithCache_ = function(note, argObj_, part) {
    var cache = this._cache.partResult_(note, argObj_, part);
    if (_SATB.IS_VALID_RESULT(cache)) return cache;
    // $._updatedPartResultWithCache_ START
    var result =
            this._uncachedPartResult_(note, argObj_, part, "WithCache");
    this._cache.updatePartResult(note, argObj_, part, result);
    return result;
    // $._updatedPartResultWithCache_ END
};
$._uncachedPartResult_ = function(note, argObj_, part, funcNameSuffix) {
    var list = this["_pairFuncListPart" + funcNameSuffix](note, part);
    if (list.length <= 0) return undefined;
    return this._rules.chainedResult(list, note, argObj_);
};
$._pairFuncListWithoutCache = function(note) {
    return this._uncachedPairFuncList(note, "WithoutCache");
};
$._pairFuncListWithCache = function(note) {
    var cache = this._cache.pairFuncList_(note);
    if (cache) return cache;
    // $._updatedPairFuncListWithCache START
    var list = this._uncachedPairFuncList(note, "WithCache");
    this._cache.updatePairFuncList(note, list);
    return list;
    // $._updatedPairFuncListWithCache END
};
$._uncachedPairFuncList = function(note, funcNameSuffix) {
    var funcName = "_pairFuncListPart" + funcNameSuffix;
    return this._rules.priorities(note).reduce(function(list, part) {
        return list.concat(this[funcName](note, part));
    }.bind(this), []);
};
$._pairFuncListPartWithCache = function(note, part) {
    var cache = this._cache.pairFuncListPart_(note, part);
    if (cache) return cache;
    // $._updatedPairFuncListPartWithCache START
    var list = this._pairFuncListPartWithoutCache(note, part);
    this._cache.updatePairFuncListPart(note, part, list);
    return list;
    // $._updatedPairFuncListPartWithCache END
};
$._pairFuncListPartWithoutCache = function(note, part) {
    var func = this._pairs.pairFuncs.bind(this._pairs, note);
    return this._cache.partListData(part, this._battler).map(func);
};

In case you can’t fathom what this example’s about, you can read this simple flow chart(It doesn’t mention the fact that the actual codes also handle whether the cache will be used):

Even though the underlying business logic’s easy to fathom, different people will likely react to the HIV and LIV Version differently. Those who can handle very HIV well will likely find the LIV version less readable due to having to unnecessarily traverse all these excessively small methods(the smallest ones being 1 liners) and enduring the highest call stack of 11 calls(from $.result to $._pairFuncListPartWithoutCache); Those who can only handle very LIV well will likely find the HIV version less readable due to having to unnecessarily fathom all these excessively mixed implementation details as a single unit in one go from the biggest method with 12 lines and enduring the presence of 3 different levels of abstractions combined just in the biggest and most complex method($._uncachedResult).

Bear in mind that it’s just a small example which is easy to fathom and simple to explain, so the differences between the HIV and LIV styles and the potential conflicts between those who can handle very HIV well and those who can only handle very LIV well will only be even larger and harder to resolve when it comes to massive real life production codebases.

Back To The Eating Analogy

Imagine that the size of the mouth of various people can vary so much that the largest digestible chunk of those with the smallest mouth are as small as a very fine-grained powder in the eyes of those with the largest mouth. Let’s say that these 2 extremes are going to eat together sharing the same meal set. How should these meals be prepared? An obvious way’s to give them different tools to break these meals into digestible chunks of sizes suiting their needs so they’ll respectively use the tools that are appropriate for them, meaning that the meal provider won’t try to do these jobs themselves at all. It’s possible that those with the smallest mouth will happily break those meals into very fine-grained powders, while those with the largest mouth will just eat each individual food as a whole without much trouble.

Unfortunately, it seems to me that there’s still no well battle-tested automatic tools that can effectively and efficiently break a large code chunk into well-defined smaller digestible code chunks with configurable size and complexity without nontrivial side effects, so those who can only handle very LIV well will have to do it manually when having to fathom large functions. Also, even when there’s such a tool, such automatic work’s still effectively refactoring that function, thus probably irritating colleagues who can handle very HIV well.

So should those who can only handle very LIV well train up themselves to be able to deal with HIV? I hope so, but I doubt that’s similar to asking those with very small mouths to increase their mouth size. While it’s possible, I still guess that most of us will think that it’s so costly and disproportional just to eat foods in chunks that are too large for them; Should those who can handle very HIV well learn how to deal with LIV well as well? I hope so, but I doubt that’s similar to asking those with very large mouths to force themselves to eat very fine-grained meat powders without ever choking severely(getting lost when traversing a very deep call stack). While it’s possible, I still guess that most of us will think that it’s so risky and unreasonable just to eat foods as very fine-grained powders unless they really have no other choices at all(meaning that they should actually avoid these as much as possible).

So it seems that maybe those who can handle HIV well and those who can only handle LIV well should avoid working with each other as much as possible. But that’d mean all these:

  1. The current software team must identify whether the majority can handle HIV well or can only handle LIV well, which isn’t easy to do and most often totally ignored
  2. The software engineering job requirement must state that whether being able to deal with HIV well will be prioritized or even required, which is an uncommon statement
  3. All applicants must know whether they can handle HIV well, which is overlooked
  4. The candidate screening process must be able to tell who can handle HIV well
  5. Most importantly, the team must be able to hire enough candidates who can handle HIV well, and it’s obvious that many software teams just won’t be able to do that

Therefore, I don’t think it’s an ideal or even reasonable solution, even though it’s possible.

Alternatively, those who can handle very HIV well should try their best to only touch the HIV part of the codebase, while those who can only handle very LIV well should try their best to only touch the LIV part of the codebase. But needless to say, that’s way easier said than done, especially when the team’s large and the codebase can’t be really that modular.

An Imagined Solution

Let’s say there’s an IDE which can display the function calls in the inlined form, like from:

$.result = function(note, argObj_) {
    if (!$gameSystem.satbParam("_isCached")) {
        return this._uncachedResult(note, argObj_, "WithoutCache");
    }
    return this._updatedResult(note, argObj_);
};
$._updatedResult = function(note, argObj_) {
    var cache = this._cache.result_(note, argObj_);
    if (_SATB.IS_VALID_RESULT(cache)) return cache;
    return this._updatedResultWithCache(note, argObj_);
};
$._updatedResultWithCache = function(note, argObj_) {
    var result = this._uncachedResult(note, argObj_, "WithCache");
    this._cache.updateResult(note, argObj_, result);
    return result;
};
$._uncachedResult = function(note, argObj_, funcNameSuffix) {
    if (this._rules.isAssociative(note)) {
        return this._associativeResult(note, argObj_, funcNameSuffix);
    }
    return this._nonAssociativeResult(note, argObj_, funcNameSuffix);
};
$._associativeResult = function(note, argObj_, funcNameSuffix) {
    var partResults = this._partResults(note, argObj_, funcNameSuffix);
    var defaultResult = this._pairs.default(note, argObj_);
    return this._rules.chainedResult(
            partResults, note, argObj_, defaultResult);
};
$._partResults = function(note, argObj_, funcNameSuffix) {
    var priorities = this._rules.priorities(note);
    var funcName = "_partResult" + funcNameSuffix + "_";
    var resultFunc = this[funcName].bind(this, note, argObj_);
    return priorities.map(resultFunc).filter(_SATB.IS_VALID_RESULT);
};
$._partResultWithoutCache_ = function(note, argObj_, part) {
    return this._uncachedPartResult_(note, argObj_, part, "WithoutCache");
};
$._partResultWithCache_ = function(note, argObj_, part) {
    var cache = this._cache.partResult_(note, argObj_, part);
    if (_SATB.IS_VALID_RESULT(cache)) return cache;
    return this._updatedPartResultWithCache_(note, argObj_, part);
};
$._updatedPartResultWithCache_ = function(note, argObj_, part) {
    var result =
            this._uncachedPartResult_(note, argObj_, part, "WithCache");
    this._cache.updatePartResult(note, argObj_, part, result);
    return result;
};
$._uncachedPartResult_ = function(note, argObj_, part, funcNameSuffix) {
    var list = this["_pairFuncListPart" + funcNameSuffix](note, part);
    if (list.length <= 0) return undefined;
    return this._rules.chainedResult(list, note, argObj_);
};
$._nonAssociativeResult = function(note, argObj_, funcNameSuffix) {
    var list = this["_pairFuncList" + funcNameSuffix](note);
    var defaultResult = this._pairs.default(note, argObj_);
    return this._rules.chainedResult(list, note, argObj_, defaultResult);
};
$._pairFuncListWithoutCache = function(note) {
    return this._uncachedPairFuncList(note, "WithoutCache");
};
$._pairFuncListWithCache = function(note) {
    var cache = this._cache.pairFuncList_(note);
    return cache || this._updatedPairFuncListWithCache(note);
};
$._updatedPairFuncListWithCache = function(note) {
    var list = this._uncachedPairFuncList(note, "WithCache");
    this._cache.updatePairFuncList(note, list);
    return list;
};
$._uncachedPairFuncList = function(note, funcNameSuffix) {
    var funcName = "_pairFuncListPart" + funcNameSuffix;
    return this._rules.priorities(note).reduce(function(list, part) {
        return list.concat(this[funcName](note, part));
    }.bind(this), []);
};
$._pairFuncListPartWithCache = function(note, part) {
    var cache = this._cache.pairFuncListPart_(note, part);
    return cache || this._updatedPairFuncListPartWithCache(note, part);
};
$._updatedPairFuncListPartWithCache = function(note, part) {
    var list = this._pairFuncListPartWithoutCache(note, part);
    this._cache.updatePairFuncListPart(note, part, list);
    return list;
};
$._pairFuncListPartWithoutCache = function(note, part) {
    var func = this._pairs.pairFuncs.bind(this._pairs, note);
    return this._cache.partListData(part, this._battler).map(func);
};

To be displayed as something like this:

$.result = function(note, argObj_) {
    if (!$gameSystem.satbParam("_isCached")) {
        // $._uncachedResult START
        if (this._rules.isAssociative(note)) {
            // $._associativeResult START
                // $._partResults START
            var priorities = this._rules.priorities(note);
            var partResults = priorities.map(function(part) {
                    // $._partResultWithoutCache START
                        // $._uncachedPartResult_ START
                            // $._pairFuncListPartWithoutCache START
                var func = this._pairs.pairFuncs.bind(this._pairs, note);
                var list = this._cache.partListData(
                        part, this._battler).map(func);
                            // $._pairFuncListPartWithoutCache END
                if (list.length <= 0) return undefined;
                return this._rules.chainedResult(list, note, argObj_);
                        // $._uncachedPartResult_ END
                    // $._partResultWithoutCache END
            }).filter(_SATB.IS_VALID_RESULT);
                // $._partResults END
            var defaultResult = this._pairs.default(note, argObj_);
            return this._rules.chainedResult(
                    partResults, note, argObj_, defaultResult);
            // $._associativeResult START
        }
            // $._nonAssociativeResult START
                // $._pairFuncListWithoutCache START
                    // $._uncachedPairFuncList START
        var priorities = this._rules.priorities(note);
        var list = priorities.reduce(function(list, part) {
                        // $._pairFuncListPartWithoutCache START
            var func = this._pairs.pairFuncs.bind(this._pairs, note);
            var l = this._cache.partListData(
                    part, this._battler).map(func);
                        // $._pairFuncListPartWithoutCache END
            return list.concat(l);
        }.bind(this), []);
                    // $._uncachedPairFuncList END
                // $._pairFuncListWithoutCache END
        var defaultResult = this._pairs.default(note, argObj_);
        return this._rules.chainedResult(
                list, note, argObj_, defaultResult);
            // $._nonAssociativeResult END
        // $._uncachedResult END
    }
    var cache = this._cache.result_(note, argObj_);
    if (_SATB.IS_VALID_RESULT(cache)) return cache;
    // $._updatedResultWithCache START
        // $._uncachedResult START
    var result;
    if (this._rules.isAssociative(note)) {
            // $._associativeResult START
                // $._partResults START
        var priorities = this._rules.priorities(note);
        var partResults = priorities.map(function(part) {
                    // $._partResultWithCache START
            var cache = this._cache.partResult_(note, argObj_, part);
            if (_SATB.IS_VALID_RESULT(cache)) return cache;
                        // $._updatedPartResultWithCache_ START
                            // $._uncachedPartResult_ START
                                // $._pairFuncListPartWithCache START
            var c = this._cache.pairFuncListPart_(note, part);
            var list;
            if (c) {
                list = c;
            } else {
                                    // $._updatedPairFuncListPartWithCache START
                                        // $._uncachedPairFuncListPart START
                var func = this._pairs.pairFuncs.bind(this._pairs, note);
                list = this._cache.partListData(
                        part, this._battler).map(func);
                                        // $._uncachedPairFuncListPart END
                this._cache.updatePairFuncListPart(note, part, list);
                                    // $._updatedPairFuncListPartWithCache END
            }
                                // $._pairFuncListPartWithCache END
            var result = undefined;
            if (list.length > 0) {
                result = this._rules.chainedResult(list, note, argObj_);
            }
                            // $._uncachedPartResult_ END
            this._cache.updatePartResult(note, argObj_, part, result);
            return result;
                        // $._updatedPartResultWithCache_ END
                    // $._partResultWithCache END
        }).filter(_SATB.IS_VALID_RESULT);
                // $._partResults END
        var defaultResult = this._pairs.default(note, argObj_);
        result = this._rules.chainedResult(
                partResults, note, argObj_, defaultResult);
            // $._associativeResult START
    }
            // $._nonAssociativeResult START
                // $._pairFuncListWithCache START
    var cache = this._cache.pairFuncList_(note), list;
    if (cache) {
        list = cache;
    } else {
                    // $._updatedPairFuncListWithCache START
                        // $._uncachedPairFuncList START
        var priorities = this._rules.priorities(note);
        var list = priorities.reduce(function(list, part) {
                            // $._pairFuncListPartWithCache START
            var cache = this._cache.pairFuncListPart_(note, part);
            var l;
            if (cache) {
                l = cache;
            } else {
                                // $._updatedPairFuncListPartWithCache START
                                    // $._uncachedPairFuncListPart START
                var func = this._pairs.pairFuncs.bind(this._pairs, note);
                l = this._cache.partListData(
                        part, this._battler).map(func);
                                    // $._uncachedPairFuncListPart END
                this._cache.updatePairFuncListPart(note, part, l);
                                // $._updatedPairFuncListPartWithCache END
            }
            return list.concat(l);
                // $._pairFuncListPartWithCache END
        }.bind(this), []);
                        // $._uncachedPairFuncList END
        this._cache.updatePairFuncList(note, list);
                    // $._updatedPairFuncListWithCache END
    }
                // $._pairFuncListWithCache END
    var defaultResult = this._pairs.default(note, argObj_);
    result = this._rules.chainedResult(list, note, argObj_, defaultResult);
            // $._nonAssociativeResult END
        // $._uncachedResult END
    this._cache.updateResult(note, argObj_, result);
    return result;
    // $._updatedResultWithCache END
};

Or this one without comments indicating the starts and ends of the inlined functions:

$.result = function(note, argObj_) {
    if (!$gameSystem.satbParam("_isCached")) {
        if (this._rules.isAssociative(note)) {
            var priorities = this._rules.priorities(note);
            var partResults = priorities.map(function(part) {
                var func = this._pairs.pairFuncs.bind(this._pairs, note);
                var list = this._cache.partListData(
                        part, this._battler).map(func);
                if (list.length <= 0) return undefined;
                return this._rules.chainedResult(list, note, argObj_);
            }).filter(_SATB.IS_VALID_RESULT);
            var defaultResult = this._pairs.default(note, argObj_);
            return this._rules.chainedResult(
                    partResults, note, argObj_, defaultResult);
        }
        var priorities = this._rules.priorities(note);
        var list = priorities.reduce(function(list, part) {
            var func = this._pairs.pairFuncs.bind(this._pairs, note);
            var l = this._cache.partListData(
                    part, this._battler).map(func);
            return list.concat(l);
        }.bind(this), []);
        var defaultResult = this._pairs.default(note, argObj_);
        return this._rules.chainedResult(
                list, note, argObj_, defaultResult);
    }
    var cache = this._cache.result_(note, argObj_);
    if (_SATB.IS_VALID_RESULT(cache)) return cache;
    var result;
    if (this._rules.isAssociative(note)) {
        var priorities = this._rules.priorities(note);
        var partResults = priorities.map(function(part) {
            var cache = this._cache.partResult_(note, argObj_, part);
            if (_SATB.IS_VALID_RESULT(cache)) return cache;
            var c = this._cache.pairFuncListPart_(note, part);
            var list;
            if (c) {
                list = c;
            } else {
                var func = this._pairs.pairFuncs.bind(this._pairs, note);
                list = this._cache.partListData(
                        part, this._battler).map(func);
                this._cache.updatePairFuncListPart(note, part, list);
            }
            var result = undefined;
            if (list.length > 0) {
                result = this._rules.chainedResult(list, note, argObj_);
            }
            this._cache.updatePartResult(note, argObj_, part, result);
            return result;
        }).filter(_SATB.IS_VALID_RESULT);
        var defaultResult = this._pairs.default(note, argObj_);
        result = this._rules.chainedResult(
                partResults, note, argObj_, defaultResult);
    }
    var cache = this._cache.pairFuncList_(note), list;
    if (cache) {
        list = cache;
    } else {
        var priorities = this._rules.priorities(note);
        var list = priorities.reduce(function(list, part) {
            var cache = this._cache.pairFuncListPart_(note, part);
            var l;
            if (cache) {
                l = cache;
            } else {
                var func = this._pairs.pairFuncs.bind(this._pairs, note);
                l = this._cache.partListData(
                        part, this._battler).map(func);
                this._cache.updatePairFuncListPart(note, part, l);
            }
            return list.concat(l);
        }.bind(this), []);
        this._cache.updatePairFuncList(note, list);
    }
    var defaultResult = this._pairs.default(note, argObj_);
    result = this._rules.chainedResult(list, note, argObj_, defaultResult);
    this._cache.updateResult(note, argObj_, result);
    return result;
};

With just 1 click on $.result. Bear in mind that the actual codebase hasn’t changed one bit, it’s just that the IDE will display the codes from the original LIV form to the new HIV form. The goal this feature’s to keep the codebase in the LIV form, while still letting those who can handle HIV well to be able to read the codebase displayed in the HIV version.

It’s very unlikely for those who can only handle very LIV well to be able to fathom such a complicated and convoluted method with 73 lines and so many different levels of varying abstractions and implementation details all mixed up together, not to mention the really vast amount of completely needless code duplication that aren’t even easy nor simple to spot fast; Those who can handle very HIV well, however, may feel that a 73 line method is so small that they can hold everything inside in their head as a whole very quickly without a hassle.

Of course, one doesn’t have to show everything at once, so besides the aforementioned feature that inlines everything in the reading mode with just 1 click, the IDE should also support inlining a function at a time. Let’s say we’re to reveal _uncachedPairFuncListPart:

$._updatedPairFuncListPartWithCache = function(note, part) {
    var list = this._uncachedPairFuncListPart(note, part);
    this._cache.updatePairFuncListPart(note, part, list);
    return list;
};

Clicking that method name in the above method should lead to something like this:

$._updatedPairFuncListPartWithCache = function(note, part) {
    // $._updatedPairFuncListPartWithCache START
    var func = this._pairs.pairFuncs.bind(this._pairs, note);
    var list = this._cache.partListData(
            part, this._battler).map(func);
    // $._updatedPairFuncListPartWithCache END
    this._cache.updatePairFuncListPart(note, part, list);
    return list;

};

Similarly, clicking the method name updatePairFuncListPart should reveal the implemention details of that method of this._cache, provided that the IDE can access the code of that class.

Such an IDE, if even possible in the foreseeable future, should at least reduce the severity of traversing a deep call stack with tons of small functions for those who can handle very HIV well, if not removing the problem entirely, without forcing those who can only handle very LIV well to deal with HIV, and without the issue of fighting for refactoring in this regard.

Summary

In general, those who can handle very HIV well will prefer very long functions, as it’ll be more effective and efficient to draw the full picture without missing any nontrivial relevant detail that way for such software engineers, while writing and reading very short functions are just going the opposite directions in their perspectives; Those who can only handle very LIV well will prefer very short functions, as it’ll be easier and simpler to reason about well-defined abstractions(as long as they don’t leak in nontrivial ways) that way for such software engineers, while writing and reading long functions are just going the opposite directions in their perspectives. Ideally, we should be able to handle very HIV well while still being very tolerant towards LIV, so we’d be able to work well with codes having all kinds of information volume. Unfortunately, very effective and efficient software engineers are generally very intolerant towards extreme ineffectiveness or inefficiencies(especially when those small function abstractions do leak in nontrivial ways), so all we can do is to try hard.

 

Combining Information Density With Information Volume

Very HID + HIV = Massive Ball Of Complicated And Convoluted Spaghetti Legacy

Imagine that you’re reading a well-documented 100k line function where almost every line’s written like some of the most complex math formulae. I’d guess that even the best of the best software engineers will never ever want to touch this perverted beast again in their lives. Usually such codebase are considered dead and will thus be probably rewritten from scratch.

Of course, HID + HIV isn’t always this extreme, as the aforementioned 73 line version of $.result also falls into this category. Even though it’d still be a hellish nightmare for most software engineers to work with if many functions in the codebase are written this way, it’s still feasible to refactor them into very high quality code within a reasonably tight budget if we’ve the highest devotions, diligence and disciplines possible. While such an iron fist approach should only be the last resort, sometimes the it’s called for so we should be ready.

Nevertheless, try to avoid HID + HIV as much as possible, unless the situation really, really calls for it, like optimizing a massive production codebase to death(e.g.: gameplay codes), or when the problem domain’s so chaotic and unstable that no sane nor sensible architecture will survive for even just a short time(pathetic architectures can be way worse than none). If you still want to use this style even when it’s clearly unnecessary, you should have the most solid reasons and evidence possible to prove that it’s indeed doing more good than harm.

Very HID + LIV = Otherwise High Quality Codes That Are Hard To Fathom At First

For instance, the below codes falls into this category:

return isValid && (array || []).concat(object || canUseDefault && default);

Imagine that you’re reading a codebase having mostly well-defined and well-documented small functions(but far from being mostly 1 liners) but most of those small functions are written like some the most complex math formulae. While fathoming such codes at first will be very difficult, because the functions are well-documented, those functions will be easy to edit once you’ve fathomed it with the help of those comments; Because the functions are small enough and well-defined, those functions will be easy to use once you’ve fathomed how they’re being called with the help of those callers who’re themselves high quality codes.

Of course, HID + LIV doesn’t always mean small short term pains with large long term pleasures, as it’s impossible to ensure that none of those abstractions will ever leak in nontrivial ways. While the codebase will be easy to work with when it only ever has bugs that are either caught by the test suite or have at least some obvious causes, such codebase can still be daunting to work with once it produces rare bugs that are hard to even reproduce, all because of the fact that it’s very hard to form the full pictures with every last bit of nontrivial relevant detail of massive codebases having mostly small but very terse functions.

Nevertheless, as long as all things are kept in moderation(one can always try in this regard), HID + LIV is generally advantageous as long as the codebase’s large enough to warrant large scale software architectures and designs(the lifespan of the codebase should also be long enough), but not so large that no one can form the full picture anymore, as the long term pleasures will likely be large and long enough to outweigh short term pains a lot here.

Very LID + HIV = Excessively Verbose Codes With Tons Of Redundant Boilerplate

Think of an extremely verbose codebase having full of boilerplate and exceptionally long functions. Maybe those functions are long because of the verbosity, but you usually can’t tell before actually reading them all. Anyway, you’ll probably feel that the codebase’s just wasting lots of your time once you realize that most of those long functions aren’t actually doing much. Think of the aforementioned 28 line verbose Javascript examples having an extremely easy, simple and small terse 1 line counterpart, and think of the former being ubiquitous in the codebase. I guess that even the most verbose software engineers will want to refactor it all, as working with it’d just be way too ineffective and inefficient otherwise.

Of course, LID + HIV isn’t always that bad, especially when things are kept in moderation. At least, it’d be nice for most newcomers to fathom the codebase, so codebases written in this style can actually be very beginner-friendly, which is especially important for software teams having very high turnover rates. Even though it’s unlikely to be able to work with such codebase effectively nor efficiently no matter how much you’ve fathomed it due to the heavy verbosity and loads of boilerplate, the problem will be less severe if it’s short-lived. Also, writing codes in this style can be extremely fast at first, even though it’ll gradually become slower and slower, so this style’s very useful in at least prototyping/making PoCs.

Nevertheless, LID + HIV shouldn’t be used on codebases that’d already be very large without the extra verbosity nor boilerplate, especially when it’s going to have a very long life span. Just think of a codebase that can be controlled into the 100k scale all with very terse codes(but still readable), but reaching the 10M scale because of complete refactoring of all those terse codes into tons of verbose codes with boilerplate. Needless to say, almost no one will continue on this road if he/she knows that the codebase will become that large that way.

Very LID + LIV = Too Many Small Functions With The Call Stacks Being Too Deep

For instance, the below codes fall into this category:

/* This is the original codes

$._chainedResult = function(list, note, argObj_, initVal_) {
    var chainedResultFunc = this._rules.chainResultFunc(note);
    return chainedResultFunc(list, note, argObj_, initVal_);
  
};
*/
// This is the refactored codes
$._chainedResult = function(list, note, argObj_, initVal_) {
    var chainedResultFunc = this._chainedResultFunc(note);
    return this._runChainedResult(
            list, note, argObj_, initVal_, chainedResultFunc);
};
$._chainedResultFunc = function(note) {
    return this._rules.chainResultFunc(note);
};
$._runChainedResult = function(list, note, argObj_, initVal_, resultFunc) {
    return resultFunc(list, note, argObj_, initVal_);
};
//

Think of a codebase with less than 100k lines but with already way more than 1k classes/interfaces and 10k functions/methods. It’s almost a given that the deepest call stack in the codebase will be so deep that it can even approach the 100 call mark. It’s because the only way for very small functions to be very verbose with tons of boilerplate is that most of those small functions aren’t actually doing anything meaningful. We’re talking about deeply nested delegates/forwarding functions which are all indeed doing very easy, simple and small jobs, and tons of interfaces or explicit dependencies having only 1 implementation or concrete dependency(configurable options with only 1 option ever used also has this issue).

Of course, LID + LIV does have its places, especially when the business requirements always change so abruptly, frequently and unpredicably that even the most reasonable assumptions can be suddenly violated without any reason at all(I’ve worked with 1 such project). As long as there can still be sane and sensible architectures that can last very long, if the codebase isn’t flexible in almost every direction, the software teams won’t be able to make it when they’ve to implement absurd changes with ridiculously tight budgets and schedules. And the only way for the codebase to be possible to be so flexible is to have as many well-defined interfaces and seams as possible, as long as everything else is still in moderation. For the newcomers, the codebase will seem to be overengineered over nothing already happened, but that’s what you’d likely do when you can never know what’s invariant.

Nevertheless, LID + LIV should still be refactored once there are solid reasons and evidences to prove that the codebase can begin to stablize, or the hidden technical debt incurred from excessive overengineering can quickly accumulate to the point of no return. At that point, even understanding the most common call stack can be almost impossible. Of course, if the codebase can really never stablize, then one can only hope for the best and be prepared for the worst, as such projects are likely death marches, or slowly becoming one. Rare exceptions are that, some codebases have to be this way, like the default RPG Maker MV codebase, due to the business model that any RPG Maker MV user can have any feature request and any RPG Maker MV plugin developer can develop any plugin with any feature.

Summary

While information density and volume are closely related, there’s no strict implications from one to the other, meaning that there are different combinations of these 2 factors and the resultant style can be very different from each other. For instance, HID doesn’t imply LIV nor vice versa, as it’s possible to write a very terse long function and a very verbose short function; LID doesn’t imply HIV nor vice versa for the very same reasons. In general, the following largely applies to most codebases, even when there are exceptions:

Very HID + HIV = Massive Ball Of Complicated And Convoluted Spaghetti Legacy

Very HID + LIV = Otherwise High Quality Codes That Are Hard To Fathom At First

Very LID + HIV = Excessively Verbose Codes With Tons Of Redundant Boilerplate

Very LID + LIV = Too Many Small Functions With The Call Stacks Being Too Deep

Teams With Programmers Having Different Styles

Very HID/HIV + HID/LIV = Too Little Architecture vs Too Weak To Fathom Codes

While both can work with very HID well, their different capacities and takes on information volume can still cause them to have ongoing significant conflicts. The latter values codebase quality over software engineer mental capacity due to their limits on taking information volume, while the former values the opposite due to their exceptionally strong mental power.

Thus the former will likely think of the latter as being too weak to fathom the codes and they’re thus the ones to blame, while the latter will probably think of the former as having too little architecture in mind and they’re thus the ones to blame, as architectures that are beneficial or even necessary for the latter will probably be severe obstacles for the former.

Very HID/HIV + LID/HIV = Being Way Too Complex vs Doing Too Little Things

While both can work with very HIV well, their different capacities and takes on information density can still cause them to have ongoing significant conflicts. The latter values function simplicity over function capabilities due to their limits on taking information density, while the former values the opposite due to their extremely strong information density decoding.

Thus the former will likely think of the latter as doing too little things that actually matter in terms of important business logic as simplicity for the latter means time wasted for the former, while the latter will probably think of the former as being too needlessly complex when it comes to implementing important business logic, as development speed for the former means complexity that are just too high for the latter(no matter how hard they try).

Very HID/HIV + LID/LIV = Over-Optimization Freak vs Over-Engineering Freak

It’s clear that these 2 groups are at the complete opposites – The former preferring massive balls of complicated and convoluted spaghetti legacy over too many small functions with the call stacks being too deep due to the heavy need of optimizing the codebase to death, while the latter preferring the opposite due to the heavy need of making the codebase very flexible.

Thus the former will likely think of the latter as over-engineering freaks while the latter will probably think of the former as over-optimization freaks, as codebase optimization and flexibility are often somehow at odds with each other, especially when one is heavily done.

Very HID/LIV + LID/HIV = Too Concise/Organized vs Too Messy/Verbose

It’s clear that these 2 groups are at the complete opposites – The former preferring otherwise high quality codes that are hard to fathom at first over excessively verbose codes with tons of redundant boilerplate due to the heavy emphasis on the large long term pleasures, while the latter preferring the opposite due to the heavy emphasis on the small short term pains.

Thus the former will likely think of the latter as being too messy and verbose while the latter will probably think of the former as being too concise and organized, as long term pleasures from the high codebase qualities are often at odds with short term pains of the newcomers fathoming the codebase at first, especially when one is heavily emphasized over the other.

Very HID/LIV + LID/LIV = Too Hard To Read At First vs Too Ineffective/Inefficient

While both can only work with very LIV well, their different capacities and takes on information density can still cause them to have ongoing significant conflicts. The latter values the learning cost over maintenance cost(the cost of reading already fathomed codes during maintenance) due to their limits on taking information density, while the former values the opposite due to their good information density skill and reading speed demands.

Thus the former will likely think of the latter as being too ineffective and inefficient when writing codes that are easy to fathom in the short term but time-consuming to read in the long term, while the latter will likely think of the former as being too harsh to newcomers when writing codes that are fast to read in the long term but hard to fathom in the short term.

Very LID/HIV + LID/LIV = Too Beginner Friendly vs Too Flexible For Impossibles

While both can only work with very LID well, their different capacities and takes on information volume can still cause them to have ongoing significant conflicts. The former values codebase beginner friendliness over software flexibility due to their generally lower tolerance on very small functions, while the latter values the opposite due to their limited information volume capacity and high familiarity with very small and flexible functions.

Thus the former will likely think of the latter as being too flexible towards cases that are almost impossible to happen under the current business requirements due to such codebases being generally harder for newcomers to fathom, while the latter will likely think of the former as being too friendly towards beginners at the expense of writing too rigid codes due to codebases being beginner friendly are usually those just thinking about the present needs.

Summary

It seems to me that many coding standard/style conflicts can be somehow explained by the conflicts between HID and LID, and those between HIV and LIV, especially when both sides are being more and more extreme. The combinations of these conflicts may be:

Very HID/HIV + HID/LIV = Too Little Architecture vs Too Weak To Fathom Codes

Very HID/HIV + LID/HIV = Being Way Too Complex vs Doing Too Little Things

Very HID/HIV + LID/LIV = Over-Optimization Freak vs Over-Engineering Freak

Very HID/LIV + LID/HIV = Too Concise/Organized vs Too Messy/Verbose

Very HID/LIV + LID/LIV = Too Hard To Read At First vs Too Ineffective/Inefficient

Very LID/HIV + LID/LIV = Too Beginner Friendly vs Too Flexible For Impossibles

Conclusions

Of course, one doesn’t have to go for the HID, LID, HIV or LIV extremes, as there’s quite some middle grounds to play with. In fact, I think the best of the best software engineers should deal with all these extremes well while still being able to play with the middle grounds well, provided that such an exceptional software engineer can even exist at all. Nevertheless, it’s rather common to work with at least some of the software engineers falling into at least 1 extremes, so we should still know how to work well with them. After all, nowadays most of the real life business codebase are about teamwork but not lone wolves.

By exploring the importance of information density, information volume and their relationships, I hope that this article can help us think of some aspects behind codebase readability and the nature of conflicts about it, and that we can be more able to deal with more different kinds of codebase and software engineers better. I think that it’s more feasible for us to be able to read codebase with different information density and volume than asking others and the codebase to accommodate with our information density/volume limitations.

Also, this article actually implies that readability’s probably a complicated and convoluted concept, as it’s partially objective at large(e.g.: the existence of consistent formatting and meaningful naming) and partially subjective at large(e.g.: the ability to handle different kinds of information density and volume for different software engineers). Maybe many avoidable conflicts involving readability stems from the tendency that many software engineers treat readability as easy, simple and small concept that are entirely objective.

DoubleX RMMV Superlative ATB

Please note that currently it’s still under development.

This plugin aims to be the most flexible, performant and powerful ATB system with the greatest amount of freedom for users to fulfill as many functional needs as they want in as many ways as they want.

You may want to treat this as a nano ATB framework as part of the system’s written by you via parameters/configurations/notetags/calls.

Almost every parameters and notetags can be written as direct JavaScript, thus giving you the maximum amount of control over them.

You can even change most of those JavaScript codes written by you on the fly(and let your players do so with a system settings plugin), but you should only do so if you really know what you’re truly doing.

  1. Core Module
    • Lets you enable and disable this plugin on the fly
    • Lets you define the battle turn in terms of number of actions executed, or frames/seconds elapsed
    • Lets you set the maximum ATB value of each battler
    • Lets you set some states to have their turn counts updated right before the battler involved executes actions
  2. Hotkey Module(v0.01a+)
    • Lets you set some hotkeys to change the currently selected inputable actors
  3. Wait Module(v0.02a+)
    • Lets you set the ATB frame update wait conditions
    • Lets you show the ATB frame update force status
    • Lets you set some hotkeys to forcibly run/stop the ATB frame updates
    • Lets you show some clickable command windows behaving like the aforementioned hotkeys
  4. Bar Module(v0.03a+)
    • Lets you show the battler ATB bars on the battler sprites
    • Lets you show the actor ATB bars attached to the status window
  5. Charge Module(v0.04a+)
    • Lets you set some skills/items to need to be charged before being executed
    • Lets you set some hotkeys to cancel the action being charged(this applies to those not needing charging as well if the players cancel fast enough)
    • Lets you set some hotkeys to force the action charge so it can be executed before the charge’s full or overcharged beyond the maximum charge value
  6. Cooldown Module(v0.05a+)
    • Lets you set some skills/items to cause the battler involved need to be cooled down after executing those skills/items
    • Lets you set some hotkeys to cancel the the battler cooldown
  7. Countdown Module(v0.12a+)
    • Lets you set some states to have their turn count updated basedon the number of frames/seconds elapsed, with additional effectstriggered upon each turn count update
  8. CTB Module(v0.13a+)
    • Lets you change toggle the battle system between ATB and CTB on the fly and even during the same battle(you can actually set a hotkey to do that in battle)
  9. Delay Module(v0.15a+)
    • Lets you set the amount of delay between becoming able to input actions and actually inputting them for battlers can’t have their actions inputted by the player(enemies and actors with auto battle or confusion)
  10. Event Module(v0.06a+)
    • Lets you set some additional events to be triggered upon important timings inthe ATB system
  11. Order Module(v0.14a)+
    • Lets you show the ATB values of all battlers in the same ATB bar
    • Lets you show the battler action ordering in the CTB system style(You should only use this with the full wait mode unless you really know what you’re truly doing)
  12. Rate Module(v0.10a+)
    • Lets you set the ATB, charge and cooldown fill rate for each battler
  13. Reset Module(v0.07a+)
    • Lets you set the ATB value of each battler right after that battler has executed an action and becomes out of virtual action slots
  14. Speed Module(v0.08a+)
    • Lets you set the action execution priority among all battlers being able to execute actions(it likely means next to nothing in the full wait mode)
  15. Start Module(v0.09a+)
    • Lets you set the starting ATB value upon normal, preemptive and surprise battle starts
  16. Turn Module(v0.11a+)
    • Lets you show the progress of the current battle turn

Videos:

  1. DoubleX RMMV Superlative ATB(Core Module Only)
  2. DoubleX RMMV Superlative ATB Compatibility(With MOG_BattleHud Only)
  3. DoubleX RMMV Superlative ATB Compatibility(With Yanfly Engine Plugins – Battle Engine Core Only)
  4. (v0.01a+)Core And Hotkey Module Only
  5. (v0.02a+)DoubleX RMMV Superlative ATB(Core And Wait Module Only)
  6. (v0.03a+)DoubleX RMMV Superlative ATB(Core And Bar Module Only)
  7. (v0.04a+)DoubleX RMMV Superlative ATB(Core And Charge Module Only)
  8. (v0.05a+)DoubleX RMMV Superlative ATB(Core And Cooldown Module Only)
  9. (v0.05b+)DoubleX RMMV Superlative ATB Compatibility(With SEK_ChangeActor Only)
  10. (v0.06a+)DoubleX RMMV Superlative ATB(Core And Event Module Only)
  11. (v0.07a+)DoubleX RMMV Superlative ATB(Core And Reset Module Only)
  12. (v0.08a+)DoubleX RMMV Superlative ATB(Core And Speed Module Only)
  13. (v0.09a+)DoubleX RMMV Superlative ATB(Core And Start Module Only)
  14. (v0.10a)DoubleX RMMV Superlative ATB(Core And Rate Module Only)
  15. (v0.11a+)DoubleX RMMV Superlative ATB(Core And Turn Module Only)
  16. (v0.12a+)DoubleX RMMV Superlative ATB(Core And Countdown Module Only)
  17. (v0.13a+)DoubleX RMMV Superlative ATB(Core And CTB Module Only)
  18. (v0.14a+)DoubleX RMMV Superlative ATB(Core And Order Module Only)
  19. (v0.15a+)(v0.15a+)DoubleX RMMV Superlative ATB(Core And Delay Module Only)

The whole project including the demo is in my github.