<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Some reminiscences, some memories &#187; MMO</title>
	<atom:link href="http://www.mikespook.com/index.php/tag/mmo/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mikespook.com</link>
	<description>Just another boring day</description>
	<lastBuildDate>Tue, 10 Jan 2012 03:14:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>在 Netbeans 6.5 中运行和调试基于 Darkstar 的服务器程序</title>
		<link>http://www.mikespook.com/2008/12/%e5%9c%a8-netbeans-65-%e4%b8%ad%e8%bf%90%e8%a1%8c%e5%92%8c%e8%b0%83%e8%af%95%e5%9f%ba%e4%ba%8e-darkstar-%e7%9a%84%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%a8%8b%e5%ba%8f/</link>
		<comments>http://www.mikespook.com/2008/12/%e5%9c%a8-netbeans-65-%e4%b8%ad%e8%bf%90%e8%a1%8c%e5%92%8c%e8%b0%83%e8%af%95%e5%9f%ba%e4%ba%8e-darkstar-%e7%9a%84%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%a8%8b%e5%ba%8f/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 08:43:45 +0000</pubDate>
		<dc:creator>mikespook</dc:creator>
				<category><![CDATA[NetBeans]]></category>
		<category><![CDATA[Darkstar]]></category>
		<category><![CDATA[MMO]]></category>
		<category><![CDATA[Web game]]></category>
		<category><![CDATA[设置]]></category>

		<guid isPermaLink="false">http://www.mikespook.com/?p=247</guid>
		<description><![CDATA[<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>
Web game 一直以来被大家认为是开发技术门槛低，推广容易的一种游戏形式。但是在我1年来开发 web game 积累下来的经验来看，没有服务器端的 web game 只能被当作玩具，而不是一个可以运营的游戏（当然关于 Web game 技术考量关于这个话题，是我可能要写的另外一篇文章了）。为了这个目的，最近特意研究了一下 Darkstar。

Darkstar 是 SUN 公司支持的一个开源的多人在线游戏（MMO）架构，它提供了任务、数据、信道以及会话管理等一系列的功能。使得开发人员可以更加专注的设计开发游戏相关逻辑，而不是服务器基本功能设计或负载调优等等重复的体力活。关于 Darkstar 的详细介绍，可能要写 N 篇文章来说明。先有个大概了解就好了。

<span class="readmore"><a href="http://www.mikespook.com/2008/12/%e5%9c%a8-netbeans-65-%e4%b8%ad%e8%bf%90%e8%a1%8c%e5%92%8c%e8%b0%83%e8%af%95%e5%9f%ba%e4%ba%8e-darkstar-%e7%9a%84%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%a8%8b%e5%ba%8f/" title="在 Netbeans 6.5 中运行和调试基于 Darkstar 的服务器程序">阅读全文——共1785字</a></span>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>
<p>Web game 一直以来被大家认为是开发技术门槛低，推广容易的一种游戏形式。但是在我1年来开发 web game 积累下来的经验来看，没有服务器端的 web game 只能被当作玩具，而不是一个可以运营的游戏（当然关于 Web game 技术考量关于这个话题，是我可能要写的另外一篇文章了）。为了这个目的，最近特意研究了一下 Darkstar。</p>
<p><a href="http://www.projectdarkstar.com/" target="_blank">Darkstar</a> 是 SUN 公司支持的一个开源的多人在线游戏（MMO）架构，它提供了任务、数据、信道以及会话管理等一系列的功能。使得开发人员可以更加专注的设计开发游戏相关逻辑，而不是服务器基本功能设计或负载调优等等重复的体力活。关于 Darkstar 的详细介绍，可能要写 N 篇文章来说明。先有个大概了解就好了。</p>
<p>基于 Darkstar 开发服务器端的时候，不需要自己写主类。只要按照 Darkstar 提供的标准实现如 AppListener 等等的接口，就可以将开发人员实现的相关功能加入 Darkstar 架构中执行。Darkstar 分别在 *nix 系统和 windows 系统提供了 sgs.sh 和 sgs.bat 两个脚本，以方便使用。</p>
<p><a href="http://www.netbeans.org/" target="_blank">Netbeans 6.5</a> 的发布，给沉闷的开发带来了一丝生气。即使是我那 512M 内存的运行 xubuntu 的笔记本，跑起 Netbeans 也如行云流水般流畅（Eclipse 的粉丝别砸我，Eclipse 我开都不敢开）。<span id="more-247"></span>我一般是使用 Netbeans 编写 java 代码，上网找了一下，netbeans 的一个 Darkstar 插件已经有一些时候没有更新了。这使得在 Netbeans 中开发 Darkstar 很不方便，不能直接运行，也不能调试。在研究了 sgs.sh 和 sgs.bat 之后发现，这两个脚本实际上只是设置了 java 命令的一些参数，使得 Darkstar 可以执行。那么将这些参数移入 Netbeans 就可以在其中直接运行和调试了（这篇<a href="http://www.projectdarkstar.com/component/option,com_smf/Itemid,120/topic,634.0" target="_blank">帖子</a>验证了这个想法）。</p>
<p>首先添加库的时候，除了设置类路径和 javadoc 外，还应将 sgs-server-0.9.7-sources.jar 设置到源中去，方便开发和调试。</p>
<p>然后在“项目属性”中找到“运行”，按照下表填写：</p>
<p>主类：com.sun.sgs.impl.kernel.Kernel</p>
<p>参数：foobar.properties</p>
<p>工作目录：F:\java\FoobarServer\data</p>
<p>VM 选项：-Djava.library.path=F:\java\libs\sgs\sgs-server-0.9.7\lib\bdb\win32-x86</p>
<p>其中<strong>主类</strong>是在项目导入的 sgs-server.jar 中的类。在任何环境下都只可以填写这个 Kernel 类。</p>
<p><strong>参数</strong>是项目的配置文件，这个文件一般有下面的内容：</p>
<p>com.sun.sgs.app.name=HelloFoobar<br />
com.sun.sgs.app.root=F:/java/FoobarServer/data/<br />
com.sun.sgs.app.port=1139<br />
com.sun.sgs.app.listener=com.xxiyy.game.server.FoobarServer</p>
<p>name 是项目名称。root 是项目根目录，跟目录必须含有子目录 dsdb，用来存储序列会对象数据。port 是服务器监听的端口。listener 即是实现 AppListener 接口的用户类了。需要注意的是，如果不是用绝对路径，properties 文件是相对于<strong>工作目录</strong>来说的。</p>
<p><strong>工作目录</strong>需要对应 properties 文件中的 root 选项。一定要注意，工作目录必须含有子目录 dsdb。否则运行的时候会提示无法找到路径的错误。</p>
<p><strong>VM 选项</strong>是因为 Darkstar 默认使用了Berkeley db，需要加载动态库文件。对于windows 就是 bdb 所带 win32-x86 目录中的 libdb_java45.dll。对于 32 位 linux 就是 linux-x86 目录中的 libdb-4.5.so 和 libdb_java-4.5.so。其他不同系统类推。如果你在运行后出现 java.lang.UnsatisfiedLinkError: no libdb_java45 in java.library.path 这样的异常，说明你的 java.library.path 没有设置正确。</p>
<p>确定后，就可以像普通 java 程序那样在 netbeans 中直接运行或调试 Darkstar 程序了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikespook.com/2008/12/%e5%9c%a8-netbeans-65-%e4%b8%ad%e8%bf%90%e8%a1%8c%e5%92%8c%e8%b0%83%e8%af%95%e5%9f%ba%e4%ba%8e-darkstar-%e7%9a%84%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%a8%8b%e5%ba%8f/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

