java的网络版坦克大战游戏的设计与实现

1本次设计旨在运用Java语言开发一款网络版的坦克大战,该游戏能让用户通过网络联合其他玩家一起参与游戏,共同对抗随机产生的电脑坦克。本设计主要运用了Java中的图形界面、Socket、线程、双缓冲、面向对象设计等技术,模拟实现了玩家可通过键盘控制我方坦克的移动与射击,子弹的发射与爆炸等功能。并且,整个游戏界面绘制了普通墙、金刚墙、森林、河流等障碍物,还为我方坦克增加了保护基地的任务,同时用户和战友的剩余血量会实时显示在界面上,使得双方之间的联合作战既有合作又有竞争。设计还运用了JDBC技术与MySQL数据库建立了连接,当玩家中途退出时保存游戏的进度以供玩家下次继续玩,并且玩家可以通过数据库改变游戏画面。整个游戏具有良好的互动性。
目录
Abstract 1
Key words 1
引言 1
1 综述 2
1.1 国内外研究现状 2
1.2 开发本游戏的意义 2
2 系统开发所用技术介绍 2
2.1 Java语言的特点 2
2.2 Eclipse的特点 3
2.3 网络通信 3
2.3.1 网络消息的传输 3
2.3.2 多线程的运用 3
2.4 图像编程与双缓冲技术 4
2.5 事件响应 4
2.6 碰撞检测 4
2.7 Java连接数据库 5
3 系统分析 5
3.1 可行性分析 5
3.2 系统运行环境 6
3.2.1 系统运行的软件环境 6
3.2.2 系统运行的硬件环境 6
3.3 系统用例分析 6
3.3.1 系统用例图 6
3.3.2 系统活动图 7
4 系统设计 8
4.1 游戏规则和系统总体功能介绍 8
4.2 主要类的设计 8
4.2.1主窗体TankWar类的设计 8
4.2.2 网络线程NetThread类的设计 9
4.2.3 炮弹Missile类的设计 9
4.2.4 Tank类的设计 10 *好棒文|www.hbsrm.com +Q: #351916072# 

4.3 系统数据库设计 11
5 系统实现 11
5.1游戏主窗体实现 11
5.2 其他功能的实现效果 13
5.2.1 登陆注册功能 13
5.2.2 游戏结束情况 14
6 总结 16
致谢 16
参考文献 16
基于Java的网络版坦克大战游戏的设计与实现
计算机科学与技术专业学生 赵南
指导教师 薛卫
The design and realization of network version tank war based on Java
Student majoring in computer science and technology Zhao Nan
Tutor Xue Wei
Abstract: This design is aimed at using Java language to develop a online tank war, the game can let users through the network jointly participate in games with other players, against the randomly generated computer tank together. This design mainly make use of Java graphical interface, Socket, threads, double buffer, objectoriented design technology and so on, doing simulation and realizing the players through the keyboard to control the movement and shooting of our tanks, the launch and explosions of the bullets , and other functions.And the whole game interface draws the barriers of ordinary wall, wall of King Kong, forests, rivers and other objects, increasing the protection base task for our tanks, at the same time the remaining volume of user and comrade in arms will be displayed on the screen in real time,making joint operations between the two parties have both cooperation and competition. The design also uses the JDBC technology to establish a connection with the MySQL database,the system will save the progress of the game when a player drop out of the game ,for the player to continue playing on the go next time,and the player can change the game screen via the database.The whole game has a good interactive.
Key words: Java;Tank War;Eclipse;Game
引言:现代社会人们对精神生活的需求急速增长,游戏已经成为人们满足精神生活的重要方式之一,而要从精品云集的FC游戏中找一款经典之作,《坦克大战》绝对是FC上所有经典中的经典,在游戏中玩家可控制自己的坦克进行移动和射击,以保护基地为前提,歼灭敌方坦克为胜利目标。每个关卡的地形不同,玩家可利用各种地形对敌人进行打击,并会得到补给[1]。而JAVA语言是当今最为流行的程序设计语言之一,作为非常优秀和极为健壮的编程语言,它同时有面向对象,与平台无关,分布式应用,安全,稳定和多线程等优良的特征,使用JAVA语言,不仅可以开发出功能强大的大型应用程序,而且JAVA语言本身突出的跨平台的特性也使得它特别适合于Internet上的应用开发[2],因此本次设计选择了运用Java语言设计实现一款小型局域网休闲游戏坦克大战。
1 综述
1.1 国内外研究现状
《坦克大战》(Battle City)是1985年日本南梦宫NAMCO游戏公司在任天堂FC平台上推出的一款多方位平面射击游戏,从诞生至今已有30年的历史了,游戏以坦克战斗及保卫基地为主题,属于策略型联机类。目前坦克大战已经发展出了很多版本,从最初的红白游戏机到现在的网络游戏,从最开始只支持双人游戏到现在支持多人网络对战,从当初的平面2D到现在的立体3D游戏,坦克大战趋势是网络化,立体化和多样化。同时坦克大战是FC平台上少有的内建关卡编辑器的几个游戏之一,玩家可自己创建独特的关卡,并通过获取一些道具使坦克和基地得到强化,不仅有单机版、网络版、苹果版、安卓版等众多版本,还有坦克营、坦克军团、导弹坦克、3D重制版突击坦克等多种系列和游戏模式,现今可以移植入所有电脑和手机系统。其中衍生出的《坦克大战online》是一款由经典FC坦克大战改编的全民休闲对战网游,支持数万人同时在线。随着玩家的需求,用户的体验,添入新功能的新版本不断呈现出来。无论是在娱乐性还是经济性,这款游戏都显现着良好的发展态势。

版权保护: 本文由 hbsrm.com编辑,转载请保留链接: www.hbsrm.com/jsj/jsjkxyjs/1935.html

好棒文