Only Lua

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
JYinc
Prole
Posts: 6
Joined: Fri Feb 17, 2017 9:37 am

Only Lua

Post by JYinc » Sun Feb 19, 2017 8:31 am

I wanna make games with Love2d.
I know it is for Lua users but, Im wondering a little that knowing c or c++ is required?...
I mean, should I know c or c++ to make any genre of games with Love2d? Or just knowing Lua is alright?

And actually Im a newbie of programming. My friends of mine said that I should learn many algorithms and Data-structures to make games. Is that really true? Isnt it fine to learn a grammar of Lua and just start making a game without those knowledge?

Thx and please give me some advices :)

User avatar
zorg
Party member
Posts: 2914
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Only Lua

Post by zorg » Sun Feb 19, 2017 9:41 am

Only knowing lua (and math, to be honest) is required for making games with Löve... then again, having some skills relating to graphics or music is also helpful, just for the sake of making your game better.

Unless you want to hack away at the c++ source, you don't need to know that language.

c on the other hand could be useful if you wanted to optimize memory sizes, since c arrays and stuff usually take up less space than lua tables, and Löve comes with LuaJIT by default, which allows this, but again, this is something you should not worry about.

In my opinion, one should only learn data structures to see that different programming languages handle them differently; same with algorithms, and even design patterns. Lua's a dynamic language; tons of stuff aren't relevant here that are in C for example, so using those kinds of design patterns would only give extra complexity to your code, and accomplish nothing the language itself had better ways to do.

Best advice: Go skim lua 5.1's documentation, it's online; Go skim Löve's wiki about functions and stuff; Decide on a small game to implement; Implement it; repeat until you can code the game you always wanted. :3
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

Santos
Party member
Posts: 383
Joined: Sat Oct 22, 2011 7:37 am

Re: Only Lua

Post by Santos » Sun Feb 19, 2017 9:43 am

Hi JYinc!

Different people are going to say different things I think, so be sure to think critically and research and experiment to find out what you think is true. :)

Knowing C or C++ is absolutely not required for making a game with LOVE, it requires knowledge of only Lua.

Knowing algorithms and data structures also aren't necessary for getting started at making games with LOVE.

I'd suggest to make simple things with whatever you know at the time. If you only know how to draw a circle, draw a circle. If you only know how to make a circle move to the right of the screen, make that.

Then, when the need arises, learn what you need to learn. Want the circle to jump to where the mouse is but you don't know how to get the mouse position in LOVE? Then look that up. Want the circle to slowly move to the mouse position when you click? Then you'll need to learn some basic trigonometry.

You might find that you can create some cool stuff with only knowing a few things, experiment and have fun!

You can "learn what you need as you need it" for everything: Lua, LOVE, programming techniques, mathematics, algorithms, data structures, etc.

You may then get to a stage where you think "well, I'm comfortable with the basics of LOVE now, I kind of get the basic idea, now I want to read the entire wiki and learn everything that LOVE can do", then you can do that. You may want to learn more about Lua or mathematics or whatever it is that you think you could benefit from. But, unless you're inspired by this, you can learn things as you go.

Note that, in my opinion, the quality of learning resources for game programming generally aren't as good as you might hope. I say this to encourage you to not be afraid of trying things out for yourself and learning that way, and also to not be discouraged if you find some tutorials confusing or not that helpful, it's normal.

Also a thought to think about: the best games aren't necessary made by the most knowledgeable programmers or have the "best code". :) I'd advise not getting too caught up on writing "good code", you'll know what works and what doesn't with experience and thought, and it's an easy thing to fall intro the trap of obsessing about things like this while ignoring more important things, like making games! One bit of advice that you might find helpful though is to find ways not to have duplicate values/functionality in your code (you can see how I handle this in my tutorials I link to below).

Learning a little bit of the grammar of Lua and a little bit of the LOVE API will help you get started. I don't know what Lua tutorial to recommend, I'm sure there are lots, I would recommend making lots of little programs and experimenting to get comfortable with the writing and reading the language. Note that there's some features of Lua which you really don't need to know to get started, like metatables and coroutines.

For getting started, I would suggest checking out Sheepolution's tutorial, noooway's tutorial, and some tutorials that I made (I'm probably missing some good tutorials!). Don't worry too much if you don't understand everything right away in a tutorial, just get what you can get out of it and try researching Lua/LOVE things which come up that you're not sure of. With my tutorials I didn't even try to explain things, because I figure that by reading the code and seeing what changes, you'll come up with a better explanation yourself than anything I could have written, which would probably be confusing.

This may be a silly idea but if it sounds reasonable to you, I'd suggest taking a simple game from one of those tutorials, and after getting to the stage where you've gone through the tutorial and you understand what every line does (which could take a while!), you could start with a blank file and try to recreate the game from scratch without looking at the tutorial's code (at least unless you get stuck :P). The reason I suggest this is that some of getting comfortable with programming is just getting comfortable with typing, memorising Lua's syntax (grammar) and LOVE's API, reading error messages and correcting errors (tip: learn to use a debugger!), and building up your code step by step. You'll notice in the tutorials above that it starts off with a little bit of code which you can run, then adds another little bit of code which you can run, and so on, building it up in small steps. I recommend this!

I suggest learning to use a debugger, because then you can see how your program is working while it's running. Otherwise you'll be "in the dark" about how your program is running, you'll hit run and it'll just go and you might not be able to figure out what's going on.

After a bit of experience, when you come to program something you might find yourself asking yourself things like:
  • How will I draw the graphics using what LOVE provides?
  • What variables/tables do I need to store the data I need for things in the game?
  • How will this data change?
  • What mathematics and algorithms will this require, does it need something I don't know yet?
A common piece of advice is, especially if you have a plan on a huge game you want to make, instead of going ahead and start trying to make it as soon as you're getting started learning about all this stuff, try making lots of small games and experiments, because as you get comfortable with simple things you'll be able to get more comfortable with more complicated things. I think this is good advice!

So, I think you'll find out for yourself what is true, with experience. Do you really have to learn this thing or that thing to make games? Start making some games and find out for yourself. :)

User avatar
Positive07
Party member
Posts: 1006
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Only Lua

Post by Positive07 » Sun Feb 19, 2017 10:22 pm

I think that the most important knowledge beside Lua is math. And specifically trigonometry and vectors, and then physics.

You can avoid using the FFI altogether so no need to learn C and you will most likely never need to modify LÖVE itself so no need for C++, you may want to write a shader so GLSL would be something you want to learn in the long run (it's pretty similar to C).

About data structures... well LÖVE has one, tables. So you will probably learn many data structures just by making games and stuff because you will start using tables in different ways like arrays, hash tables...

So yeah, don't worry about this stuff, try to make a game with the knowledge you have... If you can't, search for the knowledge you are missing and repeat!

PS: There have been suggestions about how to learn LÖVE and Lua in this thread already so be sure to check those out!
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(Github.com/Positive07)

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests