- Joined
- Apr 22, 2024
- Messages
- 2
Hi, I'm not new to Hive Workshop or WC3Campaigns and it's been wonderful resources for me well over 15 years before Firelord was a tavern hero. I don't believe I've posted here before in all that time, so forgive my community's naiveté and etiquette. I own Reforged, but I still don't like it. I've got a "retro" Windows 98/XP PC that has 3DS MAX 4, official Art Tools, and Warcraft III. This isn't important to my upcoming question; I just wish to present some perspective. Recently I've returned to a feature I've been amazed at when I was a young teenager, the "AI Editor". Since then though, I've become experienced in programming and game logic in general and decided to attempt something, regardless of feasibility, that was intimidating then: JASS scripting. I've been working with JASS Craft, it's adequate for basic editing but I use PJASS outside of it. Anyway, here are my questions. My project is to create a monolithic (independent) AI that is significantly better than Blizzard's default AI and not reliant on, then, AMAI either. To achieve this, I only refer to native functions, types, etc. so it can perform alongside any other AI or mods in general. If I've found a non-native function useful, I reimplement it even though I understand the ridiculousness. I'm not using vJASS due to preferring a simpler "toolchain".
So here are my questions:
1. I have a lot of constants, that include several IDs for units, orders, abilities, etc. From my understanding, JASS is interpreted. Are constants any more efficient than normal variables? In compiled languages at large, constants are recognized as "references" for magic numbers (multi-occurrence, unchanged number) and are optimization-swapped. Does JASS do this? If not, is there a tool to help with that?
2. I've read that memory leaks are possible, and considering my script is already large, I feel that is necessary to pay attention to them. I have only read about replacing locations with coordinates (X, Y). How large of a difference is it? Should I instead create global locations or global reals for X and Y to reuse? The same question applies to Rects too.
3. I've read some posts about issues with using heavy math, mainly speed/efficiency. Should I "pre-compute" the math instead, if possible, and write them into variables for reuse or is it fine? Are there certain math-related functions or operations that I should look out for (sqrt, divide, etc.)?
So here are my questions:
1. I have a lot of constants, that include several IDs for units, orders, abilities, etc. From my understanding, JASS is interpreted. Are constants any more efficient than normal variables? In compiled languages at large, constants are recognized as "references" for magic numbers (multi-occurrence, unchanged number) and are optimization-swapped. Does JASS do this? If not, is there a tool to help with that?
2. I've read that memory leaks are possible, and considering my script is already large, I feel that is necessary to pay attention to them. I have only read about replacing locations with coordinates (X, Y). How large of a difference is it? Should I instead create global locations or global reals for X and Y to reuse? The same question applies to Rects too.
3. I've read some posts about issues with using heavy math, mainly speed/efficiency. Should I "pre-compute" the math instead, if possible, and write them into variables for reuse or is it fine? Are there certain math-related functions or operations that I should look out for (sqrt, divide, etc.)?