350 likes | 497 Views
Almansur : Extendable I mplementation and P arallelization Using MASS. Stuart Drummond. Introduction. Almansur Overview. Massively multiplayer online turn-based strategy game Built using Ruby on Rails by PDMFC Originally released in 2007 Created using agent-based modeling.
E N D
Almansur: Extendable Implementation and Parallelization Using MASS Stuart Drummond
Almansur Overview • Massively multiplayer online turn-based strategy game • Built using Ruby on Rails by PDMFC • Originally released in 2007 • Created using agent-based modeling Introduction Slide 1
MASS • Created and maintained by Dr. Munehiro Fukuda and Distributed System Lab at UW Bothell • What is it? • Places & Agents • Using multiple computing nodes via grid computing to parallelize • Versions • Java and C++ • Which one is being used for the project? Introduction Slide 2
Game parallelization & Benchmarking • Specific to games in web… • Most literature had to do parallelizing and scaling game server • AlBahnassi, Mudur, & Goswami, 2012 • Use of task parallelism • External validity in benchmarking Introduction Slide 3
Agent-Based Systems • What are agents? • Macal& North (2008) • What are the features of agents? • Autonomy • Social relationships • Reactivity • Proactiveness • What kind of systems could benefit from agent-based systems? Not this kind of agents Introduction Slide 4
The Problem and Requirements • Overall Speed • Ding, Gernart, Li & Hertz (2014) • Turn Processing • Functional Requirement • Performance • Non-functional Requirements • Extendibility Project Overview Slide 1
Benchmarking Results (Ribeiro, Santos, & Prada 2007) Project Overview Slide 2
Benchmarking Results (Ribeiro, Santos, & Prada 2007) Project Overview Slide 3
Worst case scenario… Project Overview Slide 4
Project Hypothesis • H0: There is no difference in performance between the original version of Almansur and the MASS-optimized Almansur. • H1: The amount of time that it takes to conduct turn processing will be significantly faster in the MASS-optimized Almansur. • Operational Definition • Speed: Less than 5% change in difference is considered within margin of error. Project Overview Slide 5
Architecture Implementations Slide 6
Components of Almansur Implementations Slide 7
MASS-optimized Almansur Implementations Slide 8
World.process_turn() Implementations Slide 9
Event Manager • Class responsible for relaying events from turn processing to agents. • Reads from a JSON file and parsed by GSON. • Additional processing to determine if the target is a place or an agent. Implementations Slide 10
Event Manager Continued… Implementations Slide 11
JSON File Implementations Slide 12
Source code documentations Implementations Slide 13
Performance Metrics • Ruby benchmarking modules • Using System.currentTimeMillis() at two points. • Graph + performance difference percentage table • Process 1 turn • PC used for testing: • CPU: i7 2600k @ 4.7 GHz • Memory: 8 GB RAM • Storage: Samsung 830 Pro SSD • GPU: 2x Nvidia GTX 780 TI Methods Slide 1
Scenario Selection • Using the same set of scenarios used by the graduate student at PDMFC • Importing provided SQL dumps • Scenarios: • Small scenario with 2 Lands • Large scenario with 200 Lands • Very large scenario with 500 Lands • Huge scenario with 1000 Lands Methods Slide 2
Scenario 1 Table (Milliseconds) Number of Lands: 2 Number of Agents: 511 Results Slide 1
Scenario 2 Table (Milliseconds) Number of Lands: 200 Number of Agents: 28005 Results Slide 2
Scenario 3 Table (Milliseconds) Number of Lands: 500 Number of Agents: 65420 Results Slide 3
Scenario 4 Table (Milliseconds) Number of Lands: 1000 Number of Agents: 126424 Results Slide 4
Performance Scatterplot Results Slide 5
Hypothesis Revisited • The implementation using MASS allowed for a processing time that was better than the original version • Was able to reject the null hypothesis • Performance bottleneck? • Any operation that involve having to refer back to the Lands / Political Entities create sections of code where parallelizable become impossible • Innate issue with the original design • Future implementation may start individualizing from the original software Conclusions Slide 1
Limitations • No multi-process results • Low sample size • Repetitive importing code • Some processes are missing Conclusions Slide 2
Future extensions • Web extension • Proper scenario importing and exporting • Additional processing • Further testing Conclusions Slide 3
Lessons Learned • The requirements of a project changes…often • Having a library that can evolve is helpful for a project • Assuming anything about the source code is risky! • Communication is key • Porting from a dynamic-typed language to a static-typed language is difficult. Conclusions Slide 4
References • Active record pattern. (2005, October 11). Retrieved September 1, 2014, from http://en.wikipedia.org/wiki/Active_record_pattern • Adobbati, R., Marshall, A. N., Scholer, A., Tejada, S., Kaminka, G. A., Schaffer, S., & Sollitto, C. (2001, January). Gamebots: A 3d virtual world test-bed for multi-agent research. In Proceedings of the second international workshop on Infrastructure for Agents, MAS, and Scalable MAS (Vol. 5). Montreal, Canada. • AlBahnassi, W., Mudur, S. P., & Goswami, D. (2012, June). A Design Pattern for Parallel Programming of Games. In High Performance Computing and Communication & 2012 IEEE 9th International Conference on Embedded Software and Systems (HPCC-ICESS), 2012 IEEE 14th International Conference on (pp. 1007-1014). IEEE. • Almansur. (2005). Free online medieval strategy turn based game. Retrieved May 1, 2014, from http://www.almansur.net/ • Barata, A. M., Santos, P. A., & Prada, R. (2011, September). AI for Massive Multiplayer Online Strategy Games. In AIIDE. • Chiu, A., Nasiri, E., & Rashid, R. (2012). Parallelization of Sudoku. • Ding, C., Gernhart, B., Li, P., & Hertz, M. (2014). Safe parallel programming in an interpreted language (Vol. 991). Technical Report. • Dong, J., Chen, S., & Jeng, J. J. (2005, April). Event-based blackboard architecture for multi-agent systems. In Information Technology: Coding and Computing, 2005. ITCC 2005. International Conference on (Vol. 2, pp. 379-384). IEEE. • Fukuda, M. (2014, January 30). MASS: A Parallelizing Library for Multi-Agent Spatial Simulation. MASS: A Parallelizing Library for Multi-Agent Spatial Simulation. Retrieved May 1, 2014, from http://depts.washington.edu/dslab/MASS/index.html • Jruby. (n.d.). Retrieved August 20, 2014. • Macal, C. M., & North, M. J. (2008, December). Agent-based modeling and simulation: ABMS examples. In Proceedings of the 40th Conference on Winter Simulation (pp. 101-112). Winter Simulation Conference. • Ribeiro, L. M. L., Santos, P., & Prada, R. (2007). Agents for Massive On-line Strategy Turn Based Games. • Ruby. (n.d.). Programming Language. Retrieved May 16, 2014, from https://www.ruby-lang.org/en • Ruby on Rails. (n.d.). Retrieved August 20, 2014, from http://rubyonrails.org/ • StarCraft II. (2010, January 1). Retrieved August 20, 2014, from http://us.battle.net/sc2/en/?-