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 ... 78
1  Discussions / Suggestions / Re: Add a link to the embedded youtube video on: 2017-01-13 15:46:34
@kevglass Smiley this was targeted at @riven, but indeed was caused by me wanting to see your video. Cheers!
2  Discussions / Suggestions / Add a link to the embedded youtube video on: 2017-01-13 15:38:23
My linux browser crashes, when I activate flash  Roll Eyes
So just rendering a youtube link under the embedded video player would be great.
Thanks Pointing
3  Game Development / Newbie & Debugging Questions / Re: getting rid of "instanceof" on: 2017-01-13 12:59:36
@cylab - I use that "pattern" a lot, but then it's basically the same as the Lookup mechanism in the NetBeans platform.  Not sure if it's the fastest approach, but it's definitely one of the nicer ones.  Smiley
Yupp. Can't deny my Netbeans RCP past...


1  
entities.forEach(e ->  e.with(PoisonGasEffect.class, h -> h.onPoison(1)));

For the sake of completeness, this is, how Entity would look like, then:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
abstract class Entity {
    private Map<Class<?>, Object> handlers = new HashMap<>();

    protected <T> void register(Class<T> type, T instance) {
        handlers.put(type, instance);
    }

    public <T> boolean supports(Class<T> type) {
        return handlers.containsKey(type);
    }

    // support java 8 style optional lambda execution
    public <T> void with(Class<T> type, Consumer<T> consumer) {
        T handler = type.cast(handlers.get(type))
        if(handler != null)
            consumer.accept(handler);
    }
}
4  Game Development / Newbie & Debugging Questions / Re: getting rid of "instanceof" on: 2017-01-13 09:51:58
I don't get the "breaking encapsulation" part here.

Well, from GoF -

Quote
Visitor's approach assumes that the ConcreteElement interface is powerful enough to let visitors do their job. As a result, the pattern often forces you to provide public operations that access an element's internal state, which may compromise its encapsulation.

This made me think, if a more component like approach using a heterogeneous container would be desirable here:

Define what actually can happen in your game as interfaces
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
@FunctionalInterface
interface PoisonGasEffect {
    // this way, you can even require signatures for your effects
    void onPoison(int toxicity);
}

@FunctionalInterface
interface SmartBombEffect {
    void onSmartBomb();
}


Putting a registy in your Entity baseclass would allow for using composition to model the entities behaviour
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
abstract class Entity {
    private Map<Class<?>, Object> handlers = new HashMap<>();

    protected <T> void register(Class<T> type, T instance) {
        handlers.put(type, instance);
    }

    public <T> boolean supports(Class<T> type) {
        return handlers.containsKey(type);
    }

    @SuppressWarnings("unchecked")
    public <T> T getHandler(Class<T> type) {
        return (T) handlers.get(type);
    }
}


Using Java 8, you can define the effects on your Entities with relative ease:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
class Monster extends Entity {
    public Monster() {
        register(SmartBombEffect.class, () -> kill());
        register(PoisonGasEffect.class, (toxicity) -> kill());
    }
    void kill() { /* ... */ }
}

class FriendlyMonster extends Monster {
    public FriendlyMonster() {
        register(SmartBombEffect.class, () -> {}); // this basically "overrides" the effect in the _unfriendly_ Monster
        register(PoisonGasEffect.class, (toxicity) -> damage(toxicity));
    }
    void damage(int points) { /* ... */ }
}

class Arrow extends Entity {
    public Arrow () {
        register(SmartBombEffect.class, () -> remove());
    }
    void remove() { /* ... */ }
}


This works also in a more traditional way:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
class Player extends Entity {

    // or if you want to...
    private class MyUberHandler implements SmartBombEffect, PoisonGasEffect {

        public void onPoison(int toxicity) {
            damage(toxicity);
        }

        public void onSmartBomb() {
            System.out.println("HAHAHA - I told you: 'DONT MESS WITH ME!!!!'");
        }
    }

    public Player () {
        MyUberHandler handler = new MyUberHandler();
        register(SmartBombEffect.class, handler);
        register(PoisonGasEffect.class, handler);
    }

    void damage(int points) { /* ... */ }
}


The actual gameloop would then be rid of specific implementations for your Entity - it's up to you, if you consider this a good or a bad thing...
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
// ...
// Poison gas cloud! The effect is encapsulated in the Entity implementation
entities.forEach(e -> {
    if(e.supports(PoisonGasEffect.class))
        e.getHandler(PoisonGasEffect.class).onPoison(1);
});

// Smartbomb! Whatever happens will happen...
entities.forEach(e -> {
    if(e.supports(SmartBombEffect.class))
        e.getHandler(SmartBombEffect.class).onSmartBomb();
});
5  Game Development / Newbie & Debugging Questions / Re: What are you guys using for your GUI? on: 2017-01-12 10:23:54
googling libgdx gui gave me this:
<a href="http://www.youtube.com/v/ELkqiMpvMLA?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/ELkqiMpvMLA?version=3&amp;hl=en_US&amp;start=</a>
LibGDX Scene2D -- UI, Widgets and Skins
6  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-01-04 12:43:58
+1

Really nice!
The shadows are a bit off, though. Maybe you could attach and transform the shadow geometry to the outer-most pixels of the sprite's bottom...
7  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-01-03 08:38:53
Looks fantastic! Nice consistent style and kind of mystic mood. What will the gameplay be?
8  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-12-22 08:13:09
As requested, the trailer for one of our new songs:

<a href="http://www.youtube.com/v/RE6hzPKGMYs?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/RE6hzPKGMYs?version=3&amp;hl=en_US&amp;start=</a>
Nice tight drumming and smooth production. Good job!

The song itself (especially the text and the guitar at the beginning) is a bit too corny for my taste Cool
9  Discussions / Miscellaneous Topics / Re: What I drew today on: 2016-12-12 07:18:58
@basil: these would make a wonderful space shooter!
10  Game Development / Newbie & Debugging Questions / Re: Concurrent Modification when changing maps? on: 2016-12-11 09:31:35
OP doesn't seem interested anyways...
11  Game Development / Newbie & Debugging Questions / Re: Concurrent Modification when changing maps? on: 2016-12-09 23:44:08
No, when ArrayList.clear() (not remove, not add: clear!!) fails with ConcurrentModificationException, the current thread is not also adding/removing *during* the clear, hence another thread is, hence the proof.

I doubt, the CME was raised in clear(). We didn't see a stacktrace from OP, so I still bet it's while adding to the itemList...
12  Game Development / Newbie & Debugging Questions / Re: Concurrent Modification when changing maps? on: 2016-12-07 08:09:31
You really need to add stacktraces and correct line numbers to this sort of questions. This way we are just guessing.

But since I am usually good at guessing, I'll give it a try: could it be, that you are adding items to the collisionObjectsLayer, when you are adding them to the ItemManager.itemList?
13  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-11-26 00:07:20
I put in the buttons on my arcade cabinet.  It's coming along nicely!  The buttons all worked right away, so that was cool.
Nice cabinet, but are you sure, that you put in the panel in the right orientation? From the curve of the buttons, I would guess, they need to be the other way around...  persecutioncomplex
14  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-11-18 06:48:24
Uploaded a Jam I had with my buddies 3 weeks ago: <a href="http://www.youtube.com/v/5MhOYv-ymYU?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/5MhOYv-ymYU?version=3&amp;hl=en_US&amp;start=</a>
I am the guy in the back on the right abusing the Novation Curcuit Cool
15  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-11-13 11:03:20
+1 for Altered Beast. Hope it's not just nostalgia tricking my memories...
16  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-11-09 08:07:21
Say you were looking to execute a java program via the command line. You first try to get the version of a potential java installation:
java -version
. Say the output is
'java' is not recognized blah blah blah
. Now you'd like to try and see if you can find a JRE or JDK installation directory somewhere on the computer from which to execute the program without downloading a full JRE. Alright. Would you say that looking for
%JAVA_HOME%
or
$JAVA_HOME
help, or would that be overkill since java is not on the path?

J0 Smiley

Just dont. Bundle your own jre. Will save you a ton of headache...
17  Discussions / General Discussions / Re: All threads marked as read on: 2016-11-01 12:33:55
I also had this from time to time. For me it was just the "Show unread post since last visit" link. Probably because of devices with different dates (or dailight saving time glitches). "Show unread posts since epoch" still worked for me in those cases.
18  Game Development / Newbie & Debugging Questions / Re: Adding lights - light map on: 2016-09-21 05:30:42
Yes. It depends however, how you are handling the scrolling and culling (e.g. translating the viewport/camera or offsetting the x/y coordinates before placing the tiles). I would use constant world coordinates with a moving viewport, so there is no guessing, what is at which x/y in the world at any given time.

But regardless what you use, you just have to make sure, you are applying the same mechanism for all layers you add.
19  Game Development / Newbie & Debugging Questions / Re: Adding lights - light map on: 2016-09-20 15:50:33
Actually it would be the same logic than you use to relocate your tiles in the color buffer when the game world scrolls...
20  Discussions / General Discussions / Re: Comparison between 2 IDE's - Netbeans and Eclipse on: 2016-08-31 22:30:51
I am totally Netbeans addicted.. I tried once intellij, the graphic is really awesome but I find working on only one project at time such a huge limitation...

This is a misconception due to their legacy wording. In reality its:
  Intellij Project = Netbeans Project Group ~ Eclipse Workspace
  Intellij Module = Netbeans Project = Eclipse Project

Also the Community Edition of Intellij is everything you need for POJO development. All the core IDE functionality is the same as in the Ultimate edition and the whole core source code is Open Source. Only the plugins contained in the Ultimate edition are not. So you are only paying for closed source plugins, not a closed source IDE.

If you give it a try, you should do it multiple weeks, not just an hour - it's impossible to judge an IDE in this short amount of time. You can also select Eclipse keybindings and import Eclipse projects, but at least the latter will imho lock you into a bias and hinder exploration of the IDEs goodies...
21  Discussions / General Discussions / Re: Porting Native Windows Windows to Java on: 2016-08-06 09:45:13
If you want toy around with jni and win32, by all means go ahead.

Just don't expect to get any benefit other than you've learned something...
22  Discussions / General Discussions / Re: Porting Native Windows Windows to Java on: 2016-08-05 11:48:59
For a feasibility, though, would porting Win32 to java as a library be a good idea?
I would say no.

Also why would you want to? If you don't like AWT/Swing, there are plenty of alternatives available - from SWT to GLFW to NEWT.

What would be the benefit of porting (? you mean binding, don't you?) Win32 to java?
23  Discussions / General Discussions / Re: What does your dream language look like? on: 2016-07-08 08:29:05
Actually python has some great stuff, but I don't really like dynamic typing, mostly because it masks information the IDE could use for code-analysis and -completion.

I'd rather would like to have a static typing with advanced type inference...
24  Java Game APIs & Engines / OpenGL Development / Re: VAO Index Buffer coupled with GL_TRIANGLE_STRIP: Avoiding flipped textured? on: 2016-06-15 14:47:05
I think ra4king failed to notice that the pastebin contains the relevant code and not the embedded code snippet...
25  Java Game APIs & Engines / OpenGL Development / Re: VAO Index Buffer coupled with GL_TRIANGLE_STRIP: Avoiding flipped textured? on: 2016-06-13 13:47:29
That's the deal - upload redundant indices, but safe on vertices and headaches...

Should have read the whole post, though. It looks you have to repeat the tex-coords or shift texture coordinate generation to the shader. If you want to texture a regular grid or terrain, it might be the way to go anyway.
26  Java Game APIs & Engines / OpenGL Development / Re: Things to try out in OpenGL on: 2016-06-13 13:40:54
- Appearance Space Texture Synthesis Cool
  (Would be very handy for terrain generation - especially if you want to have cliffs...)
27  Java Game APIs & Engines / Engines, Libraries and Tools / Re: LWJGL 3 - LMDB bindings on: 2016-06-08 06:40:22
Quote from: spasi

Having everything in the same repo, in branches, or in different repos, is just a technicality. The only thing that matters is how the software is deployed. With #100 + a few other ideas we had recently, I believe everyone will be satisfied.

I disagree on this. It's mostly a psychological issue. The more stuff is in a project, the bigger is the hurdle for others to dig into the detailes or take responsibilities.

So modularizing the project on repository and publication level would be a good thing. Other than that, stuff like lmdb would have a lot of use in enterprisy contexts, where disassociating them from a gaming library might have it's benefits.

Having said that, it would also be a bigger effort to maintain multiple projects, their public visibility and communities. So in the end it depends on the effort you are able and willing to put into it - especially when you are not convinced  Wink
28  Discussions / General Discussions / Re: Virtual Reality on: 2016-06-03 17:22:10
Rumours are also saying that Samsung is developing a lightfield screen.

Yeah, but that probably would be a normal screen with a lightfield camera attached to send recordings of your bedroom back to samsung and their content exploitation partners  Wink
29  Game Development / Game Play & Game Design / Re: [spine] Only sideway animations - opinions/suggestions? on: 2016-06-02 18:55:51
Just do separate forward/backward models with their own animations and switch them accordingly?
30  Discussions / General Discussions / Re: Virtual Reality on: 2016-06-02 18:53:04
Transparency of the extra reality is basically impossible right now. there is not even technology on the horizon to solve that.
take https://en.wikipedia.org/wiki/Smart_glass, make it smaller and get per-pixel : reality-subtractive-color-mix-to-black + agumented additive color overlay with laser-power. win.

focus can be enhanced by tracking eye-ball-direction (focus distance) or by capturing reality-depth-buffer (view distance). two different things. there are alot more idea like that around.

Also there are lightfield displays (https://www.youtube.com/watch?v=uwCwtBxZM7g). And rumours say, magic leap uses these...
Pages: [1] 2 3 ... 78
 
Galdo (299 views)
2017-01-12 13:44:09

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

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

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

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

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

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

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

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

theagentd (1225 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!