• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Spells & Systems Mini-Contests: Resource Collection

Status
Not open for further replies.
Level 29
Joined
Mar 10, 2009
Messages
5,016
Here's my progress: FINAL

JASS:
/*
===Metal Resource v1.0
===Created by Mckill2009

Uses metal as additional requirement to train units and construct structures.

HOW TO USE:
- Copy ALL the Required Libraries and this code to your map.
- Copy the "Buy Metal" and "Metal Generation" to your map, but be sure to input the correct RAW CODES.
- You can see the raw code by pressing CTRL+D in the object editor.
- Register your unitID type that requires metal as seen in the "MetalResource DEMO".

API:
    static method regTrained takes integer unitID, integer cost returns nothing
    static method regBuilding takes integer unitID, integer cost returns nothing    

CREDITS:
- Table by Bribe
- RegisterPlayerUnitEvent by Magtheridon96
- SimError by Vexorian
- SpellEffectEvent by Bribe
- CRAZYRUSSIAN for his icons
*/
library MetalResource uses RegisterPlayerUnitEvent, SpellEffectEvent, Table, SimError, BoardL

globals
    private constant integer METAL_PURCHASE_ID = 'A001' //Raw Code, abilityID to purchase metal
    private constant integer METAL_TECH_ID = 'R000' //Raw Code, research
    private constant integer METAL_STORED = 100 //configurable
    private constant real METAL_GENERATION = 3.0 //recommended
    private integer array MetalRes    
    private integer array GoldStored
endglobals

native GetUnitGoldCost takes integer unitid returns integer
native GetUnitWoodCost takes integer unitid returns integer

struct MetalResource extends array
    private static timer tm = CreateTimer()
    private static integer buildingCounter = 0
    private static integer trainedCounter = 0
    private static TableArray bldg
    private static TableArray unt
    
    private static method metalGeneration takes nothing returns nothing
        local integer i = 0
        local integer gold
        local integer tech
        loop
            set tech = GetPlayerTechCount(Player(i),METAL_TECH_ID,true)
            if GoldStored[i] > 0 then
                set GoldStored[i] = GoldStored[i]-1
                set MetalRes[i] = MetalRes[i]+tech
                call BoardL.boardSetValue(i,0,MetalRes[i])
            endif
            set i = i + 1
            exitwhen i==12
        endloop
    endmethod
    
    private static method cancelEvent takes nothing returns nothing
        call ForceUICancel()
        call PauseTimer(GetExpiredTimer())
        call DestroyTimer(GetExpiredTimer())
    endmethod
    
    private static method resourceReset takes player p, integer g, integer w returns nothing
        call SetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD)+g)
        call SetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER)+w)
    endmethod
    
    private static method checkConstruct takes nothing returns nothing
        local unit building = GetTriggerUnit()
        local player pl = GetTriggerPlayer()
        local integer unitID = GetUnitTypeId(building)
        local integer pID = GetPlayerId(pl)
        local integer gold = GetUnitGoldCost(unitID)
        local integer wood = GetUnitWoodCost(unitID)
        local integer costMetal
        local integer i = 0
        loop
            if bldg[1][i]==unitID then
                exitwhen true
            endif            
            set i = i + 1
            exitwhen i==buildingCounter
        endloop
        set costMetal = bldg[2][i]
        if costMetal > MetalRes[pID] then
            call SimError(pl,"You need at least "+I2S(costMetal)+" metal to build a "+"|cdfff1230"+GetUnitName(building)+"|r")
            call thistype.resourceReset(pl,gold,wood)
            call RemoveUnit(building)            
        else
            set MetalRes[pID] = MetalRes[pID]-costMetal  
            call BoardL.boardSetValue(pID,0,MetalRes[pID])
        endif
        set building = null
        set pl = null
    endmethod  
    
    private static method checkTrained takes nothing returns nothing
        local unit trainer = GetTriggerUnit()
        local player pl = GetTriggerPlayer()
        local integer orderID = GetIssuedOrderId()
        local integer pID = GetPlayerId(pl)
        local integer costMetal
        local integer gold
        local integer wood
        local integer i = 0
        if orderID > 0 then
            loop
                if orderID==unt[1][i] then
                    set gold = GetUnitGoldCost(orderID) 
                    set wood = GetUnitWoodCost(orderID)
                    set costMetal = unt[2][i]
                    exitwhen true
                endif
                set i = i + 1
                exitwhen i==trainedCounter
            endloop
            if costMetal > MetalRes[pID] then
                call SimError(pl,"You need at least "+I2S(costMetal)+" metal to train this unit.")
                call thistype.resourceReset(pl,gold,wood) 
                call TimerStart(CreateTimer(),0.05,false,function thistype.cancelEvent)
            else
                set MetalRes[pID] = MetalRes[pID]-costMetal  
                call BoardL.boardSetValue(pID,0,MetalRes[pID])
            endif
        endif
        set trainer = null
    endmethod
    
    private static method buyMetal takes nothing returns nothing
        local integer pID = GetPlayerId(GetTriggerPlayer())
        local integer gold = GetPlayerState(Player(pID),PLAYER_STATE_RESOURCE_GOLD)
        if gold > METAL_STORED then
            set GoldStored[pID] = GoldStored[pID] + (METAL_STORED/2)
            call SetPlayerState(Player(pID),PLAYER_STATE_RESOURCE_GOLD,gold-METAL_STORED)
        else
            call IssueImmediateOrder(GetTriggerUnit(),"stop")
            call SimError(GetTriggerPlayer(),"You need at least "+I2S(METAL_STORED)+" gold to purchase metals.")
        endif        
    endmethod
    
    private static method onInit takes nothing returns nothing
        local integer i = 0
        call RegisterSpellEffectEvent(METAL_PURCHASE_ID,function thistype.buyMetal)
        call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_CONSTRUCT_START,function thistype.checkConstruct)
        call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_ISSUED_ORDER,function thistype.checkTrained)
        call TimerStart(tm,METAL_GENERATION,true,function thistype.metalGeneration)
        set bldg = TableArray[0x3000]
        set unt = TableArray[0x3000]
        loop
            set MetalRes[i] = 0
            set i = i + 1
            exitwhen i==12
        endloop
    endmethod
    
    //API:
    static method regTrained takes integer unitID, integer cost returns nothing
        local integer i = -1
        loop
            if unt[1][i]==unitID then
                debug call BJDebugMsg("regTrained ERROR: "+UnitId2String(unitID)+" can only be registered once!")
                return
            endif      
            set i = i + 1
            exitwhen i==trainedCounter            
        endloop    
        set unt[1][trainedCounter] = unitID
        set unt[2][trainedCounter] = cost
        set trainedCounter = trainedCounter + 1
    endmethod
    
    static method regBuilding takes integer unitID, integer cost returns nothing
        local integer i = -1
        loop
            if bldg[1][i]==unitID then
                debug call BJDebugMsg("regBuilding ERROR: "+UnitId2String(unitID)+" can only be registered once!")
                return
            endif      
            set i = i + 1
            exitwhen i==buildingCounter
        endloop      
        set bldg[1][buildingCounter] = unitID
        set bldg[2][buildingCounter] = cost
        set bldg[3][unitID] = 0
        set buildingCounter = buildingCounter + 1
    endmethod
    
endstruct

endlibrary


  • MetalResource DEMO
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- First you need to register a building or unit --------
      • -------- farm requires 20 metal --------
      • Custom script: call MetalResource.regBuilding('hhou',20)
      • -------- barracks requires 150 metal --------
      • Custom script: call MetalResource.regBuilding('hbar',150)
      • -------- arcane sanctum requires 120 metal --------
      • Custom script: call MetalResource.regBuilding('hars',120)
      • -------- peasant requires 10 metal --------
      • Custom script: call MetalResource.regTrained('hpea',10)
      • -------- footman requires 35 metal --------
      • Custom script: call MetalResource.regTrained('hfoo',35)
      • -------- priest requires 15 metal --------
      • Custom script: call MetalResource.regTrained('hmpr',50)

To generate metal, you have to research and purchase it at the Castle...
I still have problems on how to display those metals coz leaderboard and multiboard wont do any good,
somehow I've been thinking to do it via texttag...

 

Attachments

  • MetalResource.jpg
    MetalResource.jpg
    50 KB · Views: 246
  • MetalResource.w3x
    71.3 KB · Views: 71
Last edited:
Level 14
Joined
Sep 17, 2009
Messages
1,297
@mckill add an item to the castle what displays metal with the charges of the item! I've seen it working well in some games.

My display will be the mana points, and you dont have to worry about the mana reg and other effects, because the mana will be set based on a saved value in the hashtable. So if you manage to add 500 mana/energy to the mill, but the hashtable havent changed, after 0.2 sec it will be set back to the previous value.
 
Level 14
Joined
Sep 17, 2009
Messages
1,297
Nope, you are right!

And i'm still working. Have to find another way to register windmodifiers :/

I wanted to make a minigame with the system for the testers, but i doubt that I will have enough time :(

Anyway, the main system is ready so i will have an entry both ways!
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Got the re-targeting of terrain tile harvest done, so I'll definitely be able to finish this :)

Just some fine tuning and making it into a little mini game.

EDIT: Attached is my almost-final entry. Everything works and I've even included a minigame for up to 4 players, but I still need to fine tune:
- Closest return to work position inaccurate at long distances from Lumber Mill
- Peasants sometimes find themselves with nothing to do; need to make a "tile taken" system

EDIT: Fun fact for the day: units with <8 collision size casting a blizzard-based ability with 0 range will cancel immediately, regardless of taking damage.
 

Attachments

  • Resource Contest - rulerofiron99.w3x
    51.8 KB · Views: 40
Last edited:
Level 25
Joined
Jul 10, 2006
Messages
3,315
Contest Submission - rulerofiron99
"Grass Harvesting"
attachment.php


Grass Harvesting is a system that allows your workers to harvest the terrain tiles themselves, and return them to a nearby lumber mill to be refined into a "real" resource like Lumber.

Features:
  • Customise any number of terrain types to be harvested, each with a resource value attached. Resource type cannot be specified in this version, all is lumber.
  • Workers automatically return to the closest Lumber Mill to drop off resources.
  • Workers automatically resume harvesting after dropping off resources.
  • Idlers (due to attempting to harvest a tile already being harvested) automatically find a new tile to harvest.
  • Works for multiple players, peasants and lumber mills.

Flaws:
  • The tilefinding algorithm is not ideal - workers will often attempt to harvest from the same tile. I attempted to make a system that causes workers to "claim" terrain coordinates and prevent other workers from harvesting there, but that system didn't work and I didn't have enough time to finish it. The current workaround is the idler system, which checks if workers are standing still for >3 seconds, at which point they will attempt to find a new target point. When playing the map, I suggest not having workers harvesting too close together.
  • Efficiency. Once again with the tilefinding algorithm, it perfoms some redundant checks, and is limited in range. No doubt it will cause some unnecessary calculations and lag with many workers in play. There are also several Distance calculations where simpler methods would have sufficed.
  • Maximum range for finding work after dropping off has been hardcoded to 9x115, due to possible lag issues.

The testmap is a mini-game with up to 4 players to harvest 2000 lumber first.

Overall, though, I'm quite happy with the result, and will hopefully be able to fix those remaining issues after the contest.

Good luck to the other contestants!
 

Attachments

  • Resource Contest - rulerofiron99.w3x
    57.2 KB · Views: 27
  • grassharvesting.png
    grassharvesting.png
    251.6 KB · Views: 320
Level 14
Joined
Sep 17, 2009
Messages
1,297
Windpower System
by kari0003

What this system will do:
- Create Windmills with Blades, and handles them.
- Allows you to create a windmap over your terrain with special windspeed in desired regions.
- Fills the windmills with energy, based on the windmill's capacity and windspeed.
- Blocks any other mana modification what is not suited for the system (brilliance aura, mana potions etc.)
- Its all in GUI, so even beginners can understand whats going on in the system.
- By using hashtables you can easily configure the windmills' stats.

How the calculations go:
Every mill gets the basic windspeed = X
then it gets multiplied by all the windmodifiers what effect the mill : (X)*r1*r2
In the end, the number is multiplied with the windmill's capacity: (X*r1*r2)*c
And this is the amount of energy the mill gets every 0.2 sec
Example: Windspeed is 1.5 ,Mill's capacity: 0.5 ,modifier: 0.7 -> 1.5*0.7*0.5= 0.525 mana/0.2sec

  • WP onPeriod
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • -------- For Each MillType, set windspeed, then set mana and animation speed --------
      • For each (Integer A) from 0 to WP_mill_type_count, do (Actions)
        • Loop - Actions
          • Set WP_tempgroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to WP_mill_type[(Integer A)]))
          • -------- For Each Mill of type, set windspeed to default --------
          • Unit Group - Pick every unit in WP_tempgroup and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load 5 of (Key (Picked unit)) from WP_milldata) Equal to True
                • Then - Actions
                  • Hashtable - Save WP_windstrength as 2 of (Key (Picked unit)) in WP_milldata
                • Else - Actions
          • -------- For Each Modifier loop trough each mill, and add modification to windspeed --------
          • For each (Integer B) from 0 to WP_modifier_count, do (Actions)
            • Loop - Actions
              • Unit Group - Pick every unit in (Units in (Load 0 of (Integer B) in WP_modifierdata) matching ((Unit-type of (Matching unit)) Equal to WP_mill_type[(Integer A)])) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Load 5 of (Key (Picked unit)) from WP_milldata) Equal to True
                    • Then - Actions
                      • Hashtable - Save ((Load 2 of (Key (Picked unit)) from WP_milldata) x (Load 1 of (Integer B) from WP_modifierdata)) as 2 of (Key (Picked unit)) in WP_milldata
                    • Else - Actions
          • -------- For Each Mill of type, set mana and animation speed --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • WP_blade_type[(Integer A)] Equal to WP_mill_type[(Integer A)]
            • Then - Actions
              • Unit Group - Pick every unit in WP_tempgroup and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Load 5 of (Key (Picked unit)) from WP_milldata) Equal to True
                    • Then - Actions
                      • Hashtable - Save ((Load 1 of (Key (Picked unit)) from WP_milldata) + ((Load 2 of (Key (Picked unit)) from WP_milldata) x WP_mill_capacity[(Integer A)])) as 1 of (Key (Picked unit)) in WP_milldata
                      • Hashtable - Save (((Load 2 of (Key (Picked unit)) from WP_milldata) x 100.00) x WP_blade_anim_speed_correction[(Integer A)]) as 0 of (Key (Picked unit)) in WP_milldata
                      • Unit - Set mana of (Picked unit) to (Load 1 of (Key (Picked unit)) from WP_milldata)
                      • Animation - Change (Picked unit)'s animation speed to (Load 0 of (Key (Picked unit)) from WP_milldata)% of its original speed
                    • Else - Actions
            • Else - Actions
              • Unit Group - Pick every unit in WP_tempgroup and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Load 5 of (Key (Picked unit)) from WP_milldata) Equal to True
                    • Then - Actions
                      • Hashtable - Save ((Load 1 of (Key (Picked unit)) from WP_milldata) + ((Load 2 of (Key (Picked unit)) from WP_milldata) x WP_mill_capacity[(Integer A)])) as 1 of (Key (Picked unit)) in WP_milldata
                      • Hashtable - Save (((Load 2 of (Key (Picked unit)) from WP_milldata) x 100.00) x WP_blade_anim_speed_correction[(Integer A)]) as 0 of (Key (Picked unit)) in WP_milldata
                      • Unit - Set mana of (Picked unit) to (Load 1 of (Key (Picked unit)) from WP_milldata)
                      • Animation - Change (Load 4 of (Key (Picked unit)) in WP_milldata)'s animation speed to (Load 0 of (Key (Picked unit)) from WP_milldata)% of its original speed
                    • Else - Actions
          • Custom script: call DestroyGroup(udg_WP_tempgroup)
  • WP onConstruction
    • Events
      • Unit - A unit Finishes construction
    • Conditions
    • Actions
      • For each (Integer A) from 0 to WP_mill_type_count, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • WP_mill_type[(Integer A)] Equal to (Unit-type of (Constructed structure))
            • Then - Actions
              • Hashtable - Save (WP_windstrength x WP_blade_anim_speed_correction[(Integer A)]) as 0 of (Key (Constructed structure)) in WP_milldata
              • Hashtable - Save True as 5 of (Key (Constructed structure)) in WP_milldata
            • Else - Actions
  • WP onConstructStart
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • For each (Integer A) from 0 to WP_mill_type_count, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • WP_mill_type[(Integer A)] Equal to (Unit-type of (Constructing structure))
            • Then - Actions
              • Hashtable - Save (WP_windstrength x WP_blade_anim_speed_correction[(Integer A)]) as 0 of (Key (Constructing structure)) in WP_milldata
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • WP_blade_type[(Integer A)] Not equal to WP_mill_type[(Integer A)]
                • Then - Actions
                  • Hashtable - Save False as 5 of (Key (Constructing structure)) in WP_milldata
                  • Unit - Create 1 WP_blade_type[(Integer A)] for (Owner of (Constructing structure)) at ((Position of (Constructing structure)) offset by 64.00 towards 310.00 degrees) facing (WP_blade_facing_correction[(Integer A)] + 310.00) degrees
                  • Hashtable - Save Handle Of(Last created unit) as 4 of (Key (Constructing structure)) in WP_milldata
                  • Animation - Change (Load 4 of (Key (Constructing structure)) in WP_milldata)'s animation speed to 0.00% of its original speed
                • Else - Actions
                  • Hashtable - Save 0 as 4 of (Key (Constructing structure)) in WP_milldata
            • Else - Actions
  • WP onDestroy
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer A) from 0 to WP_mill_type_count, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • WP_mill_type[(Integer A)] Equal to (Unit-type of (Dying unit))
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • WP_blade_type[(Integer A)] Not equal to WP_mill_type[(Integer A)]
                • Then - Actions
                  • Hashtable - Save False as 5 of (Key (Dying unit)) in WP_milldata
                  • Unit - Remove (Load 4 of (Key (Dying unit)) in WP_milldata) from the game
                • Else - Actions
            • Else - Actions
attachment.php

Credit goes to Blizzard

Note: Map includes a fake mana drain ability, to show usage of the system.

-Final entry-
 

Attachments

  • WindPower_System_kari0003.JPG
    WindPower_System_kari0003.JPG
    254.5 KB · Views: 192
  • System_minicontest_kari0003.w3x
    50.5 KB · Views: 30
Level 29
Joined
Mar 10, 2009
Messages
5,016
@kari0003
- The 'Begins Construction' is useless atm, just use 'Finishes construction'...
- Instead of ForLoop, you can add a dummy passive ability from the object editor, then check
it that way, it saves you time and lots itenerations...
- After constructing add it to a global group, and check the ID that way instead of checking
all units in playable map area, that way you dont need to destroy groups, remove unit when unit dies...
- You're spamming 'Key (Picked unit)' and a-like, cache it via integer variable...
 
Level 14
Joined
Sep 17, 2009
Messages
1,297
@kari0003
- The 'Begins Construction' is useless atm, just use 'Finishes construction'...
It is important, for the effect. How would it look like, if the mill gets its most important part, the blade, after the construction finishes. This way it is always there, just not spinning until the construction is finished.

- Instead of ForLoop, you can add a dummy passive ability from the object editor, then check
it that way, it saves you time and lots itenerations...
- After constructing add it to a global group, and check the ID that way instead of checking
all units in playable map area, that way you dont need to destroy groups, remove unit when unit dies...
These are techniques I barely did before, you got my attention so I'll look into it.

- You're spamming 'Key (Picked unit)' and a-like, cache it via integer variable...
Fair enough, I will change it.


The contest has ended right? So I cant change my entry anymore..
How many entries do we have here?
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Changes since last version:
- Fixed workers "claiming" terrain tiles, preventing multiple workers from attempting to harvest from the same one.
- All system triggers have been set to use variables, and all variables are assigned values in the Settings trigger, making the system easier to customise.
- Added support for both/either gold/lumber values for terrain tiles.

Another thing I MIGHT change/add:
- Have each terrain tile's "hit points" be stored by the terrain variation, and increasing harvest range so that multiple workers can harvest a tile together, as if the terrain tiles are trees.

I still haven't quite gotten around to fixing up the algorithm. One possibility might be to search twin vertical and horizontal rects with increasing sizes, but that wouldn't strictly be "closest", or look particularly good.

There are probably also a few minor leaks and redundant code.
 

Attachments

  • Resource Contest - rulerofiron99 101.w3x
    62.6 KB · Views: 45
dudes i needone permission. I have problemm with internet at home and i have to go to my friend to upload it.So I want to ask pharaoh to my first wip be and final. because i cannot upload twice. I have finished it and will upload it tomorrow. It is system what allow you to change buffduration. Very useful for aos maps or pvp to make stun or slow shottrer
Edit omg xD. I am such noob. I was thinnking any system. Now i see its resourse sry. If i get idea will try to finish it
 
Last edited:

The Panda

Icon Reviewer
Level 57
Joined
Jun 2, 2008
Messages
8,893
Contest Submission - rulerofiron99
"Grass Harvesting"
attachment.php


Grass Harvesting is a system that allows your workers to harvest the terrain tiles themselves, and return them to a nearby lumber mill to be refined into a "real" resource like Lumber.

Features:
  • Customise any number of terrain types to be harvested, each with a resource value attached. Resource type cannot be specified in this version, all is lumber.
  • Workers automatically return to the closest Lumber Mill to drop off resources.
  • Workers automatically resume harvesting after dropping off resources.
  • Idlers (due to attempting to harvest a tile already being harvested) automatically find a new tile to harvest.
  • Works for multiple players, peasants and lumber mills.

Flaws:
  • The tilefinding algorithm is not ideal - workers will often attempt to harvest from the same tile. I attempted to make a system that causes workers to "claim" terrain coordinates and prevent other workers from harvesting there, but that system didn't work and I didn't have enough time to finish it. The current workaround is the idler system, which checks if workers are standing still for >3 seconds, at which point they will attempt to find a new target point. When playing the map, I suggest not having workers harvesting too close together.
  • Efficiency. Once again with the tilefinding algorithm, it perfoms some redundant checks, and is limited in range. No doubt it will cause some unnecessary calculations and lag with many workers in play. There are also several Distance calculations where simpler methods would have sufficed.
  • Maximum range for finding work after dropping off has been hardcoded to 9x115, due to possible lag issues.

The testmap is a mini-game with up to 4 players to harvest 2000 lumber first.

Overall, though, I'm quite happy with the result, and will hopefully be able to fix those remaining issues after the contest.

Good luck to the other contestants!

Im in love with this!
 
The Results

Mckill2009


  • Coding (8.5/10)
    • Configuration (3/4)
    • Efficiency (2.5/3)
    • Bugs (3/3)

    • The system has good configuration, but not perfect configuration. I mean, the interval should be configurable as well.
    • The system is good in terms of the algorithms used and the algorithm complexity, but there are a couple of things:
      • You're leaking one local player.
      • Your TableArrays are too oversized. When you give a TableArray a size of 0x3000, it means you're sizing the first index. The second one can be up to 2.1 billion. It's oversized because you're only using a few index spaces in the system, so 0x3000 is way too much.
    • There are no bugs that I could reproduce.
  • Concept (7.5/10)
    • Originality (2.5/5)
    • Relevant (5/5)

    The concept is not very original, as you have to agree that metal is very common and it would be the first thing most people would think of.
    As for the theme-relevance, good job. It's completely relevant to the theme.​

Total: (16/20)

rulerofiron99


  • Coding (5.5/10)
    • Configuration (2.5/4)
    • Efficiency (1.5/3)
    • Bugs (1.5/3)

    • The configuration is great, but it's not 100% easy to use on the user's side because he has to modify system variables. There's an easier way to pull this off, and that's while using triggers and temp variables. A user would set some temp variables, and run a trigger to register something to the system.
    • Another point about configuration is about how the system is limited to one unit-type for harvesting/collecting the resource. A better solution would've been to use an array of harvesters/collectors, or better yet, a hashtable in which you store booleans.
    • You could store things into variables instead of repeating them over and over again (Like (Triggering unit)).
    • Sometimes, you're using custom scripts with BJs rather than natives. Natives are often better to use because they're faster.
    • Your system modifies unit custom values D:
    • Don't use (Integer A) and (Integer B). You should always use different integers for your GUI loops because they are global and can be messed up quite easily.
    • I'm not going to remove points for this, but there has to be a way to pull off HS Re Target with an O(kn) algorithm rather than that O(k''k'kn) one you're using.
  • Concept (10/10)
    • Originality (5/5)
    • Relevant (5/5)

    The concept is really not something anyone would expect or think of the first time. The execution is also quite good and the submission is relevant.​

Total: (15.5/20)

Chaosy


  • Coding (6.5/10)
    • Configuration (2/4)
    • Efficiency (1.5/3)
    • Bugs (3/3)

    • Don't use (Integer A) because it's a global and can be messed up very easily. Having one variable per loop is the solution since you pretty much can't avoid using globals without reverting to custom scripts.
    • The system is not Multi-instanceable. It needs to support more than one player.
    • Configuration is versatile, but the problem is that it's not very encapsulating, so a user can mess up a ton of things up. The best way to add user configuration is to have allow a user to set variables, then run triggers that do the registration in the system.
    • You shouldn't repeat things very often like (Picked unit). Store them into variables to avoid repetition. It makes things more efficient.
    • In the "cast water" trigger, why not just save true into the hashtable rather than setting the boolean to true, /then/ storing it in the hashtable? :p
    • There are no bugs that I could produce, so, okay.
  • Concept (6.5/10)
    • Originality (2.5/5)
    • Relevant (4/5)

    This entry is mostly relevant to the theme, but it's not perfectly original and the execution isn't jolly either :/​

Total: (13/20)

kari0003


  • Coding (6/10)
    • Configuration (3/4)
    • Efficiency (0/3)
    • Bugs (3/3)

    • Your configuration is incredibly versatile, but the problem is that it's not totally user-friendly. It would be more user-friendly if you had triggers that a user would use as functions. The user would set some temp variables, then run the triggers and the system would have all the data registered to it.
    • Your onPeriod trigger can be much more efficient. It would be a good idea to use a unit group to store all the units currently producing wind. When a unit is constructed in a certain region, you can store the modifier used for him in a hashtable, or you can simply set the wind production rate he has. Actually, instead, store the index of where the modifier is stored in the hashtable for this unit, so if the user changes the value during the game, your onPeriod trigger would still be able to calculate a growth rate for the unit correctly by loading it from the hashtable.
    • Don't use (Integer A) or (Integer B) because they are globals made to be used for all loops in your map, which is a terrible idea by Blizzard, because if the loops are nested, you can actually break a couple of things in the map. Use a custom global integer for each of your loops ^_^
    • Dying unit -> Triggering unit (For speed. I didn't remove points for this of course)
    • There are no bugs that I could reproduce.
    • There are way too many leaks you're not removing, like the groups inside the onPeriod trigger, and the 2 locations inside the onConstructStart trigger.
  • Concept (10/10)
    • Originality (5/5)
    • Relevant (5/5)

    The system idea is quite good, the execution is awesome, and the idea is very relevant to the theme of the contest. Well done.​

Total: (16/20)

Winner(s): kari0003 & mckill2009
2nd place: ruleofiron99
3rd place: Chaosy

Note: The winners receive 25 reputation, next places receive 5 reputation, along with the judge.

Thank you everyone for joining!

Please, visit Spells & Systems Mini-Contests: The Victorious thread.
 
Status
Not open for further replies.
Top