Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (603)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (650)
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
1  Game Development / Game Mechanics / Re: Using code generation in your game. on: 2012-04-02 15:07:11
Java is verbosity. To avoid verbosity you usually go to other programming languages, for instance Python.
This is one of the worst arguments...
   "If you don't like a piece of X, abandon X and use Y instead"

The world isn't that black and white. We can workaround problems instead of completely discarding X.

I prefer Java because of it's verbosity. Makes it easy to maintain even months after I stopped using the code, comparable to C++ or Python where you rather will gain more in rebuilding the whole thing.

Though I can't see why you would prefer Java over all other languages except as of it's verbosity. It's a nice language though it's not better than all other languages except if you consider verbosity a virtue.

I don't see how your proposed solution makes it better. The added abstraction layer of getters and enums will lead to increased code verbosity throughout the project, which is (IMHO) an even bigger problem than typing out all those classes by hand.

Maybe I'm mistaken, and you could enlighten us with a code sample.

Going from OP:

System.out.println("BOOM " + explosion.getFloat(STRENGTH));

Where the basic thing is to just do in this case enum STRENGHT instead of "strength".

You can even make it more fun with:

System.out.println("BOOM " + EXPLOSION(STRENGHT));
2  Game Development / Game Mechanics / Re: Using code generation in your game. on: 2012-04-02 11:21:46
Point 2 is even worse. So you'd prefer unsafe dynamic typing with lookups in hashmaps? Four downsides: overly verbose accessors, IDE refactoring won't work, deplorable performance and a huge number of runtime errors, due to typos in the property names and/or assuming the wrong type of a property.

Java is verbosity.

To avoid verbosity you usually go to other programming languages, for instance Python.

The errors you mentions, except said verbosity, is handled by avoiding double maintenance.

For instance if the programmer has a specific attribute he wish to aquire and he knows he otherwise would've generated with his code generator, the programmer usually creates a static final enum as to avoid double maintenance. Thereby IDE refactoring works, typo errors are impossible and you can't assume the wrong type of property.

As long as the kind of events aren't changed constantly during runtime there isn't even any performance issues if you use for example an enummap.

Code generation is a classic code smell.

An example of this solution is unit/object retrieval for a game.

As the main difference between these are just parameter values you create a master class, and then you load at runtime the units/objects you wish to have from for example a textfile. Each master class with given parameters are put into an enummap and then can be aquired by a getter with an enum parameter.
3  Game Development / Newbie & Debugging Questions / Re: List to ArrayList? on: 2011-12-17 17:18:51
If you for example create a list of lists there you want to do the same method.

One example is if you want to loop through a list of units with different movement methods and you only want to call the method .move() for each unit through a for loop.
4  Game Development / Game Play & Game Design / Re: How to build a 4x game on: 2011-12-14 07:42:24
What should i use for a 4x game. Swing or Applet
Another question i have is for a 4x game is it more GUI or UI...

Now you are just trolling right?

1, Doesn't matter. I prefer desktop platforms in Swing as I consider such games more real, others prefer Applets.

2, Isn't GUI and UI the same thing? Or do you mean text based versus graphical? In such a case it's whatever you prefer. I'd say graphical as a text based 4x feels quite a few decades old.
5  Game Development / Game Play & Game Design / Re: How to build a 4x game on: 2011-12-13 09:23:14
A core game meant that you should implement one simplest functionality to be considered a game (a starship following the mouse on the screen or whatever) and then add functionality from there until you got a whole game. Kind of a simple agile production.

If 4x sci-fi then I'd say to begin by randomizing a bunch of points into a data structure.

Then paint said points as JLabels on a JPanel.

And voila, you got the basics for the simplest kind of 4x game! Smiley

If you want some other kind of 4x then you need to specify which to let me help you.
6  Game Development / Newbie & Debugging Questions / Re: Making Images In Java on: 2011-12-01 21:41:43

If you using a .jar you will need to use something can track it's position, for example .getResource().
7  Discussions / General Discussions / Re: Thank you guys, it's been great on: 2011-12-01 18:01:50
Is that really the case in Sweden?  In North America, it seems that one's career path has the most impact.  For example, a run-of-the-mill web programming job for a no-name company would be a career dead-end.  Also there's an unwritten expectation that a lot of self-learning on the side is necessary to keep up to date with technology.

There's always a chance of growing even with little education within smaller companies there you are the only one whom got any knowledge in the field, though if there is a larger company with more than 3-14 employees within programming then you need a heavy education background to be able to go anywhere.

I don't think a Masters adds a lot of weight unless one wants to enter into R&D or academia.

In general it's the same in Sweden, though the difference is that there exist educations in Sweden which are named "civil engineering" though for computer science and other fields. Said education is a lot heavier and much more practical knowledge then within a usual master education. Though as said education doesn't exist outside Scandinavia, Germany and Canada the correct term to use when discussing with foreigners are "master of computer science".

You need that kind of education to get anywhere in Sweden within programming in any larger corporation.
8  Discussions / General Discussions / Re: Thank you guys, it's been great on: 2011-12-01 12:52:51
Lund is very far though D: (Im in Västerås, about 10 km east of Stockholm) I have been playing with the idea of studying computer science and then get a master level instead of game programming in Skövde, but Skövde seems like so much fun! XD And i heard about 80% of the guys in skövde gets employed to game development companies like codemasters less than a year after their graduation. I heard this back in 2009 though so it could have been changed.

Well, I just mentioned the educations I think is where you should go if you want to be programmers.

Though whatever you do, study enough to get the grades needed to be able to choose whichever education you wish when you have the chance.

Most master of science educations demands a 17-20 average grade (with the bonus included there). Try your best to reach at least that high and you won't regret it.
9  Discussions / General Discussions / Re: Thank you guys, it's been great on: 2011-12-01 12:43:36
I take it LTH = Lunds tekniska högskola?

In that case I have a friend there and he seems to enjoy it quite a bit Smiley

Yes, LTH = Lunds Tekniska Högskola. Smiley
10  Discussions / General Discussions / Re: Thank you guys, it's been great on: 2011-12-01 12:36:01
Don't give up on your studies - there are enough crap "game programming educations" out there and when you go to uni you should try to get to the best programming education you can, else you will regret it. To be able to do that you need to have good grades, especially in math. So even if the courses are hard, please try to motivate yourself to work harder as else you won't be able to be professional programmers and will regret it big time.

If you think you can handle being a code monkey and risking being outdated in 20-30 years try a bachelor in computer science. If you don't want to risk being unemployable in 20-30 years and actually would like to lead your own projects one day, I'd suggest a master in computer science (cvilingenjör i datorteknik in Swedish).

Most game programming educations of 1-2 years are just game maker to new levels and there you are not able to create your own games and will be unemployable within a few years afterwards.

LiTH I've heard has the best game focused master of computer science education in Sweden, though people are quite boring there and most people I've heard that studied there got quite isolated and alone during their studies.

LTH has some of the best UI design courses in the world (people with UI studies in their master at LTH often get imported by companies all over the world) and are famous for being a much more social and easier for even the most silent nerds to get friends and having fun.

Chalmers and KTH are mostly focused on buisness applications, there KTH is almost entirely focused on finance applications. They seem to be better at social aspects than LiTH though worse than LTH.
11  Game Development / Game Play & Game Design / Re: How to build a 4x game on: 2011-11-30 12:51:47
Was considering taking how I made my game into my grave, though as I know it's nothing new I guess I can share the basics I've figured out when creating a 4x.

1, Map data

As to have the quickest generation I think a HashMap<Point, Star> is the best data set. It's slow to add new stars in though it's never a problem if you generate the stars only once. The O(1) complexity to pick up a star from a position is so worth it.

The graph can be a abstract graph within each star, though picking out for example a LinkedList just as to symbolize the graph is too slow to be properly used.

Generating a galaxy depends on what kind of galaxy you wish to create. I prefer randomized galaxies and then add weights which gathers the galaxy into clusters.

Randomization  generation is usually as simple as:

Random rand = new Random();
Point p = new Point(rand.nextInt(UNIVERSE_WIDTH), rand.nextInt(UNIVERSE_HEIGHT));
starMap.add(p, new Star());

The graph creation is just  a "Breadth-first search" with weights problem.

2, There exist thousands of different suggestions.

If going turn based then going the easiest fashion with mailboxes make each player send in orders, make server do orders and then let server send out results.

If RTS then if someone do something, send said order to everyone. When everyone has said that they have recieved said order they do said order. All random factors should be set to a SEED. Making sure everyone's games are constantly identical.

3, Your idea of a functional approach isn't how you should do it in Java. Just do it OOP as you should do it in Java.

4, I preferred a randomized there events (colonization, research &:c) affects the options and then let the AI go nuts.

In my game it became quite nicely lethal but still simple.
12  Games Center / Showcase / Re: Unknown universe on: 2011-11-26 22:35:23
Woohoo, looking good! I love 4x games. I'm curious though what your ideas are on keeping such a massive galaxy manageable?

How do you mean? Any specifics?

I've myself only reached up to about 200 stars empire, and that is still manageable if I am not playing on the highest speeds RTS. Mostly as the basic engine is quite simple to use while there is still depth of possible management (with a lot more to come).

Are there anything you would like to be included? I am always willing to add anything (except 3D) that people would enjoy. Smiley
13  Games Center / Showcase / Re: Unknown universe on: 2011-11-22 11:39:03
Well, a lot has happened since the last release on this forum, it can be downloaded here:

Just a few of the things that can be built ingame:

Leaders are now included:

Direct feedback if you don't want to bother with the forum:

Ingame events:

And lots and lots of other things! Smiley

Have had about 2000 players as to this point, which is quite nice. Smiley
14  Games Center / Showcase / Re: Unknown universe on: 2011-10-11 16:28:49
Released multiplayer now! Smiley

You can join at any time you want, have a server up at the moment for 15 players, we are 2 playing now and waiting for more. Smiley

The server I have up is having a 24 hour deadline, so after you've joined and made your orders you can just quit. Then return and play again next turn 24 hours later (or earlier if players has clicked end turn before then).

If you don't like the deadline or the game you can always host your own game. Maybe with a 30 seconds deadline? Smiley
15  Games Center / Showcase / Re: Unknown universe on: 2011-10-04 08:20:20
Soon done with multipleplayer functionality. Will hopefully release next version and host a larger game next week. Smiley
16  Game Development / Game Play & Game Design / Re: Risk type game on: 2011-09-30 06:53:42
Don't steal code.

Well keep your shirt on, it's obviously for educational purposes... D=

I just consider it a good policy to have that sentence in a reply if I link to a decompiler. Not only him that read the thread and would feel bad if I helped someone to steal a game, change the credits and then start selling it in their own name.
17  Game Development / Game Play & Game Design / Re: Risk type game on: 2011-09-29 09:03:29
I agree with theagentd in general, though if you don't listen to him, then:

Don't steal code.

Otherwise if you just wish to look at code you can decompile a .jar with:

Even if my game is a strategy game I'd advice to not try to look at it as it's a hobby project and therefor quite a mess and probably not readable.
18  Games Center / Showcase / Re: Unknown universe on: 2011-09-27 15:29:12
There seem to have been a quite strange error that if you had set a species name then when you loaded a saved game you loaded as another player then yourself. Which is now fixed.

Lots of general fixes, new features and more work on the looks.

For example below is seen how you now can watch the progress of research:

Or how you can save/load multiple games and even start up with specific presets depending on the kind of game you wish to play:

And about another ten-twenty new features/fixes added.
19  Games Center / Archived Projects / Re: Fight For Arcadia (Text Based) on: 2011-09-21 19:07:43
Thank you very much I'll look into that. At the moment I'm still struggling with the basics of OOP. I'll try to make the game work first before I try to create a GUI Smiley


If you wonder anything, just ask.

The code above should easily be used with the code you got (at least the way I think you've programmed your game. Thought that said code would be a nice way to get a simple GUI up and running so you don't get lost while doing the rest of your game. Smiley
20  Games Center / Archived Projects / Re: Fight For Arcadia (Text Based) on: 2011-09-19 13:39:26
I kind of like the text and the general feeling! Smiley

Here is a very simple and quickly made GUI with comments on how to use it!

package test;

import java.awt.Dimension;
import javax.swing.*;

//By Skarion
public class ScWindow extends JFrame{

   private JPanel view;
   public ScWindow(int width, int height){
      setTitle("Fight for Arcadia");
      Dimension d = new Dimension(width, height);
      setPreferredSize(new Dimension(d));
   public void setContentPane(JPanel view){
      super.setContentPane(this.view = view);
   public static void main(String[] args){
      //Example of how to use these classes.
      char newLine = 10;
      View v = new View();
      v.setTitle("Main menu");
      v.setText("FIGHT FOR ARCADIA (now in HD)"+newLine+"Copyright (c) 2011 Robert M."+newLine+"Version 0.8 - 15 Sep 2011");
      v.setEvents(new Event("New Game"), new Event("Load Game"),new Event("Help"),new Event("Exit"));
      ScWindow s = new ScWindow(300,400);

package test;

import java.awt.*;
import java.util.HashMap;
import javax.swing.*;
//By Skarion

public class View extends JPanel{

   private JLabel title;
   private JTextArea text;
   private JPanel south;
   private static int MAXEVENTS=6;
   public View(){
      super(new BorderLayout());
      title = new JLabel();
      title.setFont(new Font("Verdana",Font.PLAIN,20));
      text = new JTextArea();
      south = new JPanel(new GridLayout(MAXEVENTS,1));
      Dimension d = new Dimension(200,30*MAXEVENTS);
      add(title, BorderLayout.NORTH);
      add(text, BorderLayout.CENTER);
      add(south, BorderLayout.SOUTH);
   public void setTitle(String s){
   public void setText(String s){
   public void setEvents(Event... events){
         System.out.println("You need to declare a larger MAXEVENTS to do this, else it will get ugly!");
      for(int i = 0;i<events.length;i++){
         JButton event = new JButton(events[i].getText());

package test;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
//By Skarion
public class Event extends MouseAdapter{

   private int value;
   private String text;
   //private Model model;
   public Event(String text /*, Model model*/){
      //Send in the model here for usage.
      //this.model = model;
      this.text = text;
   public String getText(){
      return text;
   public void setSelected(int value){
      this.value = value;
   public void mousePressed(MouseEvent e){
      //Tell model to activate this event.

If there is anything you wonder or would like to know, post and I can see if I can fix it.
21  Games Center / Showcase / Re: Unknown universe on: 2011-09-19 09:22:08
Windows 7. Got it working *once* with cmd, but now I only get this:

Found it. That was really a cute error.  Grin

One place I created a int from a long in the wrong place, and now as the date turned from yesterday to today said conversion became negative as the long became too large.

You would not had that error yesterday but you would had it today. Laughed out loud when I noticed it... Loading up a new version in a second (with new saved games keeping their current turn from now on).
22  Games Center / Showcase / Re: Unknown universe on: 2011-09-19 08:52:54
The only thing that happens when I start the Jar is that I hear the music. No window or anything. >___<

Which operative system (OS) are you using?

I thought Java was better at cross-platforming than this...

I don't have access to any Mac computer so won't be able to check that, though if you use any other OS I will probably be able to find the error.
23  Games Center / Archived Projects / Re: Fight For Arcadia (Text Based) on: 2011-09-19 08:46:48
Cute game!

Events are randomised right?

Wish to get help with a simple GUI?
24  Games Center / Showcase / Re: Unknown universe on: 2011-09-19 06:11:07
<Error>: CGContextFlush: invalid context 0x11ed4fa60
Invalid memory access of location 0x0 rip=0x11da0d8c9

Floating point exception

Hope that helps :/

I think that is caused by a Mac X bug that won't let the developer turn floating points to ints/doubles/whatever. If anyone can confirm that then I'd be very pleased! Smiley

Edit: It seem to also be able to be caused by an "Out of memory exception" though as you use the same memory base as I do I can not see how that would be possible? Or do Mac allow a different amount of memory to be used than Windows/Linux?
25  Games Center / Showcase / Re: Unknown universe on: 2011-09-18 16:43:34
Hello Skarion,

I noticed that after you load a game the turn-counter in the top right corner is reset to zero. I wasn't quite sure if that's normal or a bug Smiley

Unfortunately I still get crashes every few minutes. It's strange as they seem to occur totally by random. Sometimes the game crashes without me doing anything and sometimes it happens when I click on a button or try to open a different view. Undecided

I will try it on a windows pc later on - maybe it's just a problem with mac os?


I have never experienced any crashes myself (trying the game on Windows XP, Windows 7 and Linux SuSE).

Try using Windows and see what happens.

# If anyone else has any crashes, please state operative system please!

Edit: The reset of the turn at load is how it works currently, will try to make it continue from last turn in next version!

Edit2: Try to start the game from the command prompt (Terminal) and see what error the crash produces.
26  Games Center / Showcase / Re: Unknown universe on: 2011-09-18 14:14:39
New version has a lot of fixes and new stuff:

- A new tech tree is up and running together with everything that means!

- As of last version the load of a saved game didn't seem to work, now it works again!

- Right click on units you wish to build and you will see a summary of damage, defense, cost, time, name &:c.

- Further works on the graphics.

- Lots of smaller bug fixes and cleaning up.

- Fleets cleaned up a bit more and prepared for the introduction of leaders.

- Cleaned up a lot of misses in turn based gameplay.

- Changed gameplay to be slower early growth (with a longer exploration phase) and thereby making the AI expansion not feel like insanity.

- And much, much, more! Smiley

If there are any noticeable bugs, please report them to me and I'll try to fix them asap!

That's a quite common problem in flash games too. Tooltips that pop up occludes the button that the tooltip belongs too, removing the tooltip.

27  Games Center / Showcase / Re: Unknown universe on: 2011-09-16 06:24:03

I really enjoy your game and I love how you start so small in such a huge map - It's almost the same feeling I get while playing minecraft. I want to explore more and more Smiley

Thanks a lot! It's comments like these that makes me continue working on the game and won't give up on it! Smiley

You will see a few noticeable changes in the next version, I hope you will like it!

I noticed a little thing though. When I try to click the "End Turn" button in the bottom right corner, the popup that says "Click to end turn no..." sometimes hinders me from actually being abled to click the button. It starts to flicker and I have to carefully place my mouse to be abled to click it then Smiley

I play on a MacBook res. 1280 x 800.


Will see if I can fix that until next release! Smiley

Until I've fixed that, you can always end the turn by typing " " (Space).

Edit: Seem to been the tooltip, it work perfectly after I removed the tooltip. Smiley
28  Games Center / Featured Games / Re: SpellCrafter on: 2011-09-13 13:15:09
Fun game!

- A little too dark.
- Missed music, or at least some kind of sound reaction to things happening.
- Sometimes it lagged (had a lot of problems when walking into walls, didn't feel so smooth).
- When shooting at enemies at a crossroad the thing went usually bonkers. They and I was shooting at eachother but the spells got stuck right between us.


- Loved the minimap.
- Loved the spells.
- Loved the easy to use controls.
- Loved the way that stuff flew to me so I didn't have to pick it up directly.

Those were the most obvious things to me at least. Smiley
29  Games Center / Showcase / Re: Unknown universe on: 2011-09-09 21:44:03
As I know that some information is nessecary but hard to get, I've tried to add it.

[Early art, will likely be improved later]

Left side, in order:
1, Is shown when your star has been recently attacked.
2, Is shown when you recently has occupied/colonized said star.
3, Is shown when there is larger dissent on said star.

Right side, in order:
1, Is shown when you have a defense at said star.
2, Is shown when you are constructing something at said star.
3, Is shown when the star's population is happy. Smiley
30  Games Center / Showcase / Re: Unknown universe on: 2011-09-08 14:59:31
A download like, may be ?  Grin
You should give it with each update.

Takes a little while to prepare for release each time, so usually wait until someone wants it. Smiley

Here's the latest download link:
Pages: [1] 2 3
Jesse (16 views)
2015-07-29 04:35:27

Riven (37 views)
2015-07-27 16:38:00

Riven (19 views)
2015-07-27 15:35:20

Riven (22 views)
2015-07-27 12:26:13

Riven (12 views)
2015-07-27 12:23:39

BurntPizza (32 views)
2015-07-25 00:14:37

BurntPizza (42 views)
2015-07-24 22:06:39

BurntPizza (24 views)
2015-07-24 06:06:53

NoxInc (31 views)
2015-07-22 22:16:53

NoxInc (21 views)
2015-07-22 22:13:39
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 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‑
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!