Presented by Yisheng Tang. Introduction  Wargus is a Warcraft2 Mod that allows you to play Warcraft2 under GNU/Linux and other operating systems not.

Slides:



Advertisements
Similar presentations
1. Define the concept of assertions. 1 Explain the use of assertions. 2 Create Java program using assertions. 3 Run Java program using assertions. 4 2.
Advertisements

Problem Solving 5 Using Java API for Searching and Sorting Applications ICS-201 Introduction to Computing II Semester 071.
Written by: Dr. JJ Shepherd
IKI 10100: Data Structures & Algorithms Ruli Manurung (acknowledgments to Denny & Ade Azurat) 1 Fasilkom UI Ruli Manurung (Fasilkom UI)IKI10100: Lecture22.
Exception Handling The purpose of exception handling is to permit the program to catch and handle errors rather than letting the error occur and suffer.
SE-1020 Dr. Mark L. Hornick 1 Exceptions and Exception Handling.
Slides prepared by Rose Williams, Binghamton University ICS201 Exception Handling University of Hail College of Computer Science and Engineering Department.
Understand Error Handling Software Development Fundamentals LESSON 1.4.
Exception Handling. Introduction An exception is an abnormal condition that arises in a code sequence at run time. In computer languages that do not support.
16-Jun-15 Exceptions. Errors and Exceptions An error is a bug in your program dividing by zero going outside the bounds of an array trying to use a null.
Loops Notes adapted from Dr. Flores. It repeats a set of statements while a condition is true. while (condition) { execute these statements; } “while”
Exceptions. Errors and Exceptions An error is a bug in your program –dividing by zero –going outside the bounds of an array –trying to use a null reference.
JUnit, Revisited 17-Apr-17.
Intro to Java while loops pseudocode. 1 A “Loop” A simple but powerful mechanism for “making lots of things happen!” Performs a statement (or block) over.
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
26-Jun-15 Threads and Turns. Thread review There are two ways to create a Thread object.. Extend Thread and supply a run method: class MyThread extends.
Transformation of Java Card into Diet Java Semester Project Presentation Erich Laube.
Arrays, Loops weeks 4-6 (change from syllabus for week 6) Chapter 4.
Exceptions. Many problems in code are handled when the code is compiled, but not all Some are impossible to catch before the program is run  Must run.
More Multithreaded Programming in Java David Meredith Aalborg University.
Games and Simulations O-O Programming in Java The Walker School
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
Introduction to Computer Programming Error Handling.
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
Comp 248 Introduction to Programming Chapter 4 - Defining Classes Part A Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia.
M1G Introduction to Programming 2 4. Enhancing a class:Room.
And other languages…. must remember to check return value OR, must pass label/exception handler to every function Caller Function return status Caller.
1 Review of Java Higher Level Language Concepts –Names and Reserved Words –Expressions and Precedence of Operators –Flow of Control – Selection –Flow of.
Programming With Alice. Alice Free Java based, 3D programming tool Enables the manipulation and interaction of 3D objects Can also.
Chapter 3 Introduction to Collections – Stacks Modified
JUnit in Action SECOND EDITION PETAR TAHCHIEV FELIPE LEME VINCENT MASSOL GARY GREGORY ©2011 by Manning Publications Co. All rights reserved. Slides Prepared.
CSC172 Intro Pepper. Goals Reminder of what a class is How to create and use classes How to design classes How to think in terms of objects How to comment.
CMSC 202 Exceptions. Aug 7, Error Handling In the ideal world, all errors would occur when your code is compiled. That won’t happen. Errors which.
Artificial Intelligence in Game Design Behavior Trees.
Chapter 3 Servlet Basics. 1.Recall the Servlet Role 2.Basic Servlet Structure 3.A simple servlet that generates plain text 4.A servlet that generates.
How to Create a Videogame By: Connor McCann. Java Java is one of many programming languages Java is used to run web browsers and most PC video games I.
Debugging in Java. Common Bugs Compilation or syntactical errors are the first that you will encounter and the easiest to debug They are usually the result.
Profile and optimize your Java code Gabriel Laden CS 146 – Dr. Sin-Min Lee Spring 2004.
IBM TSpaces Lab 1 Introduction. Summary TSpaces Overview Basic Definitions Basic primitive operations Reading/writing tuples in tuplespace HelloWorld.
Exception Handling Unit-6. Introduction An exception is a problem that arises during the execution of a program. An exception can occur for many different.
CPS120: Introduction to Computer Science Decision Making in Programs.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 12: Programming Project.
Comparison-Based Sorting & Analysis Smt Genap
SilkTest 2008 R2 SP1: Silk4J Introduction. ConfidentialCopyright © 2008 Borland Software Corporation. 2 What is Silk4J? Silk4J enables you to create functional.
I Power Higher Computing Software Development High Level Language Constructs.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Li Tak Sing COMPS311F. Database programming JDBC (Java Database Connectivity) Java version of ODBC (Open Database Connectivity) ODBC provides a standard.
AI Evaluation David Nowell CIS 588 2/14/05 Baldur’s Gate.
Pengantar OOP Class-Java. 2 Software Development Tools Using Sun Java SDK alone Source File(s) (.java) Programmer Compiler (javac) Class File(s) (.class)
M1G Introduction to Programming 2 5. Completing the program.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Debugging COMP T1.
Exceptions in C++. Exceptions  Exceptions provide a way to handle the errors generated by our programs by transferring control to functions called handlers.
JUnit in Action SECOND EDITION PETAR TAHCHIEV FELIPE LEME VINCENT MASSOL GARY GREGORY ©2011 by Manning Publications Co. All rights reserved.
While and If-Else Loops ROBOTC Software. While Loops While loop is a structure within ROBOTC Allows a section of code to be repeated as long as a certain.
Written by: Dr. JJ Shepherd
CSC Java Programming, Spring, 2010 Week 2: Java Data Types, Control Constructs, and their C++ counterparts.
(1) Introduction to Robocode Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of Hawaii Honolulu.
CMSC 202 Computer Science II for Majors. CMSC 202UMBC Topics Exceptions Exception handling.
CSC Java Programming, Fall, 2008 Week 2: Java Data Types, Control Constructs, and their C++ counterparts, September 9.
And other languages…. must remember to check return value OR, must pass label/exception handler to every function Caller Function return status Caller.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
Shlomo Hershkop Basics overview. Shlomo Hershkop Basic Review - Overview Practice coding Practice coding finger guessing game finger guessing.
Java Exceptions a quick review….
Introduction to JUnit CS 4501 / 6501 Software Testing
Introduction to JUnit CS 4501 / 6501 Software Testing
Object Oriented Programming in java
Software Engineering and Architecture
Presentation transcript:

Presented by Yisheng Tang

Introduction  Wargus is a Warcraft2 Mod that allows you to play Warcraft2 under GNU/Linux and other operating systems not supported by the original Warcraft2 engine  The package is different from the official one: in addition to Wargus, it contains the java files which can be used to program a "player" to fight against the enemy AI. They were created by researchers using Wargus as testbed.  Demo

Installation  Choose File>New>Java Project.  Choose "Create project from existing source", browse and choose directory \java\proxyBot_java.  Edit file default.cfg to point to the directory in which you have Stratagus (i.e. if it's in C:\stratagus, write "C:\\stratagus\\", the two backslashes at the end are required). Test in different map: Change the code in method example.Example.loadMap()  Run project and choose Example.java as the main class.

Interact with game engine  Place your own code in the method: example.Example.runTest(ProxyBot)  This method will be called repeatedly. FYI: In case your code will throw some exception which could halt the execution of this game, we place a try- catch statement in the while loop: ○ while (!m_static_stopSignal) { ○ try{…}catch{…} ○ }  WargusStateImporter is a helper class which contains parameters and default values of this game.  Since this software are not well coded, remember to apply defensive programming techniques.

Obtain game status  Use this method to obtain a WargusMap object: WargusStateImporter.getGameStateMap(…); Further obtain the map array(char[][]): ○ base.WargusMap.get_map()  Always use the following to method to obtain player and further obtain units information: WargusStateImporter.getGameStatePlayer(…); WargusStateImporter.getGameStateOpponents(…);  DO NOT use base.ProxyBot.getMyUnits(), since the ArrayList returned is not thread safe.

Units  All construction and movable units are WargusUnit object.  Use the following method to retrieve units in this game: base.WargusPlayer.getUnits() base.WargusPlayer.getUnitsByType(String) base.WargusPlayer.getFlyingUnits() base.WargusPlayer.getLandUnits() base.WargusPlayer.getWaterUnits() base.WargusPlayer.getMobileUnits() base.WargusPlayer.getBuildings() base.WargusPlayer.getBombardingUnits() …

New Units  If the unit you want to build is a building, then use: base.ProxyBot.build(int, int, int, boolean, int)  Else use: base.ProxyBot.train(int, int)

Research  Explore the following method to discover the type of available researches: base.WargusStateImporter.researchTypeToString(int)  Exception: If you want to upgrade your town-hall, you actually use build proxyBot.upgrade(myHall.getUnitID(), 88); // upgrade to keep proxyBot.upgrade(myKeep.getUnitID(), 90); // upgrade to castle The size of town-hall, keep, castle are all 4.

Move and attack  Move to location, attacking any enemies encountered on the way ProxyBot.attackMove(int unitID, int x, int y, boolean relative)  Orders unit to attack given other unit ProxyBot.attack(int unitIDOfAttacker, int attackThisUnitID)  Orders a unit to move to an x, y location. ignore enemies along the way base.ProxyBot.move(int unitID, int x, int y, boolean relative)

Other useful API  wargusUnit.getStatus() Return a status array array[0] is the currently performing action  WargusStateImporter.statusToString(wargu sUnit.getStatus()[0]) Translate the status code  WargusStateImporter.unitCostGold(type) Return the cost of gold  WargusStateImporter.unitCostWood(type) Return the cost of wood

Useful Solutions  Keep building footmans  Never stop collect sources  Upgrade your technology in a proper time

Speed Up Running Wargus  This is the command in Java to make Wargus run fastest as possible:  proxyBot.setSpeed(-1);

Thank you! Enjoy this game!