Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (768)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (854)
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
31  Discussions / General Discussions / Re: Component Systems: Artemis style systems vs. traditional fat entities on: 2014-06-23 22:48:28
I try to keep both my entity systems and components as specialized as possible: naturally, different games warrant different solutions, but I haven't found the need for optimizing in regards to marker components in a long time.

Marker components aren't *that* expensive, normally. Where and why is your CPU time consumed - because of a high entity count, sporadic insert/remove bursts, something else? It's hard to reason about an approach without seeing some example code or knowing more about your design - the risk is that you end up getting vague recommendations that don't really apply to your project.

A recent discussion over at reddit gave some ideas on how to more efficiently deal with batch insertion/removal of entities. It will find its way into 0.7.0 (sometime during the summer) - it might cover your use-case, or at least be slightly easier on the CPU.
32  Discussions / General Discussions / Re: Component Systems: Artemis style systems vs. traditional fat entities on: 2014-06-23 21:28:55
No need to poll, better sacrifice some memory and have each system maintain a list of all entities with a matching component composition. Entity Systems are notified whenever an entity has components added or removed, keeping the list up-to-date. This is how artemis and most ECS frameworks do it.

Edit: Sorry, misread your post. If dealing with a lot of entities... simply setting a flag here and there as a marker for being processed by another system, I could see why it might be a problem (are you sure it is the bottleneck though?). One solution might be a custom EntitySystem to which you manually insert entities that need to be processed as a result of some state. Alternatively, make the components even thinner, effectively having marker components and more specialized systems.
33  Discussions / General Discussions / Re: Component Systems: Artemis style systems vs. traditional fat entities on: 2014-06-23 21:14:45
I don't really have much experience coding games that don't use an ECS; maybe I've just been exposed to poor design, but imo an ECS does help structure the design and - thanks to the emphasis on compartmentalizing game logic in distinct entity systems - isn't as sensitive to spaghettification/ridiculous coupling.

Benefits of using an ECS - or stuff one pretty much gets for free:
- Since components are pure data, serialization comes almost at no cost (code-wise).
- Entity systems can easily be reused outside the game, very handy for level/game editors.
- New types can be defined on the fly - another boon for editors. Furthermore, it's pretty straightforward writing a generic reflexive editor for manipulating component data.
- Behavior reuse > code reuse.
- Easy to profile, both via profiler and in-game.
- Entity Systems can be toggled at runtime; pretty useful for debug renderers, disabling collision handling etc.

Lastly, to respond to the OP and fat components; it's certainly doable, but it tends to make the code a little more rigid and hence harder to refactor.

It's true that one of the potential benefits of ECS is writing cache-friendly code, but aside from us being in java-land now, it's not quite as simple as strapping on an ECS and automatically reaping the benefits of a happy cpu/cache relationship - Adam Martin wrote an interesting post on it recently: http://t-machine.org/index.php/2014/03/08/data-structures-for-entity-systems-contiguous-memory/

Most of the early work with ECS appears to have more to do with fast iteration times, rather than fast execution.
- http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/
- http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/

34  Java Game APIs & Engines / Engines, Libraries and Tools / Re: JRebel on: 2014-06-18 13:53:26
And whats the difference from Eclipse?

You're not limited to only modifying method bodies, if that's what you mean. It's also possible to jack in custom resource parsers (loading level data from json or whatever). Only used it for web development myself; very handy.
35  Discussions / Miscellaneous Topics / Re: Longest program you have written? on: 2014-06-16 20:22:30
That would make for a fun java game jam/contest. Instead of "under 4k", "in 48 hours", etc, we could have a "best game with less than 500 lines of code" contest. It would have to include external settings/config files so no one cheats and stuffs all the meat into a .properties file or something.

Could be a fun idea down the road.

This would work only if everyone used (or someone who verifies used) the same [eclipse] formatter settings. It could be done though.

A more interesting approach would be to only measure the opcode count: this way it wouldn't encourage excessively obfuscated code or discourage meaningful naming conventions.
36  Discussions / Miscellaneous Topics / Re: Longest program you have written? on: 2014-06-16 19:35:39
Let's see some smaller numbers. Cheesy

I recently stumbled upon this self-playing flappy bird clone in 155 lines, incl graphics: http://glsl.heroku.com/e#14407.0
37  Discussions / Miscellaneous Topics / Re: Longest program you have written? on: 2014-06-16 17:03:46
Not sure, somewhere in the 50k-100k range. The code tends to be more expressive the longer you've programmed though, meaning the LOC to feature ratio decreases significantly. I remember back when I was somewhat fresh at programming - I could easily spew out 2-3k LOC per day; I rarely write more than 500-700 on a good day now, yet I manage to implement a lot more functionality in that same timeframe nowadays.

In the end, LOC isn't really a useful metric of anything - even if some backward companies encourage such nonsense.
38  Discussions / Miscellaneous Topics / Re: [Girls] How to completely block them from our lives? on: 2014-06-09 16:25:55
Are there not any girl programmers on this forum? I would think that there would be at least one.

This thread certainly isn't helping...

Not everyone is a programmer.

There are VERY few female programmers.

The majority of programmers don't work on games.

Thus, a female on this EXACT forum is pretty much a statistical impossibility.

Actually, the majority of the female programmers I've met have worked in gamedev.
39  Game Development / Newbie & Debugging Questions / Re: Entity Framework on: 2014-06-08 22:59:24
I was also thinking of maybe having a "root" entity that all of the entities can attach to. Then, you can specify rotation, scaling, and translation for the root. Without having to deal with pesky screen shake caused problems.

But basically what I'm asking is that if you were to make a entity framework with a nice working and learning curve, how would you do it?

Entity system frameworks typically don't have different kinds of entity types, only different component compositions making up the entities. The seminal series of articles on entity systems is still Adam Martin's Entity Systems are the future of MMOG development.


Vanilla artemis shouldn't be used anymore - it hasn't been in development for a long time and has plenty of bugs. Use one of the many forks floating around, if you like artemis' API - such as mine or gdx-artemis.

40  Game Development / Newbie & Debugging Questions / Re: [LibGDX & Artemis] Random Null Pointer Exception in System on: 2014-06-06 18:17:41
As a quick check; if you make the SpriteRenderSystem the first system to be processed (ie; add it to the world instance before any other systems), does it still throw a NullPointerException?
41  Discussions / Miscellaneous Topics / Re: Quad core + 2gb of ram on: 2014-05-30 13:53:00
If you're buying a new computer today, I wouldn't consider getting anything less than 8gb. I had 4gb in my old quad-core and I was hitting the memory barrier every day - even a browser can easily hover around 1gb mem usage when enough tabs are open; then consider IDE, background processes, the OS, gimp/photoshop etc. Ideally, you never want to close applications due to running low on RAM.

42  Game Development / Newbie & Debugging Questions / Re: Does anyone create custom annotations in their game code? on: 2014-05-21 15:14:37
And let's not forget project lombok for some clever hacks involving annotations and the JVM.
43  Game Development / Newbie & Debugging Questions / Re: How do you name variable for angles? on: 2014-05-15 09:19:56
What's wrong with angle? Or degrees - if it's the unit used.
44  Discussions / General Discussions / Re: Value Types Proposal for Java on: 2014-05-07 13:50:58
In C++ (and C#, I believe) a struct is only superficially/syntactically different from a class; so constructors and initializer lists work.
45  Discussions / General Discussions / Re: Value Types Proposal for Java on: 2014-05-06 21:54:43
Heh, must experiment with this during the weekend!

It's very unlikely that a 3rd party class would be suitable to be used as a struct. There is just theoretical support ^.^

I was thinking along the lines of libgdx's vector classes. Right now I'm using my own, more constrained struct-like approach, but it results in having to re-implement a lot of the math utility classes.
46  Discussions / General Discussions / Re: Value Types Proposal for Java on: 2014-05-06 21:40:10
Sorry, by "normal" classes I meant classes that came from an external library; would be neat to if it were possible to retrofit those too but that might be much harder.

47  Discussions / General Discussions / Re: Value Types Proposal for Java on: 2014-05-06 21:28:43
Derailing back to Riven's original reply.

I only very briefly skimmed the outer layers, but LibStruct looks really interesting!

When you say stack allocation, does that mean that you do the equivalent of scalar replacement? If so, are there any clever tricks to ensure that the intermediate representation doesn't grow too big for the JIT to optimize - apart from fiddlling with XX:MaxInlineSize etc?

I'm assuming the Vec3 class in the code snippet is one's own and not something out of an external library - or is it possible to allocate "normal" classes on the stack too (via external configuration or similar)? Would be super-useful, though maybe not plausible.
48  Game Development / Newbie & Debugging Questions / Re: Are HashMaps bad for Entity-Component-System Architectures? on: 2014-05-06 18:23:06
Most ECS frameworks have some sort of array-like data structure per component type. In artemis each entity is given an integer id: the id represents the index at which the component is stored.

Unless you have a lot of entities, you probably won't see a noticeable performance hit (ofc depends on platoform, entity count, GC and so forth). One of the ideas behind ECS, besides reducing complexity as the project grows, is performance: if all instances of ComonentX are aligned in memory, you'll get faster memory access (better cache locality), but java doesn't easily lend itself to contiguous memory layout when it comes to objects.

edit: If entities hold on to their own components, how do you get all entities matching a specific component composition?
edit 2: If you want to stick with your current approach - consider using the component's class as key and replacing the HashMap with IdentityHashMap - getClass() always returns the same object per class.
49  Game Development / Newbie & Debugging Questions / Re: Using files in META-INF on: 2014-04-24 12:05:03
Class#getResource is what you're looking for, see: http://stackoverflow.com/a/1273432/431535
50  Discussions / General Discussions / Re: The Big Linux Distro Thread on: 2014-04-03 15:03:14
1. Resizing window borders appear to be 1 pixel thick. The mouse flickers in a terribly ungainly fashion when attempting to hover over a border or

I think most (all?) window managers support resizing by Alt-RMB anywhere in the window.

For the most part though, it mostly comes down to a matter of familiarity. I feel like I can't do much whenever I'm confronted with a different OS: I switched over to linux back in 2000-2001 - OSX is ok (got acquainted with it last summer),b ut windows is just unbearably obtuse from my pov.
51  Discussions / General Discussions / Re: The Big Linux Distro Thread on: 2014-04-02 13:15:04
Granted I'm not using file managers often - except midnight commander, but I find dolphin to be rather clean: https://dl.dropboxusercontent.com/u/1615755/dolphin.png - certainly a long way from Directory Opus (heh, old times...). Dolphin can speak sftp too - good enough for simple operations.

Dropbox for linux is ok, but I believe the OS integration is better under win and osx.

If you go the KDE way, amarok is really nice. Quite different from how I remember winamp though. I also believe Ark (KDE's zip/unzipper) handles most formats, although gzip and bzip are more common in linux land.

Edit: KDE is butt-ugly in its default configuration, but can be made to look really nice. Also much less mouse-centric than the other window managers etc.
52  Game Development / Networking & Multiplayer / Re: Entity System - Networking on: 2014-03-31 15:01:47
Vanilla artemis hasn't been updated for quite some time and has a number of bugs. You're better off using a fork, like mine or this one.
53  Discussions / General Discussions / Re: JDK 8 is released on: 2014-03-26 14:26:42
- Reified types is on the list for Java 9.

Are you sure about this? If so, it seems that all I'm missing expect operator overloading is scheduled for java 9. Happy times (in 3-4 years)!
54  Discussions / General Discussions / Re: Programmer jokes on: 2014-03-17 20:37:16
There's a review on the children's book The Story about Ping (http://en.wikipedia.org/wiki/The_Story_about_Ping) which is just fantastic.

http://www.amazon.com/review/R2VDKZ4X1F992Q
55  Discussions / General Discussions / Re: Ever forget how your own code works? on: 2014-03-12 17:45:14
It used to be a problem for me, but after a few years of coding it became increasingly more rare. Some time ago, I revisited my first game prototype - hadn't touched the code in ~1.5 years, I was surprised that diving into it again was so painless.

I generally never comment my code, I prefer short methods and tiny, purposeful classes instead. I sometimes tell myself to make class- or package-level comments for complicated stuff, but rarely commit to it. The risk with commenting code is that comments can fall out of sync with the code (during refactoring and whatnot), becoming nothing more than a misleading distraction.

A good rule-of-thumb for writing comments is comment the WHY not the WHAT.
56  Game Development / Newbie & Debugging Questions / Re: What to use for config files? on: 2014-03-11 14:26:13
Json is what I normally prefer - easy to read, easy to debug, easy to use. Nate's JsonBeans lib is very nice.
57  Game Development / Shared Code / Re: Green Threads on: 2014-03-07 13:04:35
I had to do some emergency maintenance on that server, and due to the underwhelming user base of 1 or 2 souls, I haven't bothered to bring my http server back up with my hobby projects. It's a bit like my MappedObject library... everybody whining that Java doesn't have structs, and upon release I got a buch of responses like this was a solution looking for a problem. Only theagentd gave it a serious whirl, for which I'm grateful, but it put the hours upon hours of work into perspective. I guess JGO is the wrong audience for this kind of tech, but at the same time I am not part of any other online community, so picking the right one might take even more time that I'm not willing to invest. Anyway, Nate, you've got a copy of the code, live the dream!

FWIW, I never had a chance to try out the code, only found the thread after it had been removed, but I found it very inspirational from a programming POV.
58  Game Development / Newbie & Debugging Questions / Re: New to java, where do i start? on: 2014-03-04 15:19:51
+1 for Bruce Eckel's Thinking in Java - it does a very good job at explaining OO-thinking and java. At least back in 2000, it was the best introductory book on java.

link: http://www.mindviewinc.com/Books/TIJ4/
59  Game Development / Newbie & Debugging Questions / Re: Libgdx and ImmediateModeRenderer20 on: 2014-02-28 10:39:51
You must enable blending before drawing:
1  
2  
      Gdx.gl.glEnable(GL20.GL_BLEND);
      Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
60  Game Development / Newbie & Debugging Questions / Re: Libraries and how you guys use them on: 2014-02-27 16:14:13
I personally use maven for all my java projects; it integrates reasonably well with Eclipse, but - I believe - is stronger with IDEA and netbeans. Maven isn't everyone's cup of tea, but I'm enamored with its ways - besides packaging the project for you, it also manages dependencies and it's easy to hook in other project-related hooks (post-compilation processing, assembling resources/assets, running tests etc).
Pages: 1 [2] 3
 
EgonOlsen (1340 views)
2018-06-10 19:43:48

EgonOlsen (1229 views)
2018-06-10 19:43:44

EgonOlsen (939 views)
2018-06-10 19:43:20

DesertCoockie (1380 views)
2018-05-13 18:23:11

nelsongames (1112 views)
2018-04-24 18:15:36

nelsongames (1374 views)
2018-04-24 18:14:32

ivj94 (2120 views)
2018-03-24 14:47:39

ivj94 (1269 views)
2018-03-24 14:46:31

ivj94 (2286 views)
2018-03-24 14:43:53

Solater (808 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
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!