Game Development Community

Jared's Resource Manager--functionality requests?

by Stephen Zepp · in RTS Starter Kit · 11/18/2004 (8:03 pm) · 41 replies

I liked the functionality in Jared's SupplyMan resource, so I decided to adapt it to a server authoritative version, where the client was only allowed to display the data sent by the server.

I currently have the client able to:

--display the icons John created for us in a SupplyDisplay gui panel
--Accept a server command to setup the local store
--Inform the server the store is ready for inventory
--accept the server's authoritative inventory count, and update guis

And I have the server be able to:

--tell the client to setup the local store
--maintain an authoritative count of each supply
--send an inventory (supply and count) to the client
--(almost ready) accept client requests to "spend" resources

I wanted to ask everyone here what other type of functionality we would like for this updated resource.

I currently plan to implement tomorrow:
--client requesting to "spend" inventory
--server authorizing/declining a spend request
--server adjusting inventory for anything spent
--(already done) server sending authoritative inventory updates

I haven't yet decided how I'd like to adjust inventories over time. Jared's resource is very similar to Warcraft 3's tracking of food (your count doesn't go up or down over time based on individual apply events, it simply "is", based on any addSupply calls). We might want to further define individual supplies as "static"--where you don't spend the supply to do things, it's simply there as a count that allows you to do other things, and "dynamic" where you can collect more of the supply over time, and spend the supplies to do things (like lay down buildings, buy troops, etc.).

Any other things folks would like to see?
#21
11/20/2004 (1:16 pm)
Yep,

clientCmdAcceptSetupStores--setting up resource store
----MOVE THIS TO APPROPRIATE PLACE IN CLIENT STARTUP

was in there.

I didn't get an error when placing the building, I just didn't see it there. It was probaly just because the directory was wrong, I'll check that and the playGUI in one second.
#22
11/20/2004 (1:16 pm)
What the sequences should look like in logs:

(note: your object id's may vary)
(second note: I had to "merge" my server side and client side console.logs for this order, so I may have something slightly out of whack, but it looks ok to me)
the entire sequence client side should be:

Mapping string: MissionStartPhase3Ack to index: 2
...server sees client enter game
RTSConnection::onClientEnterGame--setting up resource store
resourceStore::Ctor()

...server tells client to setup stores
Mapping string: AcceptSetupStores to index: 15
clientCmdAcceptSetupStores--setting up resource store
 ----MOVE THIS TO APPROPRIATE PLACE IN CLIENT STARTUP

...client tells server "we're ready"
Mapping string: AckStoresSetUp to index: 3
...server inits client's store to base values, and sends
resourceStore::initServerStore
resourceStore::initServerStore--Index is 0 supply is Gold Total store count is 4
resourceStore::initServerStore--Index is 1 supply is Wood Total store count is 4
resourceStore::initServerStore--Index is 2 supply is Food Total store count is 4
resourceStore::initServerStore--Index is 3 supply is Stone Total store count is 4
resourceStore::initServerStore--Sending inventory to client: Gold 1000 Wood 500 Food 20 Stone 150

...client catches initial update
clientCmdAcceptSupplyUpdate--store is LOCAL Inventory list is Gold 1000 Wood 500 Food 20 Stone 150 stock type is 
clientCmdAcceptSupplyUpdate--Trying to stock 1000 Gold
resourceStore::FindSupply--%this is 1540 supply is Gold
clientCmdAcceptSupplyUpdate--Trying to stock 500 Wood
resourceStore::FindSupply--%this is 1540 supply is Wood
clientCmdAcceptSupplyUpdate--Trying to stock 20 Food
resourceStore::FindSupply--%this is 1540 supply is Food
clientCmdAcceptSupplyUpdate--Trying to stock 150 Stone
resourceStore::FindSupply--%this is 1540 supply is Stone

...player clicks build icon
Client sending building notify! -34.048 -56.2631 95.5569 0 0 1 3.14159 TestBuildingBlock

...PlaceBuilding asks for permission to spend resources
resourceStore::requestSpendSupplies
----client is 1138 store is(1192)
----requestId is (PlaceTestBuilding)
 request is (Gold 100 Wood 50) notifyClient is true
resourceStore::checkInventory--%this is 1192 supply is Gold count requested is 100
resourceStore::checkInventory--%this is 1192 supply is Wood count requested is 50
resourceStore::AlterSupply--this is (1192), Supply is Gold count is -100
resourceStore::FindSupply--%this is 1192 supply is Gold
resourceStore::FindSupply--%this is 1192 supply is Gold
resourceStore::AlterSupply--this is (1192), Supply is Wood count is -50
resourceStore::FindSupply--%this is 1192 supply is Wood
resourceStore::FindSupply--%this is 1192 supply is Wood

...server tells client to update stores (since it was approved), client catches
clientCmdAcceptSupplyUpdate--store is LOCAL Inventory list is Gold 900 Wood 450 stock type is 
clientCmdAcceptSupplyUpdate--Trying to stock 900 Gold
resourceStore::FindSupply--%this is 1540 supply is Gold
clientCmdAcceptSupplyUpdate--Trying to stock 450 Wood
resourceStore::FindSupply--%this is 1540 supply is Wood
clientCmdAcceptSupplyUpdate--store is LOCAL Inventory list is GOLD 950 stock type is 
clientCmdAcceptSupplyUpdate--Trying to stock 950 GOLD
resourceStore::FindSupply--%this is 1540 supply is GOLD
...
serverCmdPlaceBuilding--request by   APPROVED
#23
11/20/2004 (1:17 pm)
(cont from above)
...result of placing building, server sets up and schedules gold adds
repeatingAddSupplies()
---%this: 1197 
---Schedule: 5000 
---%store: LOCAL requestId:  ScheduledRepeatingSupplyAdd 
---request:  GOLD 50 Notify Client? true
resourceStore::requestAddSupplies
----client is 1138 store is(LOCAL)
----requestId is (ScheduledRepeatingSupplyAdd)
 request is (GOLD 50) notifyClient is true
requestAddSupplies--checkMaxInventory returned 0
resourceStore::AlterSupply--this is (1192), Supply is GOLD count is 50
resourceStore::FindSupply--%this is 1192 supply is GOLD
resourceStore::FindSupply--%this is 1192 supply is GOLD

...client catches the auto-supply update
clientCmdAcceptSupplyUpdate--store is LOCAL Inventory list is GOLD 1000 stock type is 
clientCmdAcceptSupplyUpdate--Trying to stock 1000 GOLD
resourceStore::FindSupply--%this is 1540 supply is GOLD

resourseStore::repeatAddSupplies rescheduled, id is (53)
#24
11/20/2004 (1:18 pm)
Everything except the gui is now working right. The only problem with the building was the directory. I just built ten though and it wouldn't let me build anymore after that. I can't seem to find the problem for the gui, but I'll keep looking.
#25
11/20/2004 (1:20 pm)
(cont from above)
...result of placing building, server sets up and schedules gold adds
repeatingAddSupplies()
---%this: 1197 
---Schedule: 5000 
---%store: LOCAL requestId:  ScheduledRepeatingSupplyAdd 
---request:  GOLD 50 Notify Client? true
resourceStore::requestAddSupplies
----client is 1138 store is(LOCAL)
----requestId is (ScheduledRepeatingSupplyAdd)
 request is (GOLD 50) notifyClient is true
requestAddSupplies--checkMaxInventory returned 0
resourceStore::AlterSupply--this is (1192), Supply is GOLD count is 50
resourceStore::FindSupply--%this is 1192 supply is GOLD
resourceStore::FindSupply--%this is 1192 supply is GOLD

...client catches the auto-supply update
clientCmdAcceptSupplyUpdate--store is LOCAL Inventory list is GOLD 1000 stock type is 
clientCmdAcceptSupplyUpdate--Trying to stock 1000 GOLD
resourceStore::FindSupply--%this is 1540 supply is GOLD

resourseStore::repeatAddSupplies rescheduled, id is (53)
#26
11/20/2004 (1:21 pm)
Quote:
Everything except the gui is now working right.

The gui does display eventually, just not right at first, or?
#27
11/20/2004 (1:33 pm)
Ok, found the gui problem (instructions blatently wrong!)

In section A, it should say:

Quote:
I suggest you create a new directory in your client/ui/ dir, called resourceDisplay
and place them there.

Instead of what's there now.

In the playGui.gui section that you cut and paste, change the bitmap paths to be:

bitmap = "./resourceDisplay/icon_XXXX"

That should fix it, or get you much closer.
#28
11/20/2004 (1:48 pm)
Good catch. It still isn't working though. In desprate attemps, I've placed the added code everywhere I could think of.

//--- OBJECT WRITE BEGIN ---
new GuiRTSTSCtrl(PlayGui) {
   profile = "GuiRTSContentProfile";
   horizSizing = "right";
   vertSizing = "bottom";
   position = "0 0";
   extent = "640 480";
   minExtent = "8 8";
   visible = "1";
   cameraZRot = "0";
   forceFOV = "0";
   renderMissionArea = "0";
   missionAreaFillColor = "255 0 0 20";
   missionAreaFrameColor = "255 0 0 128";
   consoleFrameColor = "255 0 0 255";
   consoleFillColor = "255 0 0 120";
   consoleSphereLevel = "1";
   consoleCircleSegments = "32";
   consoleLineWidth = "1";
   selectionLocked = "0";
   selectionIncludesTeam = "1";
   dragSelectionIncludesTeam = "0";
      helpTag = "0";
      firstResponder = "1";
      
      new GuiControl(SupplyDisplay) {
      profile = "GuiDefaultProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "829 612";
      extent = "189 76";
      minExtent = "8 2";
      visible = "1";

      new GuiBitmapCtrl(SUP_Gold) {
         profile = "GuiDefaultProfile";
         horizSizing = "left";
         vertSizing = "top";
         position = "10 10";
         extent = "32 32";
         minExtent = "8 2";
         visible = "1";
         bitmap = "./resourceDisplay/icon_gold";
         wrap = "0";
      };
      new GuiBitmapCtrl(SUP_Wood) {
         profile = "GuiDefaultProfile";
         horizSizing = "left";
         vertSizing = "top";
         position = "48 10";
         extent = "32 32";
         minExtent = "8 2";
         visible = "1";
         bitmap = "./resourceDisplay/icon_wood";
         wrap = "0";
      };
      new GuiBitmapCtrl(SUP_Food) {
         profile = "GuiDefaultProfile";
         horizSizing = "left";
         vertSizing = "top";
         position = "84 10";
         extent = "32 32";
         minExtent = "8 2";
         visible = "1";
         bitmap = "./resourceDisplay/icon_food";
         wrap = "0";
^Is the current. You got any ideas of what's wrong?
#29
11/20/2004 (1:49 pm)
};
      new GuiTextCtrl(SUP_Gold_Count) {
         horizSizing = "left";
         vertSizing = "top";
         position = "12 48";
         extent = "28 18";
         minExtent = "8 18";
         visible = "1";
         maxLength = "5";
      };
      new GuiTextCtrl(SUP_Wood_Count) {
         profile = "GuiDefaultProfile";
         horizSizing = "left";
         vertSizing = "top";
         position = "55 48";
         extent = "21 18";
         minExtent = "8 18";
         visible = "1";
         maxLength = "5";
      };
      new GuiTextCtrl(SUP_Food_count) {
         profile = "GuiDefaultProfile";
         horizSizing = "left";
         vertSizing = "top";
         position = "94 48";
         extent = "14 18";
         minExtent = "8 18";
         visible = "1";
         maxLength = "5";
      };
      new GuiBitmapCtrl(SUP_Stone) {
         profile = "GuiDefaultProfile";
         horizSizing = "left";
         vertSizing = "top";
         position = "122 10";
         extent = "32 32";
         minExtent = "8 2";
         visible = "1";
         bitmap = "./resourceDisplay/icon_stone";
         wrap = "0";
      };
      new GuiTextCtrl(SUP_Stone_count) {
         profile = "GuiDefaultProfile";
         horizSizing = "left";
         vertSizing = "top";
         position = "125 48";
         extent = "14 18";
         minExtent = "8 18";
         visible = "1";
         maxLength = "5";
      };
   };
      
         };
      };
   };
};
  
   
//--- OBJECT WRITE END ---
$CommandMenu::currentCommand = "None";

function CommandMenu::onMoveClick()
{
   PlayGui.setCommandState("Move");
}

function CommandMenu::onStopClick()
{
   commandToServer('IssueStop');
}

function CommandMenu::onHoldClick()
{
   PlayGui.setCommandState("Hold");
   commandToServer('IssueStop');
}

function CommandMenu::onBuffPlusClick()
{
   PlayGui.setCommandState("BuffPlus");
}

function CommandMenu::onAttackClick()
{
   PlayGui.setCommandState("Attack");
}


function CommandMenu::onCancelClick()
{
   PlayGui.setCommandState("None");
}

function CommandMenu::onBuffMinusClick()
{
   PlayGui.setCommandState("BuffMinus");
}
#30
11/20/2004 (1:58 pm)
Other than deleting your playGui.gui.dso file and trying to run again, not sure.

Check your logs carefully early on in the startup and see if there are any error reports on playGui.gui.
#31
11/20/2004 (2:07 pm)
Ok, I just ran through the (updated based on your input) instructions like a robot, and it worked for me in the starter kit stock with no problem.

I'm betting that your playGui.gui file isn't correct--maybe revert back to the original (install the kit again to a different directory, then copy the file) and try to apply the changes again.

I'm e-mailing you an updated version of the .zip file as well, you might have cascading errors from previous problems.
#32
11/20/2004 (2:14 pm)
Compiling starter.RTS/client/ui/playGui.gui...
starter.RTS/client/ui/playGui.gui Line: 120 - Syntax error.
>>> Advanced script error report. Line 239.
>>> Some error context, with ## on sides of error halt:
maxLength = "5";

};

};

};

}##;##

};

};

new GuiTextCtrl(SUP_Stone_count) {
         profile = "GuiDefaultProfile";
         horizSizing = "left";
         vertSizing = "top";
         position = "125 48";
         extent = "14 18";
         minExtent = "8 18";
         visible = "1";
         maxLength = "5";
               };
            };
         };
   };
};
  
   
//--- OBJECT WRITE END ---
#33
11/20/2004 (2:17 pm)
It looks like you deleted just about the whole file except for the adds I gave. The instructions may have not been too clear--you simply wanted to -add- those gui controls, not over-write anything.
#34
11/20/2004 (2:20 pm)
Alright yeah, I'll just download the kit again.
#35
11/20/2004 (2:37 pm)
How in the world did I manage that. Got the icons up, only problem is they're on the chathud. Where is it supposed to be for the demo? Numbers aren't showing up because of the hud so I'm just going to move those real quick. So far, I'm liking how this' going. Good job to you and Jay(?) on creating this, and the person who created the pictures.
#36
11/20/2004 (2:40 pm)
How in the world did I manage that. Got the icons up, only problem is they're on the chathud. Where is it supposed to be for the demo? Numbers aren't showing up because of the hud so I'm just going to move those real quick. So far, I'm liking how this' going. Good job to you and Jay(?) on creating this, and the person who created the pictures.
#37
11/20/2004 (2:44 pm)
Parent relationships in the playGui.gui file are based very much like standard script--the order gui controls show up within the file (and their presence inside { } blocks) determine which gui control is the "parent".

For our gui's, we basically copied the way GG did the CommandMenu guis--made them children of the top level PlayGui control.

It sounds like you just cut/paste the gui's into the wrong place, and wound up inserting them "inside" the { } block for the chatHud...making the chatHud the parent of the various gui controls inside our ResourceDisplay--which as you noticed, screwed 'em up pretty good!

I emailed you a copy of the playGui.gui that I created blindly applying the latest instructions against stock RTS SK.
#38
11/20/2004 (3:00 pm)
That's me in a nutshell, the person who created the pictures. :)

I like the title, though. I may use that from now on.

Like I told you in email, Stephen, it seems to be rolling good aside from the resolution problem. I like it a lot. I may try repositioning the icons later and switching them to the shorter versions.
#39
11/20/2004 (3:01 pm)
John noticed something--I created the windows using a 1024x768 resolution, and they don't seem to be resizing/moving properly at different resolutions. I'll take a look at it, but I'm not a gui creation expert, so it may be a while.

Until then, try setting your resolution for the game to be 1024x768 and you should be able to see the gui's fine.

EDIT: Ok, fixed that issue. You need to set the 3rd and 4th lines of the copy/paste section for playGui.gui to read:

horizSizing = "top";
vertSizing = "left";

instead of:

horizSizing = "bottom";
vertSizing = "right";
#40
11/20/2004 (3:14 pm)
That seems to have fixed it, Stephen. I tested it out by switching resolutions and Alt+Entering and it all seemed to work fine. :)