Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Running an SFML Game on other computers  (Read 4906 times)

0 Members and 1 Guest are viewing this topic.

Clockwork

  • Newbie
  • *
  • Posts: 47
    • View Profile
Running an SFML Game on other computers
« on: April 09, 2014, 02:46:00 am »
Hi everybody!

So I recently finished working on a little game just for learning and all that, and I want to run it on other computers and I remember doing it a long time ago, but it wasn't the best way, since I just copied the .dll files straight into the folder with the .exe.  How should I go about running my game on other computers?

Thanks!  ;D

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Running an SFML Game on other computers
« Reply #1 on: April 09, 2014, 07:52:56 am »
I believe that's exactly what you're supposed to do with .dlls.  What's wrong with it?

MadMartin

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
Re: Running an SFML Game on other computers
« Reply #2 on: April 09, 2014, 08:39:55 am »
That's the way it works. Look at other games. Even the AAA-titles do it the same way.

The alternative is to install it to a central place like c:\windows\system32 | c:\windows\syswow64, where most of the other dlls are placed (e.g. the MSVC++ redistributable dlls like msvcp120.dll, msvcrt.dll, ...).
But that is also one of the central problems with dlls: These places should be reserved for vital system dlls and not some other files the user places there just arbitrary.
Under unixoid systems there is the nice separation of /usr/lib and /usr/local/lib that shows the difference.

So, go with it, just place them besides your files. For the MSVC++ redistributables, just include the appropriate installer with your game (and never include the *_d.dll files, as they are debug files and Microsoft doesn't allow them to be redistributed).

Clockwork

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: Running an SFML Game on other computers
« Reply #3 on: April 09, 2014, 03:00:52 pm »
Oh ok thanks!

Could you remind me which dlls I need?

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Running an SFML Game on other computers
« Reply #4 on: April 09, 2014, 03:36:13 pm »
Could you remind me which dlls I need?

The information about what dynamic libraries your executable needs is, of course, available in the executable itself (otherwise the dynamic linker/OS wouldn't know what to load at runtime).
On Linux you'd use the 'ldd' tool to get at that info. On Windows there is 'Dependency Walker'.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Running an SFML Game on other computers
« Reply #5 on: April 09, 2014, 03:52:35 pm »
Well if you copy all the dlls Dependency Walker lists, you're doing it wrong. :P

For SFML you'll just need to copy the ones that are needed, e.g. if you've used something from the graphics module, you automatically using the window and system modules, thus you'd have to provide sfml-system(-d).dll, sfml-window(-d).dll and sfml-graphics(-d).dll. If you also use the network module, you'll have to provide that dll as well. The audio module is a bit special, since you'll also have to provide the openal32 and the libsndfile DLLs. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Running an SFML Game on other computers
« Reply #6 on: April 09, 2014, 03:59:16 pm »
Also depending on the compiler you may want to include the runtime dlls.  ;)
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Running an SFML Game on other computers
« Reply #7 on: April 09, 2014, 04:00:53 pm »
Well if you copy all the dlls Dependency Walker lists, you're doing it wrong. :P

Of course you shouldn't just blindly copy all those dll's. But if you create your MSI installation package with your own files and the obvious SFML dll's that you use. Then after installing your MSI and the Visual Studio redistributables (if you build with VS), then Dependency Walker should be able to find everything when run against your newly installed application - if not, you are missing something.