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

Author Topic: Blokade [source and binaries now available]  (Read 7359 times)

0 Members and 1 Guest are viewing this topic.

moonfirefly

  • Newbie
  • *
  • Posts: 28
    • View Profile
Blokade [source and binaries now available]
« on: January 21, 2013, 03:57:00 am »
I got far enough to show my work in progress with my simple game Blokade, a falling blocks clone. My goal is to experiment with SFML and learn to make a small game in C++ in XCode.



Right now I'm not able to get the game to run on anything besides the Mac I used to make it. I think the XCode build settings need to be tweaked. I will make a binary available when I sort this out :)

---

Just uploaded Blokade version 0.9.3 with top 5 high scores and top lines. A lot of changes in code but UI is the same.

Github: https://github.com/moonfirefly/Blokade
OSX binary: https://www.dropbox.com/s/ig2cu3qv5usksd7/Blokade_0.9.3_OSX_En.zip
Windows binary: https://www.dropbox.com/s/edy9gpticrk9orj/Blokade_0.9.3_Windows_En.zip

This is probably my last update for this game for a while. I'm starting my next SFML project, a mario bros 1 platformer :) I will upload to github and make binaries available as soon as I get a decent version running.
« Last Edit: February 03, 2013, 09:55:49 am by moonfirefly »
Blokade: Source

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Blokade
« Reply #1 on: January 21, 2013, 04:18:45 am »
Looks quite nice! Good job! :)

... a falling blocks clone.
Are you on purpose trying to avoid calling it a T3TR1S clone? ;D

If you didn't use any OS X-only code, I could probably build a Windows binary for you (if you want to).
« Last Edit: January 21, 2013, 02:11:05 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

moonfirefly

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Blokade
« Reply #2 on: January 21, 2013, 04:31:39 am »
yes I avoided the official name to be off the google radar, but since this project is only for fun it should be fine  ;D it's the first game I thought would be fun to make.

I have an include that is OSX-specific to get the resource path to load images and such, besides that I only use C++ and SFML includes. I have to figure the equivalent for Windows. I think I'll download the Windows SFML install and see what I have to do for the resource path. I think I need a preprocessor define for each OS in that case.
Blokade: Source

moonfirefly

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Blokade
« Reply #3 on: January 21, 2013, 07:46:51 am »
I have found why the binary wasn't working on another mac, the SFML dylib libraries are not compiled in the application bundle. As soon as I installed SFML on the other machine, the game started flawlessly.

I don't think users should have to install the lib to play the games, I think XCode is missing a build setting to compile the necessary dylibs right in the application archive.

but that's for another post..  ;)
Blokade: Source

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Re: Blokade
« Reply #4 on: January 21, 2013, 02:04:40 pm »
Your clone looks nice, well done. I like the overall impression of it.

Quote
yes I avoided the official name to be off the google radar, but since this project is only for fun it should be fine
Thanks to eXpl0it3r, you won't be off the radar anymore. ;)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Blokade
« Reply #5 on: January 21, 2013, 02:11:43 pm »
Thanks to eXpl0it3r, you won't be off the radar anymore. ;)
Not anymore, though I don't get what the problem is with being on 'Googles radar'...
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Re: Blokade
« Reply #6 on: January 21, 2013, 02:15:31 pm »
Quote
T3TR1S
It's not random enough. You have to reverse it, exchange some characters, apply ROT13 etc.

Quote
though I don't get what the problem is with being on 'Googles radar'...
Me neither, probably moonfirefly is afraid of being sued by the Tetris copyright holders.

moonfirefly

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Blokade
« Reply #7 on: January 21, 2013, 04:44:31 pm »
indeed tank, they're not playing but considering the exhaustive amount of clones in the wild, I should blend in  :)
Blokade: Source

moonfirefly

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Blokade
« Reply #8 on: January 28, 2013, 08:06:54 am »
Source is now available: https://github.com/moonfirefly/Blokade
Also link to binaries in the readme  :) you probably need OSX 10.8.2 to run it though.

If someone wants to try to get it to compile and run on windows, that would be cool!

Blokade: Source

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Blokade
« Reply #9 on: January 28, 2013, 01:08:51 pm »
If someone wants to try to get it to compile and run on windows, that would be cool!
Done! See the pull request on GitHub. ;)

And here's a Windows binary: Blokade.zip [2.43 MiB]

On the way I've fixed a few compiler warnings, mainly unsigned vs signed checks. But there are still some warnings that need your attention.

  • In GFXFont.hpp on line 205 and 257 the if statement is always true, because unsigned char is always in the range from 0 to 255. Either remove it or make your intends more clearly. Btw. char is by default unsigned.
  • In GFXMenutItem.hpp you define a few virtual functions; don't you want to make them pure virtual?
  • At the moment you make rarely if at all use of the initialization list. Whenever you create a class, it should be fully initialized after the call of the constructor and to directly initialize member variables you should do this in the initialization list.
  • Your inheritance structure is flawed, i.e. you've derive multiple times from the same base class (sf::Drawable). GFXMenuItem inherits sf::Drawable and e.g. GFXMenuButton inherits GFXMenuItem and sf::Drawable. You should probably rethink your design here.
  • You're also mixing include guard types (#ifdef vs #pragma once) (see GFXBean.hpp), chose one and stick with it or use both everywhere.
  • You should probably use strings more often than char arrays.

Anyways, nice game and I hope you're going to check and accept my pull request, but make sure to read the notes on GitHub first. :D
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

moonfirefly

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Blokade [source and binaries now available]
« Reply #10 on: January 28, 2013, 06:00:01 pm »
wow that was fast! thanks a lot, I appreciate it :) I merged your pull request and the Xcode build still compiles fine, that's awesome.

Yes I'm learning about std::string, I started to use it in the FileAccess class and it's much more elegant than char*. Yes GFXMenuItem is supposed to be pure virtual, I forgot to remove the protected members while refactoring, I'll take care of that.

I did read about initialization lists, probably a better practice than init methods. But llvm complains when I don't provide a default constructor, that's why I used init methods. I see your point about the inheritance, I will look into it.

About the guard types, I saw code examples using both and I thought it was better, I'll take one off.

Great feedback and thanks for the port  :D
Blokade: Source

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Blokade [source and binaries now available]
« Reply #11 on: January 28, 2013, 06:14:11 pm »
I merged your pull request and the Xcode build still compiles fine, that's awesome.
Yeah just saw it, nice! :)

GFXMenuItem is supposed to be pure virtual, I forgot to remove the protected members while refactoring
I meant more that you shouldn't define a body, but simply write e.g.:
virtual void myFunction() = 0;
Which makes the class an abstract one.

I did read about initialization lists, probably a better practice than init methods. But llvm complains when I don't provide a default constructor, that's why I used init methods.
One thing doesn't really have to do anything with the other one. For an initialization list you in fact need a constructor, if it's now a default one or not depends on the purpose of the class.

Btw you should probably edit your first post and add the GitHub link and my Windows binary, so people don't have to search through the posts. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

moonfirefly

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Blokade [source and binaries now available]
« Reply #12 on: January 28, 2013, 06:57:34 pm »
I remember seeing =0 somewhere for virtual functions, now I know what it means. And I have to re-design the way I initialize instances, I'll see what I can come up with.

Done, I modified the first post with the links :)

Blokade: Source

moonfirefly

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Blokade [source and binaries now available]
« Reply #13 on: January 28, 2013, 08:55:56 pm »
I am trying to compile in Windows 8 with the Code::Blocks project, I get a compile error on an Enum not being a class. When I turn on compile for C++11 then I get the error getenv is not in namespace std. Once I remove the std then the project compiles but the game crashes upon execution  :-\ Your binary works fine though. And I have put all resources in the debug bin output directory.

Plus, my executable is 4mb but yours is only 1.2mb. How did you setup your Code::Blocks environment for it to compile with that project? I installed the Code::Blocks from the SFML downloads.
Blokade: Source

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Blokade [source and binaries now available]
« Reply #14 on: January 28, 2013, 09:37:20 pm »
I'm using the official MinGW 4.7.2, Code::Blocks 12.11 and my nightly build for SFML.

Make sure to build in release mode to get a small enough binary size.
I've also linked the runtime lib statically in my binary, but it's not setup that way in Code::Blocks, but I don't think it matters that much.

Yes I've compiled with -std=c++11, but why it doesn't recognize getenv in std:: I don't know. But if it works without, then it's okay I guess.

Btw I'm also on Windows 8.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything