Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 24 Nov 2006
Offline Last Active Jul 13 2016 02:56 AM

#5277866 Getting error when receiving with SDLNet

Posted by on 24 February 2016 - 05:39 AM

This is the reason I like using std::vector and it's data() accessor. Priceless when you have to work with Win32.

#5261483 Generic Installer - Cross Platform

Posted by on 11 November 2015 - 01:38 AM

I do not think such a thing is possible.




Operating systems are different and they handle software installation in a different fashion. Next-next installers are a very Windows thing. Other OS-es handle adding software quite differently. Do not belive that there is a magic pill that will help you distribute your software in a uniform way (well, apart from Steam maybe). At the very least, users of different OS-es *expect* that adding software will be done differently.


The details:


On Windows:

  • the classic is to use Windows Installer (a.k.a. .msi)
    • many companies use WIX, an abstraction over WI. It is free, and also open source, if you care about that.
    • some use InstallShield
  • many use the Nullsoft installer (NSIS) - also free and open source
  • you can write your own from scratch, it is relatively easy (if you have even modest Win32 experience). Time consuming if you haven't written an installer before.

On Linux dstributions - there is no such a thing as universal installer :) They all go out of their way to make it difficult to provide binary packages that can survive more than a few releases/years, let alone compatible across distributions. There are alternatives to WI, such as .deb and .rpm, but I would recommend against going that route if you depend on other packages being installed, as packages get split or renamed over the years. Most software that works even after decades is to basically statically link against everything and do not depend on OS filesystem layout besides ~ and your installation directory. Also, limit your use of OS libraries to the bare minimum - prefer building all dependencies on your own and bundle them with your app (as you would on Windows). Plan to include a shell script that will force the loader to use your libraries instead of the system libraries (as they will be built with a different compiler version, etc).


If you want graphical installer for Linux - there used to be the Loki installer, but I'd recommend to try Steam and link to their libraries. It will be easier for both you and your users.


I've never owned a Mac, so I can't say anything about that.

#5234407 C# becoming obsolete ?

Posted by on 12 June 2015 - 01:38 AM

It really depends on what you want to do.


For game development, C# + WinForms is the easiest way to integrate with native code (if you're writing an editor or just need a lot of P/Invoke).


For business applications, C# + WinForms isn't dead either. Visual Studio's WinForms designer makes it easy to very quickly write small utility applications, which is ofthen what IT departments would do, especially for state institutions.


WPF can achieve impressive visuals, but suffers from internal Microsoft power struggels (the guys that do tools vs the guys that do the OS). If it is updated to more easily support newer DX withouth the Windows Runtime, I guess it will be used even more.


All the flashy news are for web technologies, and Microsoft try to follow with ASP.NET MVC. Last time I wrote a site with MVC, I was impressed with how easy it was. You get ORM + template engine + great debugging experience. Recentely, they've been going to the world of "stuff happeing automagically if you follow The Convention". Whether or not you like that is a matter of preference. In my opinion, their web stack is a good piece of technology, and it has its following.


ASP.NET WebForms is dated technology.  People hate on it too much, IMO. Still, a few years ago it was VERY popular, and lots and lots of sites were written using it. Which means they'll have to be supported. Also, some .NET CMS-es were based on WebForms. I guess they've isolated those parts over the years, but that means even more sites depend on WebForms. Again, my own opinion is that this is not a very good implementation, but the idea of reusable components is a good one.


When it comes to databases... I haven't done that in years. What most people around me use these days are either ORMs that are related to the framework/language of their choice, or a very small population of very vocal hipsters that use alternative storages, like MongoDB. IMHO most sites can do with SQLite, but many people want to engineer big and complicated setups for sites with less than a thousand visitors a month.  My advice would be: get familiar with basic SQL syntax. You don't need to be a wizard or anything, but if you use an ORM, you will have to go down to SQL when debugging. Also, regardless of what database engine you use, the basic SQL is mostly the same. When you are at it, take some time to look at MongoDB - it is the most popular alternative storage in my dev circle.


In summary: .NET ain't dead yet. If you work with .NET, you'll be most likely doing business apps/sites or supporting such. This is not bad, as it is usually a very stress-free job that pays well.


If you want to do web, forget two years of studying. Start writing simple sites ASAP and learn on the go. Blog would do - the ability to write blog posts & comments in a site is a nice test to see if you can handle security (logging in, setting up https), storage (can go with simple files, any SQL engine, or the new document storages), templates and client-side programming. When you do a veeeery simple blog post, do one-pager site (e.g. https://onepagelove.com/) and make it mobile-friendly with responsive design. If you pull these off, you're ready for 99% of web development jobs. Plus, you've immediately hireable, as you have something to show for your words.

#5205653 Porting my game to Linux

Posted by on 20 January 2015 - 05:59 PM

I watched this a while ago and find it useful:


It explains what Valve recommends. Mostly, SDL2 libraries handle most of the OS/DirectX stuff, and OpenGL replaces Direct3D. Also, one advise I've found on my own: if your game is not too complex, you can do almost all the work on Windows. Booting to a Linux distro just to make sure it compiles and runs properly has been my strategy so far for small personal projects.

#5193401 Programming a website?

Posted by on 18 November 2014 - 03:42 AM

The classical resource for learning web technologies is w3schools (http://www.w3schools.com/). Start with the html5 and css3 tracks, then do the javascript track, as advised by alexw.


Then, you will need to learn frameworks that will make your life *a lot* easier. A must-know is twitter bootstrap (http://getbootstrap.com/). It basically eliminates the need to write your own css (but you still have to know how it works in order to tweak small things).


For simple sites, that's all you are going to need. If you need a little bit more complicated stuff, get familiar with XMLHttpRequest (https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest - mozilla's site is another great resource for web-related technologies) - this is the backbone of the modern web (in tandem with responsive design, which bootstrap will mostly handle for you). Then you may want to get familiar with jQuery/jQueryUI - do not learn it, just browse the demoes to know what is possible. The popular kid on the block these days for javascript is called anglular js (https://angularjs.org/), so you might want to learn that if you need more complicated web site (99% of people don't, although they they it might be kewl to sprinkle some useless crap to slow down their web site on slower smartphones, which are still prevalent). Still, it doesn't hurt to know what is possible with Angular.


This, mind you, is all on the client - defines the look&feel of your web site. The backend, however, is a different beast. ASP.NET MVC is a good start, since Microsoft have a ton of tutorials and it is easy to get started. If you don't like it, there's Django (if you are familiar with Python), Rails (if you prefer Ruby), CakePHP (if you are familiar with PHP), and.. I'm not a Java person, but I've heard of Spring. Pick the one whose programming language you are most familiar with and you'll find a lot of tutorials online.


Remember, you don't need complicated and fancy stuff just because everybody else is doing it.


Firebug is your best buddy for client web development :)


Now, these are more more complicated advices, so you might want to ignore them at first. Make your site work fast, make it work beautifully on smartphones/tablets via responsive design and don't overuse javascript. Web sites are fast if you do stuff with CSS, not Javascript, and also if you don't use AJAX for everything (if at all). Learn about bundling and minifying javascript/css, learn to use spritesheets with CSS for your images (if you are curious, look at the images in facebook). The goal, just like game programming, is to reduce the number of requests the browser makes to the server for files. The less files the browser has to download, the better. If something is static, put it in CDN. If parts of your site are static, cache them (different serves use different technologies to achieve this).

#5191671 Can't load .wav files with SDL

Posted by on 07 November 2014 - 08:51 AM

How do you run the project?

If it is ran from Visual Studio with (CTRL+) F5, then the working directory is the directory that contains the project file.


In any case, SDL requires you to have int main(int, char** argv), so what is the value of argv[0] when you run your program?



And the obvious question: do youhave a file called "PlayerShot" (no extension) in that directory?

#5191500 XML vs Database

Posted by on 06 November 2014 - 05:45 AM

For storage, you can always use google protocol buffers.

SQLite, on the other hand, has the benefit of storing all your data in one file (zip can do that, too). However, unlike zip, SQLite allows you to patch (that is, add, delete and/or  modify items without rebuilding the entire file) that file in a relatively straightforward way. Contrary to what others have said, SQLite is an example of one of the embedded database engines. It is fast enough - you are not going to load from disk all the time, anyway.


I personally dislike XML and JSON, but they are fine if you are OK with the clumsy syntax. XML was never meant for humans to write (it was always meant for tools - with the benefit that humans can read it); since protobufs support both text and binary, I see no sense to write the code yourself. While JSON is terser, it still requires you to manually map the parsed tree to code.

#5190323 Why don't you use GCC on windows?

Posted by on 31 October 2014 - 04:12 AM

GCC doesn't support the Microsoft-specific extensions to the C++ language, runtime, linker and libraries which are needed for some of the Windows-specific technologies.


Clang is currently trying to be a drop-in replacement for C++ by implementing the compiler-specific behavior of cl.exe, but they are not there yet.


GCC used to be able to run some DX (8,9) code , but I don't know if they will ever support WinRT.


It generally makes sense to integrate as best as possible with the platform(s) you target, and to do that, you must use its native APIs. If they don't work with GCC, it makes no sense whatsoever to use GCC on Windows. Plus, Xbox One also uses a version of cl.exe, so this is additional incentive to invest in VS instead of GCC.



About clang on Mac: for the similar reasons. Apple are pushing for clang, because it was built from the ground up to support IDE features. From what I understand, GCC wasn't very friendly to commercial IDEs by saying that if you want feature X, you have to open source your IDE (no static linking, no plugin system, everything is part of GCC). LLVM and company use much more liberal license, and clang was designed to be a drop-in replacement for gcc - it uses the same flags, it can use glibc, etc.


Since the tooling for Mac (XCode) depends on and uses clang, it makes no sense for most developers to use something else. If clang was the default on Linux distributions, you would use clang, not GCC.

#5188253 Switching IDE, having issue with "code completion"?

Posted by on 21 October 2014 - 12:15 AM

The MSDN documentation clearly states whether a C function or C++ functionality is Microsoft-specific or not. Different versions of the compiler support different parts of the c++11 and the upcoming c++14 standards.


You can easily use Visual Studio to work on a cross-platform project. You'd use CMake/premake4 for project generation, but unless you want platform-specific code, everything can be written in Visual Studio. It has better tooling than anything any other IDE I've tried can offer anything even close. Also, the Visual Studio's debugger is very, very good. For cross-platform projects, the most annoying thing for me is not related to the compiler, but that Windows implements Unicode via UTF-16 rather than UTF-8. The reason for that, like is the case most of the time with Microsoft products, is that they implemented Unicode support in NT when it was believed that 16 bits are enough to represent all people will ever need. Since Java was first implemented around that time, it is also one of the few tech stacks that do implement Unicode via UTF-16, as well.


The other two prominent C/C++ compilers - GCC and LLVM/Clang - also have non-standard extensions. Just look up POSIX, the libc is full of it. The fact that your Linux build compiles just fine with MinGW is only because the compiler is the same, not because it is more "pure" C or C++.


If you are one of the people that just doesn't like Microsoft, I would really recommend QtCreator and Eclipse CDT. Both work very well, and it is a matter of taste whether or not you like Eclipse. From what I understand, CodeLite uses clang for code completion, which means it must work very well and support C++11 (if using a recent version).  In case you actually do work on Linux, you can try KDevelop as well.


Generally, if you don't use Visual Studio, I advice you to use an IDE that integrates with clang. XCode uses it, QtCreator may use clang (wip/clang), KDevelop (5) is switching to it, there is a plugin (llvm4eclipsecdt) for Eclipse that uses it, CodeLite can use it. Clang was built from the ground up to support IDEs - with code completion, syntax coloring and refactoring. What is best, this is part of the compiler, so it understands the code very well and automatically supports new language features.

#5181559 .net framework text generator

Posted by on 19 September 2014 - 10:11 AM

Well, this is a game developer forum, but fine. I'm at work now, so this is a hackish solution, but it should work.


Please note that printing in Windows is complicated, so you'd better leave the job to some other control/tool.


The quickest and easiest way to print in Windows (generally) is to create a text file, then launch Notepad and tell it to print the file. This is not a perfect solution, but since you ask the question, I guess you need a quick solution.

  • Console.ReadLine() can read text from the console
  • File.WriteAllText() will write any string to a file
  • Process.Start() will launch an external program

To start Notepad in "printing" mode, you just do Process.Start(string.Format("notepad /p {0}", filename)), where filename is a variable that holds the file name.


In order to print text via API in Windows, you usually use a printing DC. You'll usually use a WinForms app to do that, as WinForms has nice wrappers for Win32. Here is a quick example on how to do that:


#5154409 how to find specefic platforms sdk like p34 and xone?

Posted by on 18 May 2014 - 07:10 AM

This is a completely different topic. In my opinion, it is much easier to program for a console (except for the publishing part). You write it on your console and then it runs the same on all other consoles, for all your customers. So long as you don't depend on the Internet connection speed, of course. And with libraries like the DirectX Toolkit (https://directxtk.codeplex.com/), you can write almost as if you were using XNA.


With PCs, it is HELL on Earth. DirectX, OpengGL, different operating systems, different drivers, different installed programs, different versions of .NET and the C++ runtime... You can't even depend on good old Internet Explorer and Windows Media Player being installed anymore for EU PCs. And you have to test it like crazy, and then you *know* it's going to crash and be totally unplayable for some users because of some stupid combo you didn't think possible. And don't get me started on pirated Windows XPs that never got updated.


In this sense, I like what Steam are doing with SteamOS and their bare-bones Linux libraries & compiler.

#5154097 how to find specefic platforms sdk like p34 and xone?

Posted by on 16 May 2014 - 01:32 PM

AFAIK Microsoft does *plan* to make retail units as dev kits, but you still need dev kits.


We still haven't got through the whole process for Xbox One, but I can confirm that dev kits cost *much* less for indie developers than what Hodgman said. As a start-up, we can definitely afford it without any financial strain. Once you get approved, you will know more about the fees.


Just have in mind that the documentation is not what it could be for indie developers, so you have to maintain more active contact with Microsoft in order to know more and have more up-to-date information.


Also, we are all playing on the edge as to what we can and cannot say, as almost all that wasn't said the last BUILD is still covered by NDAs.

#5153976 how to find specefic platforms sdk like p34 and xone?

Posted by on 16 May 2014 - 05:30 AM

Just to clarify, for some of the consoles, as an indie developer you pay only for the dev kits, not membership. Which makes sense. Also note that some countries are not officially supported. Also, almost everything is covered in NDAs. This is why you can't get more answers, but actually getting an indie account for some of the consoles is easy, it just takes time and persistence.

In case you haven't come across the term yet, 'dev kit' means a console you can develop for.


I was going to say more, but @jbadams wrote his post before I got the chance to finish mine :)

#5152262 What is a good 2D game engine?

Posted by on 08 May 2014 - 03:51 AM

While I agree with Servant of the Lord, I would also share some experience.


Writing games that run on variety of computers is a pain in the ass. Unless you use GDI (and probably even then), you are going to be introduced into the Graphic Drivers Hell. I've used mostly Direct2D (and now Direct3D), and it is less than pleasant, because all the bugs DO NOT happen on your computer. So you are running around  the office telling colleagues "does this crash on your PC?", and then staring at the code and analyzing what could possibly go wrong with some other computer configuration. If you go down that route, make sure you've got damn good logging system (and that you log a lot because you might have to "debug" on a PC without VS).

You also mentioned C#. While I love .NET and C#, writing games in pure C# is a challenge - unless you use WinForms' GDI+ mapping or WPF (make sure you use at least ver 4, or you'll get familiar with NotifyPartitionZombie and other goodies), you'll have to interface with the OS in some way. And interfacing with DX creates a whole lot of problems. While projects like SharpDX make your life a lot easier, there are some inconsistencies, some things are more difficult in C# or require you to use unsafe code, or are plain buggy. Thankfully, SharpDX devs are awesome and fix things almost immediately, but there are surely problems awaiting in less used code paths.

Game engines like Unity, although tailored for people with completely different mindset than mine, handle all the unpleasant shit for you. With one awesome feature - with a few clicks you can build a Windows Phone, Android or iOS game. 

#5142602 SDL2, mingw64, and Code::Blocks

Posted by on 27 March 2014 - 09:30 AM

@dilyan, I think what you're saying is /manifestdependency and /DEFAULTLIB are options, and you're suggesting the fix is to remove those options (instead of trying to find alternatives)?


They are options (or command-line flags, arguments, parameters, whatever). Some of them I recognize as linker options. For some reason, you've got them passed down to your MinGW linker, and it complains that they are unfamiliar to it.

I do not recommend that you go back to Code::Blocks. This was intended as an answer to your original question, in case you were still curious.