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 (553)
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:

Quote
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:

Quote
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
http://docs.oracle.com/javase/tutorial/2d/images/loadimage.html

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.

Quote
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:

1  
2  
3  
4  
5  
6  
7  
Random rand = new Random();
while(starMap.getValues().size()<STARS_MAX){
Point p = new Point(rand.nextInt(UNIVERSE_WIDTH), rand.nextInt(UNIVERSE_HEIGHT));
if(!starMap.containsKey(p)){
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:

http://www.mediafire.com/?kc8e8kj1xr37gt7

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

http://i.imgur.com/ot9bo.png
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:

http://java.decompiler.free.fr/

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:

http://i.imgur.com/Wrr0S.png

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

Greetings.

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!



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  
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);
      setSize(d);
      setPreferredSize(new Dimension(d));
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   }
   public void setContentPane(JPanel view){
      super.setContentPane(this.view = view);
      pack();
      setVisible(true);
   }
   
   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);
      s.setContentPane(v);
   }
}


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  
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();
      text.setEditable(false);
      text.setBackground(null);
      south = new JPanel(new GridLayout(MAXEVENTS,1));
      Dimension d = new Dimension(200,30*MAXEVENTS);
      south.setSize(d);
      south.setPreferredSize(d);
      add(title, BorderLayout.NORTH);
      add(text, BorderLayout.CENTER);
      add(south, BorderLayout.SOUTH);
   }
   
   public void setTitle(String s){
      title.setText(s);
   }
   public void setText(String s){
      text.setText(s);
   }
   public void setEvents(Event... events){
      south.removeAll();
      if(events.length>MAXEVENTS){
         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++){
         events[i].setSelected(i);
         JButton event = new JButton(events[i].getText());
         event.addMouseListener(events[i]);
         south.add(event);
      }
      updateUI();
   }
   
}


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  
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.
     //model.eventFired(value);
  }
}


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
1  
2  
3  
4  
<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?

greetings,
EatenByAGrue

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.

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

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!

Quote
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.

Greetings

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.

Positive:

- 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: http://www.mediafire.com/?983r9mh5srco6tr
Pages: [1] 2 3
 

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 (24 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 (33 views)
2014-08-08 02:01:56

Norakomi (42 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!