It is not the PPXL sithe what is confusing you but the sheer lack of proper knowledge about what FreePascal and Lazarus are. You See FreePascal and Lazarus are actually two separate projects (programs) where:
- FreePascal is actually a combination of Compiler, Debugger and Linker
- Lazarus is just a development IDE which makes use of FreePascal much easier and also allows some other features similar to the ones found in Delphi like visual UI design using LCL component suite.
I believe author of PXL decided to go that way in order to make maintaing support for both FreePascal and Delphi much easier as they can share same codebase.
I haven't checked the PXL yet but I assume some of these samples might be still left from its predecessors (Asphyre Sphinx).
The TMultimediaTimer is a lot different than the regular TTimer that ships with Lazarus or Delphi for that matter. If you look at it in object inspector you will notice that it has two events. One is OnProcess and one OnTimer.
OnProcess event should contain all in-game logic code like character movmements, simulation processing etc.
While OnTimer event is actually used only for rendering.
You can control when each of these events is fired by using Speed and MaxFPS properties. Where Speed property defines how often is game simulation being updated and MaxFPS defines what is desired screen refresh rate.
Now the TMultimediaTimer also contains special mechanism which is able to detect if your rendering call had take too much time so that game simulation should already been updated before rendering was done. In that case OnProcess event will be fired twice in a row to allow your simulation to catch up the lost time.
I strongly recommend reading the official documentation as I don't remember seeing any proper example of fully using these features.
As I mentioned above that is not the case. Unlike regular TTimer the TMultimediaTimer is much more complex. And the reason why it is using Application.OnIdle event is to gain maximum possible resolution without interfering with standard application messaging system.
There are only two way of doing this.
One is avoiding any lengthy heavy calculation or at least having ability to split that lengthy calculation into multiple steps.
Second one is implementing multithreading support where you can move such calculation to secondary thread/s. I haven't tried implementing multithreading in combination with TMultimediaTimer but I'm sure it can be done to some degree (no true asynchronous processing of graphics and game simulation). But if you really do need something like you can find Multithreaded Timer on the web.
As a game developer you will have to learn on how to make an efficient code. While in business applications it is perfectly acceptable for some lengthy processing to take up to 5 seconds or even more if you show a nice looking progress bar
in game development any such lengthy processing is already considered as serious game lag. That is in case of turn based games while in case of real-time paced games this is already considered as game hang.
So yes in a way game development is much harder than business development. But don't let that discourage you. Instead take it as a personal challenge as it will make you a better programmer in the end. At least that is my opinion.
You just have to believe in yourself. You would be surprised of how much you can achieve.
And BTW I'm only 6 years older than you. So we both have still lots of time for learning even thou sometimes learning speed can be a bit slow due to not having much free time to be used for programming.
I'm sticking with this for 15 years already (last 7 years more or less focusing on learning about game development) even thou sometimes it seems I'm not making any progress.
Just remember that there will be days where you would be as we programmers like to call it "in the zone" when you will do a lot of progress. And there would be days where you would just spend whole day banging your head around a single problem without any success.
You see programming is not like any other work it is more like art. During good days you will make huge progress and during bad days you won't. You just have to accept that and live with it. And most importantly don't quit even when it seems that there are no good days coming.
Bookmarks