Universe Resources
This page contains only the bare-bones information.
-
Generic server (see attachment).
-
(make-package model message)
to update model and send a message. -
A main function
start-big-bang
to launch the windows.(define (start-big-bang my-name initial-model) (big-bang initial-model (on-draw draw-h) (on-key key-h) (on-receive receive-h) (register LOCALHOST) ;; or ip address: "10.213.69.91" (name my-name) ;; sets window name (close-on-stop true)))
-
The
launch-many-worlds
command to quickly and easily start several windows.(launch-many-worlds (start-big-bang "whale" (make-model "blue" "gray")) (start-big-bang "squirrel" (make-model "red" "yellow")))
Sending Structures
The simplest way to send a structure is to take it apart into the individual pieces (numbers, strings, and lists), and send those individually. For example, send both the x and y coordinates separately, instead of sending a posn.
You cannot send whole structures without a hack. The hack is to make a separate file that contains a little bit of lower level Racket code and require it.
Here are the three lines you need to put in a file (by itself) to
create a msg
structure that can be sent between worlds. See the
message creation step of the walkthrough.
#lang racket
(provide (all-defined-out))
(define-struct msg (from to info) #:prefab)
Internet Connectivity
Windows at School
At school you can connect to other computers on the same network. Find
the server’s IP address by opening Windows PowerShell and running ip /addr
(note the space before the slash).
At Home
At home you will probably need to set up some port forwarding like a Minecraft server needs; use the port clause in both the server and the client if you need to specify the port. The current default port is 4567.
Additional Resources
-
Universe in Racket Documentation. See especially Section 2.4.7, the examples, where a ball-bouncing example is developed.