Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: First real game project - task: clean up / multiple attack types and levels  (Read 12565 times)

0 Members and 1 Guest are viewing this topic.

GameBear

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
    • Email
Hello SFML folks.

So, I've recently got a lot of extra time on my hands and my hands on some sfml books.
So, ive decided i wanted to give it a go at a game from scratch. my first major project on my own.

my background - an outdated webintegrator education from 2005, some Pacal, Turbo pacal, html, AS, AS2, java and java script, all at a low level mostly by hobby and free time.

gone trough all "making games with Ben" tutorials on youtube. (check thm out, you'll be glad you did)
read all of "SFML game devolopment by example" by R. Pupius (awesome book btw, can recommend, especial if a v. 2 comes out)

and this will be my devolopment log.

A demo can be downloaded here from my google drive:
https://drive.google.com/folderview?id=0B0wU233V6VHRZms3eGY4Y19acjA&usp=sharing
Latest update - Pre-Alpha : 28/7-16



About the game:
(click to show/hide)
The worksheet
(click to show/hide)

First video in spoiler:
(click to show/hide)


here is a video of my current progress
- 27/7-16 -

http://youtu.be/B-mRCY-JCYQ
« Last Edit: July 28, 2016, 09:39:22 pm by GameBear »
string message = "some random dude";
cout << "I'm just " << message;

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: First real game project - current: menu template
« Reply #1 on: July 21, 2016, 06:59:50 pm »
What do the colours represent in your list?
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

GameBear

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
    • Email
Re: First real game project - current: menu template
« Reply #2 on: July 21, 2016, 07:20:41 pm »
@Hapax

Oh, forgot to mention that. :)
Green = done
Red = ongoing
Black = to come.

:)
string message = "some random dude";
cout << "I'm just " << message;

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: First real game project - current: menu template
« Reply #3 on: July 21, 2016, 10:45:14 pm »
If the first three (which includes the menu) are done, maybe you could change the subject (of the original post) to reflect the current task  :)
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

GameBear

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
    • Email
Re: First real game project - current task: load/render level template
« Reply #4 on: July 21, 2016, 11:18:50 pm »
not 100% sure but what you mean, but I've done what I think you say...
string message = "some random dude";
cout << "I'm just " << message;

Mortal

  • Sr. Member
  • ****
  • Posts: 284
    • View Profile
Re: First real game project - current task: load/render level template
« Reply #5 on: July 22, 2016, 01:20:31 am »
cool

it would be nice also, if you add description about your game, like  storyline and game category and ...etc as much as you could.

GameBear

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
    • Email
Re: First real game project - current task: load/render level template
« Reply #6 on: July 22, 2016, 11:38:56 am »
Not a bad idea, I added a muck-up and a style description, sadly there is no story right now, as for me its more the challenge of actually making it...
string message = "some random dude";
cout << "I'm just " << message;

GameBear

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
    • Email
Re: First real game project - current task: load/render level template
« Reply #7 on: July 22, 2016, 04:08:34 pm »
So, current progress since last video:

Added a basic GUI.
Added a life/mana counter that dynamicaly updates (but no real data in it for now) to the gui.
Created a levelData class to handle level loading, collision testing and rendering.
Set bounds for the view and GUI so that if the player travels to the top/bottom/left/right we wont look outside the world.

for now a lot of values are hard coded and needs to be more dynamic. Level data still needs to be encapsulated in a level handler so as to also handle other things than terrain.

here is the video of it:
(notes awesome GUI ;) )

http://youtu.be/JAIgRUFieXY


string message = "some random dude";
cout << "I'm just " << message;

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: First real game project - current task: load/render level template
« Reply #8 on: July 22, 2016, 04:12:22 pm »
Your current step is 4: "add a level handler - render a level from a png - render as RectangeShapes".
Rendering many rectangles to display a level of tiles can be highly ineffecient. You will almost certainly benefit from using a vertex array (or equivalent) for the display of the level. If the level is a strict grid formation, the vertex array tutorial has an example of drawing a simple tilemap. However, maybe Selba Ward's Tile Map could be useful ;)

p.s. As if you posted while I replying. Still, I think my post is relevant. Are you still drawing multiple rectangle shapes?
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

GameBear

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
    • Email
Re: First real game project - current task: load/render level template
« Reply #9 on: July 22, 2016, 04:24:44 pm »
-Snip- 1:
Rendering many rectangles to display a level of tiles can be highly ineffecient.
-Snip- 2:
You will almost certainly benefit from using a vertex array (or equivalent)
-Snip- 3:
Are you still drawing multiple rectangle shapes?
1: indeed, this is only the solution until Texture and sprites are added later, it is simply because it is faster to set up :)

2: true, currently i use a grid system based on the image (more in 3)

3: yes, or that is, i use 1 rect that are moved to the needed position and then drawn. I use a (flat) 3d int array [width][hight][2]
where 2 is set as 1 or 0 in the first space to indicate if anything is there, and the second is used to determine what type.

I know this is overkill, but it is set up to later support multiple different tiles of each type (so that all grass is not the same, but with some variation to it :)

I also intent to implement it so that the level handler will not render any tiles outside the level :)
//Edit: done - in the spoiler is a sample of what i mean...
(click to show/hide)

but thanks for the link, ill give it a look :)
« Last Edit: July 22, 2016, 04:54:33 pm by GameBear »
string message = "some random dude";
cout << "I'm just " << message;

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
3D array? You can store these sorts of levels in a 1D array and it's still as (probably more so) simple to use. You only need to know the width of the level to use it: level[y * widthOfLevel + x]
As for that third dimension, you can use a single integer value to represent if something exists and which type if it does by using a single value (maybe zero?) for 'nothing' and the other values for which type.
As a bonus, map editors like Tiled and Mappy store the tile maps in this way so it's simple to use the maps directly :)
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

GameBear

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
    • Email
-Snip- 1:
3D array? You can store these sorts of levels in a 1D array

-Snip- 2:
As for that third dimension, you can use a single integer value to represent if something exists and which type if it does by using a single value (maybe zero?)
1: yes, i know, and do.. that was what i meant by (flat) 3d array. not sure what else to call it? my arrow looks like so:
Quote
   _xSize = _levelImg.getSize().x;
   _ySize = _levelImg.getSize().y;
   int size = _xSize * _ySize * _depth;
   _tiles = new int[size];
   for (int i = 0; i < _ySize; i++) {
      for (int k = 0; k < _xSize; k++) {
         int Tile = 0;
         if (_levelImg.getPixel(k, i) == sf::Color(0, 0, 0)) Tile = 1;
         
         //Tile can later be 2,3... for sloops, edges... and so one
         _tiles[(k * _depth) + (i * _xSize * 2) + 0] = Tile;
         //the tile set i've drawn have 3 versions of each tile, so determining a random number to make it more seemless
         _tiles[(k * _depth) + (i * _xSize * 2) + 1] = rand() % 3;
      }
   }

2: yes, i could use 0 = nothing, 1,2,3 = ground, 4,5,6 = slope left and so on, I'll consider it :)

*Thanks for all the interest and suggestions, that is awesome and motivating :) :)

*added a video to my previous update, that explains a bit of it :)
string message = "some random dude";
cout << "I'm just " << message;

GameBear

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
    • Email
Aaand last update of the day..

phew.. I've got a lot of things done.
I cleaned up a lot of code (broke it into functions, deleted unneeded double code, rearranged stuff) but i still need some cleaning of all those hard coded values...

please note that the game is not this laggy, but the cam recorder and other stuff is killing my laptop cpu...

I've added colored blocks to show the "randomization" of the ground tiles
I've added Agents that can interact with the ground
added spatial partitioning so that agents only check the closest ground tiles for collision
added jump ability and move
added the ability to shift between 3 different Agents (This is really important for the game-play)

now, a lot of cleaning up to do.. and i have to figure out why my hit test misses the ground at specific places... maybe i need to convert from float to int :S hmm...

any how.. here is the latest video:

http://youtu.be/Nc9zOoV9v2s
string message = "some random dude";
cout << "I'm just " << message;

Mortal

  • Sr. Member
  • ****
  • Posts: 284
    • View Profile
Re: First real game project - task: clean up hitTest code
« Reply #13 on: July 23, 2016, 12:41:24 am »
wow, that's really impressive all those updates done in one day!.

keep up the good work.  :)

GameBear

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
    • Email
Re: First real game project - task: clean up hitTest code
« Reply #14 on: July 24, 2016, 11:35:21 pm »
@Mortal
Thank you, i do what i can, when i can. Mostly i don't work much on code, but that day i had a lot of time, so a lot was done :)

ps. does anyone have a good suggestion for a screen capture program, the one i use lag even at 8% cpu usage (3% for the game, 3% for the cam program 2% for mics others), so not wort much :S (frame rate set between 30 and 60, all lag :S

Next update is here:

1: I've added ladders to the terrain, as i figured their use is heavily tied to my terrain hitTest.
2: Fixed the fall down bug, so items no longer gets embedded into the ground or the walls.
3: added a "head" hitTest, so that you cannot jump up trough the ceiling.
4: added a "auto center" function to ladder
5: again removed a lot of double code
6: added a "focus rectangle" to the character image area on the left, showing what character is active
7: added individual mana and hp to each character (randomized for now)

I think that is is.. next up, textures :D

http://youtu.be/acLkdVyLRKc
« Last Edit: July 24, 2016, 11:42:24 pm by GameBear »
string message = "some random dude";
cout << "I'm just " << message;