SummerOfCode/2012/PortSupertux: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:


Status Report
Status Report
Jun 11th - Jun 17th
This week I spent most time to figure out why the animation failed after changed the game loop to setInterval form. Finally I figured it out.
Here's the call chain from main to the game loop:
main->GameSession::run()->setInterval->main_loop
After setInterval is executed, the program will return from run() and finally exit from main. This return process will modify the global stack base which is also used by other threads. I just comment any code after setInterval. The following animation works:
(1) The tux can drop from the sky onto the land.
(2) The elapse time showing works.
(3) The question mark on brisk shines.
But the tux cannot move now. It seems that the game can not receive event. Supertux uses SDL_PollEvent which is in a while loop. I add printf into the loop and recompiled the code, It's weird that there's no drawings anymore. I'll keep looking.
Jun 4th - Jun 10th
Sorry, this week has no update. This is my final week in graduate school, I spent all the time preparing for theise oral defense. I'll compensate by pay more efforts in following weeks.


May 28th - Jun 3rd
May 28th - Jun 3rd
Line 26: Line 48:


After doing this, the picture still dosen't move. I'll figure it out.
After doing this, the picture still dosen't move. I'll figure it out.


May 21st - May 27th  
May 21st - May 27th  

Revision as of 14:11, 17 June 2012

This project is going to port Supertux to web by using Emscripten, a C/C++-to-Javascript compiler.

Status Report

Jun 11th - Jun 17th

This week I spent most time to figure out why the animation failed after changed the game loop to setInterval form. Finally I figured it out.

Here's the call chain from main to the game loop:

main->GameSession::run()->setInterval->main_loop

After setInterval is executed, the program will return from run() and finally exit from main. This return process will modify the global stack base which is also used by other threads. I just comment any code after setInterval. The following animation works:

(1) The tux can drop from the sky onto the land. (2) The elapse time showing works. (3) The question mark on brisk shines.

But the tux cannot move now. It seems that the game can not receive event. Supertux uses SDL_PollEvent which is in a while loop. I add printf into the loop and recompiled the code, It's weird that there's no drawings anymore. I'll keep looking.


Jun 4th - Jun 10th

Sorry, this week has no update. This is my final week in graduate school, I spent all the time preparing for theise oral defense. I'll compensate by pay more efforts in following weeks.


May 28th - Jun 3rd

Continue to fix problems when run the compiled page in broswer.

(1)Implement the missing SDL function SDL_GetKeyName in Emscripten.

SDL_GetKeyName is used in drawing text when user setting new control key bindings.

(2)Fix the no drawing problem.

I found that when linking llvm found the definition of SDL_Rect from the system header, which include uint16 element. But when running, the code to read SDL_Rect treated element in SDL_Rect as uint32, which was defined in Emscripten's SDL header files.

LLVM should use the Emscripten's header files instead of the system's. This is caused by the configure script of Supertux, which use /usr/bin/sdl-config to find the header files, while the emconfigure right now cannot affect the behavior of sdl-config.

I removed the sdl-config part in configure, but there was several compiling errors. This is because Supertux use SDL 1.2, while Emscripten use SDL 2.0. After a little modification to the supertux source, the compiling errors gone. The modification include:

a. remove alpah element from struct PixelFormat

b. change SDL_GetKeyState to SDL_GetKeyboardState

(3) Change the game main loop to ansychronized form in javascript.

After doing this, the picture still dosen't move. I'll figure it out.


May 21st - May 27th

I'v compiled the supertux to a html. And I'm going to run it in broswer and fix any problems met during this process.

(1)Fix page stuck caused by audio format.

Supertux contains MOD format audios which are not supported by the current HTML5 audio. This problem is solved by converting the audios to ogg format.

(2)Fix page stuck caused by IMG_Load.

Emscripten's IMG_Load implementation seems buggy, as it will trim the leading "/' of an absolute path of the image. I just commented the code, and this stuck disappeared. I'll talk to Alon about this problem.

(3)Fix page stuck caused by missing SDL functions in Emscripten.

a. Mix_ReserveChannels: I just commented the code in Supertux.

b. SDL_WM_SetIcon: commented.

c. SDL_Joystick*: commented.

d. SDL_GetKeyState: similar to SDL_GetKeyboardState, implemented.

e. SDL_GetVideoSurface: just return the SDL.screen, implemented.

After doing this, the html page now can run into the game main loop, and background music plays well. But still has no pictures, as there's still some SDL functions not implemented, and the main loop is not yet changed to javascript setTimeInterval form.




Status report before May 21st will be added as soon as possible.