As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'd like to experiment with Haskell a bit, and I'm hoping to write a small 2D arcade game (Tetris or Breakout).
Can you recommend a simple graphics library that will help me to get started quickly?
Btw, I've been experimenting with SDL and wxWidgets, but haven't yet succeeded in running any samples because of dependency problems, working on it...
It's not exactly a "simple" library, but there is a lot of information online about OpenGL and GLUT, as well as some very good tutorials and a ton of example code.
The biggest issue you're up against is that the OpenGL and GLUT bindings in Haskell do not include the libraries that they bind to. (This is true for wxWidgets as well.) A lot of Linux distros come with OpenGL binaries bundled, but not Windows. The Haskell Platform was supposed to fix this, but it didn't seem to for me.
So, assuming you're installing on Windows, here's what I'd recommend you try:
Follow the directions in this blog to the letter. They're complicated -- involving installs of MinGW, MSys, and hand-compilation of a GLUT project from SourceForge, but it's the only way I've gotten OpenGL to work. I've now successfully installed on three separate machines, including XP and Vista, so I can safely say that these are very good directions.
Once it does work, check out these two awesome tutorials. They really opened my eyes about just how powerful Haskell can be when it comes to graphics. You'll find the code involved a lot simpler than you may have anticipated.
Check out the sample games on the Haskell OpenGL page. They're very experimental -- which is good, as it means less code to wade through than you'll find in a production system -- but they're also surprisingly sophisticated. (And yes, there's already more than one bare-bones Tetris implementation, but don't let that stop you.)
Another good source of sample code is Haskell's GLUT binding itself. Look for the examples directory and you'll find many ports of sample code from the OpenGL Red Book.
OpenGL is very stateful, so you may find the Haskell code a little daunting if you haven't fully grokked Monads yet. I'm using my OpenGL experiments as motivation to finally wrap my mind around the concept.
Good luck!
Have you perused the following lists:
Haskell Graphics Libraries:
There appears to be quite a few interfaces to OpenGL, SDL, and other graphic libs here.
Haskell GUI:
There's some wxWidget libs here as well.
Cairo Is written in C but has haskell bindings, Perhaps trying that might be a good idea. Ive only ever used its python bindings but those seemed to work well.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm learning Haskell for great good.
I'm pretty into OOP and the various type systems. I used Java to develop webapps (Java EE, spring, Hibernate, struts 1.x), now I'm using regularly Python (pylons, django, sqlalchemy, pymongo) and Javascript. I had a huge improvement in my personal productivity: the lightweight approach, duck typing, awesome iterators, functions as first class citizens, simple syntax and configuration, fast tools like pip and distribute (and much more) helped me a lot.
But the first reason of my productivity boost is the Python language itself.
What are the main benefits of using Haskell for web developing?
For example, how its type inference can really improve my web app? So far, I noticed that when you decorate your function with its type-signature you are adding a lot of semantics to your program. I expect all this effort to come back in some way, to save many lines of code and to make them sound. I really like the sharp distinction between types and data, I'm starting to understand how they works, but I want something back :P
Don't get me wrong, I've just started studying Haskell so Maybe I'm missing some awesomness but I really want to understand its paradigm and when it's worth using it.
Most web applications aim to be stateless and handle concurrency well. Its also rather important to scale (Google SEO reasons, and user experience).
Haskell handles these problems rather well (although IMHO in more academic and perhaps less "human" intuitive way).
That being said due to the sheer lack of people doing web app dev (compared to say node.js) and that traditional web app dev has been more focused in a OOP mind frame it might be rather difficult.
I had some issues trying to use it as you can see in my questions below:
How do I do automatic data serialization of data objects?
Handling incremental Data Modeling Changes in Functional Programming
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I want to use Haskell in production. It has a lot of libraties but not all of them are stable, ready-to-use and well-developed. Some libraries with interesting conceptions have experimental status. Many libraries are still in minor versions (0.0.1 for example). Some of them just abandoned. Hackage too huge to monitor them, so I need a brief slice of the current libraries state, their prospects and suitability for use.
I understand that question is very broad, but this information will be useful to anyone in any way. Here we can gather information bit by bit and then use it for an informative paper.
So what libraries I can use for:
Fast arrays capable of handling millions of items
Fast and powerful maps (probably, Data.Map?)
Fast, generic and convenient trees
Queues, hashtables
Regular expressions
Finite state machines
Neural networks, genetic algorithms
Mathematical calculations
Physics (wich can be used in game developing)
GUI
Image processing (we have various image formats actually)
Working with databases (maybe ORM or some DSLs to generate SQL)
Functional reactive programming
OpenGL bindings (yes, HOpenGL is good), OpenAL and OpenCL bindings
Parsing (Parsec is great I think)
Multithread and parallel programming
Network
Multipurpose game engines
Something else?
What is also interesting to have the tools for:
Testing (QuickCheck)
Logging (Maybe hslogger)
Profiling
Debugging
Here the links to the similar topics:
What are the best Haskell libraries to operationalize a program?
Regex & String Libraries in Haskell
Libraries for strict data structures in Haskell
Memory efficient strings in Haskell
Which Haskell library for computer graphics geometry?
Which Haskell XML library to use?
Other links
Applications and libraries (list and brief description)
Regular expressions
Haskell libraries you should use
There are a hell of a lot of Haskell libraries now. What are we going to do about it?
Popular Haskell Packages: Q2 2010 report
Thank you.
I'll leave this as a community wiki - others people please feel free to add items or commentary in a reasonably concise manner.
Fast arrays capable of handling millions of items: Repa, Vector.
Fast and powerful maps: containers and unordered-containers.
Fast, generic and convenient trees:
Queues, hashtables: See the hashtables package for the latest and greatest.
Regular expressions: regex-pcre, regex-tdfa
Finite state machines: fsmActions - but it has version 0.4.3 alpha; fst - but not exactly a FSM. In some cases FRP will be useful instead of true FSM.
Neural networks, genetic algorithms: HNN is well established. As far as GA, we really have a framework (GA) and something that looks more complete (hgalib), but I haven't inspected it closely.
Mathematical calculations: hmatrix
Physics: dimensional.
GUI: GTK works well. I get the sense that wxhaskell generates more questions per-capita, but that's an informal impression.
Image processing: Parsing? Juicy-Pixels and JuicyPixels-Repa.
No, Image processing! The CV, Friday, yarr
Working with databases: Consider using the persistent-* wrappers, but also look at HDBC. PostgreSQL is stable. For Cassandra there are several but consider cql.
Functional reactive programming: Reactive-banana, netwire
OpenGL bindings: OpenGL, GL.
Parsing: Parsec, attoparsec, polyparse, frisby.
Multithread and parallel programming - See the parallel package and Control.Concurrency. monad-par is relatively new but frequently easier to reason about than the basic parallel library. See also async for concurrent IO.
Network - Depends. Network with blaze-builder, cereal, or binary. Also consider network-{conduit, enumerator, pipes}. There are several client/server wrappers out there as well.
Multipurpose game engines: For learning? gloss. Otherwise you probably need to roll your own but make use of OpenGL, GLUT, GTK, FRP, ogre bindings, SDL, and perhaps FunGEn if it's back on track.
Configuration management: configurator, config-ini.
XML Process: HaXml, HXT, xml-conduit - good, stable and powerful libraries.
Tools:
Testing - QuickCheck, LazySmallCheck, Test-Framework, hspec, HUnit
Logging - Yep, hslogger or dlist with the writer monad if that's all you need.
Profiling - hpc, thread scope, criterion, GHC time and space profiling utilities.
Debugging - GHCi debugging, unsafe (trace) debugging, making better property tests.
Related Questions:
Haskell library for 2D drawing
Filling the enclosed areas with random colors - Haskell - Friday
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'd just like to ask if there are other alternatives for REALStudio or Runtime Revolution?
I'm not looking for something like a .NET framework or a plugin. I want it to be fully self-contained like the aforementioned IDEs.
It should also be cross-platform.
NOTE:
Please don't mention Java. I already know of it.
Just to be clear, I'm looking for a programming environment that would let me create a desktop application for Windows, Mac OS X and Linux...
I still feel like I'm shooting in the dark by answering this question. It's unclear if you're looking for a programming language and GUI toolkit, or if you just want an IDE that is cross-platform. It's also unclear why you are abandoning REAL Studio, since it seems to meet your requirements.
Anyway, there are really a lot of options here, especially if you don't need one that uses the REALbasic language. I can only talk about the ones I am familiar with and have experience in using. Others can surely tell you more about dynamic languages like Perl, Python, Ruby, etc. etc.
First off, I'm not sure why you think that the .NET Framework is not "fully self-contained". Yes, it requires a runtime, much like Java does. But those two managed languages have gotten quite a bad rap for requiring a runtime. It seems people have forgotten that programs compiled in C and C++ can often require a runtime as well (at least they do on Windows).
I would take a second look at .NET. It is an extremely easy-to-use, rapid development environment, much in the style of REALbasic. VB.NET retains a lot of the syntax, while bringing you (in my opinion) even more powerful features. Since almost all desktop applications should be distributed with an installer (setup program), the requirement of a runtime is really a non-issue. Your installer should install the necessary dependencies at the same time as your application—the user will never be the wiser.
Of course, producing a desktop application with a user interface that is truly native across all three of your target platforms is going to be difficult at best. Windows, Mac OS X, and Linux all have vastly different platform conventions, and even though you can find environments that will let you generate an executable that runs on all those platforms, none of them are going to produce interfaces that actually look like a native application. I'm extremely picky about this, and you'll find that Mac users are, too. Windows and Linux users are much more accepting, but following standard platform conventions is the key to making your app easy to use and easy to understand. Conforming to the behavior the user expects and taking advantage of native widgets has a lot of advantage that developers (often prone to reinvent the wheel) seem to be forgetting recently.
The absolute best thing to do (in my opinion) is to write your code in a portable language like C++, and create the user interface using tools provided for each platform (For Windows, you might use the Windows API, or WinForms or WPF provided by the .NET Framework. For Mac OS X, you'll use Cocoa and Apple's Xcode/Interface Builder. For Linux, you'll do whatever it is Linux people do.) Then, you just have to recompile your application on each platform, and you get the best of both worlds.
A good compromise would be to use a GUI toolkit for C++ like Qt or wxWidgets that promises to generate cross-platform applications. Yes, the apps themselves are truly cross-platform, but they don't always have truly native interfaces. I understand that Qt has gotten better recently, but it's still not up to my standards. You and your users might be less picky. Note the "your users" part there. The Mac Office team discovered that Mac OS X users just wouldn't accept the ribbon as it was implemented in Windows. Mac Office 11 finally brings the ribbon to the Mac, but it looks completely different, having been entirely reimplemented to look like a native Mac OS X widget. By contrast, Apple's iTunes sticks out like a sore thumb on Windows. What's long been the standard for an innovative, easy-to-use interface on the Mac is regarded by many PC users as an abomination. But then again, native GUI is sort of my soapbox, so if you care, I recommend perusing my answers to other, similar questions:
Advice for supporting both Mac and Windows Desktops
What is the best library to use when writing GUI applications in C++?
If you goal is to have a self contained IDE with an easy to use GUI builder, that can produce standalone cross platform executables, then to the best of my knowledge, the options are pretty limited.
If you like BASIC (similar to RealBasic or RunRev), then you may want to look at www.PureBasic.com . Documentation and new material is sparse, IMHO. It has it’s own GUI builder, but for a bit more cash, you may want to pair it with PureVision.
For cross platform development using wxWidgets programming in C++, wxPython, wxLua or wxRuby, you may want to consider DialogBlocks.
The answers given here are terrible of course, but the question you are asking is a difficult one and there may not be an answer. I'm asking myself the same question as REALStudio doesn't work as well as I would like. Java is poor, difficult and ugly. .NET is the favourite but not cross platform.
Consider that appearance is a major problem. If the GUI doesn't look native, there's no reason why you can't design something superior (look at MojoWorld for example). I would tentatively suggest REBOL. Although it appears to be an interpreter a compiler could be purchased. As the software is free, if your program works reasonably well you might then buy the compiler. Not sure if it has an interface builder as the buttons are generated by code. The free version is moderately poor but has been improving in recent years.
Not being able to update the interface from a thread (Cocoa for example, I guess NextStep is really old now) seems to defeat the whole object of the exercise. Having Timers that don't run (REALStudio) also seems hopeless given that those are supposed to update the interface instead. Then you have Object-Orientation, an excuse for poor programmers unable to understand code. Not being able to 'GOTO' a button unless you put the code into a Timer pretending that it's a module (yey for for REALStudio). I can understand your problems. Try to realise that programming is HARD and that it only looks easy when you see the end results produced by experts like Apple.
So Java is proof that cross platform doesn't work. Give REBOL a try.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Coding a new 3D engine is fascinating but I there are so many out there. Is it sane for a programmer to start a new one? Are there industry sections in need?
Reasons to do it:
You want to learn about how to make a 3D engine, and don't really care if anyone but yourself uses it.
None of the existing engines do what you want and it's too much trouble to modify their source code (if you can even get it).
You have such an awesome idea and no other engine has done it so you need to do it because whatever you're doing doesn't exist yet.
Reasons not to do it:
You don't have enough of these resources: time/budget/expertise.
An existing engine fits your needs perfectly.
There are lots of reasons to build a new 3D engine (in no particular order):
The old one is a first person shooter, but you want a flight simulator.
The old one works, but isn't easy to use or has too many bugs
Someone else owns the old one
New hardware feature XYZ is fundamentally incompatible with the old engine
Someone is paying you to build one
You've never built one before.
Your game (simulation) only needs χ, but the old engine provides χ, ψ, ζ, α, β, γ, δ, and even π.
I happen to be building an OpenGL-based 3D engine in my off time right now. By implementing it myself, I'm expanding my basic knowledge of OpenGL way more than I would have by programming to someone else's interface (way more than I did when I implemented my own software affine texture mapped engine years ago). The downside is that I may never finish it :)
Generally, you code one if you have a need for one and there doesn't already exist one that suits your need.
Is there someone out there who needs an engine built for them because there doesn't exist one that suits their needs? Probably.
This is highly similar to the question should I write my own program/technology/framework X instead of using an existing one?" and that has been asked plenty, so I won't go over the usual boilerplate reasons.
While the answer to this question will always be somewhat subjective, a great deal depends on the context in which it is asked.
If it's being asked along the lines of I want to learn about game engines and rendering then it always can be beneficial to write your own game engine as developing the code is arguably the best way to learn. However, there may already exist good open sourced well documented engines to learn from as well.
If it's a commercial endeavor, then it's more of an issue of whether or not an existing engine provides what is needed. Modern commercial engines are written by some truly brilliant people and contain all the latest bells and whistles so it's more than likely they would suffice. This is evident by the sheer number of games that have been developed on two of the most popular game engines: idTech and Unreal engine. However, there still may be no tech related prohibiting factors to using an existing engine where writing your own is better. Such as if it can afford to be done, whether the engine can be licensed adequately, and, if the license can be afforded.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
What are some toolkits for developing 2D games in Python? An option that I have heard of is Pygame, but is there anything that has more range to do more things? What are the good and bad parts about the modules?
I use pygame myself and it is very good. It has good documentation and tutorials, and is quite well designed. I've also heard wonderful reviews of pyglet.
I have used and would highly recommend pyglet, which provides 2D sprite graphics, hooks into OpenGL effects, audio support, file asset management, and excellent text layout and display support (not something you always find in a 2D game library). The API is sane, well-documented, and easy to get started with, and goes deep (especially if you're an OpenGL wizard).
As a companion to pyglet, I have used and would also suggest Cocos2D, which adds scene management, improved sprites, tiled map support, and fancy (accelerated) effects to add a little polish. Cocos is still young, but taking shape quickly, and already has fairly solid documentation.
A blog post covering several of the alternatives, including PyGame, PyCap, SpriteCraft, and ika. I have also seen pyglet mentioned.
You may also want to look at Panda, which is a very easy to use 3D engine with Python bindings. It is used for rapid prototyping at Carnegie Mellon's ETC.
I think pygame is the standard for game development in Python, I don't know of any others. A book you may be interested in is Game Programming with Python, Lua, and Ruby. Not only does it cover Python (and, I believe, the pygame module), but it also gives you exposure to Lua and Ruby. It's also available on books24x7 if you have a subscription there.
Another option is pycap which is a wrapper for the popcap framework with Python.
If you're already familiar with using OpenGL in another language (probably C or C++) then PyOpenGL is awesome. I was surprised as to how easy it was to switch from OpenGL/C to OpenGL/Python. The performance isn't half bad either.
I've heard good things about PyGame and Pyglet though I must admit I haven't really done much messing around with either one.
I've only heard people talk about pygame. It has tons of followers & plenty of functionality.
Recently I saw this book at barnes & noble which I might check out one day. It looked good.