Skip to content

Commit

Permalink
new init args and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ezrarush committed Jul 13, 2014
1 parent 2be7dac commit 61bd057
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#WIP
This project is not finished.
For the time being ships will not be hidden for debugging purposes.

#Description

A modern OpenGL networked realtime battleship game meant to be a working implementation of [userial's app example](https://github.com/nklein/userial#protocol) so that readers may better understand the protocol.

The only change to the protocol is that ships will be placed on a field of floats because of OpenGL.
One change to the protocol is that ships will be placed on a field of floats because of OpenGL.

#How to Play

Expand Down Expand Up @@ -47,18 +46,18 @@ Run the following in a second SBCL instance shell.

```lisp
(ql:quickload "battleship")
(sdl2:make-this-thread-main (lambda () (battleship:main nil "127.0.0.1")))
(sdl2:make-this-thread-main (lambda () (battleship:main :server-p nil :server-ip "127.0.0.1" :name "Ranma Saotome")))
```

If the player one is on a different host than the server, use the server's ip address instead of the loop back address "127.0.0.1".
If player one is on a different host than the server, use the server's ip address instead of the loop back address "127.0.0.1".

### Player Two

Run the following in a third SBCL instance shell.

```lisp
(ql:quickload "battleship")
(sdl2:make-this-thread-main (lambda () (battleship:main nil "127.0.0.1")))
(sdl2:make-this-thread-main (lambda () (battleship:main :server-p nil :server-ip "127.0.0.1" :name "Ranma Saotome")))
```

If the player two is on a different host than the server, use the server's ip address instead of the loop back address "127.0.0.1".
If player two is on a different host than the server, use the server's ip address instead of the loop back address "127.0.0.1".
4 changes: 2 additions & 2 deletions battleship.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

(defvar *graphics-engine*)

(defun main (&optional (server-p t) (server-ip usocket:*wildcard-host*) (port 2448))
(defun main (&key (server-p t) (server-ip usocket:*wildcard-host*) (port 2448) (name "Unnamed"))
(sdl2:with-init (:everything)
(format t "Using SDL Library Version: ~D.~D.~D~%"
sdl2-ffi:+sdl-major-version+
Expand Down Expand Up @@ -47,7 +47,7 @@
(progn
(connect-to-server server-ip port)
(when (connected-p)
(send-message *server-connection* (make-login-message "player1"))
(send-message *server-connection* (make-login-message name))
(sdl2:with-window (win :title (if (server-p) "Battleship Server" "Battleship Client") :w *window-width* :h *window-height* :flags '(:shown :opengl))
(sdl2:with-gl-context (gl-context win)
(sdl2:gl-make-current win gl-context)
Expand Down

0 comments on commit 61bd057

Please sign in to comment.