Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (515)
Games in Android Showcase (122)
games submitted by our members
Games in WIP (577)
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 ... 282
1  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-10-30 09:51:53
http://www.java-gaming.org/topics/libstruct/34282/msg/323446/view.html#msg323446
http://www.java-gaming.org/topics/libstruct/34282/msg/323450/view.html#msg323450
2  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-10-29 21:52:11
You're asking me to make a dozen tutorials, hoping one of them matches your needs? Smiley

If you show me some code, I most likely can spot the misconception in a few minutes.
3  Game Development / Game Mechanics / Re: How to simulate Electricity in Tile-based game on: 2014-10-29 20:26:32
Every Wire is passed to exactly two Nodes, not more.

You don't really have to adjust the algorithm & data structure for a grid based map. Make a Node for every tile, and add Wires during gameplay. Sure, this can be optimized, but make it work first - optimize if it actually turns out to be slow.
4  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-10-29 18:47:33
Ah, mystery solved. I was already wondering how you could possibly end up with this result:

purely with SSOA, given that the desk behind the chair is not in the depth buffer.
5  Discussions / Chitchat Monster / Re: How to simulate Electricity in Tile-based game on: 2014-10-29 17:42:10
Fixed Pointing
6  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-10-29 16:42:06


How stable is the shading (in model space) when the camera position/angle/fov changes arbitrarily?

What is your framerate? (on which hardware?)


It's a shame 'depth darkening' adds this dark halo around objects, IMHO the (very last?) trigger for my brain to scream 'fake!' (see lamp, armrests, gong).
7  Discussions / Chitchat Monster / Re: How to simulate Electricity in Tile-based game on: 2014-10-29 16:14:15
I change them for the better Cool
8  Game Development / Newbie & Debugging Questions / Re: [SOLVED] IllegalArgumentException: input == null & res folder not exporting on: 2014-10-29 16:11:40
Next time you can read the sticky first post on this other board, as it will print out the solution for you:
http://www.java-gaming.org/topics/faq-cannot-find-the-resource-file/33226/view.html
9  Discussions / Chitchat Monster / Re: How to simulate Electricity in Tile-based game on: 2014-10-29 16:10:23
remove the space from the code tags
10  Game Development / Game Mechanics / Re: How to simulate Electricity in Tile-based game on: 2014-10-29 15:59:26
Btw, can someone please tell me the html tag for the code snippets? Can't seem, to find the right one Oo
1  
[ code]System.out.println("p0wer!");[ /code]



EDIT: So the "pole" is some kind of "connection node", makes sence Smiley
Pole == Node, as every Node is a "connection node" (after all it knows which wires it is connected to), I just named it "Pole" to show how it models reality.


I think i need the wires to be a Node also, but that isn't much of a problem.
I wouldn't do that. A wire is conceptually very different from a Node. Making a Wire a Node will lead to all kinds of workarounds and hacks, as it doesn't match reality - and reality is the easiest to wrap your head around.
11  Game Development / Game Mechanics / Re: How to simulate Electricity in Tile-based game on: 2014-10-29 15:55:15
You connect a wire to a wire (and them some) by connecting them both to the same Node. I don't see why that would be a problem. It models reality, as no sane person would connect high-power wires (in a knot). Something small or big will hold them together (a Node).



Generator  ---------- Pole --------- Pole --------- Consumer
                        |
                        |
                    Consumer
12  Game Development / Game Mechanics / Re: How to simulate Electricity in Tile-based game on: 2014-10-29 15:48:27
No energy consumption in 'crash and burn':
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
public class Consumer extends Node {
   public int demand = 33;

   public void tick() {
-     int taken = Math.min(demand, energy);
-     energy -= taken;
-     if(taken < demand) {
+     if(demand <= energy) {
+        energy -= demand;
         // up and running!
      }

      super.tick();
}


Implementing a storage (a battery):
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  
import java.util.ArrayList;
import java.util.List;

public class Node {
   public int energy;
   public int capacity;

   public List<Wire> wires = new ArrayList<>();

   public void tick() {
      if (energy == 0 || wires.isEmpty())
         return;

      while (true) {
         Node target = null;
         for (Wire wire : wires) {
            Node remote = (wire.a != this) ? wire.a : wire.b;
            if (remote.energy == remote.capacity)
               continue; // remote node is full
-            if (remote.energy >= this.energy)
-               continue; // cannot spread against a voltage potential
            if (target == null || remote.energy < target.energy)
               target = remote; // we found a new target
         }
         if (target == null)
            return;

         this.energy -= 1;
         target.energy += 1;
      }
   }
}
13  Game Development / Game Mechanics / Re: How to simulate Electricity in Tile-based game on: 2014-10-29 15:44:09
The 'beauty' of my design is that it models reality (although in reality it converges to a solution much quicker), is trivial, and just works, no matter how complex your scene.
14  Game Development / Game Mechanics / Re: How to simulate Electricity in Tile-based game on: 2014-10-29 15:38:53
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
public class Wire {
   public final Node a, b;

   public Wire(Node a, Node b) {
      this.a = a;
      this.b = b;
      a.wires.add(this);
      b.wires.add(this);
   }

   public void cut() {
      a.wires.remove(this);
      b.wires.remove(this);
   }
}

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  
import java.util.ArrayList;
import java.util.List;

public class Node {
   public int energy;
   public int capacity;

   public List<Wire> wires = new ArrayList<>();

   public void tick() {
      if (energy == 0 || wires.isEmpty())
         return;

      while (true) {
         Node target = null;
         for (Wire wire : wires) {
            Node remote = (wire.a != this) ? wire.a : wire.b;
            if (remote.energy == remote.capacity)
               continue; // remote node is full
            if (remote.energy >= this.energy)
               continue; // cannot spread against a voltage potential
            if (target == null || remote.energy < target.energy)
               target = remote; // we found a new target
         }
         if (target == null)
            return;

         this.energy -= 1;
         target.energy += 1;
      }
   }
}


A generator is a Node:
1  
2  
3  
4  
5  
6  
7  
8  
9  
public class Generator extends Node {
   public int production = 100;

   public void tick() {
      energy = Math.min(energy + production, capacity);

      super.tick();
   }
}


A consumer is a Node:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
public class Consumer extends Node {
   public int demand = 33;

   public void tick() {
      int taken = Math.min(demand, energy);
      energy -= taken;
      if(taken < demand) {
         // make something crash and burn
      }

      super.tick();
}


Generate, spread & consume electricity:
1  
2  
3  
for(Node node: world.nodes) {
   node.tick();
}
15  Game Development / Shared Code / Re: Clippy: clipboard history tool on: 2014-10-29 14:54:03
offtopic:

Nice, good catch Riven! What do you think of DataStore? It doesn't hide that SQL is being used, but it makes it super easy to setup and use an H2 database in a thread safe way. A long time ago I had another layer on top of it that was basic ORM, but that gets nasty pretty quick.
I have an abstraction layer that is actually pretty nifty, without forcing you into ORM. (there is an ORM layer I built on top of it, but it's optional)

It mostly revolves around named parameters:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
Set<Integer> bestFriendIds = new HashSet<>();
bestFriendIds.add(13);
bestFriendIds.add(14);
bestFriendIds.add(37);
// or: int[] bestFriendIds = new int[]{13,14,37};

Query q = new Query(); // builder pattern-ish
q.withSQL("SELECT [whatever:w], [sumfin:s]    ");
q.withSQL("  FROM whatever AS w               ");
q.withSQL(" INNER JOIN sumfin AS s            ");
q.withSQL("         ON w.id = s.fk            ");
q.withSQL(" WHERE w.id IN ( :ids )            ");
q.withSQL("   AND age < :age                  ");
q.withParam("ids", bestFriendIds);
q.withParam("age", 55);
resultset = q.execute();


Is expanded to:
1  
2  
3  
4  
5  
6  
7  
SELECT w.id, w.user, w.email, w.age,  <-- fixed column order, allowing for
       s.id, s.quirk, s.isDuke        <-- high performance: resultset.get(++columnIndex)
  FROM whatever AS w
 INNER JOIN sumfin AS s
         ON w.id = s.fk
 WHERE w.id IN (?, ?, ?)              <-- notice the variable amount of parameters, determined by Collection.size()
   AND age < ?
where the parameters are converted/transformed and shoved into the PreparedStatement.



Would I open-source it? Nevah! No time to give support to mere mortals! Emo
16  Game Development / Shared Code / Re: Clippy: clipboard history tool on: 2014-10-29 13:26:58
https://github.com/EsotericSoftware/clippy/blob/master/src/com/esotericsoftware/clippy/util/DataStore.java

Bug (line 381) - swap if statements.
1  
2  
3  
4  
         else if (dataType.startsWith("TIME"))
            type = Types.TIME;
         else if (dataType.startsWith("TIMESTAMP"))
            type = Types.TIMESTAMP;
17  Discussions / General Discussions / Re: Programmer jokes on: 2014-10-29 13:13:13
Most of my strings are multi-threaded. It's really comfy.
18  Game Development / Newbie & Debugging Questions / Re: [LWJGL] I'm VBO'ing wrong... on: 2014-10-26 11:16:08
I could improve it - the bit shifting (n << 2) seems to be too confusing for some, but then again, OpenGL is not a library for newbies. You are bound to have to read the documentation, so duplicating this effort seemed like a waste. I could add some links to docs in strategic places though.

If anything, the tutorial provides a lot of handholding already, and working code that you can tinker with, discovering what works and what crashes the JVM.
19  Game Development / Newbie & Debugging Questions / Re: [LWJGL] I'm VBO'ing wrong... on: 2014-10-26 10:59:14
Check out my article:
http://www.java-gaming.org/topics/introduction-to-vertex-arrays-and-vertex-buffer-objects-opengl/24272/view.html

@thedanisaur: like SHC said, you are suggesting the way it works for VAs when the OP needs VBOs. If you're not familiar with the difference you could read up on how to use VBOs in OpenGL.
20  Game Development / Newbie & Debugging Questions / Re: Generating water pool on: 2014-10-26 09:28:55
I wasn't saying it's impossible, but it's not an inherent feature/property of OpenGL.

Advising the OP to use OpenGL to generate curves, is like sending him down the rabbit hole.
21  Game Development / Newbie & Debugging Questions / Re: Generating water pool on: 2014-10-26 08:49:40
If you're using openGL you create the shape using curves...
Hm... have you ever worked with OpenGL? Smiley It's not curvy at all.
22  Games Center / Featured Games / Re: Daedalus - no escape on: 2014-10-25 15:17:27
Give him the (sha256) hash of your file, so he can verify the download didn't cause corruption. If the hash matches, it's out of your hands. If not, it's out of your hands too. Great, isn't it? Smiley
23  Java Game APIs & Engines / Java 2D / Re: Fast 2D hardware scaling of images (without GL?) on: 2014-10-24 20:59:22
Try to render the BufferedImage on a VolatileImage, as rendering to VolatileImages is (almost) guaranteed to be optimal in regards of hardware acceleration.
24  Discussions / General Discussions / Re: [bug] 'undefined index' relating to ranking system? on: 2014-10-24 20:54:58
I'm aware of it. No time and motivation to fix it soon. I wish you strength to deal with it Pointing
25  Discussions / General Discussions / Re: Instancing.. NVIDIA vs ATI on: 2014-10-24 20:32:20
Use (Float32) textures to sample your instance attributes, with nearest neighbour filtering, using gl_InstanceID to determine which texels to fetch.

This means you fetch instance attributes for every vertex, which is inefficient, but that is unlikely to be a bottleneck.
26  Game Development / Game Play & Game Design / Re: Unlocking features of a game on: 2014-10-23 07:30:11
Would that be so bad? Besides, you can make the time trials in such a way that you have multiple options, depending on your knowledge of features. That way you keep your time trials interesting enough to do replays, because people learn new tricks to solve the trail in previously unknown ways, drastically improving their time.
27  Game Development / Game Play & Game Design / Re: Unlocking features of a game on: 2014-10-23 07:07:00
For every N regular levels you unlock 1 time trail.
28  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-10-21 22:31:17
Or you might want to calculate normals and apply a simple NdotL, so you can get a sense of the 3d shape, without actually turning it into a 3d model.
29  Discussions / Business and Project Management Discussions / Re: Mobile Advertisment/ Admob: How much do you really earn? Where to find the data? on: 2014-10-21 07:27:56
Offtopic: ah, the joys of a lifetime AdSense ban... Some guy in Belgium clicked an AdSense ad 5 times in a row, I reported it and that was the end the account. If I could do it all again, I'd monitor ad clicks with javascript and disable ads for a few days for that browser, once one ad was clicked. Same rule applies for in-app ads, I presume.
30  Games Center / WIP games, tools & toy projects / Re: Meeting Point (2014) on: 2014-10-21 07:14:10
How does one market such a frivolous yet expensive setup? Which parties are willing to spend 5K to entertain a few dozen bystanders? Festivals seem to be a better, more fitting and lucrative market than the street art shown in the video. I imagine 'build it and they will come' doesn't apply here? So how do you do it? Smiley
Pages: [1] 2 3 ... 282
 

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

The first screenshot will be displayed as a thumbnail.

TehJavaDev (31 views)
2014-10-27 03:28:38

TehJavaDev (26 views)
2014-10-27 03:27:51

DarkCart (40 views)
2014-10-26 19:37:11

Luminem (21 views)
2014-10-26 10:17:50

Luminem (25 views)
2014-10-26 10:14:04

theagentd (31 views)
2014-10-25 15:46:29

Longarmx (61 views)
2014-10-17 03:59:02

Norakomi (57 views)
2014-10-16 15:22:06

Norakomi (46 views)
2014-10-16 15:20:20

lcass (43 views)
2014-10-15 16:18:58
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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