180 likes | 269 Views
A Fighting Game of Sorts. CS470 Project Presentation By Mark Blum. Background. I made a graphically driven game. The “clients” for my project are myself, my brother Luke, and my friends. Java was used to create the game. Project Goals.
E N D
A Fighting Game of Sorts CS470 Project Presentation By Mark Blum
Background • I made a graphically driven game. • The “clients” for my project are myself, my brother Luke, and my friends. • Java was used to create the game.
Project Goals • Make a new game that is better than any previous game I have created. • Accomplish this by incorporating the best features of the previous games I have created (story, graphics, and AI) and adding any features that may still be missing (sound and save feature).
Requirements • The system must have a save game feature, a character creation module, a cheat code, 10 stages, an ending sequence, and a high score ranking system. • My game fulfills all the listed requirements.
Sample High Score Ranking System Having completed stage X before ending the game, you have achieved the fighting rank of: • Wimp • Lucky Punk • Thug • Novice • Initiate • Adept • Expert • Specialist • Master • Grand Master • Supreme Grand Master
Data Structures • I used a couple of stacks to implement the High Score system. • To store the information about the hero and the various bosses I used a simple file format.
Data Structures, cont. • An example of a typical boss file is: Dan|110|37|0|3|2|2|2|2|3|1|5|8|6|2|0|40|5|5|5|0|0|0|24|EMC|40 • An example of a typical hero file is: true|1|Goku|112|45|0|3|2|2|2|2|3|2|true|true|true
Data Structures, cont. • For input validation I used a special data structure that was capable of only holding whole numbers. • This was used extensively in the character creation module. It is also used when the player is prompted to enter the number of additional EP to sink into an attack.
AI • Random/Rule-based hybrid. • Each character has a random percentage chance to do any particular move that they possess. • Percentage chances are modified based on certain “rules”. • Examples: if enemy is defending: then increase probability of powering up by probability to defend and set probability to defend to 0 • if enemies action equals Energy Maximum Charge attack: then defend with a 8 times current stage probability
Biggest Hurdle • The biggest hurdle I encountered during the course of my project involved threading and thread “safeness” or lack thereof. • During the players turn, I needed to “pause” the program until the player had made a selection. • Added an extra thread to take care of the fighting. Unfortunately, Swing is not thread safe.
Solution • I made a special class that I used to sync my threads with, and I made all my accessor and mutator methods synchronized. • I also declared many of my variables to be volatile, and I made use of repaint(0) instead of repaint() where it mattered. • Where possible, I used the results of a change before making the change.
What I’ve Learned • I learned that making a graphically driven game is extremely time consuming, and that making/editing the graphics can take just as much time as the coding. • In addition, I learned how to make programs that utilize Swing thread safe.