CmdrZin
01jun09
 

Plan 7

Fixing the Magic Map.
First, get the current project using the newly set up SVN project.
RMC my general game work folder and SVNCheckout...
  https://darkmud-redux.dev.java.net/svn/darkmud-redux/trunk/NetBeans/darkmudReduxNB
Startup NetBeans and use File->Open Project->darkmudReduxNB. Add distibution jar file to library if needed.
    sgs-server-0.9.9.jar, sgs-server-api-0.9.9.jar, and sgs-client.jar
Build project and check that there are no errors or warnings...all good.
RMC build folder (with ? on it) and use TortoiseSVN->Add to ignore list so it won't try to add it to the repository.
Do the same for the dist folder.
Copy darkmudReduxNB.jar from the dist folder into the sgs-server-dist-0.9.9\tutorial folder
Export (using SVN) the three files from the conf folder into the sgs-server-dist-0.9.9\tutorial\conf folder if they're not already there. (RMC conf, TortoiseSVN->Export->sgs-server-dist-0.9.9\tutorial) Yes to overwrite if asked.
Open a Command Prompt window and CD to the ...\sgs-server-dist-0.9.9 directory..launch server with
  java -jar bin/sgs-boot.jar tutorial/conf/darkmudReduxNB.boot
Lauch client by running darkmudReduxNB project from NetBeans....server up, client can log in, wander around the game..
Now to fix the Map.

In MudMain.properties, uncomment "item.map.class=com.sun.sgs.darkmud.map.WallMap" line to enable map.
Clear dsdb, then run server and look for error..getting a MangledObject / MangledReference error for a Channel...hmm...
looking through .map.Mapper code for Channel uses...
Try commenting out WallMap.java:25..call to Mapper.startMapping()..build and copy to try..hmm..no error on startup..
So, problem is with Mapper class...uncomment line 25..
try commenting out Mapper.java:66  & 68..hmm..no error..
Read ChannelManager.java comments...try creating a Channel then use getChannel(name) when going to use it..
Change Mapper.java:57
//  private Channel channel = null;
    private String channelName = null;
Change Mapper.java:67
//  Mapper mapper = new Mapper(channel);
    Mapper mapper = new Mapper(MAP_CHANNEL);
uncomment :70
Change Mapper.java:75
//  private Mapper(Channel channel) {
    private Mapper(String name) {
//      this.channel = channel;
        channelName = new String(name);
Add Mapper.java:94
    Channel channel = AppContext.getChannelManager().getChannel(channelName);
try it..doh..forgot to uncomment WallMap.java:25 to init Mapper...more working, but not complete..
Try using Mapper.MAP_CHANNEL for getChannel in Mapper instead of saved String.
got aClient error when trying "look map"..ReadOnlyBufferException..client.MapFrame.receivedMessage(:62)
ByteBuffer readonly..so need to copy message..
Change .client.MapFrame.java:62
//  byte[] b = message.array();
    byte[] b = new byte[message.capacity()];
    /* Looks strange, but it does copy the message into the array. */
    message.get(b);
WOO HOO..that did it..now a Map pops up when I use "look map"...
hmm..it seems to build a map from properties file and shows all players in the world..interesting..
I declare Plan 7 successful..updating SVN.
Excellent..now done with First phase of the project.