Page 1 of 1

A manual for LÖVE

Posted: Wed Oct 26, 2016 1:28 am
by Santos
Since I figure that I'll never make this myself, I thought I'd post this idea just in case it inspires anyone else. I don't know if I'm right about all this stuff, it's just an idea...

The Problem

To use LOVE effectively, you need to know everything it can do. Not memorize every argument to every function, but know what functionality exists.

To know everything that LOVE does, you have to read the entire wiki.

The wiki serves as a good reference to the API. However, reading the entire wiki for the purpose above is, dare I say, inefficient, ineffective, and isn't something that everyone is going to want to do.

This makes me think that some people aren't using LOVE effectively because of a lack of suitable documentation.

A Solution

A manual for LOVE, giving basically the same information that is in the wiki, but in a way that makes sense to read top-to-bottom.

I don't know exactly what this would look like, but here are some ideas:

The order in which things are presented is important

The wiki mostly orders things by module/type, and alphabetically, which is okay for a reference.

A manual could order things by purpose.

For example, love.resize, love.window.setIcon, and the window options in love.conf are all about the window, so they could be together.

love.lowmemory, t.accelerometerjoystick, and love.system.vibrate are all about mobile devices, so they could be together.

love.run, love.timer.sleep, and love.graphics.present are all about the game loop, so they could be together.

Etc.

Some things might need to be discussed in different ways in different places. For example, some blend modes are important to discuss when talking about Canvases.

The manual doesn't need to be a reference

I think the manual should be complete in the sense that it covers every function/concept, but it doesn't need to list out each function's arguments, for example, because the wiki already does this. But maybe it should, I'm not sure what would be most effective.

The manual might not even need to mention the functions by name if it already describes what the function does and has appropriate links. For example, you might be able to cover basically all of drawing shapes (assuming some stuff has been discussed previously) with just:

Lines and polygons (filled or outlined) can be drawn, and there are convenience functions for drawing rectangles, circles, ellipses and arcs.

< Pictures of what they all look like >

The line width, whether the lines are anti-aliased, and what it look likes when lines join in polygons are based on internal state.

< Pictures of different line widths/styles/join styles >

Explain why things are there, if it's not completely obvious

It's obvious why someone might want to play a sound.

It's not obvious why someone would want to use a Canvas, or a Channel, or a compressed image, or when they should be using scancodes instead of keys, or use a lot of other stuff the API provides.

So, provide example use-cases.

The wiki does/should provide this information, but I think it's extra important for the manual.

Sometimes it might even be useful to discuss why things are designed the way they are if it's not obvious.

Point out convenience functions.

Give code examples

The wiki does/should give code examples, but for the manual the examples don't need to be focused on one particular function.

I can think of two types of code examples which might be useful: examples showing how things are used if it's not obvious, and examples which allow you to "play around" with something to understand it better.

An example of the first type would be some simple but realistic uses of Threads.

An example of the second type might be something which plays around with Sources. It's not using Sources in any advanced or unexpected way, but it might be useful for people to play with to understand how Sources work (it could be expanded to demonstrate spatial effects).

Code: Select all

function love.load()
    source = love.audio.newSource('sound.ogg')
end

function love.keypressed(key)
    if key == 'space' then
        love.audio.play(source)
    elseif key == 'p' then
        love.audio.pause(source)
    elseif key == 's' then
        love.audio.stop(source)
    end
end

function love.draw()
    love.graphics.print('isPlaying: '..source:isPlaying(), 15, 15)
    love.graphics.print('isPaused: '..source:isPaused(), 15, 30)
    love.graphics.print('isStopped: '..source:isStopped(), 15, 45)
    love.graphics.print('tell: '..source:tell(), 15, 60)
end
Show images/sound/videos

If it's a graphical thing, show it in an image. If it's an audio thing, have an audio clip. If it's something like ParticleSystems, show a video/GIF.

For example, have a diagram showing what Font:getDescent etc. refers to, or give audio for what the different DistanceModels sound like maybe, or graphs of the effects DistanceModels have.

The wiki does/should have this also.

Have a good introduction

What does LOVE do? What does LOVE not do? Why? When would I want to use LOVE, and when would I want to use something else? How does LOVE compare to alternatives? What's the tool support like? Etc.

Another idea

The manual could also serve as a voice-over script for a video, with the visuals showing function names as they're being discussed maybe, or diagrams, examples, etc.

I think the video format would be great for this, because it's accessible and inviting, it goes by quickly, and the potentially negative aspects about learning from video (difficult to locate a specific piece of information, easy to forget what's been said) aren't that bad because it's just an introduction, not a reference.

Making this happen

I think this would need to be a collaborative effort because it's probably too much work for one person. So, some collaborative setup would be good, maybe a markdown document on GitHub, or a wiki, or a Google Doc, or something.

But, really, I'm not expecting anyone to be interested in making this, or even to agree with the stated problem, let alone the solution. It's just an idea I had.

Re: A manual for LÖVE

Posted: Wed Oct 26, 2016 2:25 am
by s-ol
Sounds interesting, certainly more realistic a scope to write collaboratively than love2d-book, which is suspended once again.

Personally I don't like video format for various reasons, I would rather have a website with demos and readily available syntax-highlighted code examples (maybe with live editing?)

Re: A manual for LÖVE

Posted: Wed Oct 26, 2016 3:03 am
by Positive07
I love this idea, and would offer myself to contribute in such a project since I have somwhat memorized the wiki and each and every function LÖVE packs and what it does (I haven't used all, since I don't write sound code nor physics but I roughly know what the wiki says about them)

I think a documentation like this would be very easy to understand, much like PIL explains everything about Lua.

I also think that adding demos would be cool, now that we have LÖVE fiddle we may be able to implement something around that. It can be complemented with what you said about GIF, videos, images, audios. Since some API's are lacking features like OpenAL and Threads.

Also I think a little tutorial at the end would be rather cool, or at least a game using most features.

Pointing to commonly used libraries for commonly asked things like cameras, animations, tiling, physics and such would be helpful too.

Giving tips on how to structure modules/libraries and game code could also help. And if you wanted to get deeper you could also talk about code style (but I wouldn't go too far on this)

Re: A manual for LÖVE

Posted: Wed Nov 02, 2016 2:45 pm
by zorg
Okay, so to tackle the huge list:
Santos wrote:To use LOVE effectively, you need to know everything it can do. Not memorize every argument to every function, but know what functionality exists.
Technically, you can use something even if you only know parts of it, what's important to you at the moment. I sure never needed to use the video module yet, for instance, though i did read the wiki articles about it just out of curiosity. I didn't memorize anything though.
Santos wrote:To know everything that LOVE does, you have to read the entire wiki.
Technically, löve can do more than whatever's on the wiki.
Santos wrote:The wiki serves as a good reference to the API. However, reading the entire wiki for the purpose above is, dare I say, inefficient, ineffective, and isn't something that everyone is going to want to do.
Yes, part of the wiki is an API reference. To a framework. That gives you a tremendous amount of freedom in doing things how you want to. Unlike engines like unity or game maker. I don't see how you could create a manual for Löve, unless you go the all-hands-held route of saying "This is how i code a game in genre x and you should too! :)" which, to me, is unappealing, but hey; there may be people like that here.
Santos wrote:This makes me think that some people aren't using LOVE effectively because of a lack of suitable documentation.
Define suitable. for what? making games? Those would be tutorials, that are not updated by the devs. No one person could keep up with that much work, for free anyway. Crowd-editing would work though, probably.
Santos wrote:A manual for LOVE, giving basically the same information that is in the wiki, but in a way that makes sense to read top-to-bottom.
I don't know exactly what this would look like, but here are some ideas:
A manual could order things by purpose.
Again, reading something from top to bottom is a guide to creating one specific thing, like a tutorial; grid based character movement, etc...
Santos wrote:For example, love.resize, love.window.setIcon, and the window options in love.conf are all about the window, so they could be together.
love.lowmemory, t.accelerometerjoystick, and love.system.vibrate are all about mobile devices, so they could be together.
love.run, love.timer.sleep, and love.graphics.present are all about the game loop, so they could be together.
Except one could use those in places other where you suggest. Like, you don't even need to use setIcon if you don't want to, or love.resize if you make a game that's not resizable, for example.
Santos wrote:Some things might need to be discussed in different ways in different places. For example, some blend modes are important to discuss when talking about Canvases.
Makes sense, some topics need to touch upon the same functionality that may have been discussed before, and may be discussed after as well.
Santos wrote:It's obvious why someone might want to play a sound.
It's not obvious why someone would want to use a Canvas, or a Channel, or a compressed image, or when they should be using scancodes instead of keys, or use a lot of other stuff the API provides.
In my experience with the forums, non-obvious things also include the difference between love.audio and love.sound; similarly to fonts in love.graphics, and love.font.
Also, where to play a sound is also something people may not really care about, and just plop such function calls all over the place.
Santos wrote:So, provide example use-cases.
The wiki does/should provide this information, but I think it's extra important for the manual.
Give code examples
The wiki does/should give code examples, but for the manual the examples don't need to be focused on one particular function.
Yes, the manual should be all about this, in my opinion.
Santos wrote:Sometimes it might even be useful to discuss why things are designed the way they are if it's not obvious.
Point out convenience functions.
I can think of two types of code examples which might be useful: examples showing how things are used if it's not obvious, and examples which allow you to "play around" with something to understand it better.
I think that the first type would be good for the manual, and in paralell, having one example .love file (like what existed previously) containing many example projects that showcase the code alongside what it produces, though it may be a bit time-consuming to code and to keep it updated with the manual.
Santos wrote:If it's a graphical thing, show it in an image. If it's an audio thing, have an audio clip. If it's something like ParticleSystems, show a video/GIF.
Yep, makes sense; though i'd provide images for audio stuff as well.
Santos wrote:Have a good introduction
What does LOVE do? What does LOVE not do? Why? When would I want to use LOVE, and when would I want to use something else? How does LOVE compare to alternatives? What's the tool support like? Etc.
No comment from me, sounds good. :)
Santos wrote:The manual could also serve as a voice-over script for a video, with the visuals showing function names as they're being discussed maybe, or diagrams, examples, etc.
Video tuts are not my thing, so i really can't comment on this.
Santos wrote:I think this would need to be a collaborative effort because it's probably too much work for one person. So, some collaborative setup would be good, maybe a markdown document on GitHub, or a wiki, or a Google Doc, or something.
Gdocs is good for working on it as a document, though later, it should/could be remade as a pdf / html; or even wiki articles, though on löve's own wiki; why fragment to other wikis? :3
Santos wrote:But, really, I'm not expecting anyone to be interested in making this, or even to agree with the stated problem, let alone the solution. It's just an idea I had.
At least you got the discussion going on. :awesome:

Re: A manual for LÖVE

Posted: Thu Nov 03, 2016 11:22 am
by Positive07
I think something like the PIL would be nice

Things like [wiki]Spritebatch[/wiki]es, [wiki]Thread[/wiki]s, [wiki]Canvas[/wiki], [wiki]Quad[/wiki]s, could be described in more detail, and the relationship between their methods could be shown better.

I don't think there is a need to describe an specific game, very much like the PIL doesn't show a specific kind of program.

Re: A manual for LÖVE

Posted: Thu Nov 03, 2016 11:38 pm
by zorg
Crossposting my ideas from Santos' other thread here as well, but only the ones specifically related to the manual, in a bit more detail:
zorg wrote:Manual (I'm currently working on a page example here, akin to how gameprogrammingpatterns.com does it, explaining each facet of a game, instead of the separate modules. Updated by people who want to, but it should be kept up with the new versions; see the notice on the article.) Basically, one place, neatly contained articles, even if they are longer than anything else currently on the wiki.
So, currently at the time of me writing this post, it's still a bit bare, but i'm working on making it more structured. Was thinking of using "Sam" as an example person in this "chapter" of the manual (Sound-Audio-Music), and basically s/he starting a project from zero, this time, with audio.
Jumps in time between examples, somewhat like a story. It can be readable that way, from start to finish, though in my opinion, the various chapters should be completely separated from each other in the sense that you should be able to just read one chapter if you're only interested in coding things relating to that chapter.