From bec5738f2b77ed90a1c2e8351978fba8ee7c22a2 Mon Sep 17 00:00:00 2001 From: mdb Date: Tue, 9 Oct 2001 20:27:35 +0000 Subject: [PATCH] Skeleton for Venison! The tile-laying game of farming, brigandeering and general conquest. git-svn-id: https://samskivert.googlecode.com/svn/trunk@347 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- projects/atlanti/bin/atlclient | 16 ++++ projects/atlanti/bin/atlserver | 4 + projects/atlanti/bin/runjava | 95 +++++++++++++++++++ projects/atlanti/build.xml | 75 +++++++++++++++ projects/atlanti/lib/.cvsignore | 1 + projects/atlanti/lib/README | 46 +++++++++ .../rsrc/config/atlanti/dbmap.properties | 13 +++ .../rsrc/config/atlanti/server.properties | 4 + .../rsrc/config/micasa/server.properties | 17 ++++ .../src/java/com/samskivert/atlanti/Log.java | 6 +- .../atlanti/client/AtlantiController.java | 27 ++++++ .../atlanti/client/AtlantiPanel.java | 39 ++++++++ .../atlanti/data/AtlantiConfig.java | 19 ++++ .../atlanti/data/AtlantiObject.java | 13 +++ .../atlanti/server/AtlantiManager.java | 18 ++++ 15 files changed, 390 insertions(+), 3 deletions(-) create mode 100755 projects/atlanti/bin/atlclient create mode 100755 projects/atlanti/bin/atlserver create mode 100755 projects/atlanti/bin/runjava create mode 100644 projects/atlanti/build.xml create mode 100644 projects/atlanti/lib/.cvsignore create mode 100644 projects/atlanti/lib/README create mode 100644 projects/atlanti/rsrc/config/atlanti/dbmap.properties create mode 100644 projects/atlanti/rsrc/config/atlanti/server.properties create mode 100644 projects/atlanti/rsrc/config/micasa/server.properties create mode 100644 projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiController.java create mode 100644 projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiPanel.java create mode 100644 projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiConfig.java create mode 100644 projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiObject.java create mode 100644 projects/atlanti/src/java/com/samskivert/atlanti/server/AtlantiManager.java diff --git a/projects/atlanti/bin/atlclient b/projects/atlanti/bin/atlclient new file mode 100755 index 00000000..23317d8a --- /dev/null +++ b/projects/atlanti/bin/atlclient @@ -0,0 +1,16 @@ +#!/bin/sh + +BINDIR=`dirname $0` +JAVA_ARGS="" + +# grab the -Dinviter if it's specified +if [ ! -z "$1" ] ; then + case $1 in + -Dinvitee=*) + JAVA_ARGS=$1 + shift + ;; + esac +fi + +$BINDIR/runjava $JAVA_ARGS com.threerings.micasa.client.MiCasaApp $* diff --git a/projects/atlanti/bin/atlserver b/projects/atlanti/bin/atlserver new file mode 100755 index 00000000..5e43e32d --- /dev/null +++ b/projects/atlanti/bin/atlserver @@ -0,0 +1,4 @@ +#!/bin/sh + +bindir=`dirname $0` +$bindir/runjava com.threerings.micasa.server.MiCasaServer $* diff --git a/projects/atlanti/bin/runjava b/projects/atlanti/bin/runjava new file mode 100755 index 00000000..cb3d148e --- /dev/null +++ b/projects/atlanti/bin/runjava @@ -0,0 +1,95 @@ +#!/usr/bin/perl -w +# +# $Id: runjava,v 1.1 2001/10/09 20:27:35 mdb Exp $ +# +# Invokes java with the necessary classpath and parameters. + +use Getopt::Std; + +my $usage = "Usage: $0 [-p pid_file] [-r server_root] args\n"; + +# locations of stuff +chomp($location = `dirname $0`); + +# get the server root by popping the /bin off of our parent directory +@parts = split(/\//, $location); +pop(@parts); +my $root = join("/", @parts); + +# make sure JAVA_HOME is set +my $jhome = $ENV{"JAVA_HOME"}; +if (!defined $jhome) { + warn "$0: Error: No JAVA_HOME specified!\n"; + warn "\n"; + warn "You must set your JAVA_HOME environment variable to the\n"; + warn "the absolute path of your JDK installation. For example:\n"; + warn "\n"; + warn " % JAVA_HOME=/usr/local/jdk1.2\n"; + warn " % export JAVA_HOME\n"; + die "\n"; +} + +# make sure it's set to a directory +if (! -d $jhome) { + die "$0: Can't find a java interpreter in '$jhome'.\n"; +} + +my $java = "$jhome/bin/java"; +my $jlib = "$jhome/lib/classes.zip"; + +# determine our machine architecture +my $ostype = `uname -s`; +my $machtype = `uname -m`; +chomp($ostype); +chomp($machtype); +my $arch = "$machtype-$ostype"; + +# add our native libraries to the runtime library path +my $libs = "$root/lib/$arch"; +my $libpath = $ENV{"LD_LIBRARY_PATH"}; + +if (defined $libpath) { + $ENV{"LD_LIBRARY_PATH"} = "$libs:$libpath"; +} else { + $ENV{"LD_LIBRARY_PATH"} = $libs; +} + +# put everything in our class path +my $classpath = "-classpath $jlib:$root/dist/classes"; + +# any zip or jar files in our lib/ directory get added to the class path +if (opendir(DIR, "$root/lib")) { + foreach $lib (grep { /.(zip|jar)/ && -f "$root/lib/$_" } readdir(DIR)) { + $classpath .= ":$root/lib/$lib"; + } + closedir DIR; +} + +my $pid_file = undef; +my $i = 0; + +# strip out the args (we'd use getopt() but the damned thing provides no +# way of escaping arguments so that we can pass args to runjava that get +# passed down to the JVM) +for ($i = 0; $i < @ARGV; $i++) { + my $arg = $ARGV[$i]; + + # stop when we see -- (and strip it out because Java don't dig --) + if ($arg eq "--") { + splice(@ARGV, $i, 1); + last; + } + + if ($arg eq "-p") { + $pid_file = $ARGV[$i+1]; + splice(@ARGV, $i, 2); + $i -= 1; # decrement i so that things stay in sync + } +} + +# log the pid file if requested to do so +print `echo $$ > $pid_file` if (defined $pid_file); + +my $cmd = "$java $classpath " . join(" ", @ARGV); +# print "$cmd\n"; +exec($cmd); diff --git a/projects/atlanti/build.xml b/projects/atlanti/build.xml new file mode 100644 index 00000000..c1efeecd --- /dev/null +++ b/projects/atlanti/build.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/atlanti/lib/.cvsignore b/projects/atlanti/lib/.cvsignore new file mode 100644 index 00000000..0f2dd2af --- /dev/null +++ b/projects/atlanti/lib/.cvsignore @@ -0,0 +1 @@ +i686-Linux diff --git a/projects/atlanti/lib/README b/projects/atlanti/lib/README new file mode 100644 index 00000000..35f65eb7 --- /dev/null +++ b/projects/atlanti/lib/README @@ -0,0 +1,46 @@ +Required external libraries +--------------------------- + +The Venison code requires the following external Java libraries (JAR +files) to be placed (or symlinked) here in the lib/ directory or in the +shared library directory specified in the build.xml file +(${java.libraries}). + +* Apache Commons Util library (from the sanbox) + http://jakarta.apache.org/commons/index.html + +* The samskivert package: + http://www.waywardgeeks.org/code/samskivert/ + +* MM MySQL driver: + http://mmmysql.sourceforge.net/ + +* Matt Welsh's Non-blocking IO library: + http://www.cs.berkeley.edu/~mdw/proj/java-nbio/ + + (The native code shared library should be built and placed into + lib/i686-Linux where it will be automatically added to LD_LIBRARY_PATH + by the runjava script. Alternatively you can put it into your + LD_LIBRARY_PATH by hand.) + +* The Java API for XML Processing (JAXP) 1.1 Reference Implementation: + http://java.sun.com/xml/download.html + + (Only crimson.jar and jaxp.jar are required. xalan.jar may safely + be excluded.) + +* Megginson Technologies' XMLWriter 0.2 library: + http://www.megginson.com/Software/xml-writer-0.2.zip + +* The ? game development platform + http://www.threerings.net/code/?/ + +* The MiCasa game hosting service + http://www.threerings.net/code/micasa/ + +Once the jar files are in place (regardless of what they are named), the +build system will automatically include them in the compile-time +classpath. + +-- +$Id: README,v 1.1 2001/10/09 20:27:35 mdb Exp $ diff --git a/projects/atlanti/rsrc/config/atlanti/dbmap.properties b/projects/atlanti/rsrc/config/atlanti/dbmap.properties new file mode 100644 index 00000000..c39d793c --- /dev/null +++ b/projects/atlanti/rsrc/config/atlanti/dbmap.properties @@ -0,0 +1,13 @@ +# +# $Id: dbmap.properties,v 1.1 2001/10/09 20:27:35 mdb Exp $ +# +# This provides information on the JDBC connections that are used by +# Venison server services. + +# +# The database mapping for the user database. +# +userdb.driver = org.gjt.mm.mysql.Driver +userdb.url = jdbc:mysql://depravity:3306/usermgmt +userdb.username = www +userdb.password = Il0ve2PL@Y diff --git a/projects/atlanti/rsrc/config/atlanti/server.properties b/projects/atlanti/rsrc/config/atlanti/server.properties new file mode 100644 index 00000000..d7e76de4 --- /dev/null +++ b/projects/atlanti/rsrc/config/atlanti/server.properties @@ -0,0 +1,4 @@ +# +# $Id: server.properties,v 1.1 2001/10/09 20:27:35 mdb Exp $ +# +# Configuration for the Venison server diff --git a/projects/atlanti/rsrc/config/micasa/server.properties b/projects/atlanti/rsrc/config/micasa/server.properties new file mode 100644 index 00000000..69adf716 --- /dev/null +++ b/projects/atlanti/rsrc/config/micasa/server.properties @@ -0,0 +1,17 @@ +# +# $Id: server.properties,v 1.1 2001/10/09 20:27:35 mdb Exp $ +# +# Configuration for the MiCasa server + +# +# The list of lobby identifiers to be loaded into this server. +# +lobby_ids = venison + +# +# The cofiguration for the test lobby. +# +venison.config = com.threerings.micasa.lobby.LobbyConfig +venison.ugi = venison,board,tile,strategy +venison.name = Venison Lobby +venison.game_config = com.threerings.venison.VenisonConfig diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/Log.java b/projects/atlanti/src/java/com/samskivert/atlanti/Log.java index f4f70d3a..9fd1c93e 100644 --- a/projects/atlanti/src/java/com/samskivert/atlanti/Log.java +++ b/projects/atlanti/src/java/com/samskivert/atlanti/Log.java @@ -1,7 +1,7 @@ // -// $Id: Log.java,v 1.1 2001/10/03 18:32:28 mdb Exp $ +// $Id: Log.java,v 1.2 2001/10/09 20:27:35 mdb Exp $ -package org.waywardgeeks; +package com.threerings.venison; /** * A placeholder class that contains a reference to the log object used by @@ -14,7 +14,7 @@ package org.waywardgeeks; * generate log messages. For example: * *
- * import org.waywardgeeks.venison.Log;
+ * import com.threerings.venison.Log;
  * // ...
  * Log.warning("All hell is breaking loose!");
  * // ...
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiController.java b/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiController.java
new file mode 100644
index 00000000..f2d3eaee
--- /dev/null
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiController.java
@@ -0,0 +1,27 @@
+//
+// $Id
+
+package com.threerings.venison;
+
+import com.threerings.cocktail.party.client.PlaceView;
+import com.threerings.parlor.client.GameController;
+import com.threerings.parlor.util.ParlorContext;
+
+import com.threerings.venison.Log;
+
+/**
+ * The main coordinator of user interface activities on the client-side of
+ * the Venison game.
+ */
+public class VenisonController extends GameController
+{
+    protected PlaceView createPlaceView ()
+    {
+        return new VenisonPanel(_ctx);
+    }
+
+    protected void gameDidStart ()
+    {
+        Log.info("Venison game did start.");
+    }
+}
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiPanel.java b/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiPanel.java
new file mode 100644
index 00000000..b84f498d
--- /dev/null
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/client/AtlantiPanel.java
@@ -0,0 +1,39 @@
+//
+// $Id
+
+package com.threerings.venison;
+
+import java.awt.BorderLayout;
+import javax.swing.*;
+
+import com.threerings.cocktail.party.data.PlaceObject;
+import com.threerings.cocktail.party.client.PlaceView;
+
+import com.threerings.parlor.util.ParlorContext;
+
+/**
+ * The top-level user interface component for the Venison game display.
+ */
+public class VenisonPanel
+    extends JPanel implements PlaceView
+{
+    /**
+     * Constructs a new Venison game display.
+     */
+    public VenisonPanel (ParlorContext ctx)
+    {
+        add(new JLabel("Venison panel"), BorderLayout.CENTER);
+    }
+
+    // documentation inherited
+    public void willEnterPlace (PlaceObject plobj)
+    {
+        Log.info("Panel entered place.");
+    }
+
+    // documentation inherited
+    public void didLeavePlace (PlaceObject plobj)
+    {
+        Log.info("Panel left place.");
+    }
+}
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiConfig.java b/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiConfig.java
new file mode 100644
index 00000000..2781e285
--- /dev/null
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiConfig.java
@@ -0,0 +1,19 @@
+//
+// $Id: AtlantiConfig.java,v 1.1 2001/10/09 20:27:35 mdb Exp $
+
+package com.threerings.venison;
+
+import com.threerings.parlor.data.GameConfig;
+
+public class VenisonConfig extends GameConfig
+{
+    public Class getControllerClass ()
+    {
+        return VenisonController.class;
+    }
+
+    public String getManagerClassName ()
+    {
+        return "com.threerings.venison.VenisonManager";
+    }
+}
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiObject.java b/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiObject.java
new file mode 100644
index 00000000..5ab6bb70
--- /dev/null
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/data/AtlantiObject.java
@@ -0,0 +1,13 @@
+//
+// $Id: AtlantiObject.java,v 1.1 2001/10/09 20:27:35 mdb Exp $
+
+package com.threerings.venison;
+
+import com.threerings.parlor.data.GameObject;
+
+/**
+ * The distributed object used to maintain state for the Venison game.
+ */
+public class VenisonObject extends GameObject
+{
+}
diff --git a/projects/atlanti/src/java/com/samskivert/atlanti/server/AtlantiManager.java b/projects/atlanti/src/java/com/samskivert/atlanti/server/AtlantiManager.java
new file mode 100644
index 00000000..566ba8a8
--- /dev/null
+++ b/projects/atlanti/src/java/com/samskivert/atlanti/server/AtlantiManager.java
@@ -0,0 +1,18 @@
+//
+// $Id: AtlantiManager.java,v 1.1 2001/10/09 20:27:35 mdb Exp $
+
+package com.threerings.venison;
+
+import com.threerings.parlor.server.GameManager;
+
+/**
+ * The main coordinator of the Venison game on the server side.
+ */
+public class VenisonManager extends GameManager
+{
+    // documentation inherited
+    protected Class getPlaceObjectClass ()
+    {
+        return VenisonObject.class;
+    }
+}