Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (407)
games submitted by our members
Games in WIP (293)
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 3 ... 6
1  Game Development / Newbie & Debugging Questions / Re: Finding nearest objects on: 2013-05-09 07:54:47
Would the performance of this be much better then something simple like this...

1  
p.distance(start)


Distance uses
Math.sqrt()
which is slow.
2  Java Game APIs & Engines / OpenGL Development / Re: Am i good student :D ? Hows the code? background drawing on: 2013-05-09 05:46:30
You still creating a new spritebatch every draw call. Initialize it once and use it twice. Maybe you could keep it in the Create method. Or in the draw method, use

1  
2  
if (spritebatch == null)
    spritebatch = new SpriteBatch();
3  Game Development / Newbie & Debugging Questions / Re: Player wall collision sliding problem [Need Help] on: 2013-05-07 17:16:51
Quote
I compute a separate step count per dimension (x, z)

Where did z axis come in? I thought this is a 2d game
4  Discussions / General Discussions / Re: New feature: necro thwarter on: 2013-05-07 16:43:37
It would be better to exclude the articles board also. Newbies can ask doubts on them.
5  Game Development / Newbie & Debugging Questions / Re: Game Versioning or Numbering on: 2013-05-07 09:49:11
There are several schemes of versioning. I catagorized them into six though the names I use aren't the originals.

  • Single version scheme
  • Double version scheme
  • Triple version scheme and
  • Quadraple version scheme
  • Year version scheme
  • Character-Number version scheme

Single version scheme


It just get's incremented by a single digit and the version is in the format
<major>
For example, take flash player. It's versions are 5, 6, 7, 8, 9, 10, and the recent 11. Even Java has this. Java 5, Java 6 and recent Java 7.

Double version scheme


It contains two stages in the version string.
<major>.<minor>
This is used to show also revisions of the software containing bugfixes. Example: Windows OS itself. Windows XP has 6.0 Windows Vista has 6.1 and Windows 7 has 6.2.

Triple version scheme


It contains three stages in the version string.
<major>.<minor>.<build>
Linux kernel, Apple OS X, the popular NSIS install system, uses this versioning number.

Quadraple version scheme


It contains four stages.
<major>.<minor>.<release>.<build>
This is the default version for executables used by windows. Though, the software uses it's own versioning, this is the format present in the Properties dialog of the windows executables.

Year version scheme


Some softwares which are released once an year can have the year number as the version. For example, MS Office 2003, 2007, 2010, 2013 and the popular system utils like TuneUP Utilities.

Character-Revision version scheme


Some softwares such as photoshop uses a custom implementation like
CS3
where CS denotes major and 3 denotes the revision number.
6  Discussions / General Discussions / Re: Hello to all :) on: 2013-05-06 16:46:13
The fun comes from creating -and finishing- the game, not from reinventing the wheel

It's also fun to learn the underlying things which you mean by reinventing the wheel.
7  Game Development / Newbie & Debugging Questions / Re: Problems with vertical tearing using Bufferstrategy FSEM on: 2013-05-06 15:47:16
Try with this. I just render normally and when contents lost not restored.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
public void drawScreen() 
{
     
    do { //ensures that the contents of the drawing buffer are consistent in case the underlying surface was recreated
           
        // get graphics object to draw on
       Graphics2D g = (Graphics2D) bs.getDrawGraphics();

        //render screen: Here I just and draw the background of the frame and the moving rectangle to g,
       renderScreen(g);

        //dispose the graphics
       g.dispose();
        //flip buffer
       bs.show();

        //sync display, fixes something on Unix
       Toolkit.getDefaultToolkit().sync();
         
    } while(bs.contentsLost()); // repeat rendering if the buffer contents were lost

}
8  Game Development / Game Play & Game Design / Re: Saving and reloading game state from a remote server on: 2013-05-06 15:35:46
I have a few questions about how you want to save. (loading is fine).

  • Save the whole game like the current map and the positions of each and every object?
  • Just save the current map number? (Most games do this)

If you are going to save the whole map state, then serialization is the best option. But I strongly recommend the second one. Just save the map number to a file and read it when you want to load your game.

As a side note, if I was playing a game and am I just going to lose some health, I save the game and closes it. I prefer to play from the first of the level again but if I was playing a game in which the saving is implemented in serialization, when I reload the game, I'll again fall and lose health.

I like the latter option and it's much easier too.
9  Game Development / Newbie & Debugging Questions / Re: Finding nearest objects on: 2013-05-06 09:05:02
@DrZoidberg, I've added benchmarking to your code.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
long ts = System.nanoTime();
List<GameObject> newList = new ArrayList<>(list);
long te = System.nanoTime();
System.out.println("Time taken for creating new list: " + ((te-ts)*0.000001) + "ms");
ts = System.nanoTime();
sortAndFilter(newList, GameObject.getX);
te = System.nanoTime();
System.out.println("Time taken for sorting x-axis: " + ((te-ts)*0.000001) + "ms");
long ts2 = System.nanoTime();
sortAndFilter(newList, GameObject.getY);
te = System.nanoTime();
System.out.println("Time taken for sorting y-axis: " + ((te-ts2)*0.000001) + "ms");
System.out.println("Time taken for sorting both the axis: " + ((te-ts)*0.000001) + "ms");
for(GameObject go: newList) System.out.println(go);

Here's the output

1  
2  
3  
4  
5  
6  
Time taken for creating new list: 0.054296ms
Time taken for sorting x-axis: 45.428871ms
Time taken for sorting y-axis: 0.023437ms
Time taken for sorting both the axis: 45.543712ms
pos = (100.0, 100.0) - size = (20.0, 20.0)
pos = (110.0, 110.0) - size = (20.0, 20.0)

Does this mean is this slow for a very few objects? I'll try for adding more objects.

For ten objects,

1  
2  
3  
4  
Time taken for creating new list: 0.016796ms
Time taken for sorting x-axis: 3.447565ms
Time taken for sorting y-axis: 0.046874ms
Time taken for sorting both the axis: 3.580764ms


For 15 objects,

1  
2  
3  
4  
Time taken for creating new list: 0.009374ms
Time taken for sorting x-axis: 1.6327699999999998ms
Time taken for sorting y-axis: 0.061716999999999994ms
Time taken for sorting both the axis: 1.8187019999999998ms


It's more for less number of objects.
10  Discussions / Suggestions / Re: Articles & tutorials - Name the author on: 2013-05-05 17:35:50
I also made a topic with the image on display error but posted in regular discussions not in suggestions. So I'm quoting that here.

Quote
I had noticed the following difference in the articles board.



  • Profile picture is on the left!
  • No "number of views" nor "who's viewing"

I've tried this on FireFox and Chrome and from Opera Mobile on my tablet. Getting the same. It's from a week I've been seeing this. Also tried cleaning the cache, history and also ran CCleaner.

Does anybody had experienced this?

Or it's only me?
11  Game Development / Newbie & Debugging Questions / Finding nearest objects on: 2013-05-05 16:07:49
I've shared my tutorial "Using Grids For Collisions" on Google+ and there I've got a comment.

Quote
I use a different, very fast algorithm: First, sort all objects by their x-coordinate. Then calculate abs(x(n)-x(n-1)) to filter out those objects, which are nearby each other on x (can be done during sort), and only those you have to insert into a list, sort again by their y-coordinate. And if those left are also nearby on y, you have sorted out then all candidates for a more intense collision detection. The advantage is, if you use a sort algorithm, which likes pre-sorted data, its incredibly fast. Works for several hundred thousands of object coordinates (means polygons) in near real-time. No need to differentiate between unmovable and moving objects! And - because of the simplicity of the algorithm, it is typically translated into very fast machine code, avoiding cache - misses. And if you need to detect z-axis collisions, just add one more sorter. Works perfectly in fully dynamic worlds, where all objects move. Have fun!

I wanna try it but I don't understand it. Can anybody help me understanding it so that I can implement?
12  Game Development / Game Play & Game Design / Re: Game art for developers who have no artistic sense whatsoever? on: 2013-05-02 15:05:04
I'm not selling any games. I'm making them as a hobby or with interest in leisure. I don't even release it in public. So I just search them in google images. Or you can also use Icon Finders. If you can pay, then the best option is to pay. Here's an example of getting the sprites for a space invaders game.

I went straight into the www.iconfinder.com and set the size to 128x128 px and selected "Free" ones. And here's my search for "spaceship"



And now I searched "alien". Here's so many alien faces.



Now for backgrounds, I went into google and in images, entered "space animated background".



So many sprites enough for making a simple game.

** Don't use them if you are thinking to sell your game.
13  Game Development / Game Play & Game Design / Re: Game art for developers who have no artistic sense whatsoever? on: 2013-05-02 14:37:33
@ctomni,

The link to your message is http://www.java-gaming.org/topics/developpers-art/27098/msg/241621/view.html#msg241621. It's not 609.
14  Game Development / Newbie & Debugging Questions / Re: Package naming conventions on: 2013-05-01 11:56:20
I first use
com
. Then I add the project name such as my GEJ in lower caps. It becomes
com.gej
. Then I'll start grouping the classes into multiple packages, like
com.gej.core
and all. I'll never keep a class in the root i.e.,
com.gej
. If there're anyone, I'll move them to the
core
sub package.
15  Games Center / Showcase / Re: Space Turdz on: 2013-05-01 10:12:50
I can't get your game to play. Here's the screenshot.



I just double-clicked the game jar and a blank JFrame appears.
16  Game Development / Articles & tutorials / Re: Basic rotation and Moving toward angle direction (car movement) on: 2013-04-30 05:28:01
Nice article but I have some recommendations.

1  
2  
3  
4  
5  
6  
7  
-   init();
    addKeyListener(new Controll());
    setFocusable(true);
    setBackground(new Color(0, 50, 100));
    setDoubleBuffered(true);
    setFocusable(true);
+   init();

You are adding keylistener after the starting of gameloop! This can make the player think that the game is too slow if the game starts playing when it's started and input may take some time. So create keylistener first.

The second issue is with your game loop.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
while (true) {
    repaint();
    play();
    try {
       loop.sleep(2);
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
       e.printStackTrace();
    }
}

You are calling
loop.sleep(2)
. You should call it like
Thread.sleep(2)
since
sleep
is a static method. Also the precision of the sleep method is not guaranteed across platforms. Please read the article Game Loops!.

Other than those, it's a nice article.
17  Game Development / Newbie & Debugging Questions / Re: how to check collision between object from the same arrayList on: 2013-04-29 16:57:54
@matheus23

He is using Java 2D not LibGDX
18  Discussions / General Discussions / Re: Cross Language Game Tutorial on: 2013-04-28 06:05:39
Hendra G. TamilNadu ?
19  Game Development / Newbie & Debugging Questions / Re: Mixing light-weight (Swing) and heavy-weight (AWT) components? on: 2013-04-27 17:24:33
1  
2  
-    public class AbstractGame {
+    public abstract class AbstractGame {

Class needs to be declared as
abstract
for it to have abstract methods.
20  Discussions / General Discussions / Re: Cross Language Game Tutorial on: 2013-04-27 17:06:53
No, it's speed enough in my experience. The main flaw is if on a slower system, the game loop keeps playing catch-up and it'll be always end up in playing catch up without any rendering. I am just skipping 5 frames even in my engine and my demo space invaders game gets almost 38 fps on my crappy old laptop with 512 MB of ram and running XP SP 1 with an integrated intel card of 24 MB of video memory. It is faster and getting 140 fps on my pc.

@ReBirth

Yes. I'm from Andhra Pradesh. Where are you from?
21  Discussions / General Discussions / Re: Cross Language Game Tutorial on: 2013-04-27 16:35:28
I just need ways on how I can improve the content.
22  Game Development / Newbie & Debugging Questions / Re: shooting is working but ... on: 2013-04-27 15:25:50
Isn't the vertical axis reversed?

1  
2  
3  
4  
5  
6  
7  
public void move() {

    x += 2 * Math.cos(a);
-   y += 2 * Math.sin(a);
+   y += 2 * Math.sin(-a);

}


I think this works now.
23  Discussions / General Discussions / Cross Language Game Tutorial on: 2013-04-27 15:19:54
Hi everybody,

Today I started a new tutorial website to teach basics of game programming in three languages at ones.

Here's the site.



The languages are Java, C# and VB .Net

I'll be adding more and I need feedback.

Thanks.
24  Games Center / Contests / Re: Ludum Dare 26 starting 26th April! on: 2013-04-26 13:30:47
Having exams for me too ( on May 10, 17 and 22 ). Just got result for one. 888 for 1000. I'll be trying in this competition after they are completed.
25  Game Development / Newbie & Debugging Questions / Re: Game starting help ! on: 2013-04-23 17:22:57
Here's the list of tutorials I have posted when alaslipknot asked the same.

Quote
@alaslipknot

I think you need a tutorial to get started. Here's a list of tutorials from this site.


These should get you started well. I also recommend to see the Zetcode Java2D Games Tutorial

First understand what a game is and the basic terminology used like (game loop, fps, ups, etc.,). Then learn how you can structure your program to make it a game the best. There are a lots of approaches. The best way to learn is by coding and experience it.

In the starting, try to make console games, like adventure ones, like

Quote
Press W to go North.
Press S to go South.
Press A to go West.
Press D to go East.

>> W

You went North. You found .....

And soo on.

Then start making some GUI applications. Create a window by using Swing. Learn how you can display an image. Then try implementing animations, by changing the images. Before that, you have to learn about some threads. Learn how to create render loops. Try adding the game logic.

The first I made was a simple frame in which a box moves from left to right and swaps the screen. It's on my tutorial site. http://easyjavatutorial.weebly.com/. Then understand how to make a best game loop (in the above mentioned articles). The first rule of thumb is to separate the game logic and rendering logic.

Then strip of to using a game engine and learn how it works by making some games with it and analyzing how it works. You can also see the source of the engine to see how it is structured. It helps you to create easily efficient games. Then try making your own engine. I've made games with GTGE and JGame and also made my own.

Then you can probably start off with some advanced topics such as OpenGL. Start off with a game engine like Slick2D or libGDX. Understand several example games. (Also rewrite them). Then check your knowledge against LWJGL, if it's a success, you've learnt a lot. Try different ways of applications. Learn some Vector math. It helps much in games.
26  Game Development / Newbie & Debugging Questions / Re: How to know the rotation ? on: 2013-04-22 11:49:20
Shouldn't it be

1  
Math.sin(-1 * o1.rotation / 180 * Math.PI)


Isn't the y-axis inverted?
27  Games Center / WIP games, tools & toy projects / Re: Guardian II on: 2013-04-22 09:49:40
Game Maker 8( i think thats the 5th time i said it here xD). It allows you to easily add black transparency, and exports to strips.

This functionality is present from 6.1C Version (You can load the strips)
28  Game Development / Newbie & Debugging Questions / Re: Fix "my" method to make an object A move toward X,Y coordinates on: 2013-04-21 12:13:05
Sorry, I accidentally clicked upon Appreciate.
29  Game Development / Newbie & Debugging Questions / Re: Fix "my" method to make an object A move toward X,Y coordinates on: 2013-04-21 05:55:39
This is my Java2D method.

moveTo()

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  
/**
 * Moves this object to a specified point with a specific speed. Note that
 * the velocity used is independent of vertical or horizontal velocities of
 * this object.
 *
 * @param nx The new x-position
 * @param ny The new y-position
 * @param speed The speed with which to move
 * @return True if the new point has been reached
 */

public boolean moveTo(float nx, float ny, float speed){
    boolean _x = false;
    boolean _y = false;
    int distance = (int) Math.sqrt((double) ((x - nx) * (x - nx) + (y - ny) * (y - ny)));
    float vel = Math.min(distance, speed);
    float newx = x;
    float newy = y;
    if (x > nx) {
        // We should move left
       newx -= vel;
    } else if (x < nx) {
        // We should move right
       newx += vel;
    } else {
        _x = true;
    }
    if (y > ny) {
        // We should move up
       newy -= vel;
    } else if (y < ny) {
        // We should move down
       newy += vel;
    } else {
        _y = true;
    }
    x = newx;
    y = newy;
    return (_x && _y);
}
30  Games Center / WIP games, tools & toy projects / Re: A Java scripting language -- Leola on: 2013-04-21 05:26:11
I was really interested in this. (Also got a copy of the book you mentioned from a local shop). However got one doubt though.

1  
class Entity(pos, speed) {


What if I want to do multiple constructors? Is this available?
Pages: [1] 2 3 ... 6
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (91 views)
2013-05-17 21:29:12

alaslipknot (100 views)
2013-05-16 21:24:48

gouessej (130 views)
2013-05-16 00:53:38

gouessej (125 views)
2013-05-16 00:17:58

theagentd (136 views)
2013-05-15 15:01:13

theagentd (123 views)
2013-05-15 15:00:54

StreetDoggy (165 views)
2013-05-14 15:56:26

kutucuk (187 views)
2013-05-12 17:10:36

kutucuk (189 views)
2013-05-12 15:36:09

UnluckyDevil (196 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.303 seconds with 20 queries.