Jump to content

My Homemade MMA Game


mjdgoldeneye

Recommended Posts

I made an MMA game in Java!

 

I present you with MJD's MMA Game (v4.0). I adapted this version from a simple text thingy I made. Now, it has a full-fledged user interface (with pictures and buttons and stuff) instead of it's original console window. Programming AI isn't something I want to mess with yet, so it's a 2-player game. I find it's equally fun playing out a fight as both guys.

 

I'm pretty satisfied by my progress with it. This time last year I was about 2 weeks through my first Java course and just taught myself how to use graphical interfaces over the last week. Just today I added the achievements system and completely restructured a lot of the methods and cut the length of the main GUI code in half. I figured it was good enough to share at this point. Pretty much everything recognizable about this program was created in the last 4-5 days.

 

Seeing as I did make tons of changes and additions today, there might be a few crippling bugs. I played through a bunch of times with no problems, but sometimes bugs are really really specific about when they destroy the program.

 

Also:

 

1. I left the "known issues" part out of the readme on accident. All you really need to know is that mirror matches are not functional (technically). If you try to have Brock Lesnar vs. Brock Lesnar, he just damages himself and nothing really makes sense. I guess it's fairly realistic... :p

 

2. Read the last question in the readme F.A.Q.. There's an 85% chance that this won't run for you immediately. However, there's a 95% chance it'll run fine if you follow the given instruction.

 

Anyway, report any bugs or problems to me and let me know what you think or recommend.

Link to comment
Share on other sites

I didn't have a second player. So I played against myself. Brock Lesnar beat Frank Mir by beating the ever loving explative out of him.

 

TBH I played against myself as well, Mir beat Junior Dos Santos.

 

Decent game, could get a bit repetitive after time but it is a good game considering its price (free :D)

Link to comment
Share on other sites

A fun game and an amusing diversion. My only real quibble is that you have close and reopen the program to play another game.

 

Yea, the way the game is written, I'm having trouble thinking of a way to reset within the game. I think I thought of a way, though.

 

Also, there's a silly typo in one of the achievements where it says "fighter" instead of "fight".

 

Sometime soon, I'll come out with another version with at least more achievements and a reset button.

Link to comment
Share on other sites

I could try to help if you'd like.

 

How are you initializing the program? (Feel free to PM me if you'd rather not have this conversation in public. Or tell me to take my stupid nose and keep it in my own projects. I could also do that.)

 

I consider the project open source. It's not like I'm going to sell a UFC game or anything... :p

 

(I just ask that no one use my program for their own financial or academic benefit. They may edit, improve, or ruin it for their own purposes as they wish.)

 

That being said, the java files are in the download if you want to check them out. I tried commenting stuff a bit.

 

It's a frankenprogram. The core stuff I made myself, but the framework is patched together from random tutorial programs and stuff I'd already made.

 

private static void createAndShowGUI() throws IOException {
        MMAGUI frame = new MMAGUI("MJD's MMA Game (v4.0)");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.addComponentsToPane(frame.getContentPane());
        frame.pack();
        frame.setVisible(true);
     }

public static void main(String[] argv) throws IOException{
        try {
           //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
           UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
        } 
           catch (UnsupportedLookAndFeelException ex) {
              ex.printStackTrace();
           } 
           catch (IllegalAccessException ex) {
              ex.printStackTrace();
           } 
           catch (InstantiationException ex) {
              ex.printStackTrace();
           } 
           catch (ClassNotFoundException ex) {
              ex.printStackTrace();
           }
        UIManager.put("swing.boldMetal", Boolean.FALSE);

        javax.swing.SwingUtilities.invokeLater(
              new Runnable(){
                 public void run() {
                    try {
                       createAndShowGUI();

                    } 
                       catch (IOException ex) {
                          ex.printStackTrace();
                       }
                 }
              }); 
     }

 

That's what puts the pieces together for use.

 

I know what everything does, more or less, but I'm not really familiar with the contents of the main method. The first parts just look for UI errors and issues, but I haven't used the .invokeLater method, Runnables, etc. before.

 

Another issue that's bugging me is putting panels on the frame. BorderLayout is annoying me.

Link to comment
Share on other sites

Yeah, I'm really thankful for Visual Studio, myself.

 

I put out a program that I am kinda pleased with a while ago that has a bunch of entirely broken features, but it exports TEW files to a format readable by OpenOffice (and Excel) and I have no idea how it defined the windows. I've read that part of the code but it still feels like un-duplicateable magic.

 

(PS. I can't figure anything from that. It's probably too much work for me to do anything with. I'm secretly lazy, I just like puzzles.)

 

(PPS. It's not that I didn't understand. A lot of it was abstracted or irrelevant, really, to what I wanted to know. I kinda failed at explaining what I wanted to read since you gave me exactly what I asked you for. I more meant that either I'd pour over the code, which I probably wouldn't, or I'd keep nickel-and-diming you for weeks)

Link to comment
Share on other sites

Yeah, I'm really thankful for Visual Studio, myself.

 

I put out a program that I am kinda pleased with a while ago that has a bunch of entirely broken features, but it exports TEW files to a format readable by OpenOffice (and Excel) and I have no idea how it defined the windows. I've read that part of the code but it still feels like un-duplicateable magic.

 

Java is really suited for internal applications that you never see, not graphical stuff or games. However, my school teaches Java for some reason, so I'm making due for now.

 

I'll learn C++ eventually. The syntax is similar. The tough part is doing all the annoying lower-level stuff that Java doesn't have to worry about.

Link to comment
Share on other sites

I highly recommend C#. It's somewhere between C++ and Java, but it's a lot more readable than C++, and while I don't like Microsoft's policies on a lot of subjects, they know how to support a programming language. While C++ will take some time not only to learn but also to gather the libraries you'll want, C# tends to come with a lot of what you will want, and for graphical games you have XNA which helps automate a lot of things as well.

 

EDIT: That said, my current project involving a wrestling sim and a lot of time being on my hands between work days, if I can get some of the kinks worked out in the save files (for some reason, I decided that the first thing I wanted was to be able to write out my save files; I'll never know why) is being worked on in Haskell. It's really, really not for everyone, but I realized that it probably sounded like I'm really gung-ho about C#, which I'm not. It's just my favorite in the C family.

 

Except maybe for D, which has really poor support on a lot of systems and doesn't have the library base for a newbie like me.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...