Programming Fundamentals  
General Course Information  
Edirlei Soares de Lima  
<edirlei.lima@universidadeeuropeia.pt>  
Programming Fundamentals  
What is computer programming?  
The process of writing, testing and maintaining a computer program  
for accomplishing a specific task.  
What is a computer program?  
A sequence of instructions that automate the process of performing a  
task for solving a specific problem.  
How to write a computer program?  
A computer program is written using a programming language.  
Programming Fundamentals  
What is a programming language?  
A programming language is a vocabulary and set of grammatical rules  
for instructing a computer to perform specific tasks.  
Examples of programming languages: C, C++, C#, Java, JavaScript,  
HTML, PHP, Python, Lua, Processing, Ruby, Objective-C, Prolog, Go, …  
What is the best programming language?  
There is no "best programming language". It depends on the goals of  
the application, platform, programmer’s skills, etc.  
Programming Fundamentals  
Professor: Edirlei Soares de Lima  
Education:  
B.Sc. in Computer Science UnC  
M.Sc. in Computer Science UFSM  
Ph.D. in Computer Science PUC-Rio  
Teaching Experience: PUC-Rio, UNIRIO, UERJ, IADE-UE  
Game Experience:  
Game Engines: RPG Builder, 3D Game Builder (http://www.3dgamebuilder.com.br/);  
Research Projects: most are related with Logtell (http://www.icad.puc-rio.br/~logtell/);  
Games: Krimson (Best Game Award at SBGames 2010 Indie Game Development  
Festival), and several other prototype games.  
Programming Fundamentals  
Games & Apps Development:  
Study the fundamentals of computer programming in a game  
development context.  
Learning Outcomes:  
1
2
3
4
. Understand the concepts of algorithm and program  
. Construct algorithms to solve specific problems  
. Implement simple graphical and interactive applications  
. Apply the concepts learned in the development of small-size  
computer games  
Programming Fundamentals  
Module Content:  
1
2
3
. Introduction to programming: concepts of algorithm and program  
. Introduction to Lua: variables, data types, operators and functions  
. Introduction to computer graphics: coordinates, color, transparency,  
and Löve 2D  
4
5
6
7
8
9
. Conditional statements and user interaction  
. Loops and images  
. Vectors, physics and collision detection  
. Arrays, matrices, animations and level representations  
. Music and audio effects  
. Introduction to artificial intelligence  
Method  
Project-Based Learning:  
Learn by doing;  
Teamwork;  
"Large" project;  
Active and experiential learning:  
Theoretical concepts;  
Practical examples;  
Implementation exercises;  
Programming Language: Lua  
Evaluation  
Continuous Assessment (bipartite):  
[60%] Intermediate assessment:  
[20%] Individual exercises on the concepts learned;  
[20%] Project with Math, Physics and Games I;  
[60%] Two intermediate deliveries of the team project (within the  
semester’s PBL team project).  
[40%] End of term assessment:  
[100%] Final delivery of the team project (within the semester’s PBL team  
project) with individual discussion.  
Final Assessment:  
[100%] Individual project development, delivery, and discussion.  
Evaluation  
Intermediate project deliveries:  
[30%] 2nd delivery: working prototype;  
[30%] 3rd delivery: alpha version;  
Final project delivery:  
4th delivery: final version;  
Lua Programming Language  
Lua is a powerful, fast, lightweight, embeddable,  
free and open-source scripting language designed  
for general purposes.  
In video game development, Lua is one of the most  
popular scripting language for game programming.  
Lua was developed by a team of researchers at  
PUC-Rio (Pontifical Catholic University of Rio de  
Janeiro) in Brazil.  
Currently, PUC-Rio has a entire laboratory (LabLua)  
dedicated for the development and maintenance of the  
Lua language.  
Lua Programming Language  
Games that use Lua as scripting language:  
Angry Birds  
Civilization V  
Far Cry  
Grim Fandango  
Ragnarok  
Dota 2  
World of Warcraft  
Löve 2D Framework  
LÖVE is a framework to create 2D games in Lua.  
It comprises a library of functions to draw visual objects, control user  
interaction, simulate physics, play audio, and everything else a game  
needs.  
It's free, open-source and multiplatform (Windows, Linux, Mac OS,  
Android, iOS, Web Browsers).  
Example of Game (Lua + Löve2D)  
.
..  
function love.draw()  
for i = 1, numStars do  
love.graphics.setColor(255 - stars[i].speed,  
2
1
55 - stars[i].speed/2,  
50, stars[i].speed*0.9)  
love.graphics.draw(star_image, stars[i].x,  
stars[i].y, 0, stars[i].speed/255 + 0.55)  
end  
love.graphics.setColor(255, 255, 255)  
if spaceship_isBoosted == false then  
love.graphics.draw(spaceship_image_normal,  
spaceship_x, spaceship_y)  
else  
love.graphics.draw(spaceship_image_boosted,  
spaceship_x, spaceship_y)  
end  
local totalLaserBeams = table.getn(lasers)  
for i = 1, totalLaserBeams do  
love.graphics.draw(laser_image, lasers[i].x,  
lasers[i].y)  
end  
end  
.
..  
Software  
Löve: https://love2d.org/  
ZeroBrane Studio: https://studio.zerobrane.com/  
Bibliography  
Ierusalimschy, R. (2016). Programming in Lua,  
Fourth Edition. Lua.Org. ISBN: 978-8590379867  
Ierusalimschy, R., Figueiredo, L. H., Celes, W.  
(
Media Limited. ISBN: 978-9888381227  
2015). Lua 5.2 Reference Manual. Samurai  
Web Resources  
Lua 5.3 Reference Manual: https://www.lua.org/manual/5.3/  
Löve Documentation: https://love2d.org/wiki/Main_Page  
Programming Fundamentals  
Blackboard (Programming Fundamentals):  
https://europeia.blackboard.com/  
Course Webpage:  
http://www.inf.puc-rio.br/~elima/gameprog/  
Contact: