Difference between revisions of "Output libraries"

From RogueBasin
Jump to navigation Jump to search
(write article about output libraries)
 
 
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
It can be difficult to decide which output library to use when creating a Roguelike. There are many different ones available. Libraries differ in portability, ease of use, speed, and other factors. This article compares different options.
It can be difficult to decide which output library to use when creating a Roguelike. There are many different ones available. Libraries differ in portability, ease of use, speed, and other factors. This article compares different options.
== conio.h ==
'''Do not use conio.h.''' It is unportable. It only works on DOS and Windows. If you use conio.h, then unless you design your code extremely well, when you try to port your game to other platforms, you are going to have problems.
Advantages:
* Easy to use
Disadvantages:
* Unportable


== Curses ==
== Curses ==
[http://en.wikipedia.org/wiki/Curses_(programming_library) Curses] is a library for I/O to a terminal. It's quite portable, and applications will often compile on different operating systems with little or no change. It is probably your best choice if you don't need more than 8 or 16 colors.
[[Curses library|Curses]] is a library for I/O to a terminal. It's quite portable, and applications will often compile on different operating systems with little or no change. It is probably your best choice if you don't need more than 8 or 16 colors.


Advantages:
Advantages:
Line 18: Line 9:


Disadvantages:
Disadvantages:
Only allows up to 8 foreground colors and 8 background colors. (It's possible to get 8 more foreground colors by using the bold attribute.)
* Limited by the player's and developer's terminal. Most terminals only allow up to 8 foreground colors and 8 background colors. (On these terminals, it's possible to get 8 more foreground colors by using the bold attribute.)
* May require special code for different terminals, for example code to support 256-color, 88-color and terminals that can change their colors at runtime.


== Windows API Calls ==
== SDL ==
It's possible to call the Windows API functions directly. This is usually a bad idea, because they are obviously unportable. It's almost always better to use someone else's library instead.
[[SDL]] is a cross-platform multimedia library. It has many features not found in other libraries on this page, and is portable (though it can be hard to install on Windows machines). It has bindings for several languages, including [[Python]].


Advantages:
Advantages:
* Fast
* Many features
* Portable


Disadvantages:
Disadvantages:
* Very hard to use
* Somewhat difficult to use
* Completely unportable


== libtcod ==
== libtcod ==
[[Libtcod]] allows 16 million colors, and larger consoles than available otherwise. It's portable, but unfortunately it takes some time to get used to. (Can someone add more to this? I'm not really familiar with libtcod.)
[[Libtcod]] allows 16 million colors, and larger consoles than available otherwise. It's portable, and includes a collection of FOV algorithims, noise generators for Perlin, simplex and wavelet noise, heightmap generators, random name generators, and other roguelike goodies. Unfortunately it takes some time to get used to.


Advantages:
Advantages:
* Portable
* Portable
* 16 million colors
* 16 million colors
* Supports Unicode
* Many capabilities besides a command-line interface, like mouse support and a configuration file parser, and advanced features such as perlin noise
* Many capabilities besides a command-line interface, like mouse support and a configuration file parser, and advanced features such as perlin noise


Disadvantages:
Disadvantages:
* A little hard to learn
* Somewhat difficult to use
* The default font is hard to read, especially on large screens
* The default font is hard to read, especially on large screens.


== RLLib ==
== RLLib ==
RLLib is being developed by [[Nathan Stoddard]]. It isn't available for download yet, unfortunately. It will almost certainly be released in time for the 2009 7DRL competition, though, if anyone wants to use it. It will have a better name, though, because "RLLib" is too generic, and too similar to "Roguelikelib" which is completely different.
RLLib was developed by [[Nathan Stoddard]]. It isn't being developed anymore, because the author is now using [[Python]], but the newest version is [http://nathanstoddard.com/rllib/rllib.shtml available for download], and it might be useful for some games. Note that it is different than [[Roguelikelib]], which happens to have a similar name.


Advantages:
Advantages:
* Portable
* 16 million colors
* 16 million colors
* Mouse support, an RNG, config file support
* Mouse support, an [[RNG]], config file support
* Doesn't rely on any additional libraries
* Doesn't rely on any additional libraries
* Allows access to individual pixels, and drawing characters at any position on the screen
* Allows access to individual pixels, and drawing characters at any position on the screen
* A simple message printing system
* A simple message printing system
* Multiplayer support
* Relatively easy to use
* Relatively easy to use
* Almost as fast as raw API calls
* Hexagon support
* Simple graphics support
 
Disadvantages:
* Not easily portable to platforms besides [[Windows]] and the [[X Window System]].
 
== conio.h ==
This only works with [[DOS]] and [[Windows]] and hence '''should not be used''' for any game required to be portable. 
 
Advantages:
* Easy to use
 
Disadvantages:
* Unportable
 
== Windows API Calls ==
It's possible to call the Windows API functions directly. As you can tell from the name this only works with Windows and is '''not portable to other platforms'''.
 
Advantages:
* Fast


Disadvantages:
Disadvantages:
* Not released yet
* Very hard to use
* Unportable
 
== LÖVE2D ==
[https://love2d.org/ LÖVE2D] is a [[Lua]] graphics framework.
 
Advantages:
* Fast
* Portable (Mac, Windows, Linux, Android, iOS...)
* Strong support for touch devices and other modern features
* Well documented
 
Disadvantages:
* Lua only
* Historically rapidly evolving, a lot of code you find is not up to date
* A fair portion of development is commercial, so better code can be hard to find
 
 
[[Category:Articles]]

Latest revision as of 22:20, 11 September 2016

It can be difficult to decide which output library to use when creating a Roguelike. There are many different ones available. Libraries differ in portability, ease of use, speed, and other factors. This article compares different options.

Curses

Curses is a library for I/O to a terminal. It's quite portable, and applications will often compile on different operating systems with little or no change. It is probably your best choice if you don't need more than 8 or 16 colors.

Advantages:

  • Portable
  • Relatively easy to use

Disadvantages:

  • Limited by the player's and developer's terminal. Most terminals only allow up to 8 foreground colors and 8 background colors. (On these terminals, it's possible to get 8 more foreground colors by using the bold attribute.)
  • May require special code for different terminals, for example code to support 256-color, 88-color and terminals that can change their colors at runtime.

SDL

SDL is a cross-platform multimedia library. It has many features not found in other libraries on this page, and is portable (though it can be hard to install on Windows machines). It has bindings for several languages, including Python.

Advantages:

  • Many features
  • Portable

Disadvantages:

  • Somewhat difficult to use

libtcod

Libtcod allows 16 million colors, and larger consoles than available otherwise. It's portable, and includes a collection of FOV algorithims, noise generators for Perlin, simplex and wavelet noise, heightmap generators, random name generators, and other roguelike goodies. Unfortunately it takes some time to get used to.

Advantages:

  • Portable
  • 16 million colors
  • Supports Unicode
  • Many capabilities besides a command-line interface, like mouse support and a configuration file parser, and advanced features such as perlin noise

Disadvantages:

  • Somewhat difficult to use
  • The default font is hard to read, especially on large screens.

RLLib

RLLib was developed by Nathan Stoddard. It isn't being developed anymore, because the author is now using Python, but the newest version is available for download, and it might be useful for some games. Note that it is different than Roguelikelib, which happens to have a similar name.

Advantages:

  • 16 million colors
  • Mouse support, an RNG, config file support
  • Doesn't rely on any additional libraries
  • Allows access to individual pixels, and drawing characters at any position on the screen
  • A simple message printing system
  • Relatively easy to use
  • Hexagon support
  • Simple graphics support

Disadvantages:

conio.h

This only works with DOS and Windows and hence should not be used for any game required to be portable.

Advantages:

  • Easy to use

Disadvantages:

  • Unportable

Windows API Calls

It's possible to call the Windows API functions directly. As you can tell from the name this only works with Windows and is not portable to other platforms.

Advantages:

  • Fast

Disadvantages:

  • Very hard to use
  • Unportable

LÖVE2D

LÖVE2D is a Lua graphics framework.

Advantages:

  • Fast
  • Portable (Mac, Windows, Linux, Android, iOS...)
  • Strong support for touch devices and other modern features
  • Well documented

Disadvantages:

  • Lua only
  • Historically rapidly evolving, a lot of code you find is not up to date
  • A fair portion of development is commercial, so better code can be hard to find