Results 1 to 10 of 13

Thread: Help SDL behaves strangely...

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Hmm and then I should put the events that happen at the end of the game (not when SDL quits, I could still need it for a nice scoreboard or something like that) inside the main loop in a conditional and check if the game has ended each time the game loops? Still sounds logical and it also helps to avoid some unexpected errors I think. So thanks again. You guys help me a lot I'm very grateful for that. This way this game will be finished in no time and I can start another and then another and each one more difficult so I might get better and have less basic questions like this It's just both SDL and OOP are yet new for me. Object orientation is half-new(there was something that could almost be called similar to object orientation in Game Maker) Or after this game I might study a bit of Delphi it seems useful. Maybe more useful than FPC.

  2. #2
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    You will eventually want to make a game state/mode variable to keep track of what state your game is currently in too. ie Intro screens, main menu, in-game play mode, in-game pause mode, end game credits and so on. You'll have to determine for yourself what you need based on how you organize your code. But do organize it so that it's easy to come back to later. It make later development and updating older projects so much more easier when you took the time to comment and keep your code orderly.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  3. #3
    Oh I wonder why I haven't thought about that since my complicated games were structured like that in Game Maker too except for that I didn't make state variables but jumped to different rooms it was easier that way. Now it's the same concept just a bit different method. And I always keep my code in order. Mostly it's because me and my friend occasionally show each other our programs and we must write them in a way easy to understand for the other too. So usually it is full of comments and I go one tab inside after every begin or repeat.

  4. #4
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Game state is usually quite a good way to go for complicated games... I found that making a game without procedures or functions (only one big main begin end. statement) with no records or anything is impossible. I got around 2,260 lines in and then found sustainability was impossible. And that without graphics since it was meant to be like nethack (hehe).

    Reading this thread though, makes me want to step back out there and get to game coding once again though. Maybe more work on the libraries I made for RPGs? Or perhaps on the one I started for Mario style platformers? Oh, and of course I'll keep throwing more lines at prometheus. Although now I think of it, you aren't Lazarus or Delphi are you? From those that use it I hear it's really great. As for my Prometheus suggestion, although its quite new, its event handling is (I find) quite useful. I've just started writing the documentation for it, so you would probably be able to either use the full core unit, or just svn the source code and take what you need. Thats what its there for after all.

    Sorry for the long post, but hey, hope it helps.
    code_glitch.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  5. #5
    it's not long at all and thanks for it. I used to use Turbo Pascal at the very beginning of my "pascal carreer" but that just sucked in several ways so when I had started this again(about a month ago) my friend suggested me Free Pascal. And not long after that I found this site where I also found out that this SDL is compatible with Free Pascal so that seemed a comfortable way to go. I will look at your Prometheus game but now I am going to have the most useless class ever "Learning Methods" (in a Medical University) Fortunately this is the last class in the semester(and at all since this course is just 1 semester long) and I get 1 credit for it so now for the following 6 years I only have to get 359 more to get my degree.

  6. #6
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Well, good luck with your class. And the purpose of Prometheus was to make video, sound, event handling and all that even simpler than sdl without limiting flexibility too much. On the whole it's worked so far but I'm overhauling it (its on the main thread here: http://www.pascalgamedevelopment.com...s-Game-Library ) if you're interested in it. The new updates I'm putting forward to it are the first drafts of audio, the new event handler data types and improving performance of the video unit by switching from code that uses SDL to hardware accelerated OpenGl, its due out later this week/early next week, but again its a work in progress and I've only just started writing the documentation. So I wouldn't recommend basing your entire game on it, just grab what you need from it since the code isnt mature yet.

    Well, better get cracking. First lunch and then onto some code. Hey, its my holiday, whod've guessed it? I get more work done on holidays in general though since I dont have stupid GCSE work...
    cya,
    code_glitch.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  7. #7
    Oh well thanks. I will really look at what it is about. By the way. Since this problem has been solved the thread can be closed I think.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •