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

Pages: [1]
1
Python / How to display window in a separate thread/process?
« on: November 17, 2011, 08:30:02 pm »
Hi. I'm practicing with PySFML. I made a simple app that measures user response with a timer. To avoid mad refresh rate I enabled vertical sync. This is where the problems start. Without Vsync the results were accurate, but with Vsync on they are rounded according to the refresh rate of the screen. For example on my PC i keep getting results like 0,2333 second (14 / 60). This is because the window.display() function waits for the vertical sync and pauses the whole app. For me, this is unacceptable.

So there goes my question: How to move the display code to a separate thread or process? I read some tutorials on thread, threading and multiprocessing libraries, but they all seem to have a problem in accessing shared objects. I want to handle input and drawing in separate threads, and both reside in the same sf.window object. Is there a way to solve this?

Big thanks up front for help!

2
Window / How to achieve high framerate with Vertical Sync?
« on: November 06, 2011, 11:09:06 pm »
Hi. If I am correct, enabling vertical sync pauses the app each time window.display() is called, so that the buffer is not overwritten while the graphics card renders it. This means that the main game loop will be repeated the number of times equal to the refresh rate (e.g. 60).

What if I wanted to achieve more calculation frames per second (e.g. I'm making an F1 game and I want to count lap times in milliseconds, or I make a multiplayer game and I want to process the data from sockets the moment they arrive)?

Would multi-threading be an option? 1 thread for physics calculations, other thread for rendering stuff? Would vsync even work if I did not lock the window.display() method?

Also, what happens if Vsync is enabled to 60 FPS (new frame is rendered every 17 milliseconds) but my main game loop lasts a constant 20 ms? Will SFML "miss the train" and wait to catch the next one (34 ms), thus reducing the effective framerate to 30 FPS?

3
Feature requests / Load sf::Sprite as a subrect of sf::Image
« on: April 25, 2010, 01:50:20 pm »
Hello. I'd like to ask, if it would be possible to implement a method to the sf:Sprite class that would look sth like this:

Code: [Select]
sf::Sprite::SetImageRect(sf::Image, sf::Rect)

If I am right, the problem with displaying large images lies on the sprite side. So if I could load a large image with sf::Image and then slice it into smaller subrectangles, supported by the graphics cards, and make sprites of them.

Is this doable? Or do I have to split the image manually to ensure, that my sprite is not too big for some old hardware? Thanks.

4
Feature requests / FS#82 - Add functions to sf::Vector2
« on: April 25, 2010, 01:41:41 pm »
Hello, I've got a question about this ticket. Does it mean that it will soon be possible to use sf::Vector2f like a euclidean vector?

http://en.wikipedia.org/wiki/Euclidean_vector

Will it be possible to declare a vector not only by its XY coordinates, but with angle and magnitude as well?

If the vector is declared by XY coords, will it be possible to read its angle and magnitude, and vice versa?

Will it be possible to change the vector after it is declared?

Will the operators be overloaded so that we can add, substract or even multiply vectors? (http://en.wikipedia.org/wiki/Cross_product)

I'm asking, because I'd like to use the sf::vector in my physical equations, and not have to create a separate class for that.

5
Graphics / Problem loading large images
« on: April 21, 2010, 08:46:43 pm »
Hey, I posted a very early version of a game ive been working on (the game called Screenway in the Projects section). It uses a texture of a car and a track. The texture of the track is about 6000 x 2000 pixels. Now, my GeForce supports maximum textures of 8192x8192, so the game works fine. However, on a majority of PCs and Laptops the max size is 4096x4096 or even 2048x2048.

AFAIR, this value is stored in GL_MAX_TEXTURE_SIZE.

I can't imagine chopping down the image into smaller pieces and then calculating all the sprites to follow the movement and rotation, so that the puzzle doesn't fall apart.

So my question is: is the biggest possible loadable image in SFML limited to the maximum texture size of user's graphics card? Are there plans to change that? What do you suggest me to do to overcome this obstacle?

Another problem is, on a laptop which is able to run windows 7 with the Aero transparent interface, the game behaves really bad. It's choppy, like the vertical sync was not working correct. What would that be?

6
SFML projects / Screenway - a racing game
« on: April 20, 2010, 11:54:40 pm »
Hello there. I finally started my first project. It is going to be a racing game. At the moment there is only one car that can be driven over a surface with no collisions. I made it using VS 2010 and SFML 2.0 snapshot. The VC 2010 dll's are included in the package, so it should run out of the box.

Link:

http://grebocin.com/upload/screenway08.zip

Controls:

steering - arrows
gear up - A
gear down - Z
toggle vsync - F1
zoom in - NUM+
zoom out - NUM-

List of changes:

rev 8 (2010-04-24) - added rev meter and a timer
rev 7 (2010-04-22) - added zooming

7
General discussions / Which language to use?
« on: April 14, 2010, 02:44:32 pm »
Hello. I am a hobbyist programmer. I do not have academic programming knowledge, only the things I learned on my own.

I would like to write a 2D racing game of my own, and I really like SFML. However, there are many obstacles when I try to write it in C++. I lack the flexibility of PHP, I can't really grasp the whole low-level programming stuff, like memory management, pointers. Converting numbers to strings is a real pain in the ass.

I have heard about Python, although I do not know how to program in this language.

So I would like to have some advice from more advanced programmers. For a hobbyist programmer, who does not like to fiddle much with the source code to get things done, which programming language should I use? Are the SFML bindings fully functional? Or should I stick with C++?

8
General discussions / Visual Studio 2010
« on: April 13, 2010, 06:54:17 pm »
Hey, I just installed the new Visual Studio 2010 Professional from the MSDN Academic Alliance (it's free for students!).

First thing I did was opening the SFML2 snapshot solution. At first, it converted itself to VS2010 format. Then i compiled the static and the dynamic build with 15 successful builds and only one fail (VOIP sample). I successfully ran some samples and all seem to work. That's good news I guess, because it means it should not be a hard time for Laurent to fully support VS2010 in next release.

And one off-topic question: when is the SFML2 release+documentation expected to see broad daylight? :wink:

9
Graphics / Direction of Angles
« on: April 10, 2008, 12:57:12 am »
Hello, I wanted to suggest if the angle in SFML should not be clockwise instead of counter-clockwise?

On paper, the X coordinate expands to the right, and the Y to the top. But on screen the Y coordinate is flipped downwards. To use the usual trigonometrical formulas I have to add minuses when calculating or refering to the Y coordinate.

So, in brief: if the coordinates system is flipped, shouldn't the angle be flipped too?

Other case is the measure. SFML uses degrees but the trigonometrical functions in cmath use radians, which makes me store my angle values as radians and then convert them for SFML.

10
General discussions / SFML 1.3 / nightly builds
« on: April 03, 2008, 08:04:36 pm »
Hello.

Q1: When should I expect v1.3?

Q2: In case the answer is "in may/june" can somebody please treat me with a nightly build of the latest SVN? I really can't get this thing to work and i really need latest features/bugfixes.

I'm using Windows, and the IDE is CodeBlocks (MinGW).

11
Feature requests / Extended support in handling images
« on: March 25, 2008, 01:03:45 pm »
I've noticed a feature called Improve management of dependant resources in the roadmap. I wonder if it includes retrieving information about images like width, height, bits per pixel.

Let me describe my problem. I want to load large images to the program, but as ive been told, the size is limited by the graphics card.

So I want to slice the image into squares, but then I need to know the size of the image before loading it. And, as I already requested, I will need a function to slice out these rectangles from an image. ImageMagick library calls this function Extract.

Laurent, you told me that you will think about this feature, but should i expect it to be added in a month or rather in a year?  :wink:

12
Feature requests / Platform independent executable calling
« on: March 17, 2008, 07:40:09 pm »
I would like to have an easy way to call external executables. Of course with a possibility to pass arguments and receive standard output.

something like:
string output = sf::exec("program.exe","args");

But you know, maybe i just didnt google enough to see its included in the system library.

13
Feature requests / SVG image rendering and more keyboard assignments
« on: March 13, 2008, 11:30:42 am »
Request one:
Add support for opening SVG images. I know it is a big thing to ask for, but there are ready DLLs. Integrating them into SFML would be swell!

Request two:
Add support for every Key on the keyboard. For a game developer a LEFT shift is entirely different from RIGHT shift.

Request three:
Add a function to change a relative transformation point for SPRITES. Something like Sprite::SetTransformationPoint. It would replace SetRotationCenter, and serve as a base for positioning, zooming and rotating.

Note: I really appreciate your work, i tried to work with QT, but it is too complex for me. I love elegance and simplicity.

14
General discussions / I found some errors.
« on: March 13, 2008, 11:14:09 am »
Hello. I'm not an experienced programmer, but i'd wish to report some bugs i noticed. My platform is Windows XP and the IDE is CodeBlocks.

Error one: the tutorial example, where the F1 key is bound to make a screenshot ends with a windows error message Memory could not be "written".

Code: [Select]
if (Event.Key.Code == sf::Key::F1)
{
    sf::Image Screen = App.Capture();
    Screen.SaveToFile("screenshot.jpg");
}


Error two: Another tutorial sample, where it is supposed to load an image, works fine on my PC, but when i tried it out on a laptop, i did not work with a 1600x1200 jpg image. I had to reduce the size of the image. The same happened when it was emulated in Wine: Failed to create image, it's internal size is too high (1600x2048).

Code: [Select]
sf::Image Image;
if (!Image.LoadFromFile("image.jpg"))
return EXIT_FAILURE;


I want to make a racing game that loads a track from a file, and it's supposed to be a considerable resolution. I'm worried that on some machines it won't work.

Pages: [1]