Author Archives: Rokas Paulauskas
The Last Signal. Post #3: sprite management considerations
The projects (games) which we are working on in the course 5SD033 – Introduction to Game Development may not be big, but they are considerably bigger in scope than the simple games in 5SD022 – Game Programming I course.
In these games, a lot of sprites are required. A pressing need for a flexible sprite manager arises.
I spent a lot of time simply thinking about the right strategy to handle sprites. I also had my awful GameState::Enter()
function in mind; it […]
The Last Signal. Post #3: sprite management considerations
The projects (games) which we are working on in the course 5SD033 – Introduction to Game Development may not be big, but they are considerably bigger in scope than the simple games in 5SD022 – Game Programming I course.
In these games, a lot of sprites are required. A pressing need for a flexible sprite manager arises.
I spent a lot of time simply thinking about the right strategy to handle sprites. I also had my awful GameState::Enter()
function in mind; it […]
The Last Signal. Post #2: adding multiple bullets
So far we were only able to have one bullet in the game at any time. One of the most important tasks I was working on during this sprint (16 Feb – 20 Feb) was to implement “overcharge” item which temporarily increases rate of fire. When palyer’s rate of fire is increased, there will definitely be more than one bullet on the screen.
So this post is about how I added multiple bullets to the game. This is going to be a moderately […]
The Last Signal. Post #2: adding multiple bullets
So far we were only able to have one bullet in the game at any time. One of the most important tasks I was working on during this sprint (16 Feb – 20 Feb) was to implement “overcharge” item which temporarily increases rate of fire. When palyer’s rate of fire is increased, there will definitely be more than one bullet on the screen.
So this post is about how I added multiple bullets to the game. This is going to be a moderately […]
The Last Signal. Post #1: placing colliders
One of the requirements of the course which we are now taking, 5SD033 – Introduction to Game Development, is to post weekly updates about an artifact you have been working on in the previous week. My team is working on a game called The Last Signal which focuses on a pilot’s efforts to survive when his space exploration vessel picked up extraterrestrial life forms while the ship was landed on a planet.
Once a week I will make a post beginning with […]
The Last Signal. Post #1: placing colliders
One of the requirements of the course which we are now taking, 5SD033 – Introduction to Game Development, is to post weekly updates about an artifact you have been working on in the previous week. My team is working on a game called The Last Signal which focuses on a pilot’s efforts to survive when his space exploration vessel picked up extraterrestrial life forms while the ship was landed on a planet.
Once a week I will make a post beginning with […]
Programming: Binding Object Rotation to Mouse Movement
A new term started on Monday this week. Now we are going to have two simultaneous courses, “Game Programming II” and “Introduction to Game Development”.
Over a span of roughly two months we will make a game based on one of the concepts produced by student groups in the previous course, “Introduction to Game Design and Analysis”. Our group has already started working on our game, “The Last Signal”, but at the moment we’re mostly doing decision stuff – what we […]
Programming: Binding Object Rotation to Mouse Movement
A new term started on Monday this week. Now we are going to have two simultaneous courses, “Game Programming II” and “Introduction to Game Development”.
Over a span of roughly two months we will make a game based on one of the concepts produced by student groups in the previous course, “Introduction to Game Design and Analysis”. Our group has already started working on our game, “The Last Signal”, but at the moment we’re mostly doing decision stuff – what we […]
Programming: SDL2 Native functions (cont.)
In this post, I want to present remaining important SDL2 functions that were used in Araknoid coding sessions.
First, one more SDL object type.
SDL_Event
– a grouping of objects that refer to user input events. Objects of this type are declared by the programmer but are filled with meaningful data by a special function, SDL_PollEvent()
SDL_PollEvent()
SDL_PollEvent(&event)
In SDL, when the user moves a mouse, presses a key on the keyboard etc., an input event of appropriate type is added to the event queue. […]
Programming: SDL2 Native functions (cont.)
In this post, I want to present remaining important SDL2 functions that were used in Araknoid coding sessions.
First, one more SDL object type.
SDL_Event
– a grouping of objects that refer to user input events. Objects of this type are declared by the programmer but are filled with meaningful data by a special function, SDL_PollEvent()
SDL_PollEvent()
SDL_PollEvent(&event)
In SDL, when the user moves a mouse, presses a key on the keyboard etc., an input event of appropriate type is added to the event queue. […]
Programming: SDL2 Native Functions
We’re using SDL 2 library to create our first games. This library allows low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.
In our first working game, Arkanoid, we used about 20 SDL2’s functions. I’m going to describe them in this post.
SDL_Init() and SDL_Quit()
SDL_Init(flags)
The two functions initialize and quit the SDL system, respectively. You have to initialize SDL to be able to make use of functions provided by the SDL or to quit it to […]
Programming: SDL2 Native Functions
We’re using SDL 2 library to create our first games. This library allows low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.
In our first working game, Arkanoid, we used about 20 SDL2’s functions. I’m going to describe them in this post.
SDL_Init() and SDL_Quit()
SDL_Init(flags)
The two functions initialize and quit the SDL system, respectively. You have to initialize SDL to be able to make use of functions provided by the SDL or to quit it to […]
Programming: several C++ container classes
In our live Arkanoid coding sessions, we used several standard C++ container classes. I am going to describe them in this post.
std::pair
An array contains multiple elements of the same type. Sometimes, however, it is useful to hold two objects (possibly of different types) as a single entity. For this purpose, we use the std::pair
container.
Below is a table with basic personal data:
Id
Name
100
John
It is natural to group Id and Name and refer to them as a single object within the […]
Programming: several C++ container classes
In our live Arkanoid coding sessions, we used several standard C++ container classes. I am going to describe them in this post.
std::pair
An array contains multiple elements of the same type. Sometimes, however, it is useful to hold two objects (possibly of different types) as a single entity. For this purpose, we use the std::pair
container.
Below is a table with basic personal data:
Id
Name
100
John
It is natural to group Id and Name and refer to them as a single object within the […]
Programming: Week 5
I haven’t made any posts for quite some time, mostly because I didn’t want to post about something incomplete. A lot has been happening recently and I have been working on several areas: doing exercises, analyzing Arkanoid game code, doing SDL 2 tutorials, and more. So this post won’t be strictly about what we did during the fifth week but rather a selection of various topics I covered in the two previous weeks.
Advanced topics: Recursion
We were introduced to the concept […]
Programming: Week 5
I haven’t made any posts for quite some time, mostly because I didn’t want to post about something incomplete. A lot has been happening recently and I have been working on several areas: doing exercises, analyzing Arkanoid game code, doing SDL 2 tutorials, and more. So this post won’t be strictly about what we did during the fifth week but rather a selection of various topics I covered in the two previous weeks.
Advanced topics: Recursion
We were introduced to the concept […]
Programming: Week 3 (cont. 2)
Ex. 6
Define a class that is able to describe any of the 52 cards in a pack of cards. Include a Print method that outputs the suit and the rank of a card.
Class Design Considerations
The class Card
should contain the info required to uniquely identify a card, i.e., describe its suit (Hearts, Diamonds, Spades, Clubs) and rank (A, 1, 2, … 10, J, Q, K).
The class needs at least two member variables, one for suit and one for rank. You […]
Programming: Week 3 (cont. 2)
Ex. 6
Define a class that is able to describe any of the 52 cards in a pack of cards. Include a Print method that outputs the suit and the rank of a card.
Class Design Considerations
The class Card
should contain the info required to uniquely identify a card, i.e., describe its suit (Hearts, Diamonds, Spades, Clubs) and rank (A, 1, 2, … 10, J, Q, K).
The class needs at least two member variables, one for suit and one for rank. You […]
Programming: Week 3 (cont.)
Ex. 3
Write a TemperatureConverter
class that handles conversions between Celsius, Fahrenheit and Kelvin. Each conversion mode should have its dedicated method; the user should be able to choose which conversion mode to use.
Here is the program:
#include
#include
#include
class TemperatureConverter
{
public:
void SetTemp(std::string input)//set methods – provide data entered by the user to the Class
{
int n = input.length();
char sist = input.at(n – 1);
float temp_part = std::stof(input.erase(n – 1, 1));
temperature = temp_part;
};
void SetSource(std::string input)
{
int n = input.length();
char sist = input.at(n – 1);
source = […]
Programming: Week 3 (cont.)
Ex. 3
Write a TemperatureConverter
class that handles conversions between Celsius, Fahrenheit and Kelvin. Each conversion mode should have its dedicated method; the user should be able to choose which conversion mode to use.
Here is the program:
#include
#include
#include
class TemperatureConverter
{
public:
void SetTemp(std::string input)//set methods – provide data entered by the user to the Class
{
int n = input.length();
char sist = input.at(n – 1);
float temp_part = std::stof(input.erase(n – 1, 1));
temperature = temp_part;
};
void SetSource(std::string input)
{
int n = input.length();
char sist = input.at(n – 1);
source = […]
Programming: Week 3
Week 3 is all about classes. Again, this is totally new to me but it is doable.
Just one exercise this time, more on classes to come.
Ex.2
Define a “Person” class. Within the class, define private variables (member variables/data members) to hold the age (an int
) and the name (an std::string
). Define public methods to assign values to the private variables and access the values in the private variables.
Use the class in a program so that the main()
function calls the methods […]
Programming: Week 3
Week 3 is all about classes. Again, this is totally new to me but it is doable.
Just one exercise this time, more on classes to come.
Ex.2
Define a “Person” class. Within the class, define private variables (member variables/data members) to hold the age (an int
) and the name (an std::string
). Define public methods to assign values to the private variables and access the values in the private variables.
Use the class in a program so that the main()
function calls the methods […]
Programming: Week 2 (cont.)
Ex. 10
Write a program that generates a random symbolic game map that contains characters. Use the following characters:
# represents a wall
& represents a tree
_ represents walkable area
This one is simple. Since we need to randomly choose one of 3 options, we generate an integer from the interval [0;2] (or [1;3], it doesn’t change anything).
#include
#include
#include
int random()
{
return rand() % 2;
}
int main(int argc, char* argv[]){
std::cout << std::endl;
srand((unsigned int)time(0));
for (int i = 0; i < 9; i++)
{
std::cout << " ";
for […]
Programming: Week 2 (cont.)
Ex. 10
Write a program that generates a random symbolic game map that contains characters. Use the following characters:
# represents a wall
& represents a tree
_ represents walkable area
This one is simple. Since we need to randomly choose one of 3 options, we generate an integer from the interval [0;2] (or [1;3], it doesn’t change anything).
#include
#include
#include
int random()
{
return rand() % 2;
}
int main(int argc, char* argv[]){
std::cout << std::endl;
srand((unsigned int)time(0));
for (int i = 0; i < 9; i++)
{
std::cout << " ";
for […]