Slick Forums

Discuss the Slick 2D Library
It is currently Fri May 24, 2013 8:35 am

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 420 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 28  Next
Author Message
 Post subject:
PostPosted: Sat Mar 19, 2011 7:00 pm 
Offline
Game Developer
User avatar

Joined: Tue Nov 21, 2006 4:46 am
Posts: 619
Location: Iceland
slam wrote:
Just found another one http://code.google.com/p/slick-entity-system/
as far as I can see this project extends your code, or it is also your project? :)
and one more question: are you planing to create maven repo for artemis?


Ah, nice find. I don't know how many are using Artemis, so I surely would like people to let me know.

I might set up a maven repo.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 20, 2011 12:00 pm 
Offline

Joined: Wed Mar 09, 2011 10:40 pm
Posts: 49
Haha thats mine ^^

I was using my own code until recently (when I first posted here). I've updated the project description with a link to Artemis. Sorry about the confusion.

Hoped to post a demo this week, but I realize now that there is some way to go from "shooting randomly spawning enemies" to game.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 20, 2011 1:53 pm 
Offline
Game Developer
User avatar

Joined: Tue Nov 21, 2006 4:46 am
Posts: 619
Location: Iceland
Uberrated wrote:
Haha thats mine ^^

I was using my own code until recently (when I first posted here). I've updated the project description with a link to Artemis. Sorry about the confusion.

Hoped to post a demo this week, but I realize now that there is some way to go from "shooting randomly spawning enemies" to game.


Btw. systems can communicate with each other. Check SystemManager.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 20, 2011 4:19 pm 
Offline
Regular
User avatar

Joined: Tue Apr 07, 2009 12:58 pm
Posts: 232
Location: Uruguay
appel wrote:
slam wrote:


The svn is the official repo. Github mirrors the svn, but I cannot guarantee it.


The github code repo is automatically synced with the svn code repo. Automatic sync could fail of course, so if you want to use the github repo, do it as your own risk.

The idea to have a github code repo is to easily test things by forking the repo. We are already using it.

appel, have you considered working with git instead of svn? it could be a great gain for the ppl who want to test things over the engine and even wanted to make contributions (only proposing, don't want to discuss pros and cons of git or svn, at least not in this post)

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 20, 2011 4:24 pm 
Offline
Regular
User avatar

Joined: Tue Apr 07, 2009 12:58 pm
Posts: 232
Location: Uruguay
appel wrote:
slam wrote:
Just found another one http://code.google.com/p/slick-entity-system/
as far as I can see this project extends your code, or it is also your project? :)
and one more question: are you planing to create maven repo for artemis?


Ah, nice find. I don't know how many are using Artemis, so I surely would like people to let me know.

I might set up a maven repo.


As you have no dependencies in your repo, I really recommend you to upload the engine over maven central instead creating your own maven repo, ruben01 has already uploaded some projects to maven central so he could help you if you want to upload it. It would be tons of times better than having your own maven repo, and easier than someone could think.

Again, it is only a suggestion, if you think you don't want to upload it or maintain your maven repo is easier for you, then it is your choice, I will not argue against :).

As an example, we have our maven natives plugin uploaded to central.

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 23, 2011 12:58 pm 
Offline

Joined: Fri Mar 18, 2011 2:53 pm
Posts: 21
1)
How do you have to use this framework in terms of multiplayer. Could it be imaginable to store all the entities/components in a database like discussed in this article (http://t-machine.org/index.php/2009/10/ ... os-part-5/).

2)
I have still some question about the exact interpretation of an entity. Like for example is a (tiled) map an Entity or not? And an inventory is it an Entity or a component of a player entity.
I searched different definitions but there are so many (different) definition for an entity so I can't really catch the concept.
What is the meaning of an entity in terms of this approach?

It's a great framework and a really nice approach on this paradigm! And I can really feel the power of this approach.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 26, 2011 1:19 pm 
Offline
Game Developer
User avatar

Joined: Tue Nov 21, 2006 4:46 am
Posts: 619
Location: Iceland
1. In terms of multiplayer, I've started implementing both client and server versions. What I found is that the client and server do not necessarily share the same systems. The server is supposed to run the actual logic, but the client only extrapolation, or a simulation. The server can run without any rendering systems. You can see some idea shaping up in the tankz source code. http://gamadu.com/svn/tankz/

If you are going to do a multiplayer game, I'd start implementing it as a multiplayer game from start, and always have the client version connect to the server version, even if the player is only playing e.g. skirmish vs. the computer.

Sorry, I haven't imagined how to use a database with this framework, as that's really something I'm not really trying to do in my games. But there's really just three things you need to store, the id's of the entity (entityId and uniqueEntityId), the components for each entity, and maybe the state of the systems (if you store internal state for it).


2. The tiled map question is a good one. I would say it's not an entity, but it's really a system. E.g. TiledMapSystem, which would contain public methods that can be used in other systems and also rendering logic.
You could have something as a Entity, e.g. the 2d grid, for the tiled map, but I don't find it to be necessary. It's really up to you, you can have it as a entity+system or just a system.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 26, 2011 2:52 pm 
Offline

Joined: Fri Mar 18, 2011 2:53 pm
Posts: 21
Thanks for the answers. They are really pointing me in the good direction.

Quote:
Sorry, I haven't imagined how to use a database with this framework, as that's really something I'm not really trying to do in my games. But there's really just three things you need to store, the id's of the entity (entityId and uniqueEntityId), the components for each entity, and maybe the state of the systems (if you store internal state for it).


If you want to develop a game with a user database it could be imaginable to link a player/character entity to a user I think. The uniqueEntityId can be really helpful for that in terms of databases! I'm gonna try this out.

Quote:
2. The tiled map question is a good one. I would say it's not an entity, but it's really a system. E.g. TiledMapSystem, which would contain public methods that can be used in other systems and also rendering logic.
You could have something as a Entity, e.g. the 2d grid, for the tiled map, but I don't find it to be necessary. It's really up to you, you can have it as a entity+system or just a system.


Ok so sometimes there is not really "one" good answer. I can choose myself what suits best. I have a lot of game elements where I wonder in which category they belong. But I suppose choosing will be easier with more experience with the framework!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 26, 2011 3:23 pm 
Offline
Game Developer
User avatar

Joined: Tue Nov 21, 2006 4:46 am
Posts: 619
Location: Iceland
Banni wrote:
Ok so sometimes there is not really "one" good answer. I can choose myself what suits best. I have a lot of game elements where I wonder in which category they belong. But I suppose choosing will be easier with more experience with the framework!


You can see what I've done in Tankz in regards of CameraSystem, BoundarySystem, TerrainRenderSystem.

http://gamadu.com/svn/tankz/trunk/src/c ... ystem.java
http://gamadu.com/svn/tankz/trunk/src/c ... ystem.java
http://gamadu.com/svn/tankz/trunk/src/c ... ystem.java

TerrainRenderSystem uses CameraSystem to render the terrain correctly offset.
CameraSystem uses the BoundarySystem to ensure the camera doesn't go offmap.
BoundarySystem ensures certain entities don't go out of bounds.

How could this have been implemented with entities/components? I could have had a Boundary entity, Camera entity and Terrain entity with corresponding components. Then I would have tagged them and then make the systems process the tagged boundary, camera and terrain entities.

That's perhaps better if you need savegame feature, putting all the data the systems use into components so the systems are really stateless. But you can also store the state of the systems. But I found it to be really redundant.




In a previous framework I used to have systems as entities in the game world. So I would have had a TerrainEntity which would have had a Terrain component with public methods like retrieving a tile. I would have tagged that entity as "TERRAIN" and simply looked it up where I had to query the Terrain component if e.g. tile X,Y was passable or not. I found this way of doing things to be very strange, but it worked.

It's sometimes better to keep things a part, stuff that's not really entities should not be entities, and what you would consider as entities should be entities, e.g. bullets, creatures, explosions, etc. It helps keeping things cleaner and code more understandable.


Last edited by appel on Sat Mar 26, 2011 3:35 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 26, 2011 3:33 pm 
Offline

Joined: Fri Mar 18, 2011 2:53 pm
Posts: 21
Thanks for the explanation!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 26, 2011 5:44 pm 
Offline

Joined: Sun Jan 02, 2011 8:39 pm
Posts: 64
How many entities can be processed in one frame?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 26, 2011 5:47 pm 
Offline
Game Developer
User avatar

Joined: Tue Nov 21, 2006 4:46 am
Posts: 619
Location: Iceland
Squizzle wrote:
How many entities can be processed in one frame?


Not possible to answer this.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 26, 2011 6:06 pm 
Offline

Joined: Sun Jan 02, 2011 8:39 pm
Posts: 64
appel wrote:
Gornova81 wrote:
Hi :D

It's interesting, but how much different is from anothers component based system here on forum ? I'm not understanding difference :(


Difficult to explain, it's a totally different way of separating logic, data and view.



In the component based systems we've been seeing on these forums the components are directly attached to the entities, residing in some of a HashMap internally in the Entity class. The components have data and logic in it, and view is either in the components or in the Entity class itself.

Updating and rendering in this design requires calling each entity, update and render, or on each component.

While this design is way better than some class inheritance tree, it's still inflexible.



The backing datastructure in the Artemis framework is much more efficient. I tested that it can create a primitive entity and add to relevant systems in around 500-1000 ns. on my PC, since the datastructure for it is so machine friendly. There is 1 billion nanoseconds in a second, so that means over 1 million entities per second.

Artemis framework operates on "aspects" of the entities. A tank may have a health aspect, and multiple components may be involved. The systems implement the aspects.
This allows for much finer control of how you execute logic for your entities/components. You may only want to run certain logic every 100 ms., like fog of war creation, or health regeneration algorithm. This allows you to improve performance for you game, both framerate and memory wise.
Adding multiplayer support is just a matter of creating the right system/aspect. You can also create a dedicated server without all the graphics rendering, and ship a minimal jar, without the Rendering system/aspect.

All this isn't possible in the Entity/Component paradigm.
Have you tested it on any other specs?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 26, 2011 6:43 pm 
Offline
Game Developer
User avatar

Joined: Tue Nov 21, 2006 4:46 am
Posts: 619
Location: Iceland
I have, but don't have any accurate numbers to give you.

Obviously, performance varies between hardware.

My PC is nearly 4 years old.

It's really a question of being performant in this design architecture. You can make a different framework that runs just as fast, but it might not offer your the flexibility or architecture that Artemis does. So, comparing A with B is not reasonable if you don't consider the differences.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 28, 2011 4:26 pm 
Offline

Joined: Wed Mar 09, 2011 10:40 pm
Posts: 49
Finally squashed the last bug in moving over to Artemis, with the culprit of my woes in deleteEntity:

Code:
from pain:
   public void deleteEntity(Entity e) {
            deleted.add(e);
   }
comes pleasure:
   public void deleteEntity(Entity e) {
        if (!deleted.contains(e)) {
            deleted.add(e);
        }
   }

Double deleting an entity allowed the id to be used twice, resulting in anguish without words! I guess this problem is kind of specific to my code, but I was overcome with happiness when I found the solution.

Thanks for the speed! Is wonderful =) Hopefully I can complete my Slick contest contribution, so the power Artemis in a fully datadriven codebase can be showcased.

Squizzle: My code is far from optimized, but on the speed front I'm running hundreds of collision boxes, thousands of entities and ten-thousands of components without problem. Its easy to work with once you wrap your head around the concept, and implementing new functionality without breaking everything blows OOP so far out of the water its not even funny.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 420 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 28  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group