Client Perspective Example
Model was written in NetLogo 5.0RC10
•
Viewed 748 times
•
Downloaded 104 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This example demonstrates client perspectives: specifically, HUBNET-SEND-FOLLOW, HUBNET-SEND-WATCH, and HUBNET-RESET-PERSPECTIVE. These mirror FOLLOW, WATCH, and RESET-PERSPECTIVE, however, they only affect the view on the given client.
HOW TO USE IT
Make sure that the "Mirror 2D view on clients" box is selected on the HubNet Control Center. To explore different perspectives that are available to clients, select different client-view buttons on the interface.
Comments and Questions
Click to Run Model
breed [students student] students-own [ user-id step-size ] to startup hubnet-reset end to setup clear-patches clear-drawing clear-output ask turtles [ set step-size 1 hubnet-send user-id "step-size" step-size ] reset-ticks end to go listen-clients every 0.1 [ tick ] end ;; ;; HubNet Procedures ;; to listen-clients while [hubnet-message-waiting?] [ hubnet-fetch-message ifelse hubnet-enter-message? [ create-new-student ] [ ifelse hubnet-exit-message? [ remove-student ] [ ask students with [user-id = hubnet-message-source] [ execute-command hubnet-message-tag ] ] ] ] end to create-new-student create-students 1 [ set user-id hubnet-message-source set label user-id set step-size 1 pen-down send-info-to-clients ] end to remove-student ask students with [user-id = hubnet-message-source] [ die ] end to execute-command [command] if command = "step-size" [ set step-size hubnet-message stop ] if command = "up" [ execute-move 0 stop ] if command = "down" [ execute-move 180 stop ] if command = "right" [ execute-move 90 stop ] if command = "left" [ execute-move 270 stop ] end to send-info-to-clients ;; turtle procedure hubnet-send user-id "location" (word "(" pxcor "," pycor ")") end to execute-move [new-heading] set heading new-heading fd step-size send-info-to-clients end ; Public Domain: ; To the extent possible under law, Uri Wilensky has waived all ; copyright and related or neighboring rights to this model.
There are 7 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Client Perspective Example.png | preview | Preview for 'Client Perspective Example' | over 12 years ago, by Uri Wilensky | Download |
This model does not have any ancestors.
This model does not have any descendants.