Visit Our Project Home Page

Archive for the ‘Programming’ Category

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.

inventory item resize problem..solved!

Sunday, April 27th, 2008

Previously when re-sized Items were picked up and placed in the inventory the size was not saved. When the same Item was placed back into the world from the inventory it would create a new Item with the same name but with the original size. We were able to keep the re-sized dimensions and place them into the mysql database and when the Item was placed back into the world it takes the information from mysql and apply them to the Item.

Rudimentary AI framework

Friday, April 25th, 2008

Stephen and I have designed a basic framework for giving models in our game the ability to act for themselves! This code can be found in the new game.ai package in the repository, and in the spikesAndTests package. If you want to check out an awesome die moving all on its own, run

java -Djava.library.path=../project/lib spikesAndTests.AISpike 3 9999

or with whatever parameters are relevant. (HINT! try rotating the die while it’s moving around.)

What has yet to be done is integrating the BrainManager (don’t laugh!) into our main code base and creating a wonderful user interface for assigning Wills to Brainables.

I will not rest until the Julios tag becomes our most prominent

Friday, April 25th, 2008

I’ve implemented the pseudo-drag and quasi-drop mentioned in my last update, and as an added bonus, compensated for parental rotation when moving objects (Julio’s Bounty 1.) Until I can figure out how Quaternions work, it’s implemented manually by taking the parent’s rotation around the y-axis and rotating the delta-translation of the child by the opposite of that amount. (Maybe Quaternion.inverse() will have the same effect?)

The ClickManagers probably need a little refactoring. I’ll see about that this weekend.

It’s Flyspray…You put bugs in it!

Friday, April 25th, 2008

I have added a bug tracker to our wonderful set of web applications.

You can find it here.

Create an account for yourself and start adding bugs!

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…)

I’m buying myself 2 bags of Julios

Wednesday, April 23rd, 2008

I fixed issue 2 and issue 4, which I mentioned in my previous post.

Also, I fixed a random bug that made every model into an item after the server was restarted — the opposite of the problem we had with items turning into models.

Issues 1 and 3 still have a Julios bounty on their heads.

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?