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

Pages: 1 2 [3] 4 5 ... 7
General discussions / Switched times to Uint32 milliseconds in SFML 2
« on: November 05, 2011, 09:34:41 am »
Quote from: "Laurent"
There will be a problem indeed, since 1.6 can't be returned (it will be 1 by the way, C++ truncates when it converts float to int).

What if my loop lasted shorter than 1 ms (0.9 ms), would it be truncated to 0 ms?

Also, if I ran a loop that would accumulate the elapsed time, the loop lasting 1,9 ms (displayed as 1 ms), after 1000 frames 1,9 second would have elapsed in reality, but the accumulated timer value would show 1 second! That's seriously crappy. In that case I would totally drop the frame timer and go for a global timer. Then the differences would be corrected, right?

What do you mean that OS guarantees 1ms as the smallest measurement? If so, then why was the float displaying non-round FPS values, like 1700 FPS?

General discussions / Switched times to Uint32 milliseconds in SFML 2
« on: November 04, 2011, 06:13:16 pm »
Sorry to resurrect this thread but I've got a question.

Let's assume that each one frame of some game lasts a constant 1.6 ms. By one frame I mean one loop cycle. The question is: what will be the elapsed time value? Will it be equal to 2 ms each frame?

I'm asking because the elapsed time is used to calculate movement of an object by multiplying its velocity by the elapsed time. When the interval is big, there is no problem, but if it is as small as I've suggested, will there be problems?

I must say I'm not convinced to using integer for storing time. It's like limiting sprite position to full pixels.

General / Time as float?
« on: November 03, 2011, 10:38:12 pm »
Since it's been mentioned, can anyone tell me why was time changed from float to integer milliseconds? If I ever wanted an integer, I could always round the value. Why is it rounded for me?

Python / pysfml2-cython
« on: October 27, 2011, 11:19:47 pm »
Quote from: "bastien"
When I try your Pong example with my sf.pyd, I get this:

Code: [Select]
err:module:import_dll Library libgcc_s_sjlj-1.dll (which is needed by L"Z:\\home\\bastien\\Desktop\\pong\\sf.pyd") not found
err:module:import_dll Library libstdc++-6.dll (which is needed by L"Z:\\home\\bastien\\Desktop\\pong\\sf.pyd") not found
Traceback (most recent call last):
  File "main.py", line 9, in <module>
    import sf

Could you copy-paste here the command-lines that are issued when you build the binding? I guess I missed something to include the standard libraries.
Also, for some reason the SFML libs I cross-compiled aren't even detected by Wine.

Maybe my libs require having installed the Visual C++ redistributable? I build an executable of the pong example with PyInstaller and it put all the necessary DLLs in the folder. I gave it to my friend who has "bare" windows and it worked for him, so it should work for you too in Wine. Check it out here:


Regarding the compilation output, here it is:


Could you please deal with the conversion from Double to Float warnings? Why do you even use floats if SFML uses doubles? Does python have doubles? If not, could you at least convert these via a function so there is no warning? Thanks :).

Python / pysfml2-cython
« on: October 27, 2011, 08:23:25 pm »
OK I tested your sf.pyd and it tells me that "import sf failed, module was not found". I've no idea what's wrong with your file :P.

I put my own sf.pyd on the web, accessible here:


Also, I put the whole Pong example, with SFML dlls, extlibs, sf.pyd and main.py:


Perhaps this may be of help for all PySFML starters.

Python / pysfml2-cython
« on: October 27, 2011, 09:40:24 am »
Quote from: "bastien"
I just compiled something that looks like a Win32 module, but I can't get it to work with Wine (it tells it can't find dependent DLLs, even when they are in the current directory).
Can someone test it on Windows and tell me if it works? Here is the direct link: https://github.com/downloads/bastienleonard/pysfml2-cython/sf.pyd

I will test it as soon as I get hom from work. I can see you only put sf.pyd file. It makes no difference which SFML libs I use with it? (revision / compiler). I presume that when compiling the pyd file, you needed to have the dlls present, right? Maybe it would be good to include them in the package with the binding, so that the end-user does not have to compile SFML on his own.

Python / pysfml2-cython
« on: October 24, 2011, 09:46:42 pm »
Ah, very well. No special debug libs means one thing less to care about :P. So far my apps did not require special debugging, so I haven't really figured out what SFML debug libs do. If you say that regular python debugger will do, that's just perfect.

Well, I think I'm going to dedicate more time to learn Python and maybe start off a little project in PySFML. I'm really overwhelmed by Python philosophy :). I just hope you won't get bored too soon and that you keep updating and upgrading PySFML (e.g. reference/documentation).

General / SFML Complete Game Tutorial
« on: October 24, 2011, 09:09:44 pm »
Ah, from your tutorial I just need the game framework. I'd like to write the engine myself, as I'm fairly good at maths. In my prior 2d racing project I had all the trigonometry and physics figured out. In fact, that is the most fun part of all, fiddling with the physical equations and then testing the effect it has on the car :D.

I don't know if you should teach maths in your tutorial. You don't teach general programming, do you? I like your tutorial, so far, because it's a missing ingredient of how to wrap SFML libs to make an organized game framework. But if you really wish to teach trigonometry, i think its not all that hard to comprehend. Seriously, what more needs to be said than this little infographic I made? :D

By the way, I managed to compile PySFML2 and I'm overwhelmed by the simplicity of Python. For example, project is not kept in a file, you just open a folder and all files inside that folder are treated as part of the project. I love the language itself. In most cases there is only one right way of doing stuff, which is cool beacause understanding the code  is easier that way. The syntax is clean. I downloaded a PySFML asteroids game called Multitroids and the code looks really nice, I think the structure is similar to yours. I only hope that Python won't be too slow for the game I'm planning to make.

Python / pysfml2-cython
« on: October 24, 2011, 06:50:38 pm »
Hi Bastien

A question about debugging. As we know, SFML can be compiled as Release or Debug, and for development process it is advisable to use the Debug libraries (I don't know why exactly, I guess more debug info is being produced during runtime).

Should we use the Debug libraries in PySFML too? Will it work? Is there any reason why we should/should not use them? Is compiling the bindings for Debug libraries as simple as removing the "-d" suffix from SFML lib filenames? Are you planning to include Debug libs in the binding so that there are two output files: sf.pyd and sfd.pyd?

General / How do I bring an SFML game out on the Internet?
« on: October 22, 2011, 03:44:39 pm »
Should I mention I find it awful to port everything into a web browser? The web browser is becoming more and more a substitute for operating system. It's nice to have gmail, maps and spreadsheets available on the web, but for some tasks a standalone application is just irreplaceable. I think it's pretty viable to make a single-file SFML game that would work without installing and would download necessary textures from the web.

General / How do I bring an SFML game out on the Internet?
« on: October 22, 2011, 01:58:45 pm »
Wait, you can't make a multiplayer game with PySFML? I'm almost sure ingwik means multiplayer, not a browser game.

There are two types of multiplayer servers. One is a server that is built in the game and very often the multiplayer is peer-to-peer. The second type is a dedicated server, where the server is a different app that receives/sends data between players and does all the physics calculations. the client-side games are then just GUI frontends to interact with the server.

General / SFML Complete Game Tutorial
« on: October 22, 2011, 01:48:23 pm »
Waiting for part 7, Serapth...  :wink:

Python / pysfml2-cython
« on: October 19, 2011, 08:46:57 pm »
Quote from: "bastien"
That's strange. Last try: did you also copy the DLLs that are in SFML/extlibs? (I don't see a “DLL loaded failed” message when importing a non-existing module, so my guess is that a dependency can't be loaded.)

OMG it worked  :shock:

The pong example runs now. Also, when I type "import sf" with extlibs in the folder, it does not return error. This was one hell of a job to make this binding work. I guess it would be much easier with VC2008 or MinGW. But still, some binaries would be really appreciated and save quite some time, instead of compiling it all.

Thanks for help and feedback.

Python / pysfml2-cython
« on: October 19, 2011, 06:14:46 pm »
Quote from: "bastien"
You're right, it's .pyd on Windows apparently. What happens if you open a command prompt, go to the path where sf.pyd is, type “python”, and then type “import sf” interactively?

calling "python" in cmd does not work for me, I had to enter full path:

Code: [Select]

Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: Nie mo┐na odnalečŠ okreťlonego modu│u.

Last line says: Can't find specified module

Python / pysfml2-cython
« on: October 18, 2011, 09:00:00 pm »
Quote from: "bastien"

sf.dll needs to be in the Python path. The simplest way is to put it the current directory just before you execute the program. Or you can modify the PYTHONPATH environment variable.

Or you can run python setup.py install, and it should be available for all the programs. But I would do this only after testing the binding.

sf.dll? I only got sf.pyd as a result of my compilation. I put standard c++ libraries as well as the sf.pyd in the same folder as pong.py. The compiler still can't find the sf module... :(

Pages: 1 2 [3] 4 5 ... 7