Jump to content

  • Log In with Google      Sign In   
  • Create Account

WeNeedFocus

Member Since 20 Jan 2013
Offline Last Active Jun 04 2013 10:36 AM

Posts I've Made

In Topic: Just a simple way to organize Entities in a 2D array.

12 May 2013 - 08:11 AM

Thanks guys, but, I'm facing another problem.

What if the entity is meant to occupy more than one space? If for example a bonfire is 2x2 tiles wide, how do i fit that into the 2 dimentional entities array?

Should I just make it into a list instead of a 2d array, and put Point Location; so the entity will contain it's own location? But when I want to retrieve a certain entity, I have to go loop through the whole list... Is there a better way to do this?

 

I thought of separating entities into different parts: TopLeftOfBonFire, TopRightOfBonFire, BottomLeftOfBonFire, BottomRightOfBonFire, so each one can occupy one tile. But then I faced the problem with Units. Units are updated, so separating them into parts like this is not efficient.

Please help, Davud


In Topic: Just a simple way to organize Entities in a 2D array.

06 May 2013 - 05:18 AM

Another way is: instead of storing entities by location have each entity store its own location and simply store them in an agnostic container. Pick a container that will allow you to quickly locate entities matching a position through iteration.

 

 

Having entities store their own location, was my very first choice, in a list. But it was inefficient since I had to run through the list each time I wanted an entity, so this seems logical.

Sorry, agnostic container? I searched some stuff on google, but there was nothing specific. Is this a some sort of a library, or just a spontaneous word you made?

 

 

There's also the possibility of hybridization. That is, have a master list of entities which are aware of their own location and also retain a 2D array of containers that point to all entities that occupy each location. This is the most expensive in terms of storage and architecture but has the best access time for any method.

 

This seems tough, but I'll consider it as my second option.

 

Thank you guys, if you can just help explain the concept of this agnostic container, I would be grateful.

Also, since almost anything with height will be an entity, and some entities won't update, should I keep them in a different layer?

So there are two types of entities, the ones that stay still (trees), and the ones that move (animals). There is no point to do Entity.Update() if it's a still entity, so it's logical to keep them in two different layers, right? But the problem is, since they're both entities, it's like separating skin from bone, I don't like the idea of two layers for entities.

Is there another method for this as well (or should I make a new thread)?


In Topic: Just a simple way to organize Entities in a 2D array.

05 May 2013 - 07:14 PM

That works, out of curiosity, are there any other ways?

I'll most likely do the array of lists of entities, thanks.


In Topic: What game type do you prefer and why?

25 February 2013 - 04:46 PM

For me, my favorites are usually RTS, RPG (ideally real time RPGs), MMORPG, and to a lesser degree turn based strategy and turn based role playing. I usually like 3D better, but well done 2D is perfectly fine as well.

 

Well I have this 2D sandbox game idea in mind inspired by Terraria. It would be more technological than Terraria, and even though it's 2D, you will be able to go indoors. I can't explain myself very well, but I'm trying to say like a door on the wall in the background that you can enter, and if you do, its like another layer behind the previous one. and it can go a few layers back. It saves alot of space. So Imagine Terraria with like multiple layers of tiles. Good / Bad / Dumb?

I think it could work. There have been a lot of top down games with multiple levels, but I can't remember playing any side view games with this kind of system. I wonder if it will be harder to make it clear where the doorways into the rooms outside of the screen are? (that is, if the character is facing into the screen with his back visible, the door would be behind him) I guess you'd just put a sign on the opposite wall or something? I can think of a few other issues like how the back walls would work (in this case walls between layers) and whether you'd be able to see into deeper layers for drawing the backgrounds, but I think they could all be worked out.

First of all, I thank you for replying to me, secondly for telling my that you don't remember playing any side view games with this kind of system(makes mine feel unique).

 

First, the background is drawn, then the tiles in front are drawn. If in the background there is a tile with transparency, then it draws the tile behind it(in the layer behind the current) with 40/255 darker alpha. If a tile behind a transparent tile, a window for example, is also a window, then it is drawn 80/255 darker alpha, and it draws the third layer back. Basically, if the tile behind a transparent one is also transparent, it draws the tile even behind the second one, but, each time it is 40/255 darker, and this only goes on for 4 layers(160/255).

 

To build a door, to prevent building doors anywhere(outdoors, caves), it will need to be placed inside of a room. Also, if you go a layer back the only tiles that show will the the ones below the door.

 

Now, if you build a door on a tower, but jump down(and survive) the way to get back to the default layer will be to press (< or >). This may prevent the use of doors, but doors are always useful because they prevent unwanted creatures out of your house.

 

To enter a door that leads a layer back(<) you need to press W or the key that is assigned to #UP. To enter a door that leads a layer front(>) you will need to press S or the key that is assigned to #DOWN. Now, if you pass through a door, and enter the back layer(<, again) how would you see the door you came from(since you cannot see the layers in front, but just the layers in back)? Simple, transparent tiles "leak light" into the next door. So if you happen to have a window between two rooms, then the tile behind the window(in the back layer, <) will be a little lighter, 20/255(this may to another value later). For open doors, it will leak light the shape of the door(still thinking what would determine to set the door as open or closed when you pass through them, or to even include open doors at all), but the closed doors will only leak light of the outline of the door, it will look like two parallel lines with an arc at the top, and a little light from the key hole.

 

I'm still working on this, but thanks for commenting, and reading.

 

~WeNeedFocus


In Topic: How would I include Xna dlls with my app so the user won't have to downlo...

23 February 2013 - 07:51 PM

Yea, I was thinking about this. Thanks


PARTNERS