Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - BaneTrapper

Pages: 1 ... 10 11 [12] 13 14 15
166
Graphics / Re: Collision detection
« on: August 20, 2013, 12:38:03 pm »
Hello.
I got problem with collision detection.
My map looks like:
1, 1, 1, 1, 2, 1, 1
1, 2, 1, 1, 1, 3, 1
1, 1, 1, 3, 1, 1, 1
1, 2, 1, 1, 1, 3, 1

Every numer is a 16x16 tile, different number - different object.
Number 1 means grass so character can move through it, numbers higher than 1 should block character.
To move character im using .move(x,y).

Can you help me with collision detection ? I got no ideas.
are you moving 16 or ? pixels per key press?
When user presses movement key check if place where he is gonna be is walid.
if walid move him, else dont

167
It's the same, sf::Sprite uses 4 sf::Vertex internally.
But using sf::Vertex i will only apply "transformation" so i can move it around.
If i use sprite, scaling etc... is also applied therefore slower?

168
Well that is the reason i made this post.
Estimated amount of sprites is about 50 at long term period with about + 100 being temporary.
The amount of them being shown at screen will vary to 25-30 at times.
I will also need to draw text for each unit 2 times therefore i want to make the drawing allot faster so i can get some complex AI for the units.
If i made for each unit sf::VertexArray of 4 sf::PrimitiveType::Quads instead of sf::Sprite would that be better regarding performance?

169
Hello.
2d top down 4sidescroller(i don't know how to describe going up and down) game.
I will jump strait to the point because am having trouble getting this true.
What i am making is unit, that is linked with VertexArray.
My goal is not to use sf::Sprite and to get great performance, therefore i was thinking of code going like this.
class Unit : BehaviorInhertiance
{
public:
//Witch vertices is this unit in VertexArray
int StartingVertice;//Position in vertex array that the sprite starts
};
 

The issue starts when i look what is gonna happen in the game.
I am gonna have units die, units get spawned(created).
That means removing or adding elements or keeping track or elements that are free and when adding new unit populate the free elements instead of adding new ones, the issues with this aproach is that i am thinking about boss battles and at some times i will need to create about 50 units that are gonna be just dummy units. But they need position and textures.
Resizing the array will probably be ok if i dont use references, but using int and storing vertex position is kinda not the thing id like to do.
So any suggestions you would like to pass, what should i so considering the design i am wanting.

170
SFML projects / Re: Scratchvaders - a project of silliness and woo
« on: August 11, 2013, 06:00:09 pm »
I really like the concept, execution seems a bit simplistic but overall great!

171
Graphics / Re: A better scrolling background technique
« on: August 09, 2013, 11:21:14 pm »
What you want to do is
sf::Sprite spr.setSize(INFINITE, INFINITE); "or the texture?"
But then drawing is slow...
So that actually is bad.

172
SFML game jam / Re: Questions regarding game jam
« on: August 09, 2013, 07:35:41 pm »
Good to know!

173
SFML game jam / Questions regarding game jam
« on: August 09, 2013, 02:15:36 pm »
Hello.
I have just few questions so am gonna trow them ASAP:
1. What is the rule set for "Game jam".
    Do you make a theme (Ghosts, 2d) and you are supposed to make game using these 3 things to apply?
2. How much time is given for the game to be done? or how long "Game jam" lasts
3. Is it required to apply before to enter game jam? (As in, i am gonna make a game that is about banishing ghosts from mortal plane in 2d view...)

174
SFML projects / Re: Best project ideas for beginners?
« on: August 08, 2013, 10:00:21 pm »
 I suggest text based game.
Set the amount of graphics to 0, as in just text display so you know something is happening.
The point is to get back the feel of how stuff works and how you should put it together.
Good luck!

175
General / Changable keys ingame?
« on: August 01, 2013, 09:12:33 pm »
Hello.
I believe this question has bean asked many times, but using search provides me with error asking me to contact admin...
Could someone point me to some post about changable keys ingame?
EX:
i will mose "W = north" "S = south" "A = West" "D = East"
how can i allow player to switch witch button calls witch effecet?

176
I just read your first line and am typing this replay while thinking to my self.
(Having bad day, not thinking str8, apologize and admit you are an idiot);
Well i am very sorry.
Somehow i missed the fact that each vertex has a position and texture position.
And in the plane/plain i don't have to position each 4 vertices near each other.

What i am trying to say i can make a layer 2 just by adding elements at the end of the Vertex array.
Because my map is loaded in sizes of 11x11 tiles witch are 32x32pixels width and height.
Therefore i can just make sf::VertexArray for each partition of map and always draw it whole having a great performance...


BTW::This thread is totally pointless and serves no purpose, id ask you to delete or not if you hate wasting the time.

177
Hello.
Currently i am making 2d top down game.
I made a map using sf::VertexArray, each tile in layer 1 is a tile and it cant be blank so sf::VertexArray is perfect.
Now on layer2 its gonna be used to draw (Trees, bush, Rock)
And then i need enemies/npc movable units as Sprites, my reason posting is that i want to get speed = to VertexArray but also save space if possible, what is optimal solution?

Map syntax
sizeOfMapX sizeOfMapY
Layer1:Layer2

At layer 1: 0-Infinite = tile texture ID;
at layer 2: 0 = nothing, 1-infinite = something

example:
{5 5
1:0 1:0 1:1 1:0 1:1
1:0 1:1 1:0 1:1 1:1
1:1 1:1 1:1 1:0 1:1
1:0 1:0 1:1 1:1 1:0
1:0 1:1 1:0 1:1 1:1 }
So the layer 2 can have full screen of layer 2 or absolutely nothing.

To recap:
Layer 1 = sf::VertexArray because the map cant have empty spots so its perfect.
Layer 2 = Making sf::Sprite for each tile?(I am affraid this is gonna take allot off performace when in rocky place where the whole screen is gonna have layer 2 and drawing (32width x24height, 32width x32height tiles proves to drain much when using sf::Sprites)
Layer 3 = sf::Sprite for sure because it needs to be pixel perfect

Current layer 1 image^^

178
General / c++ How to handle massive case type
« on: July 20, 2013, 08:01:46 pm »
Hello.
What i am doing is a Class that is called "Interact", the point of class is to allow for type checking.
I am making 2d tile map, and i want to allow for player to "Interact" with map as in(case isBerryBush = harvest)(case Stone = mine(check if item(Pickaxe...)))
I hope i had provided you with what my idea is.

What i am having in mind
//Type of "Addon" on tile (BerryBush, Stone...)
int GetAddonType(TileClass &tile)//TileClass::Addon is defined as int
switch(tile.Addon)
{
type::BerryBush: return my_enum::Hand; break;
type::Stone: return my_enum::Hacking; break;//As in swing to use
}

//Has tool for
bool HasToolFor(my_enum type)
{
//Check player inventory if he has tool
}

//Is the tile ready for harvest
bool IsReadyForHarvest(int TileID)
{
//Returns if the tile has grown since last harvest/planting...
}

//Somewhere in main loop
if(Interact == pressed)//Ilustration
{
  if(GetAddonType(CurrentTileStandingOn) == Hand)
  {
    if(IsReadyForHarvest(CurrentTileStandingOn) == true)
    {
      //Add item to inventory, set tile to harvested...
    }
  }
  else if(GetAddonType(CurrentTileStandingOn) == HackingHand)
  {
    if(IsReadyForHarvest(CurrentTileStandingOn) == true)
    {
      if(HasToolFor(GetAddonType(CurrentTileStandingOn)) == true)
      {
        //Add item to inventory, set tile to harvested...
      }
    }
  }
}
 

The issues with this is that its syntax is horrible imo.
Wanna share a better way? pretty please!

179
The first question I have to ask is what kind of view are you going to be using? you plan on using flat side...
Thank you for interesting and help.
And i am sorry for the lack of information!

What i am making is top down 2d view. 32x32 format(tile size).
Currently i just done the map loading(as one big peace). I am using sf::VertexArray for drawing the actual map, but i hold tile information in sf::vector. Ive done editing tiles (when i press Z button i replace the tile i am standing on with a water tile, this is just base to see it all in action.
I will require to build a huge manager to track all those stuff when editing tiles EX:

I am counting to have 3 buttons to use for commands and 1-9 for hotkeys on items...
I am still wondering how i will do the following, imagine the scene (Player standing on "grass" tile, on witch there is "Berry bush", the player pressed "Collect/Harvest"

There is allot of code i need to do, damn it c++ is slow ^^.

180
So basically what you want is a multi-dimensional infinite-size storage/search scheme... Right?
About right.

also looks to me like you're trying to clone Dwarf Fortress/Towns/Gnomoria :P
About right. Except you are gonna be playing(controling) only one "thing" and struggle for a quest.
During that quest you will need to survive the wilderness and what comes upon dust.

Pages: 1 ... 10 11 [12] 13 14 15