-
-
Notifications
You must be signed in to change notification settings - Fork 0
New Developer's Guide
This is a guide mostly pertaining to LoP development in the World Editor. It will not talk about python scripts and their functionality in depth.
Titan Land: LoP is a project with tens of thousands of lines of code, more than 100 libraries and hundreds of triggers. Therefore, it can take a while to be able to fully grasp how the project works. Hopefully this learning period can be reduced by following this guide.
These libraries are used pretty much everywhere, and knowing what they do is required in order to understand the codebase.
Hashtables are probably the most important feature ever added to JASS, as arrays are very limited in the language (for example, they can't be passed as arguments and have a maximum size of 32768). Without Hashtables, LoP would be practically impossible, as many data structures in the map have sizes that vastly outscale the maximum size allowed for JASS arrays and a lot of data is stored using handle IDs, which are also greater than the array index limit.
One of the most revolutionary libraries ever created for JASS was NewTable, made by the user Bribe. It allows for the easy instantiation of 1D tables (static tables can be created using vJASS keys) and provides a convenient API to access elements of any type, which also makes it ideal for use with textmacros.
Titan Land LoP makes extensive use of the Table, and also defines a couple of libraries that are based on Table: ConstTable and HashtableWrapper. Both of these libraries use an API that is identical to Table's, so if you learn one API you should be capable of using the others.
JASS has no standard library that defines useful data structures, so LoP uses its own. All data structures in LoP are hashtable-based, so there is virtually no limit to the number of instances and the number of stored elements.
- ArrayList
- A 0-indexed List of elements implemented as a continuous segment in a Table. Normally contains integers, but has the ability to define lists for other types (generics).
- LinkedHashSet
- A Set of integers which remembers the order elements were added in, and in which elements can be inserted at any point. Cannot contain the value 0.
A special designation for units in LoP, which can be checked using the LoP_IsUnitDecoration()
function. Whenever a decoration enters the map, a specific function must be called for them. Currently this function is called from within the Unit Indexer trigger. This function removes their Amov and Aatk abilities, in order to clear their command card and make them immobile. It also adds any necessary decoration abilities. See the "Deco On Enter Map" trigger.
Like many Warcraft III projects, LoP makes use of a unit indexer. A unit indexer is a system that assigns each unit a unique integer id whenever it enters the map, which normally (including in LoP) is stored using the unit's user User Data (using the natives GetUnitUserData
and SetUnitUserData
). These ids are mostly used for combat mechanics purposes, so they are not assigned to decorations. A Unit Indexer is also useful for detecting when a unit is removed from the game, which is necessary for running clean up routines.
There are two types of unselectable units in the map:
- Units that were given the Locust ability.
- Decorations that were converted to an
effect
.
Handling Locust units is not that hard for the most part, the main difference when enumerating them is that they do not show up in enumerations that use rects
. Special Effects, however, are handled very specifically, and there are many libraries related to their inner workings. For starters, you should focus on understanding the SpecialEffect and the DecorationSFX libraries.
When units are removed from the game, any data attached to them must be cleared in order to avoid memory leaks and possible bugs when a newly created unit is given the same handle id as an old removed one. Since boolexprs are pretty slow, and also to avoid creating too many extraenous functions, cleanup is performed in a single trigger in LoP, which calls cleanup functions for many libraries.
Decorations are instantly removed from the game whenever they are killed, so detecting their removal is easy. However, when it comes to units, there are many removal conditions that don't have specific events to detect them (summoned units expiring, archer and hippo when merging, etc.). Thus this removal detection needs to be done by the Unit Indexer.
Patch 1.31 added many UI natives that really expanded what map makers could do to offer a better user experience. The "UI" folder in LoP contains all the basic libraries used in UI elements. One of these is the Screen library, which is used to create most UI menus in the map. A "Screen" is an immovable UI element... that is, unlike a window, it has a static place on the screen that cannot be altered by the user.
Most UI libraries have documentation written for them, and also have a lot less requirements than gameplay-related libraries, so they form a less complex web of libraries. Therefore it should be easier to wrap your head around them.