Turrets Multiplayer
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
THINGS TO NOTICE
(suggested things for the user to notice while running the model)
THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
Comments and Questions
breed [ students student ] breed [ bullets bullet ] students-own [ user-id bullet-cluster? bullet-cluster-size ] bullets-own [ forward-velocity ] globals [ R_login_ID ] to setup clear-all hubnet-reset reset-ticks set R_login_ID 0 end to reset ask bullets[ die ] reset-ticks set R_login_ID 0 end to go every .1 [ listen-clients update-bullet-phyxs tick ] end to listen-clients while [ hubnet-message-waiting? ] [ hubnet-fetch-message ifelse ( hubnet-enter-message? ) [ ;Game Entity Enter Handler create-new-student-turtle ] [ ifelse (hubnet-exit-message?) [ ;Game Entity Exit Handler ask students with [ user-id = hubnet-message-source ][ die ] if(R_login_ID > 0) [ set R_login_ID R_login_ID - 1 ] ] [ ;Main Game Input Handler if(hubnet-message-tag = "Turn-CounterClockwise") [ rotate_turtle_left hubnet-message-source ] if(hubnet-message-tag = "Turn-Clockwise") [ rotate_turtle_right hubnet-message-source ] if(hubnet-message-tag = "Bullet-Clustering?") [ ask students with [ user-id = hubnet-message-source ] [ set bullet-cluster? hubnet-message ] ] if(hubnet-message-tag = "Bullet-Clust-Size") [ ask students with [ user-id = hubnet-message-source ] [ set bullet-cluster-size hubnet-message ] ] if(hubnet-message-tag = "Shoot") [ ask students with [ user-id = hubnet-message-source ] [ shoot-bullet-start ] ] ] ] ] end to create-new-student-turtle set R_login_ID R_login_ID + 1 if(R_login_ID = 1) [ create-students 1 [ set shape "turretbarrel" set color red setxy 27 -8 set heading 360 set size 5 set user-id hubnet-message-source hubnet-send-watch user-id self ] ] if(R_login_ID = 2) [ create-students 1 [ set shape "turretbarrel" set color sky setxy -27 -8 set heading 180 set size 5 set user-id hubnet-message-source hubnet-send-watch user-id self ] ] end to send-data-to [ a-user a-widget a-value ] show a-user show count students with [ user-id = a-user ] ask students with [ user-id = a-user ] [ hubnet-send user-id a-widget a-value ] end to rotate_turtle_left [ R_Message_Source ] ask students with [ user-id = R_Message_Source ] [ lt 5 ] end to rotate_turtle_right [ R_Message_Source ] ask students with [ user-id = R_Message_Source ] [ rt 5 ] end to shoot-bullet-start ifelse ( bullet-cluster? = false ) [ hatch 1 [ set breed bullets set shape "dot" set color white set size 1 set forward-velocity 300 ] ] [ hatch bullet-cluster-size [ set breed bullets set shape "dot" set color white set size 1 set forward-velocity 300 ] ] end to update-bullet-phyxs every .01 [ ask-concurrent bullets [ fd forward-velocity / 100 ] ] end
There is only one version of this model, created about 13 years ago by Ragul Balaji.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.