Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
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]
1  Discussions / Miscellaneous Topics / Re: Yippieeee! Got my new Graphic card! on: 2013-06-25 22:36:40
The nice thing about having an integrated graphics card as well as a dedicated one, is that if the dedicated ever craps out on you your computer isn't fully out of commission.  You can still boot up and use your computer, back things up, and do light weight computing/gaming while waiting for a new graphics card.

For a few extra dollars, I would definitely always consider getting a motherboard with integrated graphics just to have it as a fallback option.

As for me, I used to use an Intel GMA945 until last year, which is when I upgraded to an Intel HD3000.  My tower has a Radeon HD 6770, but I use that computer more for art and processing than I do game design.
2  Games Center / Showcase / Re: the sunset - LD26 game on: 2013-06-25 22:29:02
Several Google searches failed to find out what "Necro Rampage" means, outside of WoW.

"Necroing" meaning raising from the dead.  You are raising dead posts from the depths of the forum for seemingly no constructive reason.
3  Games Center / Showcase / Re: [Web][PC] DRINK - A One Button Game on: 2013-06-25 22:26:34
Ah, sorry, the url tag didn't work as I expected it to.  Links should be fixed.
4  Java Game APIs & Engines / Engines, Libraries and Tools / Re: libGDX - each frame with individual frame duration on: 2013-06-25 19:06:27
Best would just be to create your own Animation class for something like that.
http://pastebin.java-gaming.org/7f8d73c2a6c

5  Game Development / Newbie & Debugging Questions / Re: File reading for save function on: 2013-06-24 21:36:25
In your block class, it might just be best to have the parsing of the string in there as a constructor

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
public class Block
{
   int x, y, blocktype;

   public Block(String data)
   {
       //we make sure to use regex so add a little bit of lenience to parsing
      String[] parsedData = data.split("/[, ]+/");

       this.x = Integer.parseInt(parsedData[0]);
       this.y = Integer.parseInt(parsedData[1]);
       this.blocktype = Integer.parseInt(parsedData[2]);
   }
}


If ever it throws an exception, then we just won't add the block to your array and the garbage collector will pick it up.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
ArrayList<Block> blocks = new ArrayList<Block>();

try (BufferedReader br = new BufferedReader(new FileReader(filepath)))
{
    String line;
    while ((line = br.readLine()) != null)
    {
        try
        {
            Block b = new Block(line);
            blocks.add(b);
        }
    }
}


Thanks to try-with-resources, we can easily jump through a bufferedreader and have it automatically close when we're done.  It keeps the code looking a lot cleaner.
6  Games Center / Showcase / [Web][PC] DRINK - A One Button Game on: 2013-06-24 05:15:34
This was one of my first full Java games.  I designed, did the art, and programmed it all within 6 hours over a year ago using Java2D.  Since then, I have ported it between Slick2D and LibGdx.  You can play it either through a web-applet available through the github page and a runnable desktop application



STORY
--------------------------------------
Nick is the hero of this game. His goal is simple, to drink as much OJ as he can while the dark, rule enforcing body known simply as Girard tries to stop him. Girard is the main enemy of Nick's heroic quest to drink OJ in a room where drinking and eating is not allowed. He is the only thing standing in your way between freedom from rules and the oppressive system. In fact, he is the system, and he's there to put Nick down. Lucky for Nick, Girard gets distracted very easily, so while he's busy playing League of Legends and Runes of Magic, make Nick chug as quickly as you can.

HOW TO PLAY
--------------------------------------
Chug away while Girard is busy fiddling with his laptop. You can tell by a variety of visual signals of when he's looking around the room and when he is playing his games. When the red bar appears above Girard's head, that's a time meter that indicates when he becomes fully aware of his surroundings. In that time you need to slow down drinking the OJ and put it down and away.

Here's the tricky part. The faster you're chugging your OJ, the longer it takes to put it down, else you'd blow your cover by gasping for air. As soon as that bar appears, put the OJ down.

There's two numbers in the corners of the screen. There's the time listed, which says how much time you have spent chugging OJ, and the other is how many fluid ounces of OJ you have "dranked". There is no end game other than being caught, just keep drinking.

Features
--------------------------------------
-Cute and simple pixel style
-Based on a true story
-sweet spacebar pressing action
-SWEET spacebar Tapping action
-Sweet spacebar action
-sweet action
-spacebar action
-sweet spacebar
-action tapping spacebar sweet
-orange juice

Github page: http://git.io/TxiCxA
7  Game Development / Newbie & Debugging Questions / Re: Tile coords on: 2013-06-23 23:23:06
First of all, let's assume your tile class looks like this, or something along these lines.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public class Tile
{
    public final String name;
    public final BufferedImage image;
    public final boolean passable;

    public Tile(String name, URL imagePath, boolean passable)
    {
       this.name = name;
       this.image = new BufferedImage(ImageIO.read(imagePath));
       this.passable = passable;
    }
}


I don't care if we might load the properties from a file or what, as long as it has at least these things in it


In your map rendering thing, you could have a parallel 2d array

1  
2  
3  
4  
5  
6  
7  
8  
Tile[] tileSet = {all my different tile types};
int[][] tiles = {
  {0,0,0,0,0},
  {0,1,1,1,0},
  {0,1,2,1,0},
  {0,1,1,1,0},
  {0,0,0,0,0}
}


Your tile set is just all your different tile types in the map.  Tiles is an array where all the numbers match with the index of the tile type in tileSet.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
public void render(Graphics g)
{
    ...
    //graphics prep stuff
   ...
    for (int row = 0; row < tiles.length; row++)
    {
        for (int col = 0; col < tiles[0].length; col++)
        {
            BufferedImage image = tileSet[tiles[row][col]].image;
            graphics.draw(image, row*Tile.WIDTH, col*Tile.HEIGHT);
        }
    }
    player.sprite.draw(g);
    batch.end();
}


Now, depending on how complex of pathfinding you need, all you might need to do is check the position in your array.  I recommend having an enum of Directions

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public static enum Direction
{
    North(0,-1), South(0, 1), East(1, 0), West(-1, 0);
   
    public final int x;
    public final int y;
   
    Direction(int x, int y)
    {
        this.x = x;
        this.y = y;
    }
}


Then check a tile collision like so

1  
2  
3  
4  
public boolean doesCollide(int x, int y, Direction d)
{
    return tileSet[tiles[x + d.x][y + d.y]].passable;
}


Each tile type just needs to have a boolean set on it saying if you can step on it or not.  More complex collision detection idea where tiles can only be passable from certain directions can work the same way.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
[code]
public boolean doesCollide(int x, int y, Direction d)
{
    boolean passable;
    Tile t = tileSet[tiles[x + d.x][y + d.y]];
    switch(d)
    {
        case (North):
            passable = t.passableFromSouth;
            break;
        case (South):
            passable = t.passableFromNorth;
            break;
        case (East):
            passable = t.passableFromEast;
            break;
        case (West):
            passable = t.passableFromSouth;
            break;
    }
    return passable;
}


but requires for values to be set with each tile.


Now if you're doing pixel movement of your character, you can take their pixel position and integer divide it back into the array position and use the same collision detection as above

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
/**
 * Movement by pixels
 */

public void move(Direction d)
{
    if (doesCollide((int)(player.sprite.getX() / Tile.WIDTH) , (int)(player.sprite.getY() / Tile.HEIGHT), d)
    {
       player.sprite.translate(d.x, d.y);
    }
}


and if you don't want to do it by pixels, and instead just by full tiles
1  
2  
3  
4  
5  
6  
7  
8  
9  
public void move(Direction d)
{
    if (doesCollide(player.x , player.y, d)
    {
       player.x += d.x;
       player.y += d.y;
       player.sprite.setPosition(player.x * Tile.WIDTH, player.y * Tile.HEIGHT);
    }
}


That should be enough to handle simple tile maps and collision.  I remember doing something along the same lines awhile ago with another project of mine.  If you want to check it out, it's an RPG engine written using Java2D http://git.io/LQiAFg[/code]
8  Games Center / WIP games, tools & toy projects / Re: Beatshot: An 8-bit shmup w/ Beatmania controls on: 2013-06-23 03:06:56
I've decided to start working on a configuration tool for this.  I decided to do this so I don't have to have controller and keyboard profiles hard coded in my game for all the different layouts and controllers people will want to play with.

The configuration tool will run on first-time run or if the beatshot.conf file is not found.  You will also be able to run it as a separate application whenever you want.

Conf file will just be a basic Java Properties file formatted like so

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
#Music Directory
MUSIC_PATH=/absolute/path/to/your/music/

#Video Settings
SCALE=2

#Sound Settings
BGM_VOL = 10
SFX_VOL = 7

#Input
LEFT=Arrow_Left
RIGHT=Arrow_Right
LASERS=a,s,space,d,f
START=return
ACCEPT=a,space,f
CANCEL=s,d


Accept and cancel are assumed to be the "white" and "black" beatmania keys respectively when defining laser buttons, but can not be set individually in the config tool.  You can still manually change it by opening the file in notepad.  This is decided just for consistency sake.  Controls are also specified by keycode.

You will also now be able to specify a directory for your own music to play during endurance mode.  If the directory does not exist, or there are no songs in the directory, it will just play the level's music on repeat.


Aside from deciding to work on the configuration tool, I've also planned some simple new features.

I've also decided to add a new value to spawn sets, you will be able to have a warning pop up when the wave to come you deem as hard

1  
2  
3  
4  
<path
    ...
    warning="true"
    />


This warning will pop up in both endurance mode and story mode.

Levels will also be able to have multiple songs specified to cycle through as you play the level.  Bosses are also allowed to have their own song that plays.  These only matter in story mode.

1  
2  
3  
4  
5  
<level
    ...
    boss_music = "boss.mp3"
    music = "song001.mp3, song002.mpg, song003.mp3"
    />


I'm going to be creating a tag on the git soon to mark version 0.1.  This will come before all these changes are implemented, and will come with a compiled version of the game for people to play without having to compile it themselves.  It won't be much different from what was played at Too Many Games other than a few small bug fixes.
9  Game Development / Newbie & Debugging Questions / Re: Animations with Java2D on: 2013-06-21 18:30:05
Well, for you player you probably only want one active animation playing, and you only need to update it during the update method

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
public class Player extends Sprite implements Renderable, Actor
{
   ...
   private Animation activeAnimation;
   ...

   public void update(long deltaTime)
   {
       activeAnimation.update(deltaTime);
   }

   public void render(Graphics g)
   {
        Image i = activeAnimation.getFrame();
        if (i != null)
            g.drawImage(i, transform);
   }
}


Also make sure your sprite class has a protected AffineTransform in Sprite that you're operating on when you do things like set position and scaling of the sprite.

In your game loop, you just need to alter it like so

1  
2  
3  
4  
5  
6  
7  
8  
9  
private void update()
{
    world.update() //or whatever you do to set the current delta time
   for (int j = 0; j < actorList.size(); j++)
    {
      actorList.get(j).calcBehav();
      actorList.get(j).update(world.deltaTime);
    }  
}
10  Game Development / Newbie & Debugging Questions / Re: Animations with Java2D on: 2013-06-21 17:28:28
In your update method just leave out the while-loop

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  
  /**
   * Must be called to update the animation
   *
   * @param deltaTime The time passed since the last call to it.
   */

  public void update(long deltaTime)
  {
    if (frames.size() > 1)
    {

      if (isDone())
        return;

      currentTime += deltaTime;

      if (currentTime > totalTime)
      {
        if (looping)
        {
          frameIndex = 0;
          currentTime = 0;
        }
        else
        {
          frameIndex++;
        }
      }
    }
  }


Now whenever you call your game's render/update method and you just feed the delta to the animation there.
11  Game Development / Game Mechanics / Re: Inter-Entity Communication in an Entity System on: 2013-06-21 16:40:38
There's two good examples that I can think of for doing this, and it comes mainly from working with Artemis in my most recent project.

The first way I learned from the one game example link they have on their website
http://code.google.com/p/spaceship-warrior/

In that one, anything that's collidable have a "Bounds" property and is either a player or enemy.  On every update cycle, it checks all entities, if it's a player it iterates through the enemy list to find which one it collided with and interacts directly with it within the system, and vise versa if it was a player.  I did this approach with my own vertical shooter because it works rather well.

The other way I can think of would be good if you were doing something like a turn-based RPG, where you have something like an "Attack" component that could look like this

1  
2  
3  
4  
5  
6  
7  
8  
public class Attack
{
    final Entity target;
    public Attack(Entity target)
    {
        this.target = target;
    }
}


Whenever you would set a target you would then add the component to the actor attacking.

1  
2  
e.addComponent(new Attack(myTarget));
e.changedInWorld();


Be sure to use e.changedInWorld() to ensure all systems in the world have their lists updated so they know it has the attack component now.  Then you have an AttackSystem that'll process everything with Attack Components

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  
public class AttackSystem extends EntityProcessingSystem
{
    public AttackSystem()
    {
        super(Aspect.getFor(Attack.class));
    }

    @Mapper ComponentMapper<Attack> attacksMap;

    protected void process(Entity e)
    {
        Attack a = attacksMap.get(e);
       
        //some example battle logic for you
       Strength str = e.getComponent(Strength.class);
        Defense def = a.target.getComponent(Defense.class);
        int dmg = Math.max(str.value-def.value, 0);

        Health hp = a.target.getComponent(Health.class);
        hp.value -= dmg;

        //be sure to do this when you're done so it doesn't
       //process this attack multiple times
       e.removeComponent(a);
        e.changedInWorld();
    }
}


I can't stress enough that the second way is not something you would want to do in a real-time interaction scenario.  Adding and removing components, and having to update the world and all systems to recognize that change is extremely expensive.  In fact, it's probably not a good idea to use for such a heavily hit system as the example provides.  

Nevertheless, it does show how to do a level of interactive one-way coupling of entities.  By linking using components, you can actually reference the other entity even outside of systems by just getting the component from the parent entity using the getComponent method.

I hope those two ways help you in understanding Artemis
12  Game Development / Newbie & Debugging Questions / Re: DrawArrays work fine, yet DrawElements doesn't? on: 2013-06-19 03:46:21
Please look over documentation on both OpenGL functions

http://www.opengl.org/sdk/docs/man/xhtml/glDrawArrays.xml
http://www.opengl.org/sdk/docs/man/xhtml/glDrawElements.xml

Your problem most likely stems from the fact that you're not passing a proper indices array when using DrawElements, so it doesn't know the order or the obj's vertices.  glDrawArrays assumes an order depending on the set mode.

I also recommend using GL_TRIANGLE_STRIP instead of GL_TRIANGLES for efficiency.

http://www.opengl.org/discussion_boards/showthread.php/173362-GL_TRIANGLES-vs-GL_TRIANGLE_FAN-STRIP
13  Game Development / Game Mechanics / Re: Java2D rendering with BufferedImage RGB data on: 2013-06-18 17:04:30
When it came to changing the pixels of a BufferedImage, I just took the shortcut way and always did getGraphics() then drew directly to it while keeping a backup of the original loaded image somewhere in memory.  Of course I only did this occasionally due to the memory duplication.

Java2D does give you direct control over which pipeline you can use and what settings http://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-Desktop/html/java2d.html#gcghe

Only thing I can really recommend if you want to increase performance in your Java2D game is to be sure that anything off screen you systematically cull. If you're not accounting for the frame's dimensions and your current camera location, in your render loop you might still be rendering things that are not even being seen.
14  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Slick2D OpenGL Alpha Map problems on: 2013-06-18 06:02:18
2 4 things:
Think before you post.
Think harder before you post.
Think 10x harder than before you thought harder before you posted
Slick is a little outdated, and I see that you are just using lwjgl at this point. Here is some advice: If you know how to use those commands, slick2d is not for you. Go to libgdx. You will not regret it.
1. No
2. No
3. No
4. No

I say no to 4 because building your own framework may be harder, but you learn how to actually use core OpenGL. Do you know what all those functions in LibGDX do (or how they basically work)? If you don't, I would recommend strongly that you learn plain OpenGL and then use frameworks that build on top of it. What happens if LibGDX dies someday and there are no other libraries for Java and LWJGL? Well, you're screwed because you have no idea how to use basic LWJGL. I think ignorance of the OpenGL language would be solved partially if new people to the library would learn how to use OpenGL first before moving onto Slick2D, LibGDX etc...

Also, don't tell him to think harder. Everyone makes mistakes and he even admitted it. You are quite the newbie here too, don't go around telling others what to do.

Learning straight OpenGL takes a bit of work, but it really is worth it.  Have to admit, though, it took a little bit of stumbling to get used to OpenGL ES 2.0 and its shader reliance after only being used to OpenGL 1.4 for so long.
15  Discussions / Miscellaneous Topics / Re: Why do jar files not have icons? on: 2013-06-18 03:09:17
Jars are just archived files, much like a zip.  Executables can have independent icons because they're defined in the bit specifications for them.  Most other file formats have their icon assigned by the operating system.

You can create native binary executables for each platform and assign the icons within those, much like Eclipse has for itself.
16  Games Center / WIP games, tools & toy projects / Beatshot: An 8-bit shmup on: 2013-06-17 17:31:04
Hello there, recently I demoed at TooManyGames 2013 with Shippensburg University an 8-bit vertical shooter called Beatshot.

The game's main draw is that it's designed around the Beatmania controller to move your ship and fire 5 different lasers.  I developed it over the course of 2 weeks and like plenty of my other projects, have open sourced it for people to learn from.  If anything, it's just more of a vertical shooter framework than it is a full fledged game, but I might continue working on it to add some more features.




Libraries used:
  • LibGdx
  • Artemis Entity System

Features:
  • Svg Derived formats for defining spawn group locations, movement patterns, and (soon to be implemented) bullet patterns along paths
  • Xml files for defining enemy atlases
  • Parallax scrolling layered backgrounds in levels
  • A selection of Creative Commons songs found on the Free Music Archive to jam out to
  • Designed to be efficient and low memory friendly.

TODO:
  • Story mode with dialog support
  • Title Screen with support for choosing different modes
  • Endurance Mode selection screen for choosing which level to play through on Endurance mode.  Levels unlock as you complete them in story mode
  • Allow complex bullet and movement patterns through scripting with Lua
  • Built-in gamepad support so you don't have to use Joy2Key to use a Beatmania controller
Feel free to use the issue tracker to report bugs or request new features to keep me motivated on the project and going.

There is not yet a compiled version of the game.
You can grab the source from Github: https://github.com/nhydock/Beatshot

Right now there's only an endurance mode which will take the spawn formations from the first level and just keep repeating them in a random order.  Enemies also do not have complex bullet patterns yet, as they only shoot right at you.

Something to watch out for:
Textures are not Powers of 2 or sprite packed yet.  It's possible the game will not work with older graphics cards, like the Intel GMA 950.

Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

pw (11 views)
2014-07-24 01:59:36

Riven (10 views)
2014-07-23 21:16:32

Riven (11 views)
2014-07-23 21:07:15

Riven (12 views)
2014-07-23 20:56:16

ctomni231 (42 views)
2014-07-18 06:55:21

Zero Volt (38 views)
2014-07-17 23:47:54

danieldean (32 views)
2014-07-17 23:41:23

MustardPeter (34 views)
2014-07-16 23:30:00

Cero (49 views)
2014-07-16 00:42:17

Riven (50 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!