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.


Topics - Kanefa

Pages: [1]
1
General discussions / Android and iOS ports Status
« on: July 27, 2015, 04:30:50 am »
I want to ask about the progress of these two ports. I can see Mario is working hard on them. Are either of them far enough along to start a project and put it in a store? Would you currently recommend one over the other Thanks!

2
Graphics / Initial draws take much longer then the following
« on: May 11, 2015, 11:23:32 am »
I have been walking through the Arkanoid in 160 lines tutorial (I don't believe knowledge of the tutorial is necessary to answer the question). I just finished the second one and started to notice my version is exhibiting some undesirable behavior. This occurs when I pass the ball and paddle function time deltas.

What happens is the first visual the player sees is further along then I would like to be. I have attached two screenshots. In the first one the ball is near the center of the screen and this is the appropriate behavior. However, in the second one the ball has already knocked out two bricks and traveled quite a bit of distance before it was ever drawn.

What I have noticed is my initial draws take a very long time compared to the following ones on the next iteration of the loop. Here is a code snippet to show what I am doing. The points of interest are where I begin timing (comment 'Start time') and finish timing ('End time').

        while (window.isOpen())
        {
                auto startFrame(std::chrono::high_resolution_clock::now()); // Start time

                sf::Event event;
                while (window.pollEvent(event))
                {
                        switch (event.type)
                        {
                                case sf::Event::Closed:
                                        window.close();
                                        break;
                        }
                }

                ball.update();
                paddle.update();

                testCollision(paddle, ball);
                for (auto &brick : bricks)
                {
                        testCollision(brick, ball);
                }

                bricks.erase(std::remove_if(begin(bricks), end(bricks),
                        [](const Brick &brick){ return brick.mDestroyed; }),
                        end(bricks));

                window.clear(sf::Color::Black);
                window.draw(ball.mShape);
                window.draw(paddle.mShape);
                for (const auto &brick : bricks)
                {
                        window.draw(brick.mShape);
                }

                window.display();

                auto endFrame(std::chrono::high_resolution_clock::now()); // End time

                // Frame duration
                auto frameTime(std::chrono::duration_cast<std::chrono::duration<FrameTime, std::milli>>
                     (endFrame - startFrame).count());
        }
 

The value of 'frametime' on the initial time through the loop takes around 400-700 milliseconds. This value will be passed to the update functions and on the next draw the ball will make a huge jump and that's the undesirable behavior I am seeing. However, after this initial frame each frame then takes around 15 milliseconds and this is very expected (as it matches the tutorial).

Also, to be clear I moved around the time points and it was clear that it was the draws were taking up the bulk of the time. I believe I understand what is going on, but I am surprised. I want to ask the following questions. Should the initial draw be significantly slower than the following ones? Also, what explains the difference in Romeo's (author of tutorial) game behavior and mine? I don't think such a simple example would exasperate the fact I may be using slower computer.

3
Graphics / sf::Text and Character Size
« on: October 26, 2014, 11:54:49 am »
I am drawing the '-' character. At character size 20 it looks thicker than it does at character size 22. I have attached screenshots. I wanted to know why this happens (ex. anti-aliasing)?

4
Graphics / sf::Transformable
« on: October 25, 2014, 11:52:57 am »
I am having confusion when using sf::Transformable.

I have a class called Button that inherits sf::Transformable. My motivation to do this is I want to be able to set the position of the entire class with a single sf::Transformable::setPosition. This works.

Next, I create another class called ToggleButton that inherits from sf::Transformable and is composed of two Buttons. My motivation is the same. I want to be able to set the position of the entire class with a single single sf::Transformable::setPosition. This works.

However, I run into a problem with Button::handler(). The handler is comparing the position of the button with the position of the mouse. The problem is Button::handler() does not take into account the transform (setPosition) that occurs to ToggleButton.

When drawing the elements this is not an issue, because by inheriting from sf::Drawable I can easily apply the transform within sf::Drawable::draw with

states.transform *= getTransform();

One solution I see is for ToggleButton not to inherit from sf::Transformable. Then simply call sf::Transformable::setPosition on each Button member variable. However, I am curious to understand how I should be properly using sf::Tranformable in such situations. How do I "string" multiple transforms like this together?

5
Graphics / Assertion when passing string across a .dll boundary
« on: October 14, 2014, 11:58:14 am »
I am having an assertion when using sf::Text::getString().  I have attached an image of the message.

mText.setString("Hello");
std::string text = mTextLine.getString();  // Assertion!

Besides calling sf::Text::getString() everything is working fine when I use sf::Text. 

Searching around I found a similar issues on stackoverflow. http://stackoverflow.com/questions/18882760/debug-assertion-failed-expression-pfirstblock-phead I am having the same problem, "it blows up at the precise point where I pass a string back across a .dll boundary."

I have verified I have Multi-threaded Debug DLL (/MDd) set.  I have rebuilt SFML-2.1 with Visual Studio 2013.  Still the problem persists.

I am out of ideas.  Anyone have experience with this?

6
General / Building SFML 2.1 for VS 2013
« on: October 13, 2014, 10:12:26 pm »
I am attempting to build SFML 2.1 for VS 2013.  I am using the latest version of cMake 3.0.2.  When cMake prompts me I select Visual Studio 12 2013 and Use default native compilers.  Here are the options I use.

BUILD_SHARED_LIBS - No
CMAKE_BUILD_TYPE - Release
CMAKE_CONFIGURATION_TYPES - Debug;Release;MinSizeRel;RelWithDebInfo
CMAKE_INSTALL_PREFIX - C:/Program Files (x86)/SFML
GLEW_INCLUDE_PATH - C:/Users/My Name/Desktop/SFML-2.1/extlibs/headers
GLEW_LIBRARY - C:/Users/My Name/Desktop/SFML-2.1/extlibs/libs-msvc/x86/glew.lib
SFML_BUILD_DOC - No
SFML_BUILD_EXAMPLES - No
SFML_USE_STATTIC_STD_LIBS - No

I then open SFML.sln receive the message that "One or more projects in the solution were not loaded correctly. Please see the Output Window for details."  When I try to compile the project I get errors of the following nature, "Error 1 error MSB4025: The project file could not be loaded. And error occurred while parsing EntityName."

This issue is similar to this thread from four years ago.  http://en.sfml-dev.org/forums/index.php?topic=3519.0

Any help would be appreciated.

7
Graphics / Windowed to Fullscreen (change resolution)
« on: August 09, 2014, 12:37:41 pm »
I've been working on letting the user switch between windowed and fullscreen.  When I switch from 800x600 windowed mode to fullscreen I want to use the desktop's resolution.  I can fetch the desktop's resolution using VideoMode::GetDesktopMode() function.  However, I am not sure how to apply the new resolution.




8
General / Tiled Background & Performance (Q and Benchmarks)
« on: July 24, 2014, 02:09:08 pm »
I recently added a tiled background to my project.  It was a straightforward implementation.  I parse the information from a tmx file (Tiled Editor) and then loop through each layer and tile.  I have two layers and my map is 50 tiles by 50 tiles.  So to draw the background I loop 5,000 times (2 layers x 50 tiles wide x 50 height).

Looking at the debug and release build before implementing this I was running at 680 FPS.  If I loop through the logic, but don't call the draw method my release's performance holds at  680 FPS, but my debug's performance plunges to 40 FPS!  Next, if I loop through all the logic, and call the draw method my debug FPS drops to 15 and my release FPS drops to 330.

First, I thought it was really strange the performance hit looping through the logic takes in debug mode.  That's a 17x performance decrease.  It seems very quickly my game would become unplayable in debug mode. 

Next, my release mode is running at 330 FPS with a character and a background.  That seems fast enough, but I wish I had something to compare it to.  Does this seem like a reasonable place to begin building a simple 2D game on?

Finally, I can think of a number of optimizations.  The simplest being to not redraw the character and background every single frame.  I mention the character and background together, because I center the camera on the character.  They are linked.  Is there a "recommended" number of times to redraw per second?


9
General discussions / How to avoid linking my static lib to SFML's?
« on: March 16, 2014, 10:46:32 am »
I've created a static library and added some of my generic game systems for reuse on future projects.  However, when I link SFML I get a few warnings.

Quote
warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined...
warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library

Searching around I got plenty of hits.

Quote
Never link static libraries to your library! It can be painful, but you have to require that your applications link to your dependencies.

Quote
You don't need to add any dependencies when creating a static library. If your library uses d3d9.lib, then let the build of the EXE/DLL link it in.

It's clear I shouldn't be linking a static library to my static library.  However, I don't understand the solution.  Are they suggesting my game, that uses my static library, should link SFML?  If so this is already the case, and I don't see how this would give my static library access to SFML functionality.

10
I have been working on extending the code base from SFML Game Dev book.  I am adding mouse support, but my solution feels messy.

mKeybinding is declared in player.h as

std::map<sf::keyboard::key, Action> mKeybinding;

The problem is I want sf::keyboard::key to be more general to hold both keyboard and mouse keys/buttons.  I combine the two in a enum and handle the offsets.  I then have to begin converting from sf::Keyboard::key and sf::Mouse::button to my new enum and back.

In the end it will work, but I keep thinking there is a cleaner approach.  Any suggestions?  Thanks.

Pages: [1]
anything