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

Author Topic: Looking for a VERY simple example of a game in c++/sfml  (Read 25284 times)

0 Members and 1 Guest are viewing this topic.

Dan581

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Looking for a VERY simple example of a game in c++/sfml
« on: April 23, 2013, 07:46:48 pm »
I'm trying to make an overhead rpg in the style of final fantasy 3, I can do it but the code will be ridiculously inefficient, maybe to the point where the game will be unplayable due to lag even, you see, i'm a noob, I've only been coding for maybe a year, in my spare time, so an EXTREMELY simple example of this would help very much. Preferably with just c++ and sfml involved, though I'm open to other things as well, if they're super simple. Using windows, btw.
« Last Edit: April 23, 2013, 07:54:47 pm by Dan581 »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Looking for a VERY simple example of a game in c++/sfml
« Reply #1 on: April 23, 2013, 10:51:16 pm »
I don't see how this would fit into the SFML Projects section, but since we're already here, you should browse a bit more, because there are many games with mostly open source content.
But from what I'm reading it doesn't seem that you really need such examples, but that you don't have a feeling on how big such a project can be. Your biggest problem won't be any performance issues, but they will be to get a decent enough RPG system up and running. Things look so easy from outside, but the inside is where everything gets complex. If this is your first game, then I can only advise you to start with some smaller and way easier games, at best some game clones, after that you can take on different tasks and work yourself towards your RPG. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

santiaboy

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: Looking for a VERY simple example of a game in c++/sfml
« Reply #2 on: April 24, 2013, 03:16:38 am »
Or, for example, instead of making a full RPG, start with the battles. I'm guessing you wanted to make a turn based RPG.

You can pick the mage, the soldier and the archer (for example) and you can pick your opponents (rats, skeletons, or maybe even a dragon) and you fight. The usual: player action, do the math for the HP lost (maybe even use the "miss", and "critical"), then the AI.

And there's where it gets tricky. A good AI can do wonders for your game, whereas a bad AI will probably kill the whole project. Will the dragon attack? Will he use his turn to recover MP and so the next turn he can use his "Breath fire" spell? Will he kill the mage, or maybe cripple (cripple as a status effect, where maybe he can only land half of his hits) the soldier if he's the main character.

And honestly, there are tons of things you can add later. To be honest, while I'm writing this I'm imagining how MY RPG would be like. I love advance wars and fire emblem series, tactical turn based RPG me likes.

To conclude, don't be frightened because of a big project, divide it in sizable chunks and then eat them one by one. :)

foobarbaz

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: Looking for a VERY simple example of a game in c++/sfml
« Reply #3 on: April 24, 2013, 05:36:31 am »
I'm not sure what exactly your coding skill level is, but this tutorial gives you a very good introduction to SFML while also showing you how you should format your code. You should check it out. I'm not sure who wrote it, I literally just found it on Google and skimmed through the code. Looks good.

http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition-The-Introduction.aspx

santiaboy

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: Looking for a VERY simple example of a game in c++/sfml
« Reply #4 on: April 24, 2013, 08:07:02 pm »
I am not really sure, but I think that tutorial uses SFML 1.6, which is an outdated version and you SHOULD NOT USE IT. Again, I'm not really sure, but just in case ;)

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Looking for a VERY simple example of a game in c++/sfml
« Reply #5 on: April 24, 2013, 09:36:17 pm »
PacMan clone?
It's just c++98 and SFML 2.0, compiles easily on Windows and Linux. If you want to know something about the code you can ask, it's not too-too commented but it's quite small, simple and clear.
Back to C++ gamedev with SFML in May 2023

 

anything