PDA

View Full Version : Object Pascal port of "Managing Game States in C++"



cragwolf
25-03-2005, 05:18 AM
Hello,

I have ported to object pascal the source code accompanying this article:

"Managing Game States in C++" by Tony Lewis
http://tonyandpaige.com/tutorials/game1.html

You can download my port from here:

http://www.urbanaustralia.org/cragwolf/statemanpas.tar.gz

(24 KB)

I have only tested it with FPC v1.9.8 and JEDI_SDL v1.0 (Beta 1) on Linux. But I see no reason why it shouldn't work on Windows with FPC or Delphi (apart from some minor changes). I compile it with: fpc -Mobjfpc -ostateman main.dpr

If you have any questions about it, just email me.

cragwolf@yahoo.com

WILL
25-03-2005, 08:43 AM
Oh, excellent work! :)

I wonder if you would mind if I put it up on the library as a 'locally hosted' library Item? We need more articles like this for Pascal online.

Keep up the good work. ;)

savage
25-03-2005, 09:47 AM
Great work! You should also ask the writer of the article to add a link to your Object Pascal download.

cragwolf
25-03-2005, 12:04 PM
I wonder if you would mind if I put it up on the library as a 'locally hosted' library Item? We need more articles like this for Pascal online.

Yes, by all means go ahead. I would like to see more source code examples on this web site, but I know you have limited space.

[quote="savage"]You should also ask the writer of the article to add a ]

In fact, he suggested exactly that when I asked his permission for making the port public. So expect it there soon.

WILL
25-03-2005, 12:26 PM
Hmm... you know something. I didn't even notice that you only translated the source not the article. See to list it in the Library section it'd need to have the article translated into Pascal or at least Peseudeo code aswell. Who wants to read articles about doing things in C++ here, right? :)

cragwolf
25-03-2005, 03:37 PM
Hmm... you know something. I didn't even notice that you only translated the source not the article. See to list it in the Library section it'd need to have the article translated into Pascal or at least Peseudeo code aswell. Who wants to read articles about doing things in C++ here, right? :)

I believe that the only two concepts from that article that Object Pascal programmers will need extra explanation for is: the STL vector type, and the Singleton pattern. Each concept would probably require a seperate article. So, that would make three articles just to explain one idea: the game state idea. This is work that I'm too lazy to do. :)

My Object Pascal implementation of the Singleton pattern comes entirely from here:

http://www.skybound.nl/articles/delphi-singleton/

My Object Pascal implementation of an STL vector I did myself, but it leans heavily on the TStack class (found in contnrs). All I really added was the stack freeing its objects, and also I derived an ancestor, TGameStack, which makes the code cleaner (no typecasting required).

I hope that users will find my source code easy to follow. If not, I can add some more comments. But they will learn more by reading the original article and the article I mentioned earlier in this post.

If you can't list it in the Library, that's OK, we have this thread. Maybe you should implement a source code section, where users can submit links to their source code, along with a short description of what the source code actually does.

In the coming weeks or months I may post some more source code, as I wrestle with the construction of my game engine. I have decided that creating good game engines (e.g. Unreal) is the most technically advanced problem that human beings have ever tackled (*). Thus, even a mediocre engine is incredibly hard work. Oh the pain in my brain! :wink:

(*) Well, perhaps inventing a successful quantum theory of gravity is slightly more difficult. Only slightly.