Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (707)
Games in Android Showcase (206)
games submitted by our members
Games in WIP (781)
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 ... 360
1  Game Development / Networking & Multiplayer / Re: Need to pick your gentlemen/ladies's brains on something that's driving me crazy on: 2017-01-18 16:45:43
Stacktrace!

Cas Smiley
2  Game Development / Performance Tuning / Re: Turn-based game - world map performance issue on: 2017-01-16 22:20:36
I think we need to see some profiling data before jumping to any conclusions.

80mb of data per frame is trivial, especially as once it's gotten to VRAM it's fast as hell.

Cas Smiley
3  Game Development / Newbie & Debugging Questions / Re: getting rid of "instanceof" on: 2017-01-16 09:33:34
Usually I end up trying every combination of super and extends until it compiles. The logic behind it is indeed logic, but so hard to grasp just by glancing at something that even now after, what, over 10 years of using generics, I still can't get it right first time.

Quote
And all this discussion, interesting discussion at that, could be solved with double dispatch.
Heh Smiley And another language. But here we are.

Cas Smiley
4  Game Development / Newbie & Debugging Questions / Re: getting rid of "instanceof" on: 2017-01-12 15:31:18
Have a look at these three different ways of doing the same thing. Each has its nuances.

Firstly, the visitor pattern. The visitor pattern has these advantages:
  • Nearly the fastest implementation
  • Gracefully handles sub-hierarchies
  • To implement new effects, we simply implement different EntityVisitors that act upon the concrete subclasses directly
  • If we want to ensure that something new is always explicitly handled we don't have to use a default implementation and the compiler will complain
and these disadvantages:
  • To implement new Entities classes, we must be able to also change the EntityVisitor interface
  • Requires instantiation of an EntityVisitor instance, though this is likely escaped, and likely cacheable

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  
interface EntityVisitor {
   default void visit(Monster m) {}
   default void visit(FriendlyMonster m) {}
   default void visit(Player p) {}
   default void visit(Arrow a) {}
}

abstract class Entity {
   abstract void accept(EntityVisitor v);
}

class Monster extends Entity {
   void accept(EntityVisitor v) { v.visit(this); }
   void kill() {...}
}
class FriendlyMonster extends Monster {
   @Override
   void accept(EntityVisitor v) { v.visit(this); }
}
class Player extends Entity {
   void accept(EntityVisitor v) { v.visit(this); }
   void damage(int points) {...}
}
class Arrow extends Entity {
   void accept(EntityVisitor v) { v.visit(this); }
   void remove() {...}
}

...
// Poison gas cloud! Kill all monsters, and damage all players. Arrows are unaffected
entities.forEach(e -> e.accept(new EntityVisitor() {
   void visit(Monster m) { m.kill(); }
   void visit(Player p) { p.damage(1); }
});

// Smartbomb! Kill all monsters, remove arrows
entities.forEach(e -> e.accept(new EntityVisitor() {
   void visit(Monster m) { m.kill(); }
   void visit(Arrow a) { a.remove(); }
});


Here is what it looks like with an enum type. It has the following advantages:
  • Very easy to understand what it does at a glance
  • Entity can change what it returns from getType(), allowing it to "change" its class effectively. Not sure if this is an advantage in this case Wink

.. and disadvantages:
  • Not as fast as visitor: requires a virtual method call, then a switch, then a cast just to get to where we want to send messages to the right thing
  • If we want to add a new Entity class, we must be able to change EntityType to add a new enum for it
  • There is no actual connection between EntityType and the subclasses of Entity - it simply relies on the cast.

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  
enum EntityType { MONSTER, FRIENDLY_MONSTER, PLAYER, ARROW }
abstract class Entity {
   abstract EntityType getType();
}

class Monster extends Entity {
   EntityType getType() { return EntityType.MONSTER; }
   void kill() {...}
}
class FriendlyMonster extends Monster {
   @Override
   EntityType getType() { return EntityType.FRIENDLY_MONSTER; }
}
class Player extends Entity {
   EntityType getType() { return EntityType.PLAYER; }
   void damage(int points) {...}
}
class Arrow extends Entity {
   EntityType getType() { return EntityType.ARROW; }
   void remove() {...}
}
// Poison gas cloud! Kill all monsters, and damage all players. Arrows are unaffected
entities.forEach(e -> {
   switch (e.getType()) {
      case MONSTER:
         ((Monster) e).kill();
         break;
      case PLAYER:
         ((Player) e).damage(1);
         break;
   }
});

// Smartbomb! Kill all monsters, remove arrows
entities.forEach(e -> {
   switch (e.getType()) {
      case MONSTER:
         ((Monster) e).kill();
         break;
      case ARROW:
         ((Arrow) e).remove();
         break;
   }
});



And with instanceof. The advantages being:
  • Classes no longer need to be in an actual hierarchy or implement some common interface
and disadvantages being:
  • How do we differentiate between Monster and FriendlyMonster? We have to remember to check for the subtype before we check the super type... get it wrong and wierd things happen to your FriendlyMonsters which are strangely treated like Monsters. Imagine if you decided to change the type hierarchy so that FriendlyMonster inherited instead from Player... or Entity.
  • Slowest implementation
  • Ugly cast only gets uglier if you want to call more than one method

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  
class Monster {
   void kill() {...}
}
class FriendlyMonster {
}
class Player {
   void damage(int points) {...}
}
class Arrow {
   void remove() {...}
}
// Poison gas cloud! Kill all monsters, and damage all players. Arrows are unaffected
entities.forEach(e -> {
   if (e instanceof FriendlyMonster) {
      // Don't do anything to FriendlyMonster!
   } else if (e instanceof Monster) {
      ((Monster) m).kill();
   } else if (e instanceof Player) {
      ((Player) e).damage(1);
   }
});

// Smartbomb! Kill all monsters, remove arrows
entities.forEach(e -> {
   if (e instanceof FriendlyMonster) {
      // Don't do anything to FriendlyMonster!
   } else if (e instanceof Monster) {
      ((Monster) e).kill();
   } else if (e instanceof Arrow) {
      ((Arrow) e).remove();
   }
});


And on a related but important tangent, another way to implement all that using polymorphic dispatch. This is great when you know in advance what effects you might be hitting the Entities with.
Advantages:
  • Absolute fastest possible implementation
  • Super easy to see what's going on

Disadvantages:
  • We must know every effect that can occur to the Entities up front, rather than creating new effects by building them up from smaller effects - we cannot add new effects if we don't have access to Entity source
  • Once you've got a lot of effects, your base class becomes huge, full of empty implementations

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  
abstract class Entity {
   void onPoisonGas() {}
   void onSmartbomb() {}
}

class Monster extends Entity {
   @Override
   void onPoisonGas() { kill(); }
   @Override
   void onSmartBomb() { kill(); }
   void kill() {...}
}
class FriendlyMonster extends Entity {
   @Override
   void onPoisonGas() { // Don't do anything! }
   @Override
   void onSmartBomb() { // Don't do anything! }
   void kill() {...}
}
class Player extends Entity {
   @Override
   void onPoisonGas() { damage(1); }
   void damage(int points) {...}
}
class Arrow extends Entity {
   @Override
   void onSmartBomb() { remove(); }
   void remove() {...}
}
// Poison gas cloud! Kill all monsters, and damage all players. Arrows are unaffected
entities.forEach(Entity::onPoisonGas);

// Smartbomb! Kill all monsters, remove arrows
entities.forEach(Entity::onSmartBomb);


So... just some comparisons to think about.

Cas Smiley
5  Game Development / Newbie & Debugging Questions / Re: getting rid of "instanceof" on: 2017-01-12 15:00:39
So is breaking encapsulation, which is why I'd shy away from both whenever possible.
I don't get the "breaking encapsulation" part here.

Cas Smiley
6  Game Development / Newbie & Debugging Questions / Re: getting rid of "instanceof" on: 2017-01-12 12:28:05
Jeez, that's among the most awful code I've ever had to look upon Sad

Here's why and when you should use visitor:

1. You know all the possible types in advance but you might add more later
2. You have access to the types to change them have them all implement the acceptor
3. You need it to be fast-as-f**k
4. You want to write (and hence maintain) the bare minimum of actual code

This so happens to fit collision detection in games but there are lots of other cases where these four criteria are bang-on.

I tend to use instanceof only when I can't apply a visitor because it's not my code so I can't just stuff an acceptor interface on it. I tend to shy away from switch statements on enums because when enums grow, switch statements tend to fall behind, whereas the visitor breaks immediately at compile time (without default interface implementations) or at least doesn't actually fail.

IMO casting in OOP is one of the strongest bad smells in code, and instanceof is essentially a cast.

Cas Smiley
7  Game Development / Newbie & Debugging Questions / Re: getting rid of "instanceof" on: 2017-01-12 00:01:50
Seriously, what is wrong with visitor? It's fast, it works, it catches anything awry at compile time, and with default methods on interfaces it's not even ugly any more - what's not to like?

Cas Smiley
8  Game Development / Newbie & Debugging Questions / Re: getting rid of "instanceof" on: 2017-01-11 19:37:24
There's a new trick in Java 8 which means you don't need to provide empty method implementions in every implementing class: declare the visitor with default methods:
1  
2  
3  
4  
5  
interface Visitor {
default void visit(Grobbit g) {}
default void visit(Squirgle s) {}
default void visit(Flimbo f) {}
}

Bingo, you no longer need to litter your implementations with empty methods any more.

Cas Smiley
9  Game Development / Newbie & Debugging Questions / Re: getting rid of "instanceof" on: 2017-01-11 16:32:09
Check out this post from .... 2002.

http://www.java-gaming.org/topics/the-xap-development-diary/200/msg/1573/view.html#msg1573

Cas Smiley
10  Game Development / Newbie & Debugging Questions / Re: getting rid of "instanceof" on: 2017-01-10 23:23:38
See "Visitor Pattern".

Cas Smiley
11  Games Center / WIP games, tools & toy projects / Re: Ashworld on: 2017-01-06 19:39:18
That's why I'm on the big bucks  Cool

Cas Smiley
12  Games Center / WIP games, tools & toy projects / Re: Ashworld on: 2017-01-06 19:35:00
hack the URL, dude...

Cas Smiley
13  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-01-06 10:31:44
Post-apocalyptic America. Murcans vs. mutants.

Cas Smiley
14  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX] How do you make your UIs? on: 2017-01-05 20:48:12
@princec i did look and it was awful ... but do you use a selfmade editor to handle that ?
All hand edited :S

Cas Smiley
15  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX] How do you make your UIs? on: 2017-01-05 10:14:18
Btw if anyone is thinking of making a UI-heavy Java game any time in the future I strongly suggest you take a long, hard look at JavaFX, which is really very good, and getting better.

Cas Smiley
16  Games Center / WIP games, tools & toy projects / Re: Hexara rewrite with Java 8 & JavaFX on: 2017-01-04 09:18:31
Don't get confused! AnimationTimers are not threads. They're all invoked on the JavaFX application thread by the JavaFX pulse.

Cas Smiley
17  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-01-04 09:13:37
Good looking fog!

Cas Smiley
18  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-12-30 20:39:17
Welcome back Kev, where you been?

Cas Smiley
19  Game Development / Newbie & Debugging Questions / Re: Making fields public that use both setters and getters on: 2016-12-28 14:32:35
Just imagine how much easier this would have all been if you could declare member variables in interfaces...

Cas Smiley
20  Discussions / General Discussions / Re: New Year Resolutions -- 2017 on: 2016-12-24 02:44:39
Release Battledroid to alpha to Patreons (by Easter), and to "Minimum Viable Product" (feature complete but with no content) by midsummer.

Cas Smiley
21  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-12-21 22:13:01
Pop-up tab widget:



Cas Smiley
22  Games Center / WIP games, tools & toy projects / Re: Sullen *On Steam* on: 2016-12-21 16:26:27
Congratulations and well done Smiley

Cas Smiley
23  Game Development / Newbie & Debugging Questions / Re: LWJGL2 using LWJGL3's image loading on: 2016-12-21 11:22:43
Ah, that's a bit of a pain.
I seem to recall mutterings about how all this stuff should have been hived off into totally separate projects a while ago...

Cas Smiley
24  Game Development / Newbie & Debugging Questions / Re: LWJGL2 using LWJGL3's image loading on: 2016-12-21 10:30:20
You can use LWJGL2 and 3 at the same time AFAIK. And LWJGL3 is modular so you should be able to use just the image loading lib.

Cas Smiley
25  Game Development / Newbie & Debugging Questions / Re: Image Collision Detection Recommendations on: 2016-12-19 15:24:25
I bet there's a way to do this on a GPU super-fast Smiley

Cas Smiley
26  Java Game APIs & Engines / Engines, Libraries and Tools / Re: {LibGDX} How do you make your UIs? on: 2016-12-19 14:16:22
I see it even upsets the forum's code tag syntax highlighter Smiley

Cas Smiley
27  Java Game APIs & Engines / Engines, Libraries and Tools / Re: {LibGDX} How do you make your UIs? on: 2016-12-19 14:13:48
I use an awful home grown XML system! It makes me want to cry every day, but hey ho, I made this bed so I shall have to lie in it.

It looks like this (shield your eyes before looking):
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  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
<?xml version='1.0' encoding='utf-8'?>

<!-- HUD overlay at the top of the screen -->
<resources>

   <package name="bots.screens.hud"/>
   <class name="HUDOverlay"/>

   <property key="button.tab.w" value="64"/>
   <property key="button.tab.h" value="64"/>
   <property key="button.tab.break.w" value="12"/>
   <property key="button.tab.gap" value="10"/>
   <property key="button.tabs.y" value="30"/>
   <property key="button.tabs.margin" value="120"/>
   <property key="button.tabs.w" value="=($button.tab.w*7)+($button.tab.break.w*2)+($button.tab.gap*8)"/>
   <property key="hud.height" value="180"/>
   <property key="hud.total.height" value="=$hud.height + 130"/>
   <property key="hud.main.width" value="=$button.tabs.w + $button.tabs.margin"/>
   <property key="hud.left.width" value="290"/>
   <property key="hud.right.width" value="252"/>
   <property key="hud.left.arm.width" value="=$hud.left.width + ($hud.main.width * 0.5) + 0.1" />
   <property key="hud.right.arm.width" value="=$hud.right.width + ($hud.main.width * 0.5) - 0.1" />
   <property key="user.id.x" value="131"/>
   <property key="user.id.y" value="10"/>
   <property key="user.id.w" value="600"/>
   <property key="user.avatar.x" value="20"/>
   <property key="user.avatar.y" value="70"/>
   <property key="user.avatar.size" value="$#AVATAR_SIZE"/>
   <property key="messages.x" value="=$user.id.w + $user.id.x + 42"/>
   <property key="messages.y" value="130"/>
   <property key="dropdown.position" value="106"/>
   <property key="rhs.dropdowns.w" value="730"/>
   <property key="rhs.dropdowns.x" value="100% - 20"/>

   <!-- tab buttons -->
   <include resource="gui/hud/tabs.xml"/>

   <!-- Backgrounds -->

   <!-- top hud panel -->

   <background name="widget.panel.main" texture="widgets-glowing/widget.panel.main.png" coords="150,150,150,70" insets="-40,0,-20,0" blend="GLOWING" topColor="panel.top" bottomColor="panel.bottom" />
   <background name="widget.panel.main.back" texture="widgets-solid/widget.panel.main.back.png" coords="150,150,150,70" insets="-40,0,-20,0"  color="panel.back"/>

   <background name="widget.panel.main.L" texture="widgets-glowing/widget.panel.main.L.png" coords="60,150,60,70" insets="-40,-30,-20,0" blend="GLOWING"  topColor="panel.top" bottomColor="panel.bottom" />  
   <background name="widget.panel.main.L.back" texture="widgets-solid/widget.panel.main.L.back.png" coords="60,150,60,70" insets="-40,-30,-20,0" color="panel.back"/>
     
   <background name="widget.panel.main.R" texture="widgets-glowing/widget.panel.main.R.png" coords="60,150,60,70" insets="-40,0,-20,-25" blend="GLOWING" topColor="panel.top" bottomColor="panel.bottom" />      
   <background name="widget.panel.main.R.back" texture="widgets-solid/widget.panel.main.R.back.png" coords="60,150,60,70" insets="-40,0,-20,-25"  color="panel.back"/>

   <background name="widget.panel.main.arm.L" texture="widgets-glowing/widget.panel.main.arm.L.png" coords="60,150,60,70" insets="-40,0,-20,0"   scale="=$widget.scale" blend="GLOWING" topColor="panel.top" bottomColor="panel.bottom" />  
   <background name="widget.panel.main.arm.L.back" texture="widgets-solid/widget.panel.main.arm.L.back.png" coords="60,150,60,70" insets="-40,0,-20,0"  color="panel.back"/>

   <background name="widget.panel.main.arm.R" texture="widgets-glowing/widget.panel.main.arm.R.png" coords="60,150,60,70" insets="-40,0,-20,0" blend="GLOWING" topColor="panel.top" bottomColor="panel.bottom" />  
   <background name="widget.panel.main.arm.R.back" texture="widgets-solid/widget.panel.main.arm.R.back.png" coords="60,150,60,70" insets="-40,0,-20,0"  color="panel.back"/>
   
   <layers name="icon.connection.warning.init.layers"><sprite layer="1000" animation="icon.connection.warning.init.anim"><sprite image="img.icon.connection.warning.glow"/></sprite></layers>
   <layers name="icon.connection.warning.mouseon.layers"><sprite layer="1000" animation="icon.connection.warning.mouseon.anim"><sprite image="img.icon.connection.warning.glow"/></sprite></layers>
   <layers name="icon.connection.warning.mouseoff.layers"><sprite layer="1000" animation="icon.connection.warning.mouseoff.anim"><sprite image="img.icon.connection.warning.glow"/></sprite></layers>  
   
   <animation name="icon.connection.warning.init.anim"><frame i="img.icon.connection.warning"/><frame i="icon.init.anim"/></animation>
   <animation name="icon.connection.warning.mouseon.anim"><frame i="img.icon.connection.warning"/><frame i="icon.mouseon.anim"/></animation>
   <animation name="icon.connection.warning.mouseoff.anim"><frame i="img.icon.connection.warning"/><frame i="icon.mouseoff.anim"/></animation>

   <layers name="icon.connection.error.init.layers"><sprite layer="1000" animation="icon.connection.error.init.anim"><sprite  image="img.icon.connection.error.glow"/></sprite></layers>
   <layers name="icon.connection.error.mouseon.layers"><sprite layer="1000" animation="icon.connection.error.mouseon.anim"><sprite  image="img.icon.connection.error.glow"/></sprite></layers>
   <layers name="icon.connection.error.mouseoff.layers"><sprite layer="1000" animation="icon.connection.error.mouseoff.anim"><sprite  image="img.icon.connection.error.glow"/></sprite></layers>  
   
   <animation name="icon.connection.error.init.anim"><frame i="img.icon.connection.error"/><frame i="icon.init.anim"/></animation>
   <animation name="icon.connection.error.mouseon.anim"><frame i="img.icon.connection.error"/><frame i="icon.mouseon.anim"/></animation>
   <animation name="icon.connection.error.mouseoff.anim"><frame i="img.icon.connection.error"/><frame i="icon.mouseoff.anim"/></animation>
   
   <layers name="icon.connection.online.init.layers"><sprite layer="1000" animation="icon.connection.online.init.anim"><sprite  image="img.icon.connection.online.glow"/></sprite></layers>
   <layers name="icon.connection.online.mouseon.layers"><sprite layer="1000" animation="icon.connection.online.mouseon.anim"><sprite  image="img.icon.connection.online.glow"/></sprite></layers>
   <layers name="icon.connection.online.mouseoff.layers"><sprite layer="1000" animation="icon.connection.online.mouseoff.anim"><sprite  image="img.icon.connection.online.glow"/></sprite></layers>  
   
   <animation name="icon.connection.online.init.anim"><frame i="img.icon.connection.online"/><frame i="icon.init.anim"/></animation>
   <animation name="icon.connection.online.mouseon.anim"><frame i="img.icon.connection.online"/><frame i="icon.mouseon.anim"/></animation>
   <animation name="icon.connection.online.mouseoff.anim"><frame i="img.icon.connection.online"/><frame i="icon.mouseoff.anim"/></animation>

   <layers name="icon.connection.active.init.layers"><sprite layer="1000" animation="icon.connection.active.init.anim"><sprite  animation="icon.connection.active.blink.anim"/></sprite></layers>
   <layers name="icon.connection.active.mouseon.layers"><sprite layer="1000" animation="icon.connection.active.mouseon.anim"><sprite animation="icon.connection.active.blink.anim"/></sprite></layers>
   <layers name="icon.connection.active.mouseoff.layers"><sprite layer="1000" animation="icon.connection.active.mouseoff.anim"><sprite  animation="icon.connection.active.blink.anim"/></sprite></layers>  
   
   <animation name="icon.connection.active.init.anim"><frame i="img.icon.connection.online"/><frame i="icon.init.anim"/></animation>
   <animation name="icon.connection.active.mouseon.anim"><frame i="img.icon.connection.online"/><frame i="icon.mouseon.anim"/></animation>
   <animation name="icon.connection.active.mouseoff.anim"><frame i="img.icon.connection.online"/><frame i="icon.mouseoff.anim"/></animation>

   <animation name="icon.connection.active.blink.anim">
      <frame i="img.icon.connection.online.glow"/>
      <interpolate var="alpha" f="ease-in" start="255" end="64" duration="30" forever="true" />
   </animation>

   <layers name="icon.connection.offline.init.layers"><sprite layer="1000" animation="icon.connection.offline.init.anim"><sprite  image="img.icon.connection.offline.glow"/></sprite></layers>
   <layers name="icon.connection.offline.mouseon.layers"><sprite layer="1000" animation="icon.connection.offline.mouseon.anim"><sprite image="img.icon.connection.offline.glow"/></sprite></layers>
   <layers name="icon.connection.offline.mouseoff.layers"><sprite layer="1000" animation="icon.connection.offline.mouseoff.anim"><sprite  image="img.icon.connection.offline.glow"/></sprite></layers>  
   
   <animation name="icon.connection.offline.init.anim"><frame i="img.icon.connection.offline"/><frame i="icon.init.anim"/></animation>
   <animation name="icon.connection.offline.mouseon.anim"><frame i="img.icon.connection.offline"/><frame i="icon.mouseon.anim"/></animation>
   <animation name="icon.connection.offline.mouseoff.anim"><frame i="img.icon.connection.offline"/><frame i="icon.mouseoff.anim"/></animation>

   <animation name="icon.account.init.anim"><color c="button.text.off"/><frame i="img.icon.account"/><frame i="icon.init.anim"/></animation>
   <animation name="icon.account.mouseon.anim"><color c="button.text.on"/><frame i="img.icon.account"/><frame i="icon.mouseon.anim"/></animation>
   <animation name="icon.account.mouseoff.anim"><color c="button.text.off"/><frame i="img.icon.account"/><frame i="icon.mouseoff.anim"/></animation>
   <animation name="icon.account.disabled.anim"><color c="button.text.disabled"/><frame i="img.icon.account"/><frame i="icon.disabled.anim"/></animation>
   
   <animation name="icon.connection.init.anim"><color c="button.text.off"/><frame i="img.icon.connection"/><frame i="icon.init.anim"/></animation>
   <animation name="icon.connection.mouseon.anim"><color c="button.text.on"/><frame i="img.icon.connection"/><frame i="icon.mouseon.anim"/></animation>
   <animation name="icon.connection.mouseoff.anim"><color c="button.text.off"/><frame i="img.icon.connection"/><frame i="icon.mouseoff.anim"/></animation>

   <animation name="icon.options.init.anim"><color c="button.text.off"/><frame i="img.icon.options"/><frame i="icon.init.anim"/></animation>
   <animation name="icon.options.mouseon.anim"><color c="button.text.on"/><frame i="img.icon.options"/><frame i="icon.mouseon.anim"/></animation>
   <animation name="icon.options.mouseoff.anim"><color c="button.text.off"/><frame i="img.icon.options"/><frame i="icon.mouseoff.anim"/></animation>

   <animation name="icon.help.init.anim"><color c="button.text.off"/><frame i="img.icon.help"/><frame i="icon.init.anim"/></animation>
   <animation name="icon.help.mouseon.anim"><color c="button.text.on"/><frame i="img.icon.help"/><frame i="icon.mouseon.anim"/></animation>
   <animation name="icon.help.mouseoff.anim"><color c="button.text.off"/><frame i="img.icon.help"/><frame i="icon.mouseoff.anim"/></animation>
   
   <area name="connection.icon.spec" type="active" width="100%" height="100%" offsetX="+-18" offsetY="16"/>
   <define tag="connection" inherit="connection.icon.spec" base="area"/>
   
   <area name="tab.break.spec" type="none" width="=$button.tab.break.w"/>
   <define tag="tab-break" inherit="tab.break.spec" base="area"/>
   
   <button name="tab.button.spec" width="=$button.tab.w" height="=$button.tab.h"/>
   <define tag="tab-button" inherit="tab.button.spec" base="button-widget"/>
   
   <instance
      name="hud.overlay"
      class="bots.screens.hud.HUDOverlay"
   >
   
      <!-- Tab hotkeys. Defined here so that they call Screen.onCommand -->
      <hotkey key="F1" area="$#@homeTabButton"/>
      <hotkey key="F2" area="$#@worldTabButton"/>
      <hotkey key="F3" area="$#@deployTabButton"/>
      <hotkey key="F4" area="$#@battleTabButton"/>
      <hotkey key="F5" area="$#@armyTabButton"/>
      <hotkey key="F6" area="$#@commanderTabButton"/>
      <hotkey key="F7" area="$#@eventsTabButton"/>

      <area
         y="north"
         width="100%"
         height="$hud.height"
      >
     
         <!-- Top left corner -->
         <area
            x="west"
            y="south"
            width="$hud.left.width"
            height="$hud.height"
         >
            <background id="back" layer="-1" subLayer="0" background="widget.panel.main.L.back" />
            <background id="glow" layer="-1" subLayer="1" background="widget.panel.main.L" />
         </area>
     
         <!-- Left extending arm. 625 = top left width + half of the centre piece width; 0.1 prevents hairline cracks -->
         <area
            x="=$hud.left.width"
            y="south"
            width="50% - $hud.left.arm.width"
            height="$hud.height"
         >
            <background id="back" layer="-1" subLayer="0" background="widget.panel.main.arm.L.back" />
            <background id="glow" layer="-1" subLayer="1" background="widget.panel.main.arm.L" />
         </area>
     
         <!-- Middle part with tabs inside it -->
         <area
            x="centre"
            y="south"
            width="$hud.main.width"
            height="$hud.height"
         >
            <layout><flow vpos="$button.tabs.y" hgap="$button.tab.gap"/></layout>
           
            <background id="back" layer="-1" subLayer="0" background="widget.panel.main.back" />
            <background id="glow" layer="-1" subLayer="1" background="widget.panel.main" />
           
            <tab-button id="$#@homeTabButton"   init="tab.icon.home.init.layers" normal="tab.icon.home.mouseoff.layers" armed="tab.icon.home.mouseon.layers"/>
            <tab-break/>
            <tab-button id="$#@worldTabButton"    init="tab.icon.world.init.layers" normal="tab.icon.world.mouseoff.layers" disabled="tab.icon.world.disabled.layers" armed="tab.icon.world.mouseon.layers"/>
            <tab-button id="$#@deployTabButton"   init="tab.icon.deploy.init.layers" normal="tab.icon.deploy.mouseoff.layers" disabled="tab.icon.deploy.disabled.layers" armed="tab.icon.deploy.mouseon.layers"/>
            <tab-button id="$#@battleTabButton"   init="tab.icon.battle.init.layers" normal="tab.icon.battle.mouseoff.layers" disabled="tab.icon.battle.disabled.layers" armed="tab.icon.battle.mouseon.layers"/>
            <tab-break/>
            <tab-button id="$#@armyTabButton"    init="tab.icon.army.init.layers" normal="tab.icon.army.mouseoff.layers" disabled="tab.icon.army.disabled.layers" armed="tab.icon.army.mouseon.layers"/>
            <tab-button id="$#@commanderTabButton"   init="tab.icon.user.init.layers" normal="tab.icon.user.mouseoff.layers" disabled="tab.icon.user.disabled.layers" armed="tab.icon.user.mouseon.layers"/>
            <tab-button id="$#@eventsTabButton"    init="tab.icon.events.init.layers" normal="tab.icon.events.mouseoff.layers" disabled="tab.icon.events.disabled.layers" armed="tab.icon.events.mouseon.layers"/>
           
         </area>
         
         <!-- The messages widget -->
         <messages id="$#@messages"
            x="east"
            y="$messages.y"
            width="100%-$messages.x"
         />
         
         <!-- Right extending arm. 565 = top right width + half of the centre piece width. -->
         <area
            x="100% - $hud.right.width"
            y="south"
            width="50% - $hud.right.arm.width"
            height="$hud.height"
         >
            <background id="back" layer="-1" subLayer="0" background="widget.panel.main.arm.L.back"/>
            <background id="glow" layer="-1" subLayer="1" background="widget.panel.main.arm.L"/>
         </area>
     
         <!-- Top right corner -->      
         <area
            x="east"
            y="0"
            width="$hud.right.width"
            height="$hud.height"
         >
            <background id="back" layer="-1" subLayer="0" background="widget.panel.main.R.back" />
            <background id="glow" layer="-1" subLayer="1" background="widget.panel.main.R" />
         </area>

         <!-- User's avatar -->      
         <area id="$#@hudTopUserAvatar"
            x="$user.avatar.x"
            y="$user.avatar.y"
            width="$user.avatar.size"
            height="$user.avatar.size"
           
            contentInsets="0,0,0,0"
           
            font="bd.M"
            textColor="text.bold"
            textLayer="1"
            textSubLayer="1"
            halign="left"
            valign="top"
         />

         <!-- User ID and mini-stats -->
         <area id="aaa"
            x="$user.id.x"
            y="100%-$user.id.y"
         >
            <layout><flow hgap="8"/></layout>      

            <area id="$#@hudTopUserRank"
               offsetX="50%-0"
               offsetY="50%-0"
               width="50"
               height="60"
            />

            <area
               width="$user.id.w"
               height="60"
            >            
               <area id="$#@hudTopUser"
                  x="west"
                  y="north"
                 
                  contentInsets="0,0,0,0"
                 
                  font="bd.M"
                  textColor="text.bold"
                  textLayer="1"
                  textSubLayer="1"
                  halign="left"
                  valign="top"
               />
               
               <area id="$#@hudTopUserInfo"
                  x="west"
                  y="south"
                  width="400"
                  height="30"
     
                  font="bd.S"
                  textColor="text"
                  text="0Au 0(0)"
                  textLayer="1"
                  textSubLayer="1"
                  halign="left"
                  valign="top"
               />
            </area>
         </area>
         
         <toggle id="$#@accountCbx"
            x="$user.id.x"
            y="100%-78"
            width="50"
            height="35"
         >
            <toggle-off
               init="icon.account.init.anim"
               normal="icon.account.mouseoff.anim"
               armed="icon.account.mouseon.anim"
               selected="icon.account.mouseon.anim"
               disabled="icon.account.disabled.anim"
            />
            <toggle-on
               init="icon.account.init.anim"
               normal="icon.account.mouseoff.anim"
               armed="icon.account.mouseon.anim"
               selected="icon.account.mouseon.anim"
               disabled="icon.account.disabled.anim"
            />
         </toggle>
           
         <!-- Container for the three toggle buttons in the top right, connection, options and help -->
         <area
            x="100%-22"
            y="100%-65"
            height="35"
         >      
            <layout><flow inflate="true" hgap="12"/></layout>
           
            <toggle id="$#@connectionCbx"
               height="100%"
               width="50"
            >
               <toggle-off
                  init="icon.connection.init.anim"
                  normal="icon.connection.mouseoff.anim"
                  armed="icon.connection.mouseon.anim"
                  selected="icon.connection.mouseon.anim"
               />
               <toggle-on
                  init="icon.connection.init.anim"
                  normal="icon.connection.mouseoff.anim"
                  armed="icon.connection.mouseon.anim"
                  selected="icon.connection.mouseon.anim"
               />
               <connection id="$#@connectionWarning"    init="icon.connection.warning.init.layers" armed="icon.connection.warning.mouseon.layers" normal="icon.connection.warning.mouseoff.layers"/>
               <connection id="$#@connectionError"    init="icon.connection.error.init.layers" armed="icon.connection.error.mouseon.layers" normal="icon.connection.error.mouseoff.layers"/>
               <connection id="$#@connectionOnline"    init="icon.connection.online.init.layers" armed="icon.connection.online.mouseon.layers" normal="icon.connection.online.mouseoff.layers"/>
               <connection id="$#@connectionActive"    init="icon.connection.active.init.layers" armed="icon.connection.active.mouseon.layers" normal="icon.connection.active.mouseoff.layers"/>
               <connection id="$#@connectionOffline"    init="icon.connection.offline.init.layers" armed="icon.connection.offline.mouseon.layers" normal="icon.connection.offline.mouseoff.layers"/>
            </toggle>
                     
            <toggle id="$#@optionsCbx"
               height="100%"
               width="50"
            >
               <toggle-off
                  init="icon.options.init.anim"
                  normal="icon.options.mouseoff.anim"
                  armed="icon.options.mouseon.anim"
                  selected="icon.options.mouseon.anim"
               />
               <toggle-on
                  init="icon.options.init.anim"
                  normal="icon.options.mouseoff.anim"
                  armed="icon.options.mouseon.anim"
                  selected="icon.options.mouseon.anim"
               />
            </toggle>
                     
            <toggle id="$#@helpCbx"
               height="100%"
               width="50"
            >
               <toggle-off
                  init="icon.help.init.anim"
                  normal="icon.help.mouseoff.anim"
                  armed="icon.help.mouseon.anim"
                  selected="icon.help.mouseon.anim"
               />
               <toggle-on
                  init="icon.help.init.anim"
                  normal="icon.help.mouseoff.anim"
                  armed="icon.help.mouseon.anim"
                  selected="icon.help.mouseon.anim"
               />
            </toggle>
         </area>
                           
      </area>
   </instance>
   
   <class />
   
   <panel-small-titled name="top.dropdown.panel.spec"
      layoutState="$hidden"
   >
      <layout-transition from="{init,hidden}" to="normal" f="ease-out" duration="10" interrupt="immediate"/>
      <layout-transition from="normal" to="{init,hidden}" f="ease-out" delay="5" duration="10" interrupt="immediate"/>

      <layout-transition from="normal" to="expanded" f="ease-out" duration="10" interrupt="immediate"/>
      <layout-transition from="expanded" to="normal" f="ease-out" delay="5" duration="10" interrupt="immediate"/>
     
      <layout-transition from="{init,hidden}" to="expanded" f="ease-out" duration="10" interrupt="immediate"/>
      <layout-transition from="expanded" to="hidden" f="ease-out" delay="5" duration="10" interrupt="immediate"/>
   </panel-small-titled>
   
   <define tag="hud-dropdown-panel" inherit="top.dropdown.panel.spec" base="area"/>
   
   <include resource="gui/hud/options.overlay.xml"/>
   <include resource="gui/hud/help.overlay.xml"/>
   <include resource="gui/hud/connection.overlay.xml"/>
   <include resource="gui/hud/account.overlay.xml"/>
   <include resource="gui/hud/steam.login.overlay.xml"/>
   
</resources>


Cas Smiley
28  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-12-17 13:36:37
Finally implemented background loading in SPGL2 resource loader. Splash screen now smoothly animated. Surprisingly a lot more complicated than at first meets the eye.

If I were a real timewaster, I'd try properly multithreading resource loading and having some sort of dependency graph... but I'm not that stupid Smiley

Cas Smiley
29  Games Center / WIP games, tools & toy projects / Re: Ashworld on: 2016-12-16 10:38:03
Looks brilliant as ever!

Cas Smiley
30  Game Development / Performance Tuning / Re: Most optimal collision detection algorithms on: 2016-12-14 10:02:53
Grids and pooled lists for me. Most my my entities are roughly uniform in size, and the median number of entities in a grid cell is 1 when there are any entities at all. With a grid I'm computing collisions between about 5-6000 entities in next to no time at all.

Cas Smiley
Pages: [1] 2 3 ... 360
 
Galdo (303 views)
2017-01-12 13:44:09

Archive (464 views)
2017-01-02 05:31:41

0AndrewShepherd0 (924 views)
2016-12-16 03:58:39

0AndrewShepherd0 (864 views)
2016-12-15 21:50:57

Lunch (996 views)
2016-12-06 16:01:40

ral0r2 (1227 views)
2016-11-23 16:08:26

ClaasJG (1328 views)
2016-11-10 17:36:32

CoffeeChemist (1345 views)
2016-11-05 00:46:53

jay4842 (1426 views)
2016-11-01 19:04:52

theagentd (1226 views)
2016-10-24 17:51:53
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21
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!