Wednesday, October 31, 2007

General steps of a game program

Step(1) Initialization
We need to make standard operations such as creating and initialization of Windows to work, allocating required memory resources, declaration of variables and structures, opening files and loading required data form disks, and other necessary resources acquisition.

Step(2) Main game loop
Enter into the main game event loop which is typically infinite loop until the user gives special signal to exit form that loop and return to Windows. All the major game functions take place within this loop.

Step(3) Retrieve player's input
This takes place inside the main game loop. The game needs to know what player want to do base on the input signals from any input devices attached to the system. Even though there is not player input signal, the game logic need to continue without additional inputs.

Step(4) Perform AI and logics
This is the main part of the game. The new positions of the objects are determined with transformation mathematics, compute ingame artificial intelligence, physics calculations and other logics are computed to render next frame of display whether or not there is player input or not.

Step(5) Render the next frame
The result of the execution of AI and physics according to the player's input are used to generate next frame of rendering. Basically, the rendering is made only on the off-screen buffer (backbuffer) area and then it is transferred to the primary display very quickly to make animation.

Step(6) Synchronization of timing
To control the variation of rendering speeds of the system that depends upon the number of objects displayed on screen, we need to synchronize the frame rate of the animation to the some pre-defined amount.

Step(7) Loop again
After finishing of the rendering of the next frame, the control of the game goes back to the entry point of the main game loop. If player wants to continue the game, the game loop starts again. If the player wants to exit from the game, the loop transfers control to the existing function.

Step(8) Shutting down
This is the end of the game. Before leaving the game, all the necessary clearing of the resources acquired in the initialization step are made. The memory is released from game and reallocated to the system.
--------------------------------------------------
References:
"Tricks of the Windows game programming gurus"
"Introduction to 3D game programming with DirectX9"
"The art of game programming"

Sunday, October 28, 2007

Playing high-end games on low-end PC


There are very good 3D computer games in the market. They use very high-standard and impressive 3D graphics for realistic graphic rendering.
The good thing is that they can take the player into the totally new game world. They can make player forget the real world while playing the game. The bad thing is that they need high-performance CPU (Central Processing Unit) and graphic cards with very good GPU (Graphic Processing Unit). These high-end hardware devices will take lots of money from your wallet or purse. Agree?

So, as I usually don't have much money in my wallet, I searched the way for if I can play some high performance 3D games on low-end computers and laptops. Especially, I wanted to play the game "Resident Evil 4" which is the latest episode of the very famous "Resident Evil" game series made by CAPCOM. But I don’t have very good computer system with graphic hardware such as Nvidia Geforce FX/NX and above or ATI Radeon 9xxxx and above. My computer doesn't even have the memory amount that is recommended by most 3D games. (By the way, I am telling you the truths and don’t look up upon me..!)

I am a lucky guy..! I found the way to play that famous Resident Evil 4 game on my rather old laptop.
Believe me. My laptop only has 1.4GHz Pentium 4 (not dual core) processor and only 512MB of RAM. The graphic system is only built-in Intel 850 chipset graphics. But you may know it as "Intel Extreme Graphics 2". I think the graphic hardware in my laptop is far behind the Nvidia's Geforces or ATI's Radeons. Right?
OK..! I'm going to tell you how I can play the "Resident Evil 4 (PC version)" on my laptop. First, you need to download and install very small program called "3D-Analyze". You can find and download it freely from Internet.

Second, I installed RE4 game program into my computer as usual. (Please don’t ask me where I got that game installer.!). After I had successfully installed the game that I want, all I need to do was to run the "3D-Analyze" program and then point to my game's executable file from my computer using "SELECT" button.
As you can see, there are so many options for setting graphic properties for the game that we want to run. I know the meanings of many options (and I hope you will, too). But for now, I want to tell you only what you need to do to play your game.
Check the option "force SW TnL" before you run your program and that's all. Cool..? Then you can run your game by pressing "RUN" button. TnL means Transformation and Lighting. (I hope you know about that). SW TnL means your game will use CPU to implement these functionalities rather than using GPU. This is useful if your GPU doesn't have HW TnL capabilities.
There are many interesting options in that software to test with your game. For example, if you select "force wireframe mode" option, your game will run in interesting wireframe mode.
I'm not sure that using the "3D-Analyze" is suitable for all games because I haven't tested it with many games. But for me, I can play RE4 in my poor laptop very well and that fulfills my wish. So, as for me I have to thank that small program.
Hay, remember not to expect the graphics that will be seen on the PC with high-end hardware devices. You can play your game, but you have to sacrifice the detailed beautiful 3D graphics and some ingame speed.

Last, I want to make one credit for the guy who gave information about that precious "3D-Analyze" program. He is one of my friends named TONY. Sorry, I can't remember his real Chinese name. (Forgive me for that TONY)!

Saturday, October 27, 2007

OpenGL or DirectX..?


As far as I know, there are two major APIs (Application Programming Interface) for graphics and multimedia programming. Microsoft's DirectX and open source OpenGL.
OpenGL is the industrial standard for graphic programming. It is based on the open source ideas and therefore I think it is "Platform Independent". OpenGL can be applied to Windows, Linux, Unix, Mac and so on. In contrast, DirectX is developed by Microsoft for its famous Windows operating systems.

Before I attend the M.Sc (Digital Media Technology) course in NTU, I thought that OpenGL was far more difficult to program than DirectX. And most of the graphic hardware won't support OpenGL. I thought like that because all graphic hardware (graphic cards) that I used before had DirectX compatible drivers with them but sometimes they did not contain good drivers for OpenGL. Therefore, I thought that OpenGL has less support by hardware than DirectX. However, as I am attending Digital Media courses in NTU, our lecturers use OpenGL very widely and I know that OpenGL is used for many graphics purposes and it is on the same level of DirectX.
But I think the reason for DirectX is more widely used than OpenGL is that OpenGL supports only 3D graphics and DirectX technology has many components in it. May be wrong, I think that OpenGL is best for only 3D graphics and even not very good for 2D graphics and animation techniques. We need to do refinements for 3D to 2D changing to create 2D graphics and animations with OpenGL. But that's what I think.

On the other hand, DirectX has many components in it.
DirectDraw for 2D graphics and Direct3D for 3D graphics
DirectSound for creating sounds
DirectSound3D for 3D interactive sound effects for games
DirectMusic for creating background musics for applications (such as MIDI)
DirectInput for programming various input devices especially for games
DirectPlay that supports programmers for hardware independent network game creation
DirectShow for streaming media playback
and many more. Therefore, it can be said that DirectX has more functionalities than OpenGL. (Can you find a game without DirectX support.?)

But the good thing for OpenGL that I think is OpenGL is more stable than DirectX and it is "open source". DirectX is changing so rapidly than OpenGL. (The latest version as I know is DirectX 10). Since Windows operating systems are widely used all over the world, DirectX technologies also becomes de-fecto standard for game and multimedia programming world. But I think today's graphic hardware contained in many computer systems also support both DirectX and OpenGL APIs.

In my opinion, OpenGL is more widely used for scientific visualizations and simulations tasks. Microsoft's DirectX is used widely in gaming and multimedia industry. DirectX technology is more complicate to install because of its many components. OpenGL is easy and compact to install compare to DirectX.

So, which one is better? I don't know and I can't decide..! As digital media technical person and as digital media programmer, I think I should know and understand both OpenGL and DirectX technologies to enter into the multimedia world.

Friday, October 26, 2007

Thadin Kyut full-moon day


Today is the great and special day for Myanmar peoples especially for Buddhists. In Myanmar calendars, today is "Tha Din Kyut" full-moon day.

It is the festival of lights on the full-moon day, one day before and one day after. Houses and streets in cities and towns are brilliantly illuminated. Pagodas are also crowded with people doing meritorious deeds. It is not only a time of joy but also of thanksgiving and playing homage to teachers, parents and elders, and asking pardon for whatever misdeeds in speech or thought they might have committed during the year, and elders also readily forgive if these is anything to forgive.

In the history of Buddha, Buddha went to the heaven (in Burmese "Nat Pyi") and preached for his mother who is in that heaven. After that, our lord Buddha went back to earth from heaven on this day. Many peoples welcomed back Buddha from earth with lots of lights along his coming back journey.
Therefore, Myanmar peoples light candles and other lighting materials in pagodas and their homes on "Tha Din Kyut" full-moon day. Buddhists go to pagoda and pay homage to our lord Buddha and make wishes. They also make various forms of donations to many places and also do many good things for society aiming at Buddha.
I am very sorry for being away from my motherland on "Tha Din Kyut" full-moon day. I lighted candles for Buddha at pagodas and in my home for many years on this day. But, now I am in Singapore and I cannot light candles with my parents and my relatives together. Anyway, I think I will light candles in my apartment today like previous years.
When I was in Myanmar, I went to pagodas with my friends happily on this full-moon day. We made parties and we also made lightening ceremony with many friends as a group. We went to homes of elders in our relatives and paid homage to them. I remember those happy days very much.

I sincerely wish and pray for my parents, my brother, my relatives and friends from my motherland as well as friends from Singapore to be peaceful, full of their wishes, happy and healthy aiming to Buddha on great "Tha Din Kyut" full-moon day.

Thursday, October 25, 2007

My first experience in programming assignment

As a student of School of Computer Engineering in NTU, my first programming assignment was given by professor He Yin who is lecturer of Computer Graphics subject.
The assignment was to make 3D readnering and transformations using C++ and OpenGL API. Actually, I didn't have any experience on OpenGL programming and I didn't know the ideas and characteristics of OpenGL API. Therefore, I had to read a lot of books and papers to understand OpenGL and to know how to connect OpenGL interfaces with C++ programming language.
The assignment had many parts. To load a given file which contains information for 3D model. To render it on screen using OpenGL and add some transformation operations to it. Finally, I had to add some interaction capabilities for user.
Reading and loading file was not difficult for me because it was pure C++ programming. But I needed to study and learn about OpenGL programming to finish this assignment. I went to professor and discussed with him on weekends. I tried hard for this assignment. I finished it and I could submit it before deadline.
I got many ideas and experiences about OpenGL API by doing this assignment. I also knew about many 3D transformation ideas. Before this assignment, I had experiences only on 2D graphics and transformations.
After I had submitted my assignment to professor, he sent back one feedback email to me. I was very happy for this email because he fully accepted my assignmet. Read the following email...
Hi Thiha
You have done an excellent job in PA1. Your mesh viewer looks pretty good. All the requirements are fully met. Also, I'd like to give you one extra credit for implementing both the transformation of the objects and camera.

Thus, your score of PA1 is 101 out of 100.
You are smart and hard-working, I believe you will do a wonderful work in your dissertation too!

HY
He Yin
Assistant Professor
I got full 100 marks plus 1 extra credit mark for adding extra functionality. Ha Ha. If I knew that he would give me extra marks for extra functions, I think I could add some other extra functionalities to my assignment.
I forwarded this email to my parents. Anyway, this email not only made me happy but also engouraged me to do my dissertation. I will continue my trying hard in my academic works.

Tuesday, October 23, 2007

Our apartment in Singapore

I want to talk about the apartment where I am living and about my friends who are currently living with me in same apartment. Our apratment's phone number is : 64 054 929.
The apartment that we are currently living was hired by my friend Bo Bo Wai Maung who is PR in Singapore. Bo Bo hired our apartment before I came to here. Bo Bo is now working in NTU as a research engineer. I am very lucky because the apartment is very good and very nice. It's better than what I imagined form Myanmar. It has one big living room, three bed rooms, two toilets, one kitchen and one store room. All the rooms are quite big and well enough for all of us. Moreover, it contains one big refrigerator and automatic washing machine. I like our apartment very much because of it's neat, clean, full-furnitured and high standard. We have to manage for ourselves in both physical and mental purposes to live in Singapore.

Again, another lucky thing is that all the friends living in this apartment are very good and kind to me. Three guys are students attending NTU. The other three are working in Singapore. Bo Bo, Ko Thant Zin and Thein Zaw Ko are Engineers who got Bachelor of Engineering degrees form Myanmar. Me, Kyaw Zin Min (Toant Shan) and Ko Win Naung are M.Sc students of NTU. We are from University of Computer Studies Mandaly, Myanmar. Therefore, there are total of six persons in our apartment. Three of us are students and the other three are working in here.

Our apartment has three bed rooms. So, we can live two persons per room equally. Although we all are from different families, we are living here as real brothers. There is no problem between us. We cooked together, we make cleaning of our apartment together and we have our meals together. I am please and happy to live here with them. I feel that I am very luck guy for this case because I know that it is important for us so that all the persons in same apartment have to be equal-minded persons.
Our apartment has cable television connection, Internet access and line-phone systems. As we want to use computers and Internet, we added one wireless router to our apartment and therefore we can access Internet without cables from our rooms.
Another one good thing about our apartment is that it is very near to NTU. Therefore, we don’t have to spend much money to go to NTU during weekdays. I think that's also important to us as students who don't stay in NTU hostels.

Digital media and me...


There is one lucky thing for me in attending the M.Sc course in NTU. Digital media technology is my most interested field. I am very interested all the subjects in this M.Sc course. However, honestly saying, I am not interested in Multimedia Information Management subject because it's mainly related to database systems. But I know very well that multimedia database systems are important in real-world. Therefore, although I am interested very little on this subject, I have to study and try to understand this subject at least for my exam. There are a lot of mathematics in our subjects and this also makes me somehow trouble..!

By attending under School of Computer Engineering in NTU, I got many ideas and theories that I didn't have before for creating multimedia application especially for games. I want to create various game programs. I have a little experience on creating 2D (2 dimensional) games using C++ programming language using Microsoft's DirectX API (Application Programming Interfaces). I like to make animations and interaction functions for players in games. I read ebooks about game programming ideas and techniques. I know that 3D (3 dimensional) graphic programming is much more difficult than 2D graphic programming. 3D graphic programming involves a lot of mathematics than 2D graphics.

The main challenge for me in M.Sc (Digital Media Technology) course is that our lecturers prefer to use OpenGL API for graphics renderings rather than DirectX. So, I have to study about what OpenGL is and its characteristics and how to connect it from C/C++ programming language which is my favourite programming language. I think anyway DirectX is the de-feto standard for creating multimedia applications and games in outside world. But OpenGL is still industrial standard. Therefore, I think I need to study and learn for both APIs. Actually, I know very little about Java and Basic programming languages. I mostly work and study for C/C++ programming. The good thing for me is that the subjects that I took in M.Sc (DMT) major prefer C/C++ programming languages. But I have to learn about .NET technologies and .NET frameworks which is becoming the new standard in the programming world even though I think it is not approved yet.
Although there are many programming assignments given to us by professors, I think I satisfy doing these programming assignments because I am interested on them. This is also important for me to get job/work satisfaction.

If someone asks me "what is your aim after your M.Sc", I have two ambitions, of course. I like to stay in academic field by making further studies in Computer Science fields. On the other hand, I want to be a game programmer in multimedia and gaming industry. So, whatever from those two aims comes to me, I think it will be OK for me. All I need to do for now is to try hard and try smart for my future dreams.

Romantic song with computer graphics...

Every now and then, we find a special friend. Who never lets us down. Who understands it all. Reaches out each time you fall. You're the best friend that I've found. I know you can't stay. A part of you will never ever go away. Your heart will stay. I'll make a wish for you. And hope it will come true. That life would just be kind, to such a gentle mind. If you lose your way, think back on yesterday. Remember me this way. Remember me this way... I don't need eyes to see. The love you bring to me. No matter where I go. And I know that you'll be there. Forever more a part of me, you're everywhere, I'll always care. I'll make a wish for you and hope it will come true. That life would just be kind, to such a gentle mind. If you lose your way, think back on yesterday. Remember me this way. Remember me this way... And I'll be right behind your shoulder watching you. I'll be standing by your side and all you do. And I won't ever leave, as long as you believe. You just believe... I'll make a wish for you, and hope it will come true. That life would just be kind, to such a gentle mind. And if you lose your way, think back on yesterday.Remember me this way. Remember me this way. This way...

The sentences that are important for my life....

(1) Your happiness is your own responsibility.
(2) Purification of mind is the most important thing for buddhism.
(3) Life is very short, so please be purified and happy your mind.
(5) A wise man should have money in his head, but not in his heart.
(6) If you want your dreams to become true, don't sleep.
(7) The most important thing about a goal is having one.
(8) A friend in need is a friend indeed.
(9) If you are patient in one moment of anger, you will escape from hundreds days of sorrow.
(10) Luck comes when preparation meets with apportunity.
(11) If you fail to plan, you are planning to fail.
(12) What you see the world is entirely depends upon how you look at it.
(13) Peace requires the presence of justice.
(14) Change is the law of life. Those who see only past and present is certain to miss the future.
(15) The journey of the thousand miles must start with single step.
(16) Don't go the way life takes you, take the life the way you go.
(17) You are born to live, not living because you are born.
(18) Try smart is better than try hard.
(19) If you want something you never had, do something you have never done.
(20) Don't wait for apportunities, create them.

My first days in Singapore...

I arrived to Singapore on 21st August, 2007. Singpoare is the first forgien country that I go in my life.As soon as I arrived to Changi International airport of Singapore, I knew that this island country is more developed than our native country, Myanmar. For the very early days while I lived in Singapore, the living styles, clultures, foods and speaking languages were very much different and most of the things were amazing for me.
For the frist time arrival of Nanyang Technological University in which I will attend for my M.Sc degree, I impressed on the very big, neat and tidy campus and NTU's service systems. The most impressive places and things of NTU for me are the main library systems, big and cleaned lecturer theatres, research techno plaza and useful online systems.
Currently, I am very please to be one of the International student of Nanyang Technological University of Singapore. I have to try hard to complete my academic courses and dissertation during the given period of time.

My life in ASP...


After I had got B.C.Sc degree form my university in 2004, me and some of my friends from our University of Computer Studies Mandalay joined together and established the small computer training and service center in Mandalay, the second capital of Myanmar. We named our computer center as ASPIRATION.

In 2005, we changed our computer center to ASP (Active Successful & Powerful) and moved to the new place in Mandalay. We taught 1st year to final year students of UCSM and even Honours class students as supporting tuition. We also opened various computer training such as Microsoft Office training, programming trainings, graphic design courses, etc.

My duty in ASP was to teach some subjects related to computer science for junior students. And I worked as computer hardware/software installation and maintenance technician. During the days of working in ASP, I assembled, installed and repaired so many desktop computer systems.

ASP computer center not only supports for students of UCSM, it also service for various computer maintenance, repair and consulting purposes. I worked more than 2 years in ASP computer center until I had to leave it to attend M.Sc course in Singapore. Therefore, it can be said that ASP was one of the corner (or mile stone) in my life. I got many friends and students while I was working in ASP center. My friends and my students were very close to me sincerely.
Therefore although I left my center for my future life, I really suffered from cutting the invisible rope tied between my heart and my pupils and friends. But I thought they won't know that was really hard for me....!

I hope I can meet again with them in near future after I have completed my studying in Nanyang Technological University of Singapore. I also hope that they won't forget me...!

My student life in Myanmar


I passed the 10th standard examination during the year of 1996. This examination is also the entry exam to attend the various universities in our country.

I attend the Yangon Technological University as a part-time student and got the Diploma in Electronics Technology in 1999. This course was two year part-time course. To attend this diploma course, I lived in Yangon for about two years while my parents were living in Pathein. I got only few friends in YTU. These friends were now working in Yangon. In the year of 2000, I entered the University of Computer Studies Mandalay as a first year student. After I have completed three years of academic term, I got B.C.Sc that is same as B.Sc (Computer Science) degree and I also got a chance to attend the Honours class for another one year. I got B.C.Sc (Honours) degree in 2004 and again, I got an apportunity to attend the M.C.Sc course in UCSM. During these academic years, I attended various external training classes for certificates that are related to computer and IT fields.

I think the years I lived in Mandalay as a student of UCSM were the real student-life for me. I got many closed-friends, many teachers. Some of them were not even from my university. Me and my friends went and visited various places as a group. We met and discussed various topics almost daily at my home, teashops, restaurants or my friends' homes. We climbed mountains and visits to famous places of Mandalay together. We studied our lessons together happily in my home or in their homes alternatively. I also got many good and bad experiences during my student-life. I got many good friends as well as some bad friends in my life. Anyhow, I thank some bad friends because I knew about people and their characteristics because of them.

I really really remember the days of unstressed, happy undergraduate student life and my friends from Mandalay, Myanmar.

My feelings upon leaving my motherland...

I was very happy for getting a chance to attend the M.Sc course in NTU. This is my dream and great hope for my life, for my future and for my parents.
However, there were many different feelings in my mind as well as in my heart when I actually left my country, Myanmar. First, I was very sorry for my parents. At the time I left my country, my only younger brother was also in Singapore. Therefore, I knew how my parents felt in their hearts to send their sons to forgien country. I believed that they would feel the feeling of "empty" in their daily life without us.
When our airplane took off from Yangon International airpot, the capital of Myanmar, and I saw the Shwedagon pagoda (the most biggest and famous pagoda in the world), I felt sorry deeply in my heart and I knew that there were some tears in both of my eyes. I am sure that will never forget that feelings in my whole life. These are the first feelings of leaving my motherland that I have been staying over 20 years.


Anyway, one of my teacher told me that "Change is the law of life". That's true..! I have to struggle and try for my future. I understand that I have to give up one thing if I want another thing in differet way. I will try my best in Singapore to fullfill my wishes and my aims.