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 (416)
games submitted by our members
Games in WIP (306)
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 ... 17
1  Discussions / Miscellaneous Topics / Re: What video games have you been playing lately? on: 2013-06-19 22:12:28
The Last of Us. Obviously.

Haven't had a console since PS1, I'm watching a hilarious (still ongoing) LP of it instead. The attention to detail in the game is incredible.
2  Discussions / Miscellaneous Topics / Re: What video games have you been playing lately? on: 2013-06-19 05:35:13
Only SC2.
3  Game Development / Newbie & Debugging Questions / Re: How to show the bullets on: 2013-06-18 21:40:43
Read the links on game loops for a start. It's been linked twice now.

Bad example:

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  
class Game {
bulletsArray = new ArrayList <Bullet>();

public void gameLoop() {
   while (true) {

      update();
      render();

      // sleep
     try {
         Thread.sleep(1);
      } catch() {}
   }
}

public void update() {
   for (Bullet b : bulletsArray) {
      b.update();
   }
}

public void render(Graphics g) {
   // draw things
  for (Bullet b : bulletsArray) {
       b.draw(g);
   }
}
}


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
class Bullet {
   int x, y, xspeed, yspeed;
   update() {
      x += xspeed;
      y += yspeed;
   }
   draw(Graphics g) {
      g.drawImage(bulletImage, x, y, null);
   }
}
4  Game Development / Newbie & Debugging Questions / Re: How to use Java game engine for server backend on: 2013-06-17 22:01:17
First of all, you need to separate logic and rendering. Any game engine worth its salt  does this so it's up to you how to actually do it. Obviously you won't need to render anything on the server side. It all comes down to how your game communicates with the server and more specifically what data the server stores and how it handles it.

This is a very all-round answer but the actual "how" is up to you and depends on the server side api you're using.

Perhaps read up on some of the basics of Server-Client communication if you're not familiar with it.
5  Game Development / Newbie & Debugging Questions / Re: How to show the bullets on: 2013-06-16 19:19:05
Hello!

Read this post:

http://www.java-gaming.org/topics/hello/24411/msg/205121/view.html#msg205121

Then read this for example on good and bad Game Loops in java:

http://www.java-gaming.org/index.php?topic=24220.0

You will want to start out with a fixed timestep loops since they make more sense :))
6  Discussions / General Discussions / Re: Your View on GameMaker? on: 2013-06-08 07:04:55
Made my first games with Game Maker version 3 something. Had a few epiphanies with it. Haven't used it in years (8+), not since Version 5.3 I believe. Now it's owned by some company and I'm not sure the original author is any longer developing for it (Mark Overmars).

You could do platform games quite easily and with GML (Game Maker Language) you could really make professional ones too. It always lacked in it's portability though, although that's probably changed, and if you wanted to do anything fast you'd need to code a dll for GM to use. Multiplayer for instance was horrendously ineffective so everyone used the 39dll (which was made by a user called 39ster iirc). With that I made my first functioning mmo with sprites ripped from zelda games. I was very proud of it.

AAaaanyway, Game Maker got me into the fun of making games as opposed to playing them.

Don't know how it's like today but I think I'd prefer libGDX with what I already know. However, for a beginner I can imagine GM being something perfectly reasonable and preferable. As long as you don't dream of making 3D games or mmo's :))
7  Discussions / Miscellaneous Topics / Re: if you are not a programmer, what would you be ? on: 2013-06-06 12:41:00
My dream job was always to be in Movie Special Effects. Like smoke and mirrors, and latex; no computers. Smiley Go figure.
My dream job is be Evil Genius  Roll Eyes or free scientist
Or Evil Genius Scientist XD

(Be scientist not so fun like be scientist with loyal minions Wink)

<a href="http://www.youtube.com/v/1Bf0aYBk0OQ?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/1Bf0aYBk0OQ?version=3&amp;hl=en_US&amp;start=</a>
8  Discussions / General Discussions / Re: Your favorite platform games of the last five (5) years? on: 2013-06-06 00:23:14
Jumper and Jumper 2 (Games made with Game Maker version 5 in 2004 that inspired Super Meat Boy) and Soldat.

Last five years? Don't think I've played any platform games in the last 5 years. Unless you count Robot Unicorn?

http://www.mattmakesgames.com/
http://soldat.thd.vg/en/
9  Discussions / Miscellaneous Topics / Re: if you are not a programmer, what would you be ? on: 2013-06-03 22:43:35
A Teacher or Formula One driver.
10  Discussions / Miscellaneous Topics / Re: College make me wounder ... on: 2013-05-31 21:05:06
On the other hand, these useless degrees open doors for me in the employment market. Without a degree, my CV would go straight to the discard pile.

This. Because having a degree shows a special (or rather, "normal") kind of commitment. However, if you're good enough and can show it (projects, work experience etc) you don't necessarily need a degree of any kind.

However, depending on where you live of course, college/uni life can be expensive but it can also be cheap (paid for by the taxpayers). Mostly it's pretty  fun and leisurely (imo). Plus you meet a lot of people. People you might work with later in life. People that might be your employer in the future. It's not all about the lectures.
11  Game Development / Game Mechanics / Re: Isometric Grid - Tiles as objects on: 2013-05-30 17:16:38
There's no "usual" way. There are just ways that work and don't work. What's key is how you separate logic, data and graphics. And two of those three have nothing to do with isometric projections at all.
12  Discussions / Miscellaneous Topics / Re: What music do you listen to while you code? on: 2013-04-10 11:19:40
I listen to a wide variety of songs.


I LOVE SUM 41! My favorite songs by them are:


Why is 88 not in those list? :V
13  Game Development / Newbie & Debugging Questions / Re: Checking collisions on hex on: 2013-03-18 06:27:51
Math problem :V

http://www.playchilla.com/how-to-check-if-a-point-is-inside-a-hexagon
14  Game Development / Newbie & Debugging Questions / Re: How to play multiple sound effects in java? on: 2013-03-14 16:30:50
http://www.java-gaming.org/topics/need-a-really-simple-library-for-playing-sounds-and-music-try-tinysound/25974/view.html
15  Discussions / Community & Volunteer Projects / Re: Online multiplayer game project on: 2013-03-11 15:18:29
Also, isn't kiekko.tk/futis exactly what the OP is looking for? o.O

kiekko.tk is awesome btw - a 100% skill game (difficult to learn, even more difficult to master).
16  Discussions / General Discussions / Re: Weirdest Practical Programming Language on: 2013-03-11 15:13:57
I can't wrap my head around Ada and why it's so useful. Tasks and rendezvous make no sense to me <.<
17  Discussions / General Discussions / Re: I Switched to IDEA! on: 2013-03-09 14:22:52
Is it lighter than Eclipse?
18  Game Development / Networking & Multiplayer / Re: Server side anti chest methods for simple slotmechine game on: 2013-03-04 12:21:08
that means i need to keep the connection open.
The question of the connection being open or not doesn't matter. You're going to need to have the connection open at the very latest you want to send a response from the server to the client.

 
and to send trigger back to the client with results ,
what about if i have timer that is starting at the client , should i start to calculate it in the server also ?
is there any danger of i keep open connection to the server all the time ? and do updaters?
is web sockets are good solution ?

Hmm. I thought I could decipher your post but I'm lost tbh.

If you're using HTTP, you should know HTTP is a stateless protocol. Revolving largely on POST and GET. http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol

Why don't you have the clients send a GET message and have the server send them the calculated result in the response?

What it it all boils down to is not letting the Clients alter the server in any way. They can request information but not alter it.
19  Game Development / Networking & Multiplayer / Re: Server side anti chest methods for simple slotmechine game on: 2013-03-04 11:01:06
Hmm, the patterns of what now? Spinning calculations? :V

Client says "I want to spin the wheel"
Server calculates with Math.random() and sends back the result.

As opposed to the client calculating the result. :o
20  Game Development / Newbie & Debugging Questions / Re: Applet Lifecycle on: 2013-03-04 06:33:49
Hmm, maybe the isFocusOwner() method?

21  Games Center / Showcase / Re: Starshock, a retro-esque arcade shooter on: 2013-03-04 02:41:11
I really like the art style. Looks incredible!
22  Games Center / WIP games, tools & toy projects / Re: Ruins of Revenge on: 2013-03-03 17:59:19


The more bloom the better.

Anyhow, looks like a cool project.
23  Java Game APIs & Engines / Java Sound & OpenAL / Re: High memory usage for sounds on: 2013-03-03 17:38:42
Quote
Memory Usage
------------
The basic loading functions for Music and Sound objects produce implementations
that store all audio data in memory.  This is good for maintaining low latency,
but can also require a lot of heap space if you load many, or particularly long,
audio resources.  There are loading functions available that allow you to
request that the audio data be streamed from a file.  If this is requested, the
audio data will first be converted as usual and then written to a temporary file
from which it will be streamed.  This will dramatically reduce the overall
memory usage (after loading), but can potentially introduce occasional latency
when reading from disk.

source: https://github.com/finnkuusisto/TinySound



source: http://finnkuusisto.github.com/TinySound/doc/
24  Game Development / Game Mechanics / Re: Particle X:Y Spawn Coords Based on Rotation on: 2013-03-02 02:29:56
dirx would actually be delta x and diry you delta y or dx and dry. Whatever you call them it should be the the distance between point A and point B in the X lane and the distance between point A and point B in the Y lane. Because we can imagine that there is a 90 degree triangle between the two points.

Basic trigonometry for 90 degree angled triangles.

25  Game Development / Game Mechanics / Re: Particle X:Y Spawn Coords Based on Rotation on: 2013-03-02 02:23:06
1  
rotation = (float) (Math.atan2(yBullet - targetY, xBullet - targetX) * (180 / Math.PI));
26  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Slick2D Most efficient way to draw a pixel array on: 2013-03-02 02:21:15
If you have a pixel array, you've got an image.

You're not using 'int[] cols' in your code. Is it actually called int[] tiles?

1  
2  
BufferedImage bimg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
int[] tiles = ((DataBufferInt)bimg.getRaster().getDataBuffer()).getData();


Now changes made to int[] tiles will be reflected in the BufferedImage.

Or you could copy them into another BufferedImage whenever int[] tiles changes.

1  
2  
BufferedImage bimg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
bimg.setRGB(0, 0, width, height, tiles, 0, width);
27  Game Development / Game Mechanics / Re: Particle X:Y Spawn Coords Based on Rotation on: 2013-03-02 01:27:25
Basically we need a bit of trigonometry



Where the distance should be the distance from the missiles rotation point to the point you want the missile to appear.



Something like that.
28  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Slick2D Most efficient way to draw a pixel array on: 2013-03-02 00:59:49
Hmm, why don't you just stretch the image into 4 times its size?

1  
g.drawImage( image, 0, 0, width * 4, height * 4, null );
29  Game Development / Newbie & Debugging Questions / Re: ConcurrentModificationException errors on: 2013-03-01 01:58:31
It's because you're trying to remove items while you're looping through the list.

Though it has to be said, considering the number of things that might be found in an ArrayList, removing things from the head of the queue is really often so fast you'd never ever notice it. It depends on how many things are likely to be in it...

Consider a real-life example of, hmm... Particles. So you've got 5,000 particles in a frame (a high figure, but not unlikely). They're stored in an ArrayList. Each entry in the ArrayList takes 4 bytes, so that's 20kb of RAM, fitting neatly in the L1 data cache on many if not all desktops.

Now, imagine the rather unlikely even that every single particle dies one frame, and you discover this as you iterate through the ArrayList (using an integer index, not an iterator, just for absolute efficiency's sake). You have to shuffle 4,999 particles down 4 bytes. It's all in the L1 cache so memory access is effectively free to the CPU; you spend 4,999 cycles moving your particles assuming the loop that copies the data is about as simple and efficient as it can be. Then you have to do it again on the next particle. 4998 cycles. Repeat to solve triangular number, approximately (5000x5000)/2, or in the end 12,500,000 clock cycles, without ever having to touch the L2 or L3 caches most likely, let alone system RAM, until the end of the operation.

That's 12.5m cycles out of your 3.3 million or so you've typically got in a single video frame (2GHz core). Oh dear, you just spent 4 frames ditching a mere 5000 particles. Judder. Imagine if you had, somehow, 10000 particles. That'd be nearly a second wasted doing something utterly trivial and would present itself as a horrible jarring delay in your buttery smooth animation.

But what if, weirdly but possibly, the worst case occurred when even going backwards - every other particle died in one frame? Well, then you'd be compacting a slowly more complex list of particles even if you were scanning backwards. Scanning forwards would be exactly the same speed too.

So you'd be crafty and use the third and final technique which is to make a copy of the original arraylist, and copy the surviving particles into it each frame. This performs consistently no matter how many live or dead particles you have in any particular frame or the pattern of their expiration.

Anyway - for the OP - basically you need to do Just That. Each frame, scan your list of Interactables, and copy each live one into a second ArrayList, and then point your game at that ArrayList. Flip between two ArrayLists, alternating each frame, rather than creating (and expanding!) an ArrayList every frame, or that'll be slow.

Cas Smiley


LinkedList is rarely useful, since it has so much overhead even when it is supposed to be faster. For a very very large list where objects are constantly removed randomly hundreds of times per frame or so, LinkedList might be faster. The problem with LinkedList is that it creates an Entry object which it wraps in each object added to store the next and previous entries. This allocation (and later garbage collection) makes it a lot slower to add and remove stuff than ArrayList in most use cases. ArrayList's only weakness is removing objects in the beginning or middle of the list, since all following objects have to be shifted to fill the hole created. The longer the list the slower it becomes.

Even when you have lots of stuff to remove, ArrayList can be a good choice. Lists are often used to keep track of game objects. So you say "But wait! The objects will always be added at the end of the list, but as they die they will be removed! I have thousands of objects, so I should use a LinkedList to avoid shifting thousands of objects on every remove()!". Nope! Most likely the best solution is to use TWO ArrayLists and pingpong your objects between them. By doing that you can avoid all shifting while still getting fast (and random) access to all objects.

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  
ArrayList<GameObject> currentList, nextList;

//Lists created at load time


//Example game loop:

while(true){

    update(); //Updates all objects
   render(); //Draws all objects

}

private void update(){
    for(int i = 0; i < currentList.size(); i++){
        GameObject go = currentList.get(i);
        go.update();
        if(go.isAlive()){
            nextList.add(go);
        }
    }
   
    //Alive objects are now in nextList. Clear currentList.
   currentList.clear();
   
    //Swap current and next list
   ArrayList<GameObject> temp = nextList;
    nextList = currentList;
    currentList = temp;
}


Also Doesn't LinkedList leave null spaces in the List if you remove an object? or was that Hashtable...
Nope, LinkedList does not leave null spaces. Only arrays do that (obviously). Hashtables/HashMaps KIND OF do that, but that's simply because the key no longer maps to anything, so it returns null instead. Not really the same in my opinion.

related post (ConcurrentModificationProblem with bullets): http://www.java-gaming.org/topics/indexoutofbounds-index-7-size-7-need-help/28638/msg/261156/view.html#msg261156

quotes from: http://www.java-gaming.org/topics/arraylist-vs-linkedlist/27016/msg/240144/view.html#msg240144

Posts require 10% of the contents be written by the poster. So, to remedy this, here's a short story.

むかしむかし、亀は森の中にすんでいました。彼は遅い亀でした。終わりが。
30  Game Development / Newbie & Debugging Questions / Re: Loading files after export on: 2013-03-01 01:41:54
Indeed, since both src (by default) and now res are in the build path, their CONTENTS will be put into the jar.

If you would have created a folder under "src" (src/res/my_res.txt, for example) then "res/my_res.txt" would work because res is now part of src's CONTENTS (and res would no longer be in the build path directly).
Pages: [1] 2 3 ... 17
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

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!
mrbenebob (11 views)
2013-06-19 14:55:23

BrassApparatus (19 views)
2013-06-19 08:52:37

NegativeZero (23 views)
2013-06-19 03:31:52

NegativeZero (26 views)
2013-06-19 03:24:09

Jesse_Attard (29 views)
2013-06-18 22:03:02

HeroesGraveDev (65 views)
2013-06-15 23:35:23

Vermeer (65 views)
2013-06-14 20:08:06

davedes (66 views)
2013-06-14 16:03:55

alaslipknot (59 views)
2013-06-13 07:56:31

Roquen (82 views)
2013-06-12 04:12:32
Smoothing Algorithm Question
by UprightPath
2013-05-28 02:58:26

Smoothing Algorithm Question
by UprightPath
2013-05-28 02:57:33

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
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!