Framework
游戏框架为民间棋类爱好者而搭建。
Introduction
民间棋类游戏框架名(GODPAPER),项目代号名(The Real Knight).
From my perspective, a framework does several things:
it makes it easier to work with complex technologies;
it ties together a bunch of discrete objects/components into something more useful;
it forces the team (or just me) to implement code in a way that promotes consistent coding, fewer bugs, and more flexible applications everyone can easily test and debug the code, even code that they didn't write;
If I look at this list of vague framework requirements, I come up with a set of specific classifications that define a framework:
wrappers.A wrapper: simplifies an interface to a technology; reduces/eliminates repetitive tasks; increases application flexibility through abstraction; are often re-usable regardless of high level design considerations;
architectures. An architecture: manages a collection of discrete objects; implements a set of specific design elements;
methodologies. A methodology: enforces the adherence to a consistent design approach; decouples object dependencies; are often re-usable regardless application requirements;
Ref:http://www.codeproject.com/KB/architecture/WhatIsAFramework.aspx
Pass down the culture(民间游戏的传承)
在棋盘游戏框架下,游戏捐稿者,Flash游戏开发者,界面美工开发者,人工智能开发者,游戏插件开发者,相互促进发展。例如以下这些棋盘游戏都是在框架下实现的:
三马棋: https://www.mochimedia.com/games/play/_v317464
猫捉鼠棋: https://www.mochimedia.com/games/play/_v93665
四季棋: https://www.mochimedia.com/games/play/_v977037
二虎棋: https://www.mochimedia.com/games/play/_v687814
手工五行棋: https://www.mochimedia.com/games/play/_v776899
ColorLines: https://www.mochimedia.com/games/play/the-color-lines
三通棋: https://www.mochimedia.com/games/play/_v312167
小砖格棋: https://www.mochimedia.com/games/play/_v744572
六子棋: https://www.mochimedia.com/games/play/_v801648
中国象棋: https://www.mochimedia.com/games/play/_v331
Slogan
让民间棋类游戏在网络间重现光彩!
Draft Contributions
考虑注重实用性,文档捐稿者应对每种棋的棋类三要素——棋盘、棋子和棋规则给予文档介绍,并且安排插图和名词解释。
著作权协议Creative Commons,简称CC(知识共享)。是一个非营利组织,也是一种创作的授权方式。此组织的主要宗旨是增加创意作品的流通可及性,作为其他人据以创作及共享的基础,并寻找适当的法律以确保上述理念。传统的著作权通常为两种极端,一端是“保留所有权利”,另一端则是“不保留任何权利”(即公有领域,public domain)。知识共享则试图在两者中间广大的灰色地带保有弹性,使得创作者可以“保留部分权利”。知识共享提供多种可供选择的授权形式及条款组合,创作者可与大众分享创作,授予其他人再散布的权利,却又能保留其他某些权利。知识共享的诞生是为了避免现代知识产权以及版权法在信息共享方面的问题。该计划向版权持有人提供数种自由的版权协议,以应用于作者发表在网络上的内容。它同时也提供了描述协议的RDF/XML诠释资料,以利于电脑自动处理及定位。这些努力是为了反击支配了现代社会,而且拘束力日益增加的“权限文化”。这是传统出版者为了维持并加强其在流行音乐、大众电影的寡占,向社会大力推行的一种文化。
More:http://www.sloperama.com/advice/idea.htm
GODPAPER Roadmap
Current Releases
TheRealKnight 1.0.0
Work in progress...
- Good-Old-Fashioned-AI
- Uninformed Search
- Simulated evolution
- Simplicity of Flex application
- Mxml application
- Green thread
- Cross plant-form deployment
Future Releases
TheRealKnight 2.0
Work in planning...
- Strong AI
- Informed Search
- Knowledge Representation
- Evolutionary Computation
- Neural Networks I
- Intelligent Agents
Future areas of investigation, not scheduled yet.
- Neural Networks II
- Biologically Inspired
- Hybrid Models
Developer Contributions
Flash And Flex
Environment Requirement
Flex 4.1~4.6+ SDK
Operating systems
* Windows 7 (32 bit), Windows Vista (32 bit), Windows XP Professional with Service Pack 2 or 3 * Mac OS X v10.5.6–10.6 (Intel only) * Ubuntu 9.10 * Fedora Core 12
Java virtual machine
* Java™ Virtual Machine (32 bit), IBM® JRE 1.5, IBM JRE 1.6, Sun™ JRE 1.5, Sun JRE 1.6
Runtimes
* Flash Player 10.2+ * AIR 2.6+
Supported screen readers
* JAWS 11
Language versions
* Chinese Simplified * English * French * German * Japanese * Russian
Great common sense here. Wish Id tohguht of that.
Best practice
This guides are by no means final, or even 100% accurate. Read them with a bit of common sense.Actually the "Best practice" is follow the guide and keep practicing!
Note that these guides were created along with progress of Mediocre, some of the things mentioned have been replaced or changed in the later versions. I have included information about what version GODPAPER was in when the guide was written. To be sure to find source code that includes the things mentioned in the guide, see the corresponding version. If there is no information about version the information is either general or exists in all versions.
I mention this since the examples in the guides might look different from the source code, the 'best' version of everything is always in the latest version of GODPAPER however, so only using that might be the best idea.
As usual you may use whatever you wish in your program. Ideas, inspiration, code... A short acknowledgement if you find this useful is appreciated however.
Referals and acknowledgements from this wiki site can be found in the guides where applicable.
(Note: For now there is a bit of a problem with the game AI in the code examples)
Chapter 1: Introduction
A flash board game framework named GODPAPER(code name:”the real knight”) by as3 language. This wiki site is dedicated to all the unsung heroes of the world, those who the absence of which would degrade all our lives to the point where the sweet release of death would seem preferable to continuing this mortal existence. Ironically, the absence of those I refer to would all but guarantee this outcome! I of course refer here to the constants of the physical world:
G, the gravitational constant, whose vigilance secures us to this very world;
O, oops;
D,electric displacement field,also called the electric flux density;
P,kilogram meter per second (kg m/s);
A,area;
P,pascal (Pa);
E,the electric constant, which gives rise to the properties of the electromagnetic fields our technology depends upon;
R,Electrical resistance;
Chapter 2: Getting Started
Some useful information before you get started:
Classic board-games, i.e., two-player deterministic games with perfect information, have been submitted to intensive AI researched.
Modern board-games (also called ‘Eurogames’) are becomingmore andmore popular since their (re)birth in the 1990’s.The game SETTLERS OF CATAN can be considered an archetypical member of the genre.
Application to Classic Board-Games:
You now have a good idea of the tools involved in flash application development(such as flex/flash/as project,etc). Before you go ahead and take the plunge, the following sections discuss some useful information that can make your journey more pleasant.
Versions of Flash/Flex application:
Flex3:
Flex4:
Desktop Applications:
Mobile Application:
Summary:
- Download project template file here: http://code.google.com/p/godpaper/downloads/list
- Download solution library file here: http://code.google.com/p/godpaper/downloads/list
- Download action script documents here: http://code.google.com/p/godpaper/downloads/list
- Download "Mochi" plug-in library file here: https://github.com/downloads/yangboz/MochiPlugin/MochiPlugin_1.0.1.swc
Ref:http://www.adobe.com/devnet/games/articles/getting-started-flash-games.html
Chapter 3: Essentials
As the old Chinese adage says, “To accomplish your mission, first sharpen your tools.”
Make sure your current Flash builder and SDK is 4.5;We suggest using Flash builder 4.5 as the Adobe said,include enhancements and tooling to support mobile frameworks including Android, BlackBerry, and iOS. Using Flash Builder 4.5 and Flex 4.5, developers have access to a common codebase to cut back on development time for Flash and Air applications for mobile and include options to directly deploy finalized APKs to the Android Market and Amazon Appstore.
Thе idea is developers can code an app once and, wіth minimal changes, get іt out on as many platforms as possible thanks to Adobe’s development tools. can’t see how many party loses on that one. Of course, how useful this really is might be a question better answered by those actually developing the apps.
Architecture of the GODPAPER framework
What you will learn in this chapter:
What you learned in this chapter:
Chapter 4: Your First Game
In summary:
GODPAPER is easy to install
It’s easy to use
It generates code
You can’t effectively do agile development of flash board game without it
It’s free and open source!
Preparing the bed(board)
Feeding the bed(board)
Planting it
Subsequent pruning
Chapter 5: Game Building Blocks
Board information full at first time:
Board information appended step by step:
Board Representation
Chapter 6: AI In-Depth
Artificial intelligence (AI) is what makes your game “smart.”The intent is not to create Skynet10 and cause our flash game to become sentient and take over the planet.And al- though they are in some sense, we want the enemies in our game to have some kind of artificial intelligence.We don’t want our baddies to be so predictable that it’s no challenge to fool them,as opposed to just moving around in some random way.
Classic approaches to game AI require either a high quality of domain knowledge, or a long time to generate effective AI behavior. These two characteristics hamper the goal of establishing challenging game AI.
When implementing AI for computer games, the most important factor is the evaluation function that estimates the quality of a game state. The classic approach is to use heuristic domain knowledge to establish such estimates. However,building an adequate evaluation function based on heuristic knowledge for a non-terminal game state is a domain dependant and complex task. It probably is one of the main reasons why game AI in complex game-environments did not achieve a strong level, despite intensive research and additional use of knowledge-based methods.
Heuristics
The Oxford English Dictionary defines heuristics as “Enabling a person to discover or learn something for themselves.” The American Heritage Dictionary of the English Language defines heuristics as “Of or relating to a usually speculative formulation serving as a guide in the investigation or solution of a problem.” Neither of these definitions is very helpful in describing why heuristics are important and how they work.
Chapter 7: Game Center
Ref:http://www.adobe.com/devnet/games.html
Chapter 8: Out of the Ordinary
Q:What makes games hard? A:how you should play depends on how you think the other person will play; but how they play depends on how they think you will play; so how you should play depends on how you think they think you will play; but how they play should depend on how they think you think they think you will play; …
Q:How GODPAPER Works?
A:This overview is intended for people attempting to debug or enhance GODPAPER. Most GODPAPER users can remain blissfully unaware of the gory details described here.
Q:Using Code Examples?
A:This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code.
Graphic Interface Development
Chess Board
Chess Pieces
Data structure Design
BitBoard
Bitboard Basics Of course bitboards are not only about the existence of pieces - it is a general purpose, set-wise data-structure fitting in one 64-bit register. For example, a bitboard can represent things like attack- and defend sets, move-target sets and so on.
General Bitboard Techniques
Pattern and Attacks
AStarNodeBitBoard
NumberBoard
sample NuberBoard[x][y] for x = 7, y = 6, and n = 4:
+---------+---------+---------+---------+---------+---------+---------+
|20,26,59 |20,21,29,|20,21,22,|20,21,22,|21,22,23,|22,23,41,|23,44,56 |
| |62 |32,65 |23,35,47,|38,50 |53 | |
5 | | | |68 | | | |
| | | | | | | |
| | | | | | | |
+---------+---------+---------+---------+---------+---------+---------+
|16,25,26,|16,17,28,|16,17,18,|16,17,18,|17,18,19,|18,19,40,|19,43,44,|
|58 |29,59,61 |31,32,47,|19,34,35,|37,38,49,|41,52,56 |55 |
4 | | |62,64 |46,50,65,|53,68 | | |
| | | |67 | | | |
| | | | | | | |
+---------+---------+---------+---------+---------+---------+---------+
|12,24,25,|12,13,27,|12,13,14,|12,13,14,|13,14,15,|14,15,39,|15,42,43,|
|26,57 |28,29,47,|30,31,32,|15,33,34,|36,37,38,|40,41,51,|44,54 |
3 | |58,60 |46,50,59,|35,45,49,|48,52,56,|55,68 | |
| | |61,63 |53,62,64,|65,67 | | |
| | | |66 | | | |
+---------+---------+---------+---------+---------+---------+---------+
|8,24,25, |8,9,27, |8,9,10, |8,9,10, |9,10,11, |10,11,39,|11,42,43,|
|26,47 |28,29,46,|30,31,32,|11,33,34,|36,37,38,|40,41,54,|44,68 |
2 | |50,57 |45,49,53,|35,48,52,|51,55,62,|65,67 | |
| | |58,60 |56,59,61,|64,66 | | |
| | | |63 | | | |
+---------+---------+---------+---------+---------+---------+---------+
|4,24,25, |4,5,27, |4,5,6,30,|4,5,6,7, |5,6,7,36,|6,7,39, |7,42,43, |
|46 |28,45,49 |31,48,52,|33,34,51,|37,54,61,|40,64,66 |67 |
1 | | |57 |55,58,60 |63 | | |
| | | | | | | |
| | | | | | | |
+---------+---------+---------+---------+---------+---------+---------+
|0,24,45 |0,1,27, |0,1,2,30,|0,1,2,3, |1,2,3,36,|2,3,39,63|3,42,66 |
| |48 |51 |33,54,57 |60 | | |
0 | | | | | | | |
| | | | | | | |
| | | | | | | |
+---------+---------+---------+---------+---------+---------+---------+
0 1 2 3 4 5 6
0 - 23: horizontal wins 24 - 44: vertical wins 45 - 56: forward diagonal wins 57 - 68: backward diagonal wins
The sample map that I show above is just to show what the map[x][y] array should look like for a 7x6 board of Connect-4 (even though it's usually filled in dynamically using a few iterative loops). The numbers in this array are labels on the winnable n-in-a-row areas of the board. This is useful so that when a piece is dropped into an arbitrary board position, the algorithm can determine very quickly which n-in-a-row areas have become more likely destined for a win for the player, and, as importantly, which n-in-a-row areas are no longer possibilities for the opposing player. The numbers in the map[x][y] array are indexes into a pair of parallel single-dimensional arrays which keep track of how likely each n-in-a-row area is to be the winning area for each player. I call this the stats array.The "score" of a player is merely the sum of the stats array of the player. Subtracting one score from another determines how well a player is doing relative to the opposing player. You throw these numbers into your general run-of-the-mill minimax algorithm, throw in some alpha-beta cutoff logic for efficiency, and that, in a nutshell, is the secret to my algorithm.
GraphBoard
This graphic board providing the graph data struct and searchable functions;
DFS
BFS
DIJKSTRA
Artificial Intelligence
智能(Agent),是指一种基于硬件或者软件的计算机系统,它有如下特性:
1.autonomy(自主性).在没有人的直接干预下进行工作,可以某种方式控制自身的动作极其内部状态。
2.social ability(社会性).协作性,能够通过某种Agent通信语言与人或其他Agent相互作用。
3.reactivity(反应性).能够接受环境(其他Agent,人,Internet)的信息并作出反应。
4.pro-activeness(能动性).不仅仅对环境作出反应,而且呈现目标驱动的特性。
5.mobility(机动).能够在Internet中漫游。
6.veracity(诚实).不会故意发错信息。
7.benevolence(善意).没有冲突的目标,各自完成本身的任务。
8.rationality(理性).努力完成本身的任务,不会背道而驰。
More:http://blog.lookbackon.com/agent%e6%99%ba%e8%83%bd/
Searching Tree
The search tree as subset of the search space is a directed graph of nodes, the alternating white and black to move chess positions - and edges connecting two nodes, representing the moves of either side. The root of the search-tree is the position we like to evaluate to find the best move. Because of transpositions due to different move sequences, nodes inside the tree may occur from various ancestors - even within a different number of moves. The search tree contains various cycles, since both sides may repeat a former position with the minimum of two reversible moves each, or four plies. Cycles are usually eliminated and not searched twice, which results in searching a directed acyclic graph.
Intro to Artificial Intelligence Game Tree Search I
Generalizing Search Problems
So far: our search problems have assumed agent has complete control of environment state does not change unless the agent (robot) changes it. makes a straight path to goal state feasible. Assumption not always reasonable stochastic environment (e.g., the weather, traffic accidents). other agents whose interests conflict with yours.
Ref:http://www.cs.toronto.edu/~hojjat/384f06/Lectures/Lecture05.pdf
Ref:http://chessprogramming.wikispaces.com/Search
Ref:http://sander.landofsand.com/publications/Monte-Carlo_Tree_Search_-_A_New_Framework_for_Game_AI.pdf
Evaluation
An evaluation function is used to heuristically determine the relative value of a position, i.e. the chances of winning. If we could see to the end of the game in every line, the evaluation would only have values of -1 (loss), 0 (draw), and 1 (win). In practice, however, we do not know the exact value of a position, so we must make an approximation. Beginning chess players learn to do this starting with the value of the pieces themselves. Computer evaluation functions also use the value of the material as the most significant aspect and then add other considerations.
Ref:http://chessprogramming.wikispaces.com/Evaluation
linear
statical
fuzzy
heuristic
factors
Finite State Machine
Steering Behavior
Fuzzy Logic
WHERE DID FUZZY LOGIC COME FROM?
The concept of Fuzzy Logic (FL) was conceived by Lotfi Zadeh, a professor at the University of California at Berkley, and presented not as a control methodology, but as a way of processing data by allowing partial set membership rather than crisp set membership or non-membership. This approach to set theory was not applied to control systems until the 70's due to insufficient small-computer capability prior to that time. Professor Zadeh reasoned that people do not require precise, numerical information input, and yet they are capable of highly adaptive control. If feedback controllers could be programmed to accept noisy, imprecise input, they would be much more effective and perhaps easier to implement. Unfortunately, U.S. manufacturers have not been so quick to embrace this technology while the Europeans and Japanese have been aggressively building real products around it.
WHAT IS FUZZY LOGIC?
In this context, FL is a problem-solving control system methodology that lends itself to implementation in systems ranging from simple, small, embedded micro-controllers to large, networked, multi-channel PC or workstation-based data acquisition and control systems. It can be implemented in hardware, software, or a combination of both. FL provides a simple way to arrive at a definite conclusion based upon vague, ambiguous, imprecise, noisy, or missing input information. FL's approach to control problems mimics how a person would make decisions, only much faster.
HOW IS FL DIFFERENT FROM CONVENTIONAL CONTROL METHODS?
FL incorporates a simple, rule-based IF X AND Y THEN Z approach to a solving control problem rather than attempting to model a system mathematically. The FL model is empirically-based, relying on an operator's experience rather than their technical understanding of the system. For example, rather than dealing with temperature control in terms such as "SP =500F", "T <1000F", or "210C <TEMP <220C", terms like "IF (process is too cool) AND (process is getting colder) THEN (add heat to the process)" or "IF (process is too hot) AND (process is heating rapidly) THEN (cool the process quickly)" are used. These terms are imprecise and yet very descriptive of what must actually happen. Consider what you do in the shower if the temperature is too cold: you will make the water comfortable very quickly with little trouble. FL is capable of mimicking this type of behavior but at very high rate.
HOW DOES FL WORK?
FL requires some numerical parameters in order to operate such as what is considered significant error and significant rate-of-change-of-error, but exact values of these numbers are usually not critical unless very responsive performance is required in which case empirical tuning would determine them. For example, a simple temperature control system could use a single temperature feedback sensor whose data is subtracted from the command signal to compute "error" and then time-differentiated to yield the error slope or rate-of-change-of-error, hereafter called "error-dot". Error might have units of degs F and a small error considered to be 2F while a large error is 5F. The "error-dot" might then have units of degs/min with a small error-dot being 5F/min and a large one being 15F/min. These values don't have to be symmetrical and can be "tweaked" once the system is operating in order to optimize performance. Generally, FL is so forgiving that the system will probably work the first time without any tweaking.
SUMMARY
FL was conceived as a better method for sorting and handling data but has proven to be a excellent choice for many control system applications since it mimics human control logic. It can be built into anything from small, hand-held products to large computerized process control systems. It uses an imprecise but very descriptive language to deal with input data more like a human operator. It is very robust and forgiving of operator and data input and often works when first implemented with little or no tuning.
No more s***. All posts of this qaulity from now on
Neuron Network
Machine Learning
Genetic
Markov
MCMC
Plugin Development
IPlug:
*function get data():IPlugData; *function initialization():void;//retrieve data and more initial functions. //plugin functions list: *function showData():Boolean; *function showStore():Boolean; *function showLeaderboard(value:Object):Boolean; *function showLoginWidget():Boolean; //about data operation *function saveData(value:Object):Boolean; *function submitData(value:Object):Boolean;
IPlugData:
//Data properties,such as gameID,boardID,userId/Name... *function set gameID(value:String):void; *function get gameID():String; *function set boardID(value:String):void; *function get boardID():String; //about store items. *function get hasCaptureIndicator():Boolean; *function get hasCheckIndicator():Boolean; *function get hasMoveIndicator():Boolean;
*Library file: *Service API: *Source Code: *Example:http://apps.facebook.com/chinesechessjam/
Mochi
*Library file: https://github.com/downloads/yangboz/MochiPlugin/MochiPlugin_1.0.1.swc *Service API: https://www.mochimedia.com/support/dev_docs *Source Code: https://github.com/yangboz/MochiPlugin *Example: http://www.mochigames.com/game/_v331/
Come2Play
*Library file: *Service API:http://www.come2play.com/API_inner.asp?f=1&newsid=547 *Source Code:https://github.com/yangboz/Come2PlayPlugin *Example:
Kongregate
*Library file: https://github.com/downloads/yangboz/KongregatePlugin/KongregatePlugin_1.0.1.swc *Service API: http://www.kongregate.com/developer_center/docs/as3-api *Source Code: https://github.com/yangboz/KongregatePlugin *Example: http://www.kongregate.com/games/youngwelle/chinesechessjam
Nonoba
*Library file:https://github.com/downloads/yangboz/NonobaPlugin/NonobaPlugin_1.0.1a.swc *Service API:http://www.nonoba.com/developers/documentation/actionscript3 *Source Code:https://github.com/yangboz/NonobaPlugin *Example:http://nonoba.com/smartkit/chinesechessjam
Whirled
*Library file: *Service API:http://wiki.whirled.com/Whirled_SDK *Source Code: *Example:
Platogo
*Library file:http://static.platogo.com/sdk/PlatogoSDK_1.4.9.zip *Service API:http://www.platogo.com/devcenter/articles/getting-started *Source Code: *Example:
Ref: http://www.adobe.com/devnet/games/monetization.html
Deployment
民间棋类游戏框架采用GPL开源协议,GPL 是 GNU General Public License (GNU 通用公共许可证)的缩写形式;基于 GPL 的软件允许商业化销售,但不允许封闭源代码。如果您对遵循 GPL 的软件进行任何改动和/或再次开发并予以发布,则您的产品必须继承 GPL 协议,不允许封闭源代码。如果你的产品只是自己使用而不需要发布给别人,则并不需要提供源代码。如果发布产品源码,请使用商业版本的许可。如果是做产品的话,请购买商业许可,以及提供的技术支持。
Once you've finished developing and polishing your game, you're still not done. You still need to find a way to publish it, track how it's doing, and make money off it. The resources on this page can help you get started.
More:http://www.adobe.com/devnet/games/monetization.html
Distribution and monetization
There are a variety of ways to distribute your game. Two common ones are to submit your game to an app store or market, or to submit it to one of the many Flash game portals. Another alternative is to use a service that helps find a sponsor for your game. The resources below can help you get started with distributing your game. Before you begin, you should read this article on How to make money with online games.
AIR Desktop
Ref: http://www.adobe.com/devnet/air/articles/considerations-air-apps-mobile.html
iOS
Ref: http://iphoneflashdev.blogspot.com/2010/09/deploy-to-iphone-with-flex-builder_20.html
Android
*Library file: https://github.com/downloads/yangboz/AndroidPlugin/AndroidPlugin_1.0.1a.swc *Service API:http://blogs.adobe.com/flashplayer/2011/03/adobe-air-2-6-sdk-now-available-with-updated-ios-support.htm *Source Code: https://github.com/downloads/yangboz/AndroidPlugin/ *Example:https://github.com/downloads/yangboz/ChineseChessJam/ChineseChessJam_1.0.0.apk
WebOS
Ref: http://www.precentral.net/adobe-says-flash-webos-coming-first-half-2010 Ref: http://www.joshuagranick.com/blog/?p=205
Windows Phone 7
Ref: http://visitmix.com/labs/rosetta/FTSL/
BlackBerry Tablet OS
Google Web Store
The Chrome Web Store lets you publish free or paid apps where Google Chrome users can easily find them. Ref:http://code.google.com/chrome/webstore/faq.html