From 61bd0571c8b6c5acdaecf1f8469fe0112ad43423 Mon Sep 17 00:00:00 2001 From: Ezra Rush Date: Sun, 13 Jul 2014 04:03:32 -0500 Subject: [PATCH] new init args and documentation --- README.md | 11 +++++------ battleship.lisp | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4286d15..5f909af 100644 --- a/README.md +++ b/README.md @@ -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 @@ -47,10 +46,10 @@ 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 @@ -58,7 +57,7 @@ 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". \ No newline at end of file +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". \ No newline at end of file diff --git a/battleship.lisp b/battleship.lisp index 8e3ee46..8a22746 100644 --- a/battleship.lisp +++ b/battleship.lisp @@ -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+ @@ -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)