Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
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 ... 9
1  Discussions / Miscellaneous Topics / Re: f.lux on: 2014-04-16 18:06:21
Personally I love flux. Every now and then I will turn it off to see how I do without it, but it never lasts long.
2  Games Center / WIP games, tools & toy projects / Re: [LibGDX] GameUtils on: 2014-04-09 12:48:06
Looks good...I've been thinking about timers, intervals, etc a fair bit recently which is why these thoughts are coming to me. As for the last point, it might be nice to have a constructor for StopWatch that takes a Clock as a parameter. That way when you slow or speed up the clock time, the stop watches speed or slow down automatically.
3  Game Development / Newbie & Debugging Questions / Re: My most inefficient way of implementing running texts. How to optimize? on: 2014-04-09 12:30:00
Do you really intend on using words of 18 letters or more? It's nice to have a complete solution for these kinds of edge cases, but it may have little to no practical impact.
4  Games Center / WIP games, tools & toy projects / Re: [LibGDX] GameUtils on: 2014-04-09 07:26:31
A couple of random minor comments about StopWatch:

Is there a reason why the callback is implemented as a StopWatchCallback interface as opposed to a simpler no argument interface like execute()? I could see using this to schedule command pattern style code where I don't really care about the timer, I just want to do something when it goes off. Also, I may want to use my command object outside of the StopWatch and now I need to either pass in null to the execute or have a separate no-argument execute method.

It might be nice to have a setCallback(StopWatchCallback callback). Depending on what is going on in a game one may wish to change the callback while the stopwatch is counting down.

You may want to have more states for your StopWatch (start, stop, pause, resume). You could even assign different callbacks to each in case you wanted it to respond differently to it pausing vs. stopping prematurely.

EDIT:
Another random thought. Are or should StopWatches be associated with a Clock and if so, would the StopWatch count down at a rate equal to the Clock rate, so that if the Clock slows down, the StopWatch does as well?
5  Discussions / General Discussions / Re: JDK 8 is released on: 2014-03-28 18:54:53
Although Stripped implementations were ruled out for java 8, they may show up in a point release prior to java 9. While it's not a full module system, it would at least allow for the removal of unneeded classes in a way that is compliant with the license.
6  Game Development / Newbie & Debugging Questions / Re: vector formulas on: 2014-03-26 13:50:49
Yup.
7  Discussions / General Discussions / Re: JDK 8 is released on: 2014-03-19 23:21:41
I had downloaded the jdk pre-release builds and have been developing my game with those. Defender methods are pretty cool. It makes it easy to add certain types of functionality with very little boiler plate.

8  Discussions / Miscellaneous Topics / Re: what to do? on: 2014-03-08 01:49:42
You're there already so enjoy it. People watch. Have some fun. Be a little stupid yourself. You don't have to get high or drunk to do it, if it isn't your thing.
9  Game Development / Newbie & Debugging Questions / Re: Effecient way to use z-index for 2d games on: 2014-02-20 21:49:19
It might be more trouble than it is worth but if you have a relatively finite number of z-index values you can have a List for each layer. The layers can then be held in an array which you iterate over. Something like:

1  
2  
3  
4  
5  
6  
7  
8  
// Loop through each layer
for (int i=0; i< layers.length; i++) {

   // For each layer render everything on that layer.
  for (Renderable renderable : layers[i]) {
      renderable.render();
   }
}


if you want your z-index to take arbitrary values or if the z-index is changing frequently it may not be the best approach.
10  Discussions / General Discussions / Re: Simple JAR/Library repository on: 2014-01-30 03:10:11
I have been reading up more on Maven repositories and it looks like setting up an  "Internal Repository" may be what I want. There is a ton of documentation out there on Maven but so much of it seems impenetrable. My preference is to use something that already exists rather than write my own thing. From what I have been able to understand on how it is used, it might be worth writing a simple wrapper to interact with the repository outside of the scope of a project.

I know that Maven has those who love it and those who hate it. For me, my projects are small and simple enough that as long as the build system integrates into the IDE I think I will be fine.
11  Discussions / General Discussions / Re: Simple JAR/Library repository on: 2014-01-30 00:23:44
Yup, I can do that in IntelliJ too. I do like being able to deploy versions of even my internal projects rather than linking the source directly. This gives me more freedom to update the source without affecting downstream projects until I am ready to deploy. While attaching sources and docs are easy, it seems like something that a system could do for me.
12  Discussions / General Discussions / Simple JAR/Library repository on: 2014-01-30 00:05:16
Like most people I have multiple projects going. Some of them use similar external libraries (e.g. libgdx, guava, etc) and some projects are common code intended to be used as resources for other projects. Currently, I simply try to store my libraries under a common root directory. There are a number of things I don't like about this set up:
1. When I download libraries, I have to manually set up consistent directories to store them in.
2. Every time I create a new project, I have to navigate up and down the repository directory hierarchy adding the jars I need and also attach the javadoc, source, and natives.
3. Exporting my own common libraries into my directory structure seems overly cumbersome

What I would like is a simple system that:

1. Allows me to add a library to my local laptop my specifying a descriptor and have it create the appropriate directories and copy the file(s) over. For instance something like:
1  
2  
3  
4  
5  
6  
7  
8  
add { 
   library-name: libGDX,
   version:0.9.9,
   source-dir: c:\users\actual\downloads\
   file:libgdx.9.9.jar,
   source:libgdx-source.jar,
   javadoc:libgdx-javadocs.jar
   }

2. IDE integration: Allow me to select libraries from a flat list of projects in the repository and import them. It would also automatically find and attach javadoc/sources/natives as appropriate.

3. Simplifies the exporting of libraries that I create by automatically adding them to the correct place in the repository, and including the javadoc/source attachments.


I have a feeling that what I am looking for already exists. I looked at Maven and Apache Ivy, but both seem intended to be used as entire build systems whereas I am looking for something much simpler. Maybe I am just not understanding them properly. Since I am a solo developer, I also do not need to run repository servers, etc. and I am fine with having to first download libraries to my machine.

Creating a simple repository API to add, remove, and query libraries doesn't seem like it would be too hard but the IDE integration would be trickier. I currently use intellij, but am also comfortable with eclipse and netbeans.

Does anyone have any suggestions or thoughts?

(EDIT: Removed a bunch of white space at the end)
13  Game Development / Artificial Intelligence / Re: Active Time Battle AI :: Am I doing it right? on: 2014-01-10 20:14:27
One idea is to think about how you can turn your Behaviors into separate objects, which will come in handy as they get more numerous and more complex. Something like:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public interface Behavior {
   
   float getDesirability();

   CombatAction getAction();
}


public class AttackBehavior implements Behavior { ... }

public class DefendBehavior implements Behavior {...}

// etc



This would also make it easier to do things like evaluate the most desirable Behavior:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
Behavior bestChoice = null;
float highestScore = -1;

// Assume a list of behaviors
for (Behavior behavior : behaviors) {
   float score = behavior.getDesirability();
   if  (score > maxScore) {
      bestChoice = behavior;
      maxScore = score;
   }
}


This seems easier than throwing everything in a tree map like you are doing. If there would only be a single instance of each behavior you could look into making them enums.
14  Discussions / General Discussions / Re: Do you listen to music when you code? on: 2013-12-12 15:06:50
(+1 for that http://coffitivity.com/ very cool!)

When I originally heard about it, I thought it was just a gimmick, but once I tried it I loved it. If you like white noise but are in the mood for something geekier, you could always try listening to the idling of the TOS or TNG Enterprise.
15  Discussions / General Discussions / Re: Do you listen to music when you code? on: 2013-12-12 01:10:41
I like Coffitivity. I often listen to it without music. Gives me some background noise without being too distracting.
16  Discussions / General Discussions / Re: Bad Habits on: 2013-12-02 19:59:45
I don't document my code at a high enough level. I document the nuts and bolts of classes and methods well enough, but I find myself coming back to code later thinking....why did I do it this way? Why is this an interface? What was I planning on using this class for?

I find myself much more productive when I document my intentions. Something like: "My Action class is part of a GOAP framework. The idea is that all other Actions will inherit from this class and then only need to implement the update, onSuccess, and onFailure methods. These actions should really only be used when a GameEntity needs to do something that takes more than one time step."

This kind of document doesn't really fit into javadoc and needs its own file.
17  Game Development / Game Play & Game Design / Re: Card Battling System on: 2013-10-23 11:06:34
A "crap ton" of conditional statements is usually a bad idea. If you are looking to implement the game in OOP, then more typical style would be for the card to do its own calculations and carry out its own actions, rather than a separate system.

Some questions that might help clarify things:
  • Even though there are a wide variety of actions, can they be categorized (Damage causing, healing, stat improvement, etc)?
  • Will a given card have actions of more than one type?
  • Do all of the actions come into play all of the time or does the player choose among a set of available actions for a given card?

Without knowing more, I would create a class that represents an Action. A Card can own one or more Actions and would iterate through them to calculate the overall effect.
18  Games Center / Showcase / Re: Generic Zombie Shooter on: 2013-10-16 04:56:20
Your download URL isn't formatted correctly. this is what you are looking for.
19  Game Development / Shared Code / Re: Easy LibGDX sprite creator on: 2013-10-15 21:15:55
If you want to go with an enum type approach another option is to attach the methods directly to the enum itself. Something like:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
public enum Sprites {

   Rock("res/tiles/","rock.png"),
   Paper("res/tiles/","paper.png"),
   VoidTile("res/tiles/","void.png");
   
   
   private String imageFilePath;
   
   SpriteType(String path, String fileName) {
      imageFilePath = path + fileName;
   }
   
   
   public Sprite getSprite() {
      return new Sprite(new Texture(imageFilePath));
   }
}



Then you could call it by saying Sprite myRock = Sprites.Rock.getSprite();. This doesn't negate some of the other criticisms people have with the approach (caching, using pre-built solutions) but it is easier to use and doesn't involve multiple expanding switch statements.


20  Discussions / Miscellaneous Topics / Re: What would you like to see in Java? on: 2013-10-08 03:29:25
One thing I would like is the ability to better fine tune the visibility of classes and methods. Often times I will want a class to be accessible by another class in a different package (maybe a sub package) but not publicly accessible.
21  Game Development / Newbie & Debugging Questions / Re: Interfaces and game design ? on: 2013-10-07 15:04:04
Starting out with interfaces is an example of the advice program to an interface not an implementation. This Stack Overflow question has some good answers as to why it is desirable.
22  Game Development / Newbie & Debugging Questions / Re: is it possible to manipulate with BufferedReader and BufferedWriter on: 2013-09-30 14:48:55
Is the file large? If not, then simply read the file into a data structure, make your changes to that data structure, and then write the data structure back out to the file. It seems like the simplest approach to get you what you want.
23  Game Development / Newbie & Debugging Questions / Re: Does it make sense to load actor images of moving right and left? on: 2013-09-26 20:56:27
You can flip texture regions by setting negative bounds on the constructor, see the api docs. I would say do it....especially if it makes development easier.
24  Games Center / WIP games, tools & toy projects / Re: Stryker Game Engine and Development Suite on: 2013-09-26 16:42:52
we are planning to have unity - unreal engine quality with a lot easier usage and more features.

Can you go into a little detail as to what features currently in unreal/unity that you are looking to simplify/make easier for the user and what features you are planning on that unity/unreal does not have?
25  Discussions / General Discussions / Re: Do you customize your IDE (Eclipse?) on: 2013-09-16 01:29:44
While I don't like white on black, I do find light text on a darker background to be easier on the eyes especially when I am coding at night. Most of the websites, docs, etc. that I am consulting while programming are dark on light so maybe it's just the variety that helps?
26  Game Development / Newbie & Debugging Questions / Re: Enum and texture on: 2013-09-04 16:43:00
If you really want to go the enum route and do not want to load unnecessary textures, try pushing the texture loading out of the constructor.

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  
public enum Clan {
   
   HUMAN("human.png"), ORC("orc.png");

   private String imageFile;
   private int textIdCards;

   private Clan(String file) {
      imageFile = file;
   }


   public void loadTexture() {
        try{
         texture = TextureLoader.getTexture("PNG" , ResourceLoader.getResourceAsStream(imageFile));
         texIdCards = texture.getTextureID();
      } catch (Exception e){
         System.out.println("Can't load Textures : " + texture);
      }
   }

   public int getTexIdCards(){
      return texIdCards;
   }
}


Then you can call Clan.HUMAN.loadTexture() or Clan.ORC.loadTexture() as needed.
27  Discussions / General Discussions / Re: Any suggestions on how to create a basic AI? on: 2013-08-28 21:52:43
AI is a huge topic and there are lots of possible approaches (decision trees, state machines, GOAP). For a simple game, some if-then statements can actually take you pretty far. Pulling lots of historical data to do statistics on is a possible solution but I don't think there is a particular need to do that here. For one, your Entities do not need to take the absolute best action at every step, only that they take actions that make sense.

If you have a reasonably short list of possible actions, one approach might be to loop through all of the possible actions the Entity could take and calculate a desirability score. The Entity would then execute the one with the highest score. The calculations could be very simple such as the desirability of the CastHealthSpellAction could be monster.getHealth() / monster.getMaxHealth();.


For a little variety you could:
1. Have the Entity could randomly select between the 2-3 highest scoring Actions.
2. Add a small bit of randomness to each calculated value so that the Entity does not always take the same Action in a given situation.
3. Use "personality traits" of the Entity to help calculate values. For instance, give the Entity an AggressionScore. The desirability of a MeleAttack Action could then include the Aggression Score as part of the calculation. This way you could have Entities with a high aggression score that would be more likely to attack or those with a lower score who would be less likely.

Going further down this road can take you to full on GOAP (Goal Oriented Action Planning) but there is no reason for it to. Simply calculating the most desirable action based on the Entity's personality and the current situation should be enough to give you a pretty decent AI.







28  Game Development / Newbie & Debugging Questions / Re: Require aid refining a "Game Of Life"-esque project (Dead entities on the edges) on: 2013-08-23 20:48:03
I think you would want to loop from 1-99 otherwise you will still have nulls along on edge.

The easiest to ensure you are working with values from the same board would be to simply have a "newID" field in your Entity class. Your update could be something like:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
public void tick() {
   if (entitiesOfOppositeID(this, surEnt) >= thresholdForConversion) {
      if (ID == 0) {
         newID = 1;
      } else if (ID == 1) {
         newID = 0;
      }
   }
   else {
      newID = ID;
}

Then after you have run through the board you would then loop through and set ID to newID. There are probably more efficient ways to do this, but this should work fine.

Re: Hysteresis:

I wasn't sure if the problem you were having was that entities would flip, and then the threshold would be met, they would flip back, causing it to flip back as well, on and on... (your comment about IDs just switching back and forth). I wasn't sure if the the threshold changed depending on whether the ID is 1 or 0 would help. Something like:


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
public void tick() {

  // For this entity to flip from 0 to 1, there must be at least 5 entities that are 1.
 int threshold0To1 = 5;
 
  // For this entity to flip from 1 to 0 there must be at least 3 entities that are a 0.
 int threshold1To0 = 3;

   int oppositeIdCount = entitiesOfOppositeID(this,surEnt);

   if (ID == 0 && oppositeIdCount >= threshold0To1) {
         newID = 1;
      } else if (ID == 1 && oppositeIdCount >= threshold1To0) {
         newID = 0;
      }
   }
   else {
      newID = ID;
}


I'm not sure if it will do anything, it is just a thought I had while reading your problem and code.

On an unrelated note, do you anticipate having more than 0 or 1 as IDs? If not. what if you switched your Id type to a boolean? It might make some of your code easier to write.







29  Game Development / Newbie & Debugging Questions / Re: Require aid refining a "Game Of Life"-esque project (Dead entities on the edges) on: 2013-08-23 19:31:52
To stop having to check for null all the time what if you made the board with a strip of extra tiles. So if you want a 100-100 board, your tile array would be new Tile[102][102]. Then when you are checking entities for being surrounded you loop from 1 to 101.

A possible thought. It looks like you are modifying the board as you go. So when you are calculating the value of the current cell, you are using the current frame's value for half of the cells but the already updated values for the other half. This leaves the board in an in-between and inconsistent state. Ideally as you calculate the new states of the entities, you would ensure that you are only using the state of the current state to calculate the new values, and then update all of the values at the end.

EDIT: Another thought is that your entities may be getting into a pattern where entities are flipping back and forth because there is only a single set point (the same way a thermostat would constantly switch on and off around its set point). Hysteresis may be your friend here.
30  Game Development / Newbie & Debugging Questions / Re: Sequential and multiple method calls? (function pointer alternatives-ish) on: 2013-08-22 21:04:24

Yup. They are calling them Lambda Expressions.

Java Dzone article
Oracle tutorial.

Pages: [1] 2 3 ... 9
 

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

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (55 views)
2014-04-15 18:08:23

BurntPizza (53 views)
2014-04-15 03:46:01

UprightPath (66 views)
2014-04-14 17:39:50

UprightPath (49 views)
2014-04-14 17:35:47

Porlus (66 views)
2014-04-14 15:48:38

tom_mai78101 (90 views)
2014-04-10 04:04:31

BurntPizza (151 views)
2014-04-08 23:06:04

tom_mai78101 (247 views)
2014-04-05 13:34:39

trollwarrior1 (204 views)
2014-04-04 12:06:45

CJLetsGame (211 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!