It is currently Sun Dec 17, 2017 3:21 am


Post new topic Reply to topic  [ 15 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: A few compilation fixes
PostPosted: Sun Mar 13, 2011 6:10 pm 
User avatar

Joined: Thu Nov 11, 2010 12:38 am
Posts: 161
Location: Norway
I had to do a few tweaks to get the code to compile under windows:

Line 36 in other_procs.pbi:
Code:
Procedure read_joystick()

Shared joystick_used
   If joystick_used = 1
      ExamineJoystick()
      jax = JoystickAxisX()
      jay = JoystickAxisY()
      For i = 1 To 12
         jb(i) = JoystickButton(i)
      Next
   EndIf

EndProcedure


to

Code:
Procedure read_joystick()

Shared joystick_used
   Protected JoystickID = 0
   
   If joystick_used = 1
      ExamineJoystick(JoystickID)
      jax = JoystickAxisX(JoystickID)
      jay = JoystickAxisY(JoystickID)
      For i = 1 To 12
         jb(i) = JoystickButton(JoystickID, i)
      Next
   EndIf

EndProcedure



Line 36 in keyboard.pbi - the following line is causing an error:
Quote:
EventID = WindowEvent()
[ERROR] At least one window should be opened before using this command.


Maybe WindowEvent() is getting called before the window is properly initialized? I've found no fix so I simply uncommented this part.

Also I'm getting about 10 warnings about use of a deprecated function called CountList()

_________________
Lost Labyrinth Developer
Check out my other game: Egoboo


Top
 OfflineProfile  
 Post subject: Re: A few compilation fixes
PostPosted: Sun Mar 13, 2011 6:37 pm 
User avatar

Joined: Tue Oct 13, 2009 12:06 am
Posts: 270
The window event is needed, well, for windowed mode in windows.
If you play window mode there, game will crash on any window event (move,iconify etc.) else.
Window events should only be read if window mode is on then.
That ought to work then.


Top
 OfflineProfile  
 Post subject: Re: A few compilation fixes
PostPosted: Sun Mar 13, 2011 6:48 pm 
User avatar

Joined: Thu Nov 11, 2010 12:38 am
Posts: 161
Location: Norway
Yep that solved it.

_________________
Lost Labyrinth Developer
Check out my other game: Egoboo


Top
 OfflineProfile  
 Post subject: Re: A few compilation fixes
PostPosted: Mon Mar 14, 2011 12:19 am 
User avatar

Joined: Thu Nov 11, 2010 12:38 am
Posts: 161
Location: Norway
So I uncovered another problem. There are certain graphics (sprites) that are not properly loaded. LostLaby will give me an error and crash while running because of this.

I know for sure that #SPRITE_TILESET_SIGHT for example doesn't load. (I even wrote a small test unit to confirm that the sprite wasn't loaded)
Code:
If Not IsSprite(#SPRITE_TILESET_SIGHT)
  MessageRequester("Debug", "#SPRITE_TILESET_SIGHT not loaded!")
EndIf


There are a couple of others that aren't loaded as well (I haven't found a relation... most of them are the HUD and gui stuff ingame). Others like #SPRITE_TILESET_MONSTER load just fine. Any ideas?

_________________
Lost Labyrinth Developer
Check out my other game: Egoboo


Top
 OfflineProfile  
 Post subject: Re: A few compilation fixes
PostPosted: Tue Mar 15, 2011 4:45 pm 
Site Admin
User avatar

Joined: Mon Oct 12, 2009 2:30 am
Posts: 232
I enountered the same problem with loading the graphics with the linux version of purebasic. We do not use that anymore as we use elice instead.

A nice solution would be to use elice on windows as well.
I got the game already compiled, but encountered errors with the loading of the graphics.

This is what I did:
Code:
How to compile laby on Windows
---------------------------------
1. Download tortoisesvn from tortoisesvn.tigris.org and install it
2. With tortoisesvn check out laby from its subversion directory on sourceforge:
   https://lostlaby.svn.sourceforge.net/svnroot/lostlaby
3. Install mingw from http.//www.mingw.org (Automated installer, mingw-get-inst)
   (Install into C:\MinGW and select the C++ compiler to be installed)
4. Make the gnu compiler executable from everywhere:
   In the Startmenu Rightclick on "My Computer" select System Properties.
   In the advanced tab click on "Environment Variables".
   Change the Value of "Path" and add ";C:\MinGW\bin"
   This requires a restart to work. Or you can do:
   path = %PATH%;C:\MinGW\bin
   in the Commandline to change it instantly.
5. Copy all SDL header files from lostlaby\pb\SDL4Windows_h to C:\MinGW\lib\gcc\mingw32\4.5.0\include
6. Copy all SDL lib files  from lostlaby\pb\SDL4Windows_libs to C:\MinGW\lib
7. Compile the game:
   g++ -lm -lmingw32 -lSDLmain -lSDL -lSDL_gfx -lSDL_ttf -lSDL_mixer -lSDL_image laby.cc -o laby.exe


The problem with the joystick is caused by the new version of purebasic as well. We still use 4.20 on windows where the syntax for the joystick was slightly different. I already put all joystick code in a single routine so that it can be fixed very quickly.
Would also be solved by using the same compiler on windows as well.

Probably the windows event would also be solved by using elice.


Top
 OfflineProfile  
 Post subject: Re: A few compilation fixes
PostPosted: Tue Mar 15, 2011 6:26 pm 
User avatar

Joined: Thu Nov 11, 2010 12:38 am
Posts: 161
Location: Norway
I figured out the problem though. It's the pixel size of the image that PureBasic doesn't like. It seems that for example sight.png which is 1005x1005 pixels is not OK for PureBasic. Changing it to 512x512 makes it run just fine.

I already have tortoise svn and the msvc compiler for c++ so trying elice out might not be that much work.

_________________
Lost Labyrinth Developer
Check out my other game: Egoboo


Top
 OfflineProfile  
 Post subject: Re: A few compilation fixes
PostPosted: Wed Mar 16, 2011 2:19 am 
User avatar

Joined: Thu Nov 11, 2010 12:38 am
Posts: 161
Location: Norway
I worked a little magic and now I can compile and run the game without the help of elice :)

I wrote some code to resize sprites to the size we want them with a smooth resize algorithm. This means we can convert the packed sprite sheets to safe resolution values without affecting how they look ingame. It should work fine on Linux now as well.

_________________
Lost Labyrinth Developer
Check out my other game: Egoboo


Top
 OfflineProfile  
 Post subject: Re: A few compilation fixes
PostPosted: Sat Mar 19, 2011 5:58 pm 
Site Admin
User avatar

Joined: Mon Oct 12, 2009 2:30 am
Posts: 232
I just tried to use the purebasic compiler 4.51 on linux.
It does not work anymore.
I get:
Code:
markus@laptop ~/lostlabyrinth/pb $ ./purebasic.out

(purebasic.out:17358): Gtk-CRITICAL **: gtk_object_get_data: assertion `GTK_IS_OBJECT (object)' failed
Speicherzugriffsfehler
markus@laptop ~/lostlabyrinth/pb $


No clue what causes that.
I also do not like that gtk+ always has to be installed. Even when you do not use any functions for drawing windows and stuff.
I normally use kubuntu with qt stuff only and no gtk installed.
Laby was programmed only to use sdl as dependency but the purebasic guys fucked it up. I told them in the forum and they do not believe me :(
But I can prove it as laby compiles with purebasic 4.20 without any gtk libs!

I would like to continue using elice as we are 100% open source with it.
We have some disadvantages with it, especially as richard had no time lately to continue development. But I think it makes sense to get deeper into the compiler to make things work.
We should not simply drop Elice as its a great piece of software imho.


Top
 OfflineProfile  
 Post subject: Re: A few compilation fixes
PostPosted: Sat Mar 19, 2011 6:11 pm 
Site Admin
User avatar

Joined: Mon Oct 12, 2009 2:30 am
Posts: 232
I just wrote a mail to richard if he could correct the compile error I get with elice right now.
As this should not be too difficult.
And I also would like to have that possibility.
Means that Enumerations could start counting with 1 instead of 0.
Hopefully I will get an answer as he did not reply to the last mails I wrote him :(


Top
 OfflineProfile  
 Post subject: Re: A few compilation fixes
PostPosted: Sun Mar 20, 2011 2:32 am 
User avatar

Joined: Thu Nov 11, 2010 12:38 am
Posts: 161
Location: Norway
Good. LostLaby compiles and runs great on Windows now.

I need to know if it is broken on Linux though as I can't test that myself. I have done some pretty massive changes in various algorithms.

I had to tune down monster spawning by about 50% due to the "correctness" of the new monster spawning algorithm. I also added some code so that there is a reduced chance that low level monsters will spawn deep in the labyrinth.

_________________
Lost Labyrinth Developer
Check out my other game: Egoboo


Top
 OfflineProfile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
GuildWarsAlliance Style by Daniel St. Jules of Gamexe.net
Guild Wars™ is a trademark of NCsoft Corporation. All rights reserved.