Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (552)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2
1  Discussions / Miscellaneous Topics / Youtube Comment Viewer on: 2011-01-11 02:38:50
Hey guys, here's a random program that will retrieve every single comment from a given youtube video, sort them by thumbs up, and display a custom amount of results.

I basically use it all the time instead of reading random comments now, so I figured, since it's a java app, some of you guys might find it interesting as well.

Anyways, here's the link:
http://vipersrt3g.com/marinepower/Programming/YoutubeCommentRetriever.jar

Enjoy!
2  Game Development / Newbie & Debugging Questions / Palette Help on: 2010-09-22 02:34:58
Hello all, I've been working on this problem off and on for the past few months and haven't been able to figure it out.  Basically, I am trying to create a bufferedimage out of a byte[][] array and a IndexColorModel palette, and have no clue how to go about doing it.  Currently, this is the code I have, but it doesn't work whatsoever.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
IndexColorModel palette = new IndexColorModel(numBits, size+1, reds, grns, blus, indexOfTransPixel);

byte[][] data = ...;
               DataBufferByte imageData = new DataBufferByte(data, data.length);
               SampleModel model = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE,
                  imageData.getBankData().length,
                  imageData.getBankData()[0].length,
                  1, imageData.getBankData().length, new int[] {255});
           
               WritableRaster raster = Raster.createWritableRaster(
                  model,
                  imageData,
                  new Point(0,0));

BufferedImage renderedBi = new BufferedImage(palette,raster,true, new Hashtable());


Any help would be greatly appreciated!  (The reason I'm trying to do this is to save space, there are multiple factions each with a lot of animated sprites that have different palettes)
3  Java Game APIs & Engines / Tools Discussion / Re: Java - using XML with XSD? on: 2010-07-12 03:37:06
Thanks for the tips, guys.  I'll research the links and post back in a bit.
4  Java Game APIs & Engines / Tools Discussion / Java - using XML with XSD? on: 2010-07-09 16:31:55
Hey guys, I've recently started learning about XML and all the other hordes of file types associated with it.  However, I'm having trouble finding info about how to actually use validated XML files within my game. 

For example, I know how to extract element names using both SAX and DOM, but all this leaves me with is a bunch of Strings and if statements.  Instead, is it possible for the document to actually read the XSD file and extract the file types of the attributes?  So that everything isn't CDATA?

Thanks
5  Games Center / Showcase / Re: Cremelian Wars X - My first game on: 2010-01-23 18:36:27
Hey, thanks for the great suggestions.  I've finally gotten around to getting a host, so this game is now playable online.  You can try it out here:
http://www.cremelianwars.zxq.net
6  Game Development / Newbie & Debugging Questions / Re: How to check if a URL is a directory on: 2009-11-17 23:06:42
That seems to work, thanks!

Unfortunately, I have just realized that the way I actually read the contents of the folder no longer works when the resources are packaged into a jar.  Before, I would open up a URLConnection on a URL, then read all of the filenames in the folder using a BufferedReader.  However, inside a jar, the following method is not able to obtain the folder as a URL.

1  
URL directory = this.getClass().getResource(mapFolder);
7  Game Development / Newbie & Debugging Questions / How to check if a URL is a directory on: 2009-10-25 23:55:10
Hey guys, I'm trying to build a framework that will allow a user to navigate the contents of a signed jar file, and need it to support looking into various subdirectories.  How would one go about figuring out whether or not a given resource is a directory?

I'm getting the initial directory using MapSelection.getClass().getResource("/CremelianWars/Maps/")  which returns a URL.  The File class has a method for checking if it's a directory or not, but a URL doesn't seem to have one.

Thanks
8  Games Center / Showcase / Re: Cremelian Wars X - My first game on: 2009-10-15 21:37:04
Yup, heckboy's got it.  I've already made some plans with a friend of mine to host it on his site, so that should happen in the next couple of days.  Interesting link, though.  Is that what you use for your games?

@TheAnalogKid
Thanks for testing.  I've added in a loading screen for the game, so it hopefully won't seem laggy now.  These extra game repaints make the loading longer, since that's done in a seperate thread now, but the graphic will hopefully make up for it.

I have considered an isometric view, but it is already proving to be exceedingly difficult to create 2d graphics, so I would image that 2.5d would be even harder.

Interesting point about the gameplay.  Theres more at work than simply that, so I may need to give more instruction on the finer points of battle.  Of course, they will all boil down to one unit killing another, but some things to consider would be terrain benefits, such as standing on a mountain rather than on grass, and the ranges of the two units in the battle.  If you attack a flame thrower unit from two spaces away, you will be able to shoot without fear of retaliation.

Hopefully, once I finish the base AI, managing buildings and building the units themselves will add even more depth.
9  Games Center / Featured Games / Re: Incredibuilder on: 2009-10-15 00:54:08
Hey,

The game is pretty good so far.  I've done a couple of levels, and am planning on completing the whole thing, but I would just like a bit more clarification on a couple of things I thought weren't completely addressed.  First off, is there a keyboard key for dropping the block?  This part might have been in the directions, but I accidently skipped through some instruction and had no way of replaying it.  It seems like there should be, since the drop button is very inconvenient to use.

The only other problem I ran into was learning how to switch tools.  I'm posting this while playing the tree level and the game automatically provides the block mover tool.  This seems handy, but I was unable to win because I had one block out of place, and moving it around didn't solve anything.

Also, is there a way to store blocks for later use?  This functionality might be removed from the level I'm on, but it seems like something that should always be present.

One thing that really jumped out at me is the smoothness of the overall design, especially the way the game handles transitions and such. The textures, backgrounds, and sound effects you used were pretty good.  The only thing I would chane regarding these aspects is the initial spiraling background, which made me a bit nauseous.  If you were to slow the rotation down a bit, I bet it’d be a lot more complimentary, rather than detrimental to the over all effect.
10  Java Game APIs & Engines / Java 2D / Best way to load / Use sprites on: 2009-10-15 00:39:53
Hey guys, I've been wanting to incorporate more animation into my game, but I can't really figure out a good method of doing so.  As of now, I break up single .png images into smaller components, and then use those, but this method requires pixel-perfect alignment to work, which is a very tedious process.  This also makes it difficult to perfectly line up the sprites, especially for a quick demo.

Basically, the question boils down to:
What system do you guys use of loading and breaking up 2d frame by frame sprites into various components, and how would one do so without extensive pixel alignment?
11  Game Development / Game Play & Game Design / Re: Proposition - Game Testing Exchange System on: 2009-10-12 00:34:45
Sure, I'll work from the report.  Feel free to pm me it, or drop me an email @ eugene.raether@yahoo.com.

You not having much experience in the genre is perfectly fine.  In fact, it might even be advantageous since it will help me assess just how graspable the game is for a beginning player.
12  Games Center / Showcase / Re: Cremelian Wars X - My first game on: 2009-10-11 18:03:18
Haha, thanks.

I began working on the game after I had completed Computer Science A, which was a little more than a year ago.  This is one of the early screenshots of it:


Before I knew java, this was actually a pen-and-paper game that you could play on graphing paper I made up maybe five years ago.  The idea has been kicking around for a while.
13  Game Development / Game Play & Game Design / Re: Proposition - Game Testing Exchange System on: 2009-10-11 17:54:13
Count me in.  I agree that it is hard to find someone who will go into enough detail when providing feedback, so this seems like a great idea to get a proper response.  And considering that we're both game designers, this feedback will be even more relevant.

This is the game I'd like you to test:
http://www.java-gaming.org/topics/cremelian-wars-x-my-first-game/21315/view.html

I'll be able to check out your game either today or tomorrow.

14  Games Center / Showcase / Re: Cremelian Wars X - My first game on: 2009-10-10 18:21:10
Oops, you guys are right.  The game doesn't quit out when you lose.  I guess this is what happens when you build the game yourself lol.  You never lose. Cheesy

@insaneshane63
Alright, I'll get started on trying to fix it.  About the viking not attacking, could you tell me what level it happened on?  Thanks

@h3ckboy
Yeah, that's the plan.  I'm not sure how to host a website, or make one at the moment, so the .html file is just temporary until that's cleared up.

Just so you know, there's more than one level.  After you finish a level, click the campaign to go on to the next mission.

And lastly, yup, this actually is my first game.  I started working on it about the same time I started learning java. 

I'm glad that you guys like it!
15  Games Center / Showcase / Re: Cremelian Wars X - My first game on: 2009-10-07 21:20:14
It'd be great if someone could test this out.   Roll Eyes
16  Games Center / Showcase / Cremelian Wars X - My first game on: 2009-10-04 02:13:05
Hey guys, here is Cremelian Wars X.  It's a turn based strategy game that was inspired by both advanced wars and starcraft, and attempts to mix some elements from both games.

This game basically revolves around managing your units in order to deal the most damage to your opponent.  It features over 20 unit types, scriptable game play, a fully functional game editor, a custom sound track, and traditional pixel art!

What's changed since the last version:
- Fun, fully playable campaign
- Computer opponents will actually do something now!
- Completed map editor

So what're you waiting for?  Try it out today!
http://www.cremelianwars.zxq.net


-

-

I've been working on this game on and off for more than a year in my free time, and am happy to say that's in the final stages of development (i.e. content generation).  If you have any comments about the gameplay, or anything else in general, I'd love to hear what you think.

~Eugene R
17  Games Center / Showcase / Re: Cremelian War X on: 2009-07-18 20:19:55
Hi guys, I've recently had the opportunity to work on this again, and have put in a couple of new features that I'd like you to try out.

First off is the menu system, which is shown when you aren't playing a game.  It has three options, play the campaign, play custom maps, and input map data.  Here's how they work.  The campaign option leads you on five different missions that are supposed to take place one after another.  I've disabled victory so that you can try out the custom maps, so this option does not work as of now.

 The next and most important part of the menu is the custom map design, which works by taking in the name of the map and loading it.  The following maps have been made and are playable:
custom.map
level[1-5].map (ie level2.map etc)
versus[1-2].map (You can build on these!)

The last option on the menu is where you input map data, which allows you to resume a game that you didn't have time to finish.  While playing, press 's' to open up a dialogue box with the map data for the current map you're playing.  You can them copy and save this code somewhere, and paste it into the load map data option when you want to resume playing.  This should recreate the map you were playing perfectly.  If it doesn't, paste the map code here and I'll try to correct the problem.

I hope you guys try out this version!  (ARG dang broken message posting... makes it impossible to type out a message longer than this Sad
18  Game Development / Newbie & Debugging Questions / Re: Code Review - of project so far on: 2009-07-10 03:32:46
I didn't look at the actual code, but these are the things I feel should be worked on, judging from running the game:

1) FPS should always be on top.  I doubt 0 frames were skipped as well, as that would indicate that the FPS was some sort of constant value the entire time, which it wasn't.

2) most of the images didn't load

3) jumping feels very sluggish

4) It's hard to turn your guy

5) The colors and textures really need more work

6) flicker is visible when repainting the climbable obstacles

7) what are you playing as?  It looks like some sort of a plane, which doesn't make sense if it's a platformer.
19  Games Center / Showcase / Re: Cremelian War X on: 2009-06-02 21:11:46
Alright, extremely basic mp3 audio works now!  The problem seemed to be packaging the jlayer file inside the cremelianwars jar.  Now to work on some game scripting.
20  Games Center / Showcase / Re: Cremelian War X on: 2009-05-30 01:04:18
Thanks.  It seems that I might have deleted the actual jar from the source code package, so you can download it here:
http://www.javazoom.net/javalayer/javalayer.html

Interesting tip about the thumbs files too.  Always wondered why those were created.
21  Games Center / Showcase / Re: Cremelian War X on: 2009-05-28 21:38:08
lol that's interesting...  I extracted the contents of cremelianwars.jar, and apparently it didn't have a jlayer jar file in it.  Strange.

Anyways, you can take a look at the source code here:

http://cremelianwarsx.googlecode.com/files/CremelianWars.zip

I've never actually gotten any .mp3s to play, since java raises a security exception when running in an ide, and has never successfully loaded any in a signed applet, but I assume the JLayer package is working like it should.
The main runner file is called CremelianWarsDemoMap, and it tries to pass the song names on line 98 to a class called MP3, which is located in the ResourceManagement folder, during init().

Thanks for your help.  Anyone else is free to take a look if they want, too.
22  Games Center / Showcase / Re: Cremelian War X on: 2009-05-28 01:53:56
Time for an update.  I spent most of today working on this, and have a couple of things to show for it.  First off, there is finally someone to do the pixel art, which is a big plus.  Secondly, the game loads a bit faster, and any additional levels that are loaded after the first should now be able to take advantage of the resources used in the last map to furthur decrease the map loading time.

Some basic scripting has also been implemented.  This part is fairly exciting, since doing a good job on the scripting, and eventually releasing a map editor, can allow a game to really thrive.  The scripting engine is based around triggers, which will execute all their actions(commands) if all the preconditions are first met.

These conditions have been coded:
Always, Never, Accumulate, Bring, and Control.
Which can impact the map in the follow ways:
Defeat, Draw, Victory, Preserve Trigger, and Resource Modification.

Enjoy.
23  Games Center / Showcase / Re: Cremelian War X on: 2009-05-27 21:06:12
@Red27

The .html file was on the desktop, as well as the JLayer jar.  However, when I deleted the JLayer package off the desktop, the error remained the same.  I'm not sure what you want to know from the contents of the CremelianWars.jar file, but it contains all the necessary graphics, classes, and files to run the game, which are all subdivided into folders.  The JLayer jar was placed inside a folder called ResourceManagement.  You could extract the contents and take a look if you want.

@Mickelukas
Thanks for testing!  I'm relieved that the fps is a lot higher than the 8 fps I'm used to.
There are plans on getting this game set up on its own website, but there isn't much of a need for that until we implement multiplayer capability. 

@appel
Does the screenshot simply not load, or is it resized?  Regardless, you could see how the game looks like by just running it.  It takes about 5 seconds to load the game from start up.
24  Games Center / Showcase / Re: Cremelian War X on: 2009-05-27 03:01:21
Thanks for the info.  I tried doing something similar with a package called JLayer, but it consistently gives me the following error message:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
Exception in thread "Thread-14" java.lang.NoClassDefFoundError: javazoom/jl/player/Player
   at CremelianWars.ResourceManagement.MP3$1.run(MP3.java:54)
Caused by: java.lang.ClassNotFoundException: javazoom.jl.player.Player
   at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClassInternal(Unknown Source)
   ... 1 more
Caused by: java.io.FileNotFoundException: C:\Documents and Settings\Eugene Zhurilo\Desktop\javazoom\jl\player\Player.class (The system cannot find the path specified)
   at java.io.FileInputStream.open(Native Method)
   at java.io.FileInputStream.<init>(Unknown Source)
   at java.io.FileInputStream.<init>(Unknown Source)
   at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
   at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
   at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
   at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
   at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   ... 5 more
basic: Removed progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@21b6d
Exception in thread "Thread-15" java.lang.NoClassDefFoundError: javazoom/jl/player/Player
   at CremelianWars.ResourceManagement.MP3$1.run(MP3.java:54)


This is the .html file, with the JLayer package inside of the CremelianWars package.  Could there be a problem with the way the .html is set up?

1  
2  
3  
4  
5  
<APPLET CODE=CremelianWars/CremelianWarsDemoMap.class
     ARCHIVE="CremelianWars.jar"
     WIDTH=800
     HEIGHT=600>
</APPLET>
25  Games Center / Showcase / Cremelian War X on: 2009-05-26 02:39:17
Here is Cremelian Wars X, a turn based strategy game that puts you right in the action as you command and grow your army to defeat all that oppose you.  This game features over 20 unit types, scriptable game play, a fully functional game editor, a custom sound track, and traditional pixel art!


Current Gameplay screenshot:

Download Link
http://cremelianwarsx.googlecode.com/files/Cremelian%20Wars%20X%20v0.19b.zip

Completion:
[||||||||||] 46%


Version 0.12 (5/25/09)
Click Here to Download!

- initial release


Version 0.13 (5/27/09)
 Click Here to Download!

-added some trigger implementations
-added 4 more maps to play (I'd recommend starting on level 1, they get progressively harder)
-added more units


Version 0.19b (7/18/09)
Click Here to Download!

-added a main menu
-added undo move
-factories and airports can now build units
-infantry can now enter transports
-updated runner.html



Still to be done:
- (64%) Scripting
- (85%) (+19%)Mp3 play back
- (31%) (-42%) Map editor
- (01%) Online play
- (28%) (+6%) Sprites
- (55%) Additional sound effects
- (00%) AI
- (94%) (+9%)Pathfinding


If you download, please post what your first impressions were, as well as the fps, ups, and any errors you might have encountered. Suggestions about how to improve this game and make it more fun are always welcome, too.
Thanks

(PS, this is a two player game, so try to find a friend or coworker to play with.)
26  Game Development / Newbie & Debugging Questions / Re: Need some help with a project I'm working on on: 2009-05-02 20:13:13
Thanks for the info.  Lol i never knew you could call this() within a class. 

I tried to do something similar to your framework, except with all the Actions and Conditions being defined in different classes.  It did seem like I was writing a language inside a language, but there were only four different Parameter classes needed to define all the functionality needed, which were Quantity, PlayerParam, UnitParam, and Area, so it wasn't that big of a deal.  The main classes were implemented like so:

Parameter:
1  
2  
3  
4  
5  
6  
7  
8  
9  
   package CremelianWars.Triggers;
 
  /*A parameter is used to test various pieces of data that are sent to Condition
  objects.*/

    public interface Parameter{
   
       public boolean test(Object other);
   
   }

Quantity:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
   package CremelianWars.Triggers;
 
  /*Consists of a number, and the following tests:
  at least
  at most
  exactly*/

 
    public class Quantity implements Parameter{
   
      public static final int AT_LEAST = 0;
      public static final int AT_MOST  = 1;
      public static final int EXACTLY  = 2;
   
      private int value = -1;
      private int comparison = -1;
     
       public Quantity(int val, int comp){
         super();
         value = val;
         comparison = comp;
      }
     
       public boolean test(Object other){
       
         if(other == null)
            return false;
         if(!(other instanceof Integer))
            return false;
     
         Integer input = (Integer)other;
         
         if(getComparison() == -1)
            return false;
           
         if(comparison == AT_LEAST)//num must be greater or equal to comparison
        {
            if(input >= new Integer(value))
               return true;
         }
         else if(comparison == AT_MOST)//num must be less than or equal to comparison
        {
            if(input <= value)
               return true;
         }
         else if(comparison == EXACTLY){//num must equal comparison
           if(input == value)
               return true;
         }
         
                 
         return false;
      }
     
       public boolean test(int num){
         return test(new Integer(num));
      }
   
       public int getValue(){
         return value;
      }
     
       public int getComparison(){
         return comparison;
      }
   }


Condition:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
   package CremelianWars.Triggers;
 
 
   import java.util.*;
 
 
  /*Tests a list of input data against the data this condition was defined with.
  It uses Parameter objects to test one another*/

    public abstract class Condition{
     
      public static final int SINGLE = 1;
      public static final int MULTIPLE = 2;
      public static final int CONTINUOUS = 3;
   
      protected ArrayList<Object> parameters;
     
       public Condition()
      {
      }
     
       public abstract boolean isMet();
       
       public void setTestData(ArrayList<Object> params){
         parameters = params;
       
      }
   }


Action:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
   package CremelianWars.Triggers;
 
    public abstract class Action{
      int timesExecuted  = 0;
   
       public abstract boolean run();
   
       public int getNumExecutions(){
         return timesExecuted;
      }
   }


A class that extends Condition:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
   package CremelianWars.Triggers;
   
   import CremelianWars.*;
   
   /*Tests of a given player has accumulated a certain amount of funds:
   -----------------------------------
   Requires PlayerParam, Quantity
   Tests    Player
   */

    public class Accumulate extends Condition{
      PlayerParam activePlayer;
      Quantity compQuantity;
   
       public Accumulate(PlayerParam p, Quantity q){
         super();
         activePlayer = p;
         compQuantity = q;
      }
       public boolean isMet(){
         try{
            Player p = (Player)parameters.get(0);
            if(activePlayer.test(p))
               if(compQuantity.test(p.getFunds()))
                  return true;
         
            return false;
         
         
         }
             catch(Exception e){
               System.out.println(e);
               return false;
            }
     
      }
   }


Basically, this implementation just cascades tasks to break them up into smaller and smaller segments, them being trigger -> condition -> Parameter.  But because all of the conditions deal with different things, it seemed like a good idea to use an ArrayList of objects.  Since that's the case, though, its almost impossible to make these function within some sort of a loop, since they all have variable needs.  Typing them out isn't easy either.  I tried implementing the system, and it took a good deal of work to make the system perform a simple task, which looked like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
   package CremelianWars.Triggers;


   import java.awt.*;
   import java.util.*;


   import CremelianWars.Unit.*;
   import CremelianWars.*;

    public class TriggerTest{
       public static void main(String[] args){
       
         Random rand = new Random();
       
         Trigger t = new Trigger();
       
       //The initialized player's turn is set to 3
        Player p = new Player(3, false);
         
         
         //A map is filled with units controlled by randomized players
        GameMap map = new GameMap(3,3);
         for(int x=0;x<map.getWidth();x++)
            for(int y=0;y<map.getHeight();y++)
               map.getLoc(new Point(x,y)).setUnit(new Unit(2,2,rand.nextInt(4),2));
         
         
         //Creates three necessary Parameters for the control condition
        Parameter unitParam= new UnitParam(-1, UnitParam.UNIT);
         Parameter playerParam = new PlayerParam(p.getTurn(), PlayerParam.SPECIFIC);
         Parameter quantity = new Quantity(2, Quantity.AT_LEAST);
         
         //Creates the conditions from the parameters
        Condition control = new Control(unitParam, playerParam, quantity);
         Condition elapsed = new ElapsedTime(new Quantity(2, Quantity.EXACTLY));
         
         //adds the conditions to the Trigger
        t.addCondition(control);
         t.addCondition(elapsed);
         
         //sets the test data for the Control condition
        ArrayList<Object> input = new ArrayList<Object>();
         input.add(map);
     
         control.setTestData(input);
         
         
         //sets the test data for the ElapstedTime (in turns) condition
        ArrayList<Object> elapsedInput = new ArrayList<Object>();
         elapsedInput.add(new Integer(1));
         
         elapsed.setTestData(elapsedInput);
         
         
         System.out.println(t.allConditionsMet()+","+control.isMet());
         System.out.println(elapsed.isMet());
      }
   }
   




 Which brings me to my next point of how to use them in a map editor.  I suppose there could be a toString method associated with each, as well as a buildFromString method, so the user could type them in.  XML would probably work better, but the map is already loaded using a similar method dealing with break chars.  So, does there need to be some sort of a static factory method to create these, or do you guys see another way?

Oh yeah, and in the above piece of code, below the comment:"//Creates the conditions from the parameters",
The compiler displays that its illegal to pass those three Parameters to the Control Condition. It would probably be beneficial if there was someway around this, as to allow for more generic objects to be passed.

The Control condition is defined like so:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
   package CremelianWars.Triggers;
   
   
   import java.util.*;
   
   import CremelianWars.*;
   import CremelianWars.Unit.*;

   
   /**Tests if a player has a certain amount of units:
   -----------------------------------
   Requires UnitParam, PlayerParam, Quantity
   Tests    GameMap
   
   This method loops through the game map, getting every location, testing if
   the unit it contains meets the test of the unit parameter, and if it does,
   adding it to a total, which is then tested against a quantity.
   */

   
   
    public class Control extends Condition{
      UnitParam   unitParam;
      PlayerParam playerParam;
      Quantity        quant;
   
       public Control(UnitParam u, PlayerParam p, Quantity q){
         super();
         unitParam   = u;
         playerParam = p;
         quant       = q;
      }
       public boolean isMet(){
         try{
            GameMap map = (GameMap)parameters.get(0);
           
            ArrayList<Unit> allUnits = map.getAllUnits();
           
            int controls = 0;
           
            for(Unit u : allUnits){
               if(unitParam.test(u))
                  if(playerParam.test(u.getPlayer()))
                     controls++;
            }
           
            if(quant.test(controls))
               return true;
         
            return false;
         
         
         }
             catch(Exception e){
               System.out.println(e);
               return false;
            }
     
      }
   }
27  Game Development / Newbie & Debugging Questions / Re: Need some help with a project I'm working on on: 2009-05-01 01:07:47
Right now I'm trying to implement triggers, and would like some input on the following way of doing it.  Essentially, the trigger class runs all Action objects stored in it if all Condition objects are met.  So it would perform some sort of loop through the set of conditions, and if all were met, then it would loop through all actions, running each one.

So, a Condition could be something like... having the least amount of funds, having the most units in total, bringing exactly 3 units at a certain location, and an Action could be something like give player $50, create a unit for the player, etc.

However, in order to do something like that, you would have to have some sort of Parameter objects for each Condition.  For example, in the following condition (Current Player) brings (at least) (5) (Infantry) to Location (Bring units here!), all the things in the parenthesis should be parameters.  As they are not numbers, though, I'm not sure how to construct it so it works like that.  I suppose there could be a Quantity extends Parameter object, which could have final ints like AT_LEAST, EXACTLY, AT_MOST, and then an actual value.  Which means that a condition must be able to call a parameter with some sort of a value, say, an int, which should return true if that value meets the conditions, or false other wise.

And for the (infantry) parameter, there could be a UnitParameter, which returns true if a unit its sent meets the data it was initialized with.

It seems like that would most likely be the exact same thing that should be done with Action objects, so perhaps both of them should extend some super class.  Not sure though.


Oh yeah, and for (bring units here!) there could be an Area object, with data types such as a starting point (2,2) and an ending point (5,5), as well as a name.  This would work for testing if an object is in those bounds, but I'm not sure how it would work for creating objects in those bounds.

So, what do you guys think?  Any suggestions before I try to implement this?
28  Game Development / Newbie & Debugging Questions / Re: Need some help with a project I'm working on on: 2009-04-29 19:47:55
Hmm..  This seems like it could work, or at least something that could be built off of, so thanks for the link.  I'll try implementing it some time next week.  (Gotta study for the actual computer science AB exam first!)

To pjt33:
Yeah, that's exactly how I'm doing my spriting stuff too.  At first I used a color image method that would merge two colors together, but this would also effect the color black (which should always stay black to give something its outline), so I decided on grayscale.  However, this forces you to do everything pixel by pixel, which does take forever.  Now that I think of it, however, it could be possible to convert an image to grayscale using a filter, and then run it through this method.  I'll go try it now.

If any of you are curious, here is what the marine idle animation looks like before its colored:

And then colored:



EDIT:
Grayscale on non-hand drawn images doesn't work that great.  They only look decent when the saturated image has the same color as the original image.
Original:

Randomly colored:

29  Game Development / Newbie & Debugging Questions / Re: Need some help with a project I'm working on on: 2009-04-28 01:34:39
Well, it's been a while, but I think I've accomplished enough work on this to post an update.  As I stated in my first post, this is my first game, so I would like to post what I have so far and see if anyone can run it.  It's an applet, so even though a program might function inside an IDE, it might crash outside of one, which is why I would like some users to test it.  However, I don't have a website, so would like some suggestions about how to put it up for download.

Here's a screen shot:


Regarding the actual game programming, however, I also have a couple of questions that I've had difficulty finding the answers too.  As of now, there are no objectives of any sort, because I wanted each map to be dictated by various triggers encoded into the map.  For example, there could be triggers not just for Mission Victory/ Mission Defeat, but instead, stuff that would also allow scripted events to happen, like if a marine is brought to location 2,2, a moving tank appears for, say, player 1.

Has anyone ever implemented a system like this, or something similar?

Also, I'm drawing a complete blank with how to code TBS ai.  I suppose it only has to be calculated once, but I'm not sure what exactly goes into making a fully functioning ai, that will move units, build structures, and finally end its turn. 

I'm really excited about this game, and can't wait to finish up the complete version!   By the way, if any of you are curious, this game was completely rewritten from the ground up.  The old version was scrapped a few days after demonpant's post, which made me realize just how much my code was repeating itself just to perform a simple task.  It's currently 6000 lines of uncommented code, and like 8k commented.
30  Games Center / Featured Games / Re: Virus Effect (2D Platformer RPG Shooter) on: 2009-01-18 17:43:50
Dude, virus effect is an awesome game, I really enjoyed playing it (#8 on leaderboards lol), but here are some quick things off the top of my head that you might want to consider changing:

You should give the gravity gun some other effect so that users are tempted to use it.  Other guns, such as the grenade launcher, are just much more useful.  You could add a bunch of secret areas to make it worth while, or upgrade it so that it paralyzes the hit enemy units.

Next is the flamethrower, which also feels a bit watered-down.  You should give it a higher base damage if it has one, as catching an enemy on fire is fairly easy, but it takes for them too long to die.  Another effect that might be good is that fire will continue travelling after it hits a target, so that you can really create the apperance of a fire storm.  This would be great on that intro level with the huge mass of boxes.

You might want to tone down a bit how much an enemy flies back when shot, or make it based on the weapon strength and the enemy weight, since rapid fire weapons seem to send enemies flying (especially the last boss on level 7).  You could also add some code to remove some of the stacking that occurs when several enemies are chasing you at once, which is especially noticable with blobs.  That's basically it for monsters Grin

Some other things I've seen are that the mouse scroll will move the page, that the background music heavily impacts the game's performance, and that often times those health and armor powerups get stuck under a stack of boxes, which gives it an unrealistic feeling.

This game is already great, but imo with some of those things buffered out, it can really get popular.  Your 'X' version is comung along great too, can't wait to see it.
Pages: [1] 2
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (23 views)
2014-08-22 19:31:30

atombrot (34 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (28 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (27 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (41 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!