-
-
Notifications
You must be signed in to change notification settings - Fork 239
Multiple views via HubNet
Users often ask if they can have more than one view in their model and show different things, or show the same things differently, in each one.
Hopefully in the future we'll provide this capability directly. But it is already possible now using HubNet with local clients. It's a bit awkward, but it works.
You'll need to be using NetLogo 5.x, not some older version.
- Open any model
- from the Tools menu, open the HubNet Client Editor
- in the editor, add a view to the client
- in the Command Center, type
hubnet-reset
- In the dialog that opens, uncheck "Broadcast server location" and press the Start button
- in the HubNet Control Center window, check the "Mirror 2D view on clients" checkbox
- in the Command Center, type
__hubnet-create-client
Now you've got a second view, identical with the main view.
But identical views are no fun. You want the other views to show something different. The relevant primitives are:
- creating, detecting, and removing clients:
__hubnet-create-client
- you can make as many clients as you like
hubnet-clients-list
- for finding out the clients' names, for use with the primitives below
-
hubnet-kick-client
,hubnet-kick-all-clients
- customizing view contents ("client overrides"):
hubnet-send-override
hubnet-clear-override
hubnet-clear-overrides
- recentering and zooming view ("client perspectives"):
hubnet-send-follow
hubnet-send-watch
hubnet-reset-perspective
It's especially useful to override the turtle and link variable hidden?
, to make things invisible in one view and visible in another.
Most of the above steps can be done by code in the Code tab. And once you've added the view to the HubNet client, it's saved with the model so you don't need to add it again.
But a few manual steps are necessary. You have to click the Start button after hubnet-reset
and check the view mirroring checkbox.
Show only red turtles, make them bigger, and label them with coordinates:
hubnet-send-override one-of hubnet-clients-list turtles with [color != red] "hidden?" [true]
hubnet-send-override one-of hubnet-clients-list turtles "size" [5]
hubnet-send-override one-of hubnet-clients-list turtles "label" [(word pxcor " " pycor)]
see screenshot
- Extensions
- NetLogo Libraries
- Controlling API
- Extensions API
- 6.0 Extension and Controlling API Transition-Guide
- Optimizing NetLogo Runs
- Setting English as the Default Language when Running NetLogo
- Unofficial Features
- Advanced Installation
- Optimization List
- Java System Properties and how to use them
- NetLogo on ARM Devices
- Multiple Views via HubNet
- Branches
- Building
- Tests
- Windows Setup
- Continuous Integration
- Draft: How to Help
- Google Summer of Code Ideas List
- Syntax Highlighting
- Building with IntelliJ
- Code Formatting
- Localization
- File (.nlogo) and Widget Format
- Benchmarking
- Releasing
- Preparing the Models Library for Release
- Documentation
- NetLogo Bundled Java Versions
- JOGL
- Plugins API
- Architecture
- LazyAgentset
- Model Runs and Review Tab
- Model Runs: To Do and Code Overview
- Notes on in Radius
- Archived Branches
- The nlogox format
- Touch API Proposal
- Why isn't NetLogo "Parallel"?
- Potential Speedups
- Tortoise
- SimServer, WebStart, and NetLogo in Classrooms