Visit Our Project Home Page

Posts Tagged ‘issues’

Changes

Sunday, May 25th, 2008

I worked for a long time today trying to get the database to be able to be on a computer other than redpanda, and partially succeeded.

The conversations.Database class now keeps track of a serverAddress string that indicates, as expected, the location of the server. This is set by a static Database.setServerAddress(String) method that gets called about as soon as you start the client or server, in the FrontClient and NetworkBetterServer constructors. (Although I don’t think the server ever actually uses it - explained later.)

We have mysterious duplicate methods in the Database class, which take an extra unused parameter (boolean onServer) to distinguish between them. I’m guessing this from when we were having weird problems where we couldn’t access the database when we were running a client on redpanda itself. Currently, the methods without the ‘onserver’ parameter use the following url:

"jdbc:mysql://"+serverAddress+":3306/game_dev?user=game_client&password=###"

while the server methods access:

"jdbc:mysql://localhost/game_dev?user=game_client&password=###"

(Previously, the server methods had used the root user to connect to the database.)

I played around with mysql and discovered a few things:

  • using the command GRANT ALL ON db.* TO 'user'; is a synonym for ‘user’@'%’ where % is a wildcard.
  • for some reason, granting permissions to ‘user’@'%’ doesn’t give them permissions for accessing the database locally
  • isntead, you should grant permissions to ‘user’@'localhost’
  • and you can grant permissions to “multiple” users with the same username but different hosts

So, I ran the following commands on the mysql server on my own computer:

GRANT ALL ON game_dev.* TO 'game_client' IDENTIFIED BY '###';
GRANT ALL ON game_dev.* TO 'game_client'@'localhost' IDENTIFIED BY '###';

After doing this, I was able to spawn, pickup, etc, items in the game, when running both client and server on my own computer. However, now when I try to connect to a server running on redpanda, an exception is thrown on the server side when creating an item because the database is not accessible. I ran both of those commands on redpanda also, and checking the user table in the mysql database indicates that game_client has access from the right hosts. (Try using the mysql database and running SELECT User,Host FROM user)

I looked at the user table on redpanda before doing the hosts thing, and it didn’t look like the hosts were correct, so I’m assuming that may have been our problem before….? Anyway, I’ll probably look at it some more tomorrow. :-/

Also, I updated the game/schema/schema.sql to reflect the change we’d made to the database for keeping track of item sizes when picked up, and also put those GRANT commands at the bottom of it, so if you are wanting to set up the database on another computer, it should be sufficient to run:

mysql -u root -p < schema.sql
mysql -u root -p game_dev < test.sql

But don’t quote me on that.  :P

Java Web Start

Saturday, May 3rd, 2008

So I’ve been thinking that it would be really cool if we could get our game (or even just a demo) to run from our website with Java Web Start.

I wrote a webstart test, that you can run from the server by clicking this link:

/jws/test.jnlp

I jar’d the game and added the necessary webstart stuff, but I wasn’t in the math lounge so I couldn’t actually connect. We need to see if we can get IT to forward the necessary ports to run our game from off campus. (Also, I wonder if that’s related to the problem I posted about previously?) You can try running the game through webstart with the following link, but it takes a few minutes to download the jar file and then all you actually get to see it the login box, but if you want to check it out, go ahead.

/jws/game.jnlp

I found another 3D MMORPG that runs via Java Web Start - Wurm Online. I checked it out, and it’s kind of neat. I didn’t play it for very long, but I think it’s cool that it uses JWS, and it looks relatively mature. If you’re planning on giving it a go, you need to register for an account on the site first. And it takes a while to download the first time.

Unknown error….

Thursday, May 1st, 2008

I’m in the Cove, and can secure shell directly into redpanda, so I assumed I’d be able to run the game from here, but when I tried I got this error, before anything in the game actually loaded:

java.lang.NoSuchMethodError: method sun.misc.Service.providers with signature (Ljava.lang.Class;)Ljava.ut
il.Iterator; was not found.
at com.jme.system.DisplaySystem.getSystemProviderMap(Unknown Source)
at com.jme.system.DisplaySystem.getCachedSystemProvider(Unknown Source)
at com.jme.system.DisplaySystem.getDisplaySystem(Unknown Source)
at game.BetterGame.initSystem(BetterGame.java:116)
at com.jme.app.BaseGame.start(Unknown Source)
at game.NetworkBetterGame.notAMainMethod(NetworkBetterGame.java:104)
at game.FrontClient$2.run(FrontClient.java:87)

Has anyone encountered this before? I don’t even know what it means.

House of Mouse

Thursday, April 24th, 2008

After much frustration, I’ve finally fixed the bug with the cursor color not being updated. (Actually reading the update method helped a great deal.) Reintroducing myself to ClickManager has made me wonder if we’re approaching the translation of Wickets in the right way. We refer to our current system as “drag and drop,” but the fact that the Wicket does not remain under the cursor as long as the mouse button is held down means that we have more of a “cattle prod” interface: if it’s not doing what you want, just poke it in the direction you want it to go. Implementing a true drag and drop is well beyond my knowledge of linear algebra, but I think we could alter our current system to achieve an effect similar to a true drag and drop.

(more…)

Four Issues and Bags of Julios

Tuesday, April 22nd, 2008

Whoever fixes these problems wins a bag of Julio’s. (I’m serious.) None of these are trivial:

1) When you join two objects then rotate the parent, the child becomes impossible to control. When you drag it one way, it moves in another direction. My best guess is that we can fix this by modifying RelationalMovable or Wicket or ClickManager or wherever we implement our drag-and-drop these days. Moving a Wicket should take into account the local translation of its parent.

2) Parent/Child relationships are preserved as long as the server is running. But when you kill the server, problems arrise. I think register recursively needs to be adjusted. And possibly Wicket needs to save its name and its parent’s name; but I think this is probably already the case (because Wicket extends Node, which surely saves its own name.) So this might be as simple as sending the right parent name in the SynchronizeCreateCommonMessage that we create for each Wicket we load. However, if we have to worry about the order that messages are received on the client, then we might have trouble. For example, what if a client gets a message to create a child before it has created the parent? It will try to set the child’s parent to a Wicket that doesn’t exist yet. Should it wait around in its own thread until the parent has been created? We’ll have to see if things start breaking.

3) We can join Wickets, but we can’t unjoin them. This won’t be hard, I think. We can just have a key (like “U”), which loops through all of the selected Wicket’s children and sets their parents to be the sceneNode. But these changes must, of course, be reflected on the Server and other clients. So sending the proper messages is important. It’s possible that you can use existing method in Wicket — setParentWithName(String name) — for changing the parent based on a name string. The only problem is that, at the moment, the sceneNode’s name is null. NOTE: I think I might have left a field in SynchronizeCommonMessage called parentName. Don’t use it. It doesn’t do anything. All name setting is based on using the setId() method in Wicket (to which you pass a SynchronizeMessage’s syncObjectId.)

4) The thing that’s frustrating me most right now is that sometimes (but not all the time), if you log onto the server and create an object, all will SEEM well; but it really isn’t…

The server outputs something like “registering object with id = 2.” But then, whenver you try to move the object you’ve made, the server will continually spit out “Unable to find object 2 on server.” So it seems like it didn’t really register it in the SynchronizationManager.

I have no idea why this happens. But I have one clue: I played around with the call to hasDuplicate() in CommonObjectSynchronizationManager; and when I removed it, the problem (as far as I could tell) disappeared. It was, however, replaced by a problem involving duplicate Wickets appearing in the game — which is the same problem that motivated us to make the hasDuplicate() method in the first place. It keeps duplicate SyncWrappers from getting into the active queue in CommonObjectSynchronizationManager. So maybe it’s being too zealous and keeping SyncWrappers out when it should be letting them in?

Initialization of Parent/Child Relationships

Tuesday, April 22nd, 2008

I wrote a simple in-game interface for linking objects.

Directions: Click object A, press “J”, and then click object B.  Object A will become the parent of object B.

When this occurs, you can move the parent; and the child will follow.  Also, rotating the parent causes the child to rotate around the parent (in an orbital fashion.)  Also, scaling the parent will cause the child to scale.

Problems: If you rotate the parent then try to translate the child, you will have a fun, fun time trying to get it to behave.  Try it if you don’t believe me.  Or look at my comment to Tommy’s most recent post if you want to spoil the surprise.

Updates

Sunday, April 20th, 2008

A couple of things –

Model Linking:

Stephen and I managed to write a proof of concept for linking models. We modified the FrontClient to create a Tree and attach a Die and Castle to it, which makes changing the scale / location / rotation of the tree changes the Die and Castle also, but the Die and Castle can be moved independently. I didn’t commit the FrontClient change, though, because it causes those models to be created where you start every time you log in, which clutters things quickly. I will (sometime soon) move those changes into a spikesAndTests.LinkingSpike class or something.

When moving the parent Wicket, all wickets independently move along the terrain. This is accomplished with some simple linear algebra in the Terrain.relocateOnSurface() method.

What remains to be done is: creating special messages for preserving the hierarchy of Nodes / Wickets in the scene graph and creating some sort of user interface for managing child / parent relationships in-game. This may be all there is to it!

Chat Client:

I added some code to the game.chat.ChatClient and game.Player classes to make the chat window display the name of the player who sent the message. This is done with a call to the static method Player.getNameFromId() which, intuitively enough, queries the database to find the name of a player based on their id.

The only two players in the database right now are Enoby (id=1) and Foucault (id=2), and if you try to start a FrontClient with any other id, it will crash, which is probably not desirable behaviour, but I haven’t taken care of that yet.

I also made the chat box closable, which is a temporary fix for the very obtrusive window. I think an easily hide-able (maybe with a hotkey) window along the bottom of the screen is in order. Thoughts?

Login Box:

I changed some code in the game.gui.LoginBox class, so now clicking on “login” from that window will not crash when it tries to start the game! I did this by placing the call to FrontClient.main() in its own thread before disposing of the swing window. Right now, the login box still starts a FrontClient with player_id=1 and port=8798, but I think it will now be a trivial matter to get the player name field to intelligently pick the correct id number. I’ll have to rework some of the GUI, but I intend to put a “new player” button on there, too, which won’t be hard to implement.

I’m not sure how we want to go about populating the drop-down box of server / port choices. Ideally, there would be some way redpanda could keep track of what ports were running instances of the game and it could let connecting clients know, but I don’t know if that’s possible (or at least not very difficult). Maybe for now a text file on redpanda that we keep relatively updated with what ports are active? We could populate the combo box with the names of the servers’ save files for a friendlier interface.

I don’t know how we want to do passwords. It would be really easy for us to just add a field in the database and an if / string.equals() statement in the LoginBox class, but that would be really insecure. Though I don’t know how important security actually is, especially at this stage.

So that’s that!

EDIT: It turns out that children of Wickets don’t move along the terrain properly if the parent Wicket is scaled. I’m not sure if this means that when the parent is scaled, the child object’s origin is moved in an unusual way, or what, but this could be quite frustrating…

Screenshots

Friday, April 18th, 2008

There are two new ones! Also there should be icons for the inventory in the game, so maybe there will be new videos?? Which, by the way, Heather and Kaitlyn said didn’t work on their computers, so I don’t know what’s going on with that.

Error on server while trying to build with ‘ant’

Wednesday, April 16th, 2008

Ummm… Does anyone know why we have suddenly lost the ability to build with ant on Redpanda?

Here’s the error:

/usr/bin/build-classpath: error: Could not find xml-commons-apis Java extension for this JVM
/usr/bin/build-classpath: error: Some specified jars were not found
java-gcj-compat: tools.jar: failed to read /usr/share/java/eclipse-ecj.jar
java-gcj-compat: tools.jar: failed to load org.eclipse.jdt.internal.compiler.batch.Main
java.lang.ClassNotFoundException: org.eclipse.jdt.internal.compiler.batch.Main not found in java.net.URLClassLoader{urls=[file:/usr/share/java/eclipse-ecj.jar], parent=gnu.gcj.runtime.SystemClassLoader{urls=[file:/usr/share/java/ant.jar,file:/usr/share/java/ant-launcher.jar,file:/usr/share/java/jaxp_parser_impl.jar,file:/usr/lib/jvm/java/lib/tools.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}}
at java.net.URLClassLoader.findClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at com.sun.tools.javac.Main.<clinit>(Main.java:80)
at java.lang.Class.initializeClass(libgcj.so.7rh)
at java.lang.Class.forName(libgcj.so.7rh)
at org.apache.tools.ant.launch.Locator.getToolsJar(ant-launcher-1.6.5.jar.so)
at org.apache.tools.ant.launch.Launcher.run(ant-launcher-1.6.5.jar.so)
at org.apache.tools.ant.launch.Launcher.main(ant-launcher-1.6.5.jar.so)
java.lang.ExceptionInInitializerError
at java.lang.Class.initializeClass(libgcj.so.7rh)
at java.lang.Class.forName(libgcj.so.7rh)
at org.apache.tools.ant.launch.Locator.getToolsJar(ant-launcher-1.6.5.jar.so)
at org.apache.tools.ant.launch.Launcher.run(ant-launcher-1.6.5.jar.so)
at org.apache.tools.ant.launch.Launcher.main(ant-launcher-1.6.5.jar.so)
Caused by: java.lang.NullPointerException
at com.sun.tools.javac.Main.<clinit>(Main.java:95)
at java.lang.Class.initializeClass(libgcj.so.7rh)
…4 more

Login Box

Monday, April 14th, 2008

I began creation of a login box, painstakingly positioning the pieces in their proper places, which NetBeans made rather difficult, but I prevailed! Though when we decide we need to add more components to it (as we inevitably will), I will have to do go through the process again.

[ A screen shot and some problems after the jump. ]

(more…)