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 - zachprinz

Pages: [1] 2
1
SFML projects / Re: Thor 2.0
« on: January 07, 2014, 03:39:38 am »
Hey, I'm not sure how much this has to do with Thor but I'm having a wierd problem with the library.

I've build and installed the latest GitHub versions of both SFML and Thor for VS11 using Cmake, but get this error when trying to run your example "particle.cpp" after linking the created libs for the aforementioned libraries.



I know this usually happens when there's a mismatch between what was linked to and the dll, or a mismatch in the IDE the libraries libs were compiled for but both SFML and Thor were compiled for VS11.

Anyways, I figured I'd post and see if anyone would know whats happening.

Thanks.

EDIT: I just build static libs for sfml and thor and that works fine.

2
SFML projects / Re: 'Tiled' Tile-map Loader
« on: December 10, 2013, 03:45:11 pm »
No idea. I've never tried any kind of analysis before and, to be honest, I have no idea what 29% of the samples means. However, if you want to try analysing the samples in the repository and perhaps the vertex array samples from the SFML tutorials for comparison I'd be interested in seeing the results.

I'll be looking into it. I'll post back what I find.

Hey, I've been running performance analysis on some of my code and drawing a 25x25 map that has 2 layers and uses 1 sprite sheet through Tiled is holding about 29% of the samples. Is this normal?
Can't you tell your profiler where to find SFML's source code and resolve all those "sfml-graphics-d-2.dll" into something more useful?

It's normal that draw calls take up some time, whether it's normal with your setup is impossible to tell with the given information.
Is it already a performance issue on your end, or are you doing some premature optimization testing? ;)
That would be a nifty trick, I'll figure out how to do that seeing as like you said the info past m_DrawLayer is pretty useless.

I've been testing my code on different machines and focusing heavy on optimization lately. My goal is a solid 60 fps on Intel HD 4000 integrated graphics. I've gone from 20 to 35-40 in the last 10 days so so far so good.

EDIT: So for my purposes (Considering all animated tiles and objects are handled by my engine and not the tile map) just loading a .png of the level actually doubled my frame rate. I didn't end up testing the examples from the github. I may in the future if I find a need to use Tiled Map Loader to draw my maps.

3
SFML projects / Re: 'Tiled' Tile-map Loader
« on: December 10, 2013, 04:45:02 am »
Hey, I've been running performance analysis on some of my code and drawing a 25x25 map that has 2 layers and uses 1 sprite sheet through Tiled is holding about 29% of the samples. Is this normal?


4
Graphics / Re: Recreating Vertex Arrays vs. Adjusting Vertex Position
« on: December 09, 2013, 09:48:51 am »
Well it always depends on the task at hand. A modern GPU can easily handle 2000 draw calls per frame reducing it one draw call should however still give you some better performance.
But again it's impossible to tell without the source. How did you measure performance?

I measured it using the FPS viewer of fraps. Which I know isn't the best way. I'm going to experiment some more and hope I can find something. Any ideas would be very welcome though.

The game is using barely any of the CPU, and nearly all of the graphics card. But I would guess this is par for the course.

5
Graphics / Re: Recreating Vertex Arrays vs. Adjusting Vertex Position
« on: December 09, 2013, 09:12:00 am »
Should I be using gameArray.append() then?
Yes.

Unfortunately that has no effect on performance.

How large (ballpark) of a performance increase should I see when switching from drawing individual sprites to sprite batching?

6
Graphics / Re: Recreating Vertex Arrays vs. Adjusting Vertex Position
« on: December 09, 2013, 08:56:04 am »
Quote
-window.draw(gameArray,gameRenderStates);
-gameArray.clear();
-quadCount = 0;
-gameArray.resize(2000);
Calling clear() on the vertex array (which internally uses a std::vector) won't deallocate memory, thus you don't have to call resize again. It might very well be that the resize() call is slowing down things.

Should I be using gameArray.append() then?

When I remove the resize call I get an out of range error and in Visual Studios Autos I can see that gameArray has a size of 0 and a capacity of 2000.

7
Graphics / Re: Recreating Vertex Arrays vs. Adjusting Vertex Position
« on: December 09, 2013, 08:19:50 am »
My project is quite long, If need be I'll go through and try to write out a minimal example. For now though, here is the basic steps I go through in the sprite batching process. Please let me know if anything seems terribly off.

gameArray is the sf::VertexArray
quadCount is an int that keeps track of the amount of vertices already set up in gameArray
gameRenderStates is the sf::RenderStates that carries the info for gameArray

Quote
SetUp
-quadCount = 0;
-gameArray.setPrimitiveType(sf::Quads);
-gameArray.resize(2000);

Go through and draw sprite
-gameArray[quadCount].position = position;
-gameArray[quadCount++].texCoords = textureCoordinates;
-(repeat for each corner)

Draw the Vertex Array to the Window
-window.draw(gameArray,gameRenderStates);
-gameArray.clear();
-quadCount = 0;
-gameArray.resize(2000);

8
Graphics / Recreating Vertex Arrays vs. Adjusting Vertex Position
« on: December 09, 2013, 02:57:55 am »
When using vertex arrays to draw sprites, is it better to clear the vertex array at the beginning of every frame and then add all the objects again, or to give every object it's own vertex pointer and let it change the position of that quad every frame?

I recently stopped using sf::Sprites and drawing them onto panels every frame in favor of using a vertex array. After I did this I actually saw a drop in performance and I'm trying to figure out why.

9
SFML projects / Re: SFML Light System - Let There Be Light
« on: November 18, 2013, 09:35:45 pm »
My solution to the problem I posted above was to create the sf::RenderTexture window I have the sprite panel on at the size of the quad tree for ltbl.

Then I just set a view on the sprite panel and keep the light systems view to the whole 4096x4096 map.

This is resulting in very poor performance when you add in more than a few lights.

I've added checks to see if the lights are contained in the visible part of the map but it doesn't help much, about a 35 fps drop when there are 5 lights on screen.

Any thoughts would be appreciated.

10
SFML projects / Re: SFML Light System - Let There Be Light
« on: November 16, 2013, 01:50:25 am »
Views seem really wonky.



I'm getting this. It's the same problem everyone else was having quite a few pages ago.

The only time I can see lights is if I set the view the the default view of the panel. But then I can't see lights anywhere else.

You can see the light trailing up into the top right hand corner of the darkened area.

Anyone know a fix?


   view.setCenter();
   panel.setView(view);
        Draw(panel);
   panel.setView(panel.getDefaultView());
   lightSystem.SetView(panel.getDefaultView());
   lightSystem.RenderLights();
   lightSystem.RenderLightTexture();
   lightSystem.DebugRender();

11
SFML projects / Re: 'Tiled' Tile-map Loader
« on: November 13, 2013, 05:03:03 pm »
Thanks :)

So this is a new format which replaces the tsx schema? Or an additional format which allows multiple images to make up a single tsx/tileset? The commit date of the xsd file is from 3 years ago and the file itself says it was last updated 6/7/2008 so I'm a little dubious as to how up to date the schema is. I've always followed this which states that it is version 1.0 (not 0.7.0, which the xsd file implies).

If anyone else asks for this I may add it to the existing formats (while not replacing them) but for now I'll not act on it. If anyone wants to contribute this, however, I'll be more than happy to consider it :)

Ooh, you're right. My bad. I hadn't actually used the schema (just the changes I saw in the .tmx files.) I edited my post to include the document type definition, it looks like he documented the changes somewhere around 0.9.0.

These changes are in addition to the previous tilesets. So a regular tileset will still appear the same way in XML.

And that's fine. Like I said I've got my code working.

12
SFML projects / Re: 'Tiled' Tile-map Loader
« on: November 13, 2013, 04:07:06 pm »
Do you have any links/examples for Collection of Images tile sets? I can't seem to find anything about it on the Tiled site.

Also, as promised GitHub page :)
Yeah, https://github.com/bjorn/tiled/blob/6221c0c6cfa6d8fdbcbacb7c360d0e4fb7180b45/docs/map.xsd is a link to the schema definition for the TMX (XML) files that get outputted. If you ctrl-f for "image.tileset" those are the changes that he made.

The actual changes to the xml are pretty minimal, where previously you would have a tileset arranged like this:

Quote
<tileset firstgid="" name="" tilewidth="" tileheight="">
     <image source="" width="" height=""/>
     <tile id="">
          <properties>
               <property name"" value=""/>
          </properties>
     </tile>
</tileset>

you now have

Quote
<tileset firstgid="" name="" tilewidth="" tileheight="">
     <!-- no image here-->
     <tile id="">
          <properties>
               <property name"" value=""/>
          </properties>
          <image source="" width="" height=""/>
     </tile>
</tileset>

Also he explains the new format on the page you linked in your github https://github.com/bjorn/tiled/wiki/TMX-Map-Format

Quote
<tileset ...>
    <tile id="[n]">
        <!-- an embedded image --> //Not sure what this is
        <image format="png"> //
            <data encoding="base64">//
                ...
            </data>//
        </image>//
    </tile>
    <tile id="[n]">
        <!-- an individually referenced image for a single tile -->
        <image source="file.png"/>
    </tile>
    ...
</tileset>

13
SFML projects / Re: 'Tiled' Tile-map Loader
« on: November 12, 2013, 05:59:36 pm »
Oh, thanks! I hadn't seen this yet, I shall definitely look into it. Once I get my act together I'll move the map loader to github so it'll be easier for other people to contribute  8)

I was able to get it working for my needs. However I've already modded how the loader draws image objects (which are the only things I use collection of images for) so my fix is fairly narrow and probably wouldn't help much.  I'll use yours as soon as you finish it, I'm sure it'll be much more complete.

Also Github would be awesome. I was honestly a little surprised you didn't make a separate thread for your loader considering its completely different from the original one posted here. Anyways, Thanks for all the work you do on it  :)

14
SFML projects / Re: 'Tiled' Tile-map Loader
« on: November 11, 2013, 11:43:55 pm »
There's a new feature in Tiled which is immensely helpful called "Collection of Images" tileset. It's xml code is a little different from the xml generated for regular tilesets and if I'm not missing something (hope I am) it throws off the map loader. I'm going to look and see if I can't find a fix for it in a little.

Just thought I'd let you know if you didn't already.

Love the map loader by the way.

15
General / Re: RPG Data Serialization Methods
« on: August 17, 2013, 01:36:07 am »
I'm having a bit of trouble finding many good tutorials or information on binding Lua to C++. LuaBind hasn't been updated in 3 years which worries me a tad. But it still seems like the best option.

I'm also not sure If I've gotten the whole concept of using a scripting language for logic. My understanding of it as it stands is that I will create a scripts folder in my project folder and put a few more folders in that specifying the type of scripts inside for organization. Inside those I'll make short .lua scripts for each type of enemy/item/etc. These scripts will contain a few methods like OnCreate() to set up the values of the c++ instance of "Enemy"

Quote
RPGProject
  --scripts
     --enemies
       --man.lua
       --goblin.lua
     --items
       --potion.lua
       --food.lua

When I start the game it will load the map (I'm using tiled .tmx files) and through reading the map it will find say an enemy on tile (16,12) with a name value of "man." It will create an instance of "Enemy.cpp" and in the constructor of "Enemy.cpp" it will take the name value and find "scripts/enemies/man.lua" and call the OnCreate() method of that .lua file which will set up the values that go along with the "man" enemy.

I also plan to have an Update() method that will keep track of AI and that particular enemies behavior. The Update() method will be called every time the enemy finished the last task provided by the Update() method.

I just want to make sure I'm on the right path with this.

EDIT: Figured out how to install everything.

Pages: [1] 2
anything