Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (734)
Games in Android Showcase (223)
games submitted by our members
Games in WIP (811)
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 ... 72
1  Games Center / Featured Games / Re: Demise of Nations for PC, Mac, Linux, Android & iOS on: 2017-08-09 10:43:08
Auxlia? Don't you mean Auxilia?

Oh never mind, looks like you might be correct; silly Latin.
2  Game Development / Newbie & Debugging Questions / Re: preven title bar to show in the part of your rendering screen on: 2017-08-03 13:43:48
rtfm

Frame javadoc, 4th paragraph of the class description.

Quote
A frame may have its native decorations (i.e. Frame and Titlebar) turned off with setUndecorated. This can only be done while the frame is not displayable.
3  Game Development / Newbie & Debugging Questions / Re: [Help] PNG + transparency + PSP 4.12 on: 2017-07-17 23:17:45
Sounds like you just need to learn how to properly use your paint package of choice.

Though a small note; basic png supports 3 types of transparency;
  • full alpha channel per pixel
  • per color alpha (for palettized images)
  • simple alpha mask

Your paint package will typically use the one most appropriate & efficient for your image's color depth, though not always.
4  Game Development / Shared Code / Re: Faster Than Light JSON Parser on: 2017-07-06 23:45:41
2. Implement that table via a ByteBuffer and do the lookup with sun.misc.Unsafe.getByte() to get rid of the default Java array access bounds checks.

Wow, you really are trusting the integrity of your data  Clueless
5  Game Development / Shared Code / Re: Faster Than Light JSON Parser on: 2017-07-06 12:34:46
I'm almost certain that a single case switch...

1  
2  
3  
4  
5  
         switch (c) {
         case '"':
            string(input, listener, inobject);
            continue;
         }

...will be slower than a simple if branch.
The reason being even a tableswitch involves a branch to check bounds (both upper & lower).

The index must be of type int and is popped from the operand stack. If index is less than low or index is greater than high, then a target address is calculated by adding default to the address of the opcode of this tableswitch instruction. Otherwise, the offset at position index - low of the jump table is extracted. The target address is calculated by adding that offset to the address of the opcode of this tableswitch instruction. Execution then continues at the target address.

Of course your benchmarking might have found otherwise?

#flibble dibble silly 90% quote content check#
6  Game Development / Shared Code / Re: Faster Than Light JSON Parser on: 2017-07-06 11:50:43
Going back to isEscaped; granted it's a fringe case, but rather than counting the escaped characters, just toggle a boolean?

  • It would eliminate the limitation of 2 billion sequential escaped characters persecutioncomplex
  • It might be quicker. (not that it'd ever be noticeable outside of the degenerate case of every character in every literal being '\' )
  • It demonstrates the intent of the code a little more obviously

1  
2  
3  
4  
5  
6  
7  
    private boolean isEscaped(byte[] input) {
        int p = pos - 1;
        boolean escaped = false;
        while (read(input, p--) == '\\')
            escaped=!escaped;
        return escaped;
    }


Though looking at the bytecode generated by javac 8, it appears that negating booleans is done with a branch now!? (I believe it used to be done with an xor)
Presumably that's something optimized by the JIT.
7  Game Development / Shared Code / Re: Faster Than Light JSON Parser on: 2017-07-06 11:31:09
As it operates on bytes, it doesn't support non-ASCII characters, no?
It does support the UTF-8 character coding, since all recognized tokens (", :, 0-9, etc.) are also in the ASCII range (highest bit not set). Or in other words: There will not be any byte of the 1-4 bytes in a single UTF-8 character encoding that can be misinterpreted as a recognized token by the parser, since all such bytes use the highest order bits to indicate that there are more bytes to follow. Quite clever of them to design the character coding this way.
So you can use any UTF-8 encoded character you like in object key names and string value literals.

Makes sense; so ParseInterface#stringLiteral(int off, int len) is the number of bytes that make up the literal, not necessarily the number of characters.
Should make sure the ParseInterface javadoc makes that clear.
8  Game Development / Shared Code / Re: Faster Than Light JSON Parser on: 2017-07-05 22:20:07
Really minor tweak;

byte c
in isescaped(...) should be an int. (As it is being used as a counter, not intermediary storage of a value copied from input)

....and the method itself should be named isEscaped(...)  Pointing

I'd also decide whether the class is going to be stateful, or not.
At the moment you're storing pos as state, but passing the byte[] & ParseListener around as parameters.

Go with one, or the other; doing both looks messy.
Given the aim is minimal weight & dependencies, I'd be inclined to make it stateless so everything can be static.
Either way, I doubt it'd have any noticeable impact upon performance.
9  Game Development / Shared Code / Re: "Better" LinkedList implementation on: 2017-06-19 14:49:23
I'd be inclined to have a reference in the Element, to the List that owns it.

It'd allow fail-fast protection against multiple logic errors (adding an Element to multiple lists/the same list multiple times, removing/moving an element from a List that it's not a member of, etc), making the code far less fragile.
10  Discussions / Miscellaneous Topics / Re: Programming in schools - opinions? on: 2017-02-24 12:20:42
@Abuse, I think all tests should allow laptops and spreadsheets, mostly for the ability to easily save and see intermediate results which is hard in a calculator, and to be able to see the history of working in prior cells' working to spot an error.

Are we imagining different examination techniques?
I'm still imagining paper examinations where the calculator simply supplements the written word; it's the responsibility of the student to record their working on the examination paper.

What you're suggesting sounds like a transition to completely digital examination, and while that paradigm shift is in the works, it's yet to become mainstream here in the UK.
I do agree though; digitally recording all intermediate working would be a much better way of evaluating a student's level of understanding, but spreadsheets are not the ideal tool for that purpose.

Quote
and regular * not x and / not รท symbols which are encountered all over the workplace and in everyday life.

Mathematical operator symbology is indeed a mess, and the pervasiveness of competing Computer Science symbology has only muddied the water further.
That's a whole different topic though.
11  Discussions / Miscellaneous Topics / Re: Programming in schools - opinions? on: 2017-02-23 16:30:15
Just to be clear, when I say "teaching programmin" in an elementary school, I expect to make it accordingly, that means no gradle or complex projects, but simple exercises, like moving an character through a 2d tiled-map. Something that also attract their attention and is, somehow, fun.

Teaching programming should be, indeed, teaching how to elaborate and process algorightms

Precisely.

I introduced my 5 year old nephew (mad on Minecraft) to code.org's Minecraft Hour of Code, and he found it incredibly rewarding.
Programming (in all its guises) is already prevalent throughout our society, and will be even more so in the future; introducing it early as a 'play thing' is vital for future learning.

It's hardly a new concept; anyone remember this:

Or this:
12  Discussions / Miscellaneous Topics / Re: Programming in schools - opinions? on: 2017-02-23 13:33:52
On a related note, I always think it's incredibly dumb how students are forced to use such limited calculators in exams. All exams in math related subjects should allow spreadsheets or mathematica or Google or a programming language on a laptop.

At what level are you talking about?

No highschool student would ever need access to such powerful tools to solve the problems they're being examined on.
Moreover, having access to such tools would change the focus of the examination; you'd no longer be testing them on their understanding of the topic, but on their ability to use the tools.
13  Discussions / Miscellaneous Topics / Re: Programming in schools - opinions? on: 2017-02-23 02:31:47
Programming is logical problem solving; it's an essential life skill for everyone.
It can (and should) be taught to all young children.

Coding on the other hand (and which I suspect is what the OP is actually talking about?), is a far more specialised discipline that not everyone can grasp to the same level.
So while you don't anticipate every pupil who is taught coding at school, will go on to use it in their professional life, they will know of its existence & thus have an understanding of how computers & technology work.

The parallel would be the car; everyone uses them, most know how they work, but very few would dare attempt anything but the most superficial of servicing.

Thankfully both programming & coding have been a part of the national curriculum here in the UK for some time, so I guess someone in authority knows where society & technology are headed.
14  Game Development / Newbie & Debugging Questions / Re: Peculiar stacktrace and an error I've never seen before on: 2017-02-21 03:09:43
unless this person has a software running that does exactly that, which I wouldn't assume.

Yeah, I had that thought today too.

Perhaps you've detected someone messing around with your game in a dev environment, for some nefarious (or otherwise) purpose.
15  Game Development / Newbie & Debugging Questions / Re: Peculiar stacktrace and an error I've never seen before on: 2017-02-19 19:37:24
1st place I'd look would be JAVA_TOOL_OPTIONS or _JAVA_OPTIONS environment variables for anything untoward.
Presumably you log & report the values of these on launch?
16  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Advantages of Ant? on: 2017-01-29 23:45:43
We simply do not allow any external dependencies in a build, period. The entirety of the repository must be sufficient to produce all artefacts.

Cas Smiley

Wow!

So you've got an entire VM image containing OS & apps checked in?  Grin
17  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Advantages of Ant? on: 2017-01-26 16:49:53
IME having external dependencies in a build is a bit like building your castle on sand. The build must always succeed. Discuss.

So you're advocating the inclusion of external packages with your build, rather than having them pulled from a central repository?

I'm of the opposite opinion; pulling from a central repository minimizes data duplication, and therefore fewer places for mysterious build errors to creep in.
Either you get the correct version of the correct library, or you get nothing. Fail fast.
18  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Advantages of Ant? on: 2017-01-25 16:49:27
Surprised nobody has mentioned Maven; from my limited experience with it, it's Ant done right.
Great Eclipse integration too, and you can host your maven repository directly on github.

Takes a little while to get your head around the concepts, but the way dependencies are handled makes it a dream to use (especially when you're pulling from others' Maven projects)
19  Game Development / Newbie & Debugging Questions / Re: getting rid of "instanceof" on: 2017-01-14 23:31:18
@cylab - Your post (reply # 29) showed me that you can use a class type as a key in a HashMap, so thank you for that.  Pointing I wanted to do that one point and didn't know it was actually possible. Also, I like the implementation you suggest as it is very clean. I'll probably try that at some point, but for now this implementation is working well.

I read in several spots on the thread that casting might smell of bad design, which I do in places, namely where a state is assigned to a Mob:
1  
2  
3  
4  
5  
6  
@Override
   public MobState init(Mob m) {
      brick = (Brick) m;
      brick.setCol(0xffff00);
      return this;
   }


The problem is that I can't assign the type and recognize the subclass methods without casting. It doesn't generate a compile time error if you pass the wrong type as an argument, but I have tested it and it will throw a ClassCastException and print a stack trace. So I was wondering if this is considered bad design and if there is a better approach? Thank you all for contributing to the thread- your expert advice has been very enlightening!

In that example, it looks like your MobState super-class should be a generic type, with the init method using the class' parameterized type for its parameter.
Something like:

1  
2  
3  
4  
abstract class MobState<T> {

public abstract MobState init(T m);
}


The return type could probably be parameterized too, though I've no idea what your MobState / Mob class heirarchy looks like.
20  Game Development / Newbie & Debugging Questions / Re: Type checking an init method on: 2016-12-27 15:44:54
I'd advise that you don't get yourself wrapped up in unnecessary Generics boilerplate.

What value is this bringing to your code?
Is it reducing, or increasing, complexity & readability?
21  Game Development / Game Play & Game Design / Re: The best way to normalize chances in a two-player game? on: 2016-12-09 23:14:42
IMO the large 1st-player advantage given by the rules necessitates multiple games for each level, with serve alternating between players.
Victory would then require a 2 game lead (break their serve & hold yours).
Basically Tennis tie breaker.

1st serve wouldn't matter, so decide it with a hidden coin toss.

It'd elongate each level, but it seems to me all the other alternatives are radical departures from the classic game.
22  Game Development / Newbie & Debugging Questions / Re: Concurrent Modification when changing maps? on: 2016-12-07 00:34:58
I am also not using multiple threads.

The JVM begs to differ:
Quote
I get a concurrent modification error ...

Not strictly true.

Quote
Note that this exception does not always indicate that an object has been concurrently modified by a different thread. If a single thread issues a sequence of method invocations that violates the contract of an object, the object may throw this exception. For example, if a thread modifies a collection directly while it is iterating over the collection with a fail-fast iterator, the iterator will throw this exception.

The provided code fragment could be doing this, but there's no way for us to know if collisionObjectLayer.getObjects() is the same Collection as ItemManager.itemList
23  Game Development / Newbie & Debugging Questions / Re: Concurrent Modification when changing maps? on: 2016-12-06 19:49:44
I am also not using multiple threads.

So where else is isLoading used?
If there aren't other threads referencing it, then it's completely superfluous.
If there are other threads referencing it, then it's almost certainly unsafe.
Either way, it's a pointer to a problem in design or understanding.

Rather than giving us a useless fragment of code, and having us guess at the cause, stick your code on github in its entirety so we can tell you precisely what the problem is.

Alternatively, learn to use a debugger.
24  Game Development / Newbie & Debugging Questions / Re: Concurrent Modification when changing maps? on: 2016-12-06 12:09:05
Looks to me like you're attempting to use the isLoading flag as a mutex.

That's unlikely to be thread safe.
You need to use proper synchronization.
25  Discussions / Miscellaneous Topics / Re: Humble monthly keys on: 2016-11-11 15:48:28
Would much appreciate Rebel Galaxy please!  Pointing

Thinking about it, I have a few keys of my own I could contribute to this thread...
26  Game Development / Game Play & Game Design / Re: Layout for movement buttons in a RPG mobile game on: 2016-11-10 17:05:36
You've got a touchscreen, you should use it to your advantage.
Rather than emulating a traditional d-pad, why not have the hero move towards where ever the user presses on the tilemap?

Of course this might not be suitable for your game design, nor might it be precise enough for the scale of your tilemap.
Still, it'd be a real difference in UI design, rather than the 3 rather superficial alternatives you've presented in the OP.
27  Game Development / Newbie & Debugging Questions / Re: protect files on: 2016-09-30 11:26:56
I'm not entirely sure what you're asking, but in a JAR's manifest you can specify that specific packages are sealed.

Classes defined in a sealed package must be archived within the same JAR; this prohibits 3rd party code from declaring itself a member of the sealed package, thereby preventing access to its package-private methods & members.

https://docs.oracle.com/javase/tutorial/deployment/jar/sealman.html

Whatever it is you're trying to achieve, using the default package is NOT the solution; NEVER use the default package.
28  Game Development / Newbie & Debugging Questions / Re: Point changing for some reason on: 2016-09-27 08:52:57
1  
public Cell(Point location)


Java passes references, and Point is a mutable type.
Any changes (outside this class) made to the Point instance that you pass into the constructor will alter the value returned by Entity#getLocation().

Java actually passes by value, it never passes by reference.

It may look like it passes by reference but it is actually by value.

This doesn't change the answer though.

I didn't say it passes by reference; I said it "passes references", and yes, it passes references by value.

However, this is semantic complexity that is entirely beyond the level of understanding demonstrated by the OP, hence why I avoided the topic.
29  Game Development / Newbie & Debugging Questions / Re: Point changing for some reason on: 2016-09-26 23:25:27
1  
public Cell(Point location)

Java passes references, and Point is a mutable type.
Any changes (outside this class) made to the Point instance that you pass into the constructor will alter the value returned by Entity#getLocation().

A superficial way of fixing this would be to replace:
1  
super.location = location;

with:
1  
super.location = new Point(location)


There's a 2nd problem with your code; your Entity class has a protected member:
1  
protected Celltype cellType

while your Cell subclass has a private member of the same name.

So the assignment in your Cell constructor:
1  
cellType = MasterGame.cellTypes.get(random.nextInt(MasterGame.cellTypes.size()));

...is assigning a value to the member Cell#cellType.

While the Entity method:
1  
2  
3  
   public CellType getCellType() {
      return cellType;
   }

...will be returning Entity#cellType.

I doubt this is what you intend.
30  Java Game APIs & Engines / Engines, Libraries and Tools / Re: LibZ - 2D Java Game Library on: 2016-09-26 01:19:15
It isn't that slow.

In the order of 1000x slower than hardware accelerated drawing.
That *is* what I'd consider really slow.
Pages: [1] 2 3 ... 72
 
cybrmynd (45 views)
2017-08-02 12:28:51

cybrmynd (60 views)
2017-08-02 12:19:43

cybrmynd (68 views)
2017-08-02 12:18:09

Sralse (83 views)
2017-07-25 17:13:48

Archive (510 views)
2017-04-27 17:45:51

buddyBro (653 views)
2017-04-05 03:38:00

CopyableCougar4 (1143 views)
2017-03-24 15:39:42

theagentd (1147 views)
2017-03-24 15:32:08

Rule (1118 views)
2017-03-19 12:43:22

Rule (1093 views)
2017-03-19 12:42:17
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
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!