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] 2 3 ... 15
1
SFML projects / Re: The Wanderer - Lost in time
« on: September 20, 2015, 04:25:14 am »
Update 20-Sep-2015
Added AI, currently it gets action from town what is required to do.(Harvesting and crafting). Unit will go out, harvest, and return resources.
It will also craft when town orders it as a action when it has resources to do so.
Also equipment is now dynamic, equipping a item piece has its own sprite that shows in game.
Some spell effects have been added, and updated.

We are still going! never done, just lack of work hours to invest :)
The learning experience was very... Harsh, and joyful. If i had chance i would do it again!
I will do regular update videos which you can catch up on the youtubes
https://www.youtube.com/channel/UC8r76BkWbj9nRJL-kfSwfxA/videos

Also i stream the development, if you want to see how self learned guy does things to achieve max performance, i am your guy. Also if you needs help or tips i will do my best.
Language is c++, libraries: SFML, STL. Scripting: Custom scripting language, Lua

I stream Saturdays and Sundays when i wake up. If i am not working i will also stream during work days.

2
Another possible solution is to render a zone 2/3 tiles wider than your screen
You can for example:
  • Get the view center and the view size
  • Transform them in your tile coordinate system
  • Choose a starting tile ( like startingTile = your center - your mapSize - Vector2<T>(2,2)
  • Render your map from (StartingTile.x) to (StartingTile.x + mapSize.x + 4) same for y axis

It's really non-optimized but I used this kind of system when I learned SFML, but it's pretty effective 8)
+1, it is robust way to do it. The amount of draw calls depends on screen size Y / primitive size Y. All in all 10/10 IGN

3
Graphics / Re: 8x8 tiles and big map, bad idea?
« on: June 26, 2015, 09:48:29 am »
draw using this, i copy it from documentation, its a sf::RenderWindow::draw
Code: [Select]
void draw (const Vertex *vertices, std::size_t vertexCount, PrimitiveType type, const RenderStates &states=RenderStates::Default)

it would be something like this
Code: [Select]
for(y...)//Column
{
   for(x...)//Row
   {
      renWin.draw(...);
   }
}
This kind of goes against your reason for using a vertex array. You still have all the draw calls for each tile.

A vertex array can hold many vertices and therefore all of the (visible) tiles at once. Then, there's no need for a loop; you just call draw on the vertex array and it draws them all.

There is a tile map example in the vertex array tutorial.

Completely valid except (draw calls for each tile), it would rather be that there will be draw call for one row of tiles, but at some point it becomes better then drawing a massively huge vertex array.

4
Graphics / Re: 8x8 tiles and big map, bad idea?
« on: June 25, 2015, 07:02:03 pm »
My suggestion would be, store the tiles in one sf::VertexArray.
And then draw X vertices to optimize drawing, and allow you to have almost infinite map size (As long as your ram allows it)

And draw using this, i copy it from documentation, its a sf::RenderWindow::draw
Code: [Select]
void draw (const Vertex *vertices, std::size_t vertexCount, PrimitiveType type, const RenderStates &states=RenderStates::Default)

it would be something like this
Code: [Select]
for(y...)//Column
{
   for(x...)//Row
   {
      renWin.draw(...);
   }
}

5
Graphics / Re: Resizing a RenderTexture?
« on: May 17, 2015, 08:53:12 pm »
Too late, might as well erase
Your sprite texture rect doesn't change when you call setTexture again, unless you set the 2nd parameter to true.
You beat me to it!

6
Graphics / Re: extra images appearing at 0,0 coordinate of window
« on: May 10, 2015, 02:09:10 pm »
My poor memory, full of leaks  ;D, when you use "new" you have to use "delete" to free the memory.
The program is doing exactly what you made it to do, so to simply answer your question:
Extra images appear on top of the screen because in code its made that way.

Some issues: Use STL library for memory management if you are new to c++.
on sf::RenderWindow use function w.setFramerateLimit(60); because i had too many frames.
You also never clear screen at beginning of while loop, therefore you have so many images on screen w.clear();
All of this things can be found in the "TUTORIAL" of SFML, if you read through it, you will know all of this, i suggest you do that.

About the random sprites at 0,0 position. I did not examine the code, i just gave it a look. I suspect you do it in this order: Make warrior, draw warrior, set warrior position. (Thus the warrior will be drawn at 0,0 position first time, that is the default value, next frame he will be drawn at pos you wanted to)

TL;DR Read tutorial, everything you asked in few posts can be found there, also use STL library :)

7
Graphics / Re: texture and sprite
« on: May 10, 2015, 01:27:35 pm »
Sprites setTexture(...) function is cheap, you can use only one sprite, and change texture which you want to display/draw.

In the end it depends on what you want to do, there shouldn't be any noticeable difference doing it ether way.

8
Graphics / Re: texture and sprite
« on: May 09, 2015, 06:47:33 pm »
Can i load more than one image to texture and set texture to sprite?
Short: No, yes.
Long: No you cannot load multiple "images" intro one sf::Texture, You can use/set sprite to draw a sf::Texture

does the image1 get destroyed? if not how can i choose which image i want to render.
Short: yes, ?
Long: The image1.png will be released/destroyed, and image2.png will be loaded.

Global answer: You probably want to make two sf::Texture and load each one with different image.
Then you can use sf::Sprite to chose which one you want to draw via sf::Sprite spr1; spr1.setTexture(...) function. That's how you can go around switching around what you want to draw.

9
SFML projects / Re: The Wanderer - Lost in time
« on: May 01, 2015, 08:10:10 pm »
BUMP:

Update 4:  1st may 2015
Oh my how long has it been? too long IMHO.
Allot of things clicked in place, and are ready for usage, but i cannot scrape time...
There is no content to show it off thus we are making "Demonstration" it will be a short, playable to show off what is supposed to be in alpha.

What is to be expected in alpha:Single character control, Items that affect player (Consumables, Equipment), Environment to explore, Characters with story to tell, Quests and puzzles.

I am hoping this week end i will add a video update, and later a developer commentary, to talk a bit about the game. The video will be found on youtube.

Official youtube: "BaneTrapper Dev" https://www.youtube.com/channel/UC8r76BkWbj9nRJL-kfSwfxA

10
Graphics / Re: sf::VertexArray using incorrect texture coordinates?
« on: January 10, 2015, 07:33:39 pm »
Round up or down camera position, in other words, the position of camera needs to be whole number / integer value in order to remove the issue.

11
SFML projects / Re: The Wanderer - Lost in time
« on: December 15, 2014, 05:00:22 pm »
(I em /we are) not dead, still working. Allot of stuff changed, and was added.
Quite allot of stuff i want to add, but just few thing needed to be added so we can produce Act I.
I will make a update before January 1st to show cool stuff that has bean made.

12
General / Re: Shooting projectiles Straight **Advice needed***
« on: November 23, 2014, 03:35:30 am »
Hey SFML coders !
How do i get a sprite to be fired as projectile and move straight ahead .
Now honestly.
That is very poorly described what you want, how about you put more information of what exactly you want to have, and then i help you.
Stuff like:
In my game i want to shoot a gun, and projectiles to travel in direction of mouse. How do i do this?

To also answer your question:
angle_in_degrees is just angle in degrees...
distance_to_move is value you move the spite in given angle.
Code: [Select]
posX += cos(angle_in_degrees)*distance_to_move;
posY += sin(angle_in_degrees)*distance_to_move;


13
SFML projects / Re: Dwell - A Retro Sandbox Survival MMO
« on: October 26, 2014, 09:05:07 pm »
+1, Give all the support  8)

14
Graphics / Re: Problem with VertexArray declaration?
« on: October 07, 2014, 06:56:00 pm »
Personally i feel you are being too harsh on him even if he is newbie.
But wh1t3crayon, you could search the forums, you would find answer quickly. Also i suggest to read about c++ "struct" and "class".


What you did is not a valid way to declare vertexArray in c++ struct. The declaration should look like this.
Code: [Select]
sf::VertexArray name;

15
Graphics / Re: stuttering on some hardware, not others
« on: October 05, 2014, 10:33:03 am »
I was just looking through the quotes about those games and saw this:
Quote
...the stuttering issue is eliminated 90% of the time...
I know this because I have at least 20 coworkers who have had that problem ...worked for 17 of them.
17 out of 20 is 85% *rolls eyes*
If there are more than 20 ("at least 20"), the percentage is even lower. *tut*
:D.

Free education! thanks all.

Pages: [1] 2 3 ... 15