Weird weird problem with game (Omega Race 2009 for the iPad).

Previous topic - Next topic

Sokurah

Argh, I've lost so much time to this already. It's a VERY weird problem so this will be a long post.

A few days ago I decided to port my Omega Race 2009 remake to GLBasic so I can get it running on the iPad and I've finished most of it already (probably because I've been able to work on it both at home and at work ;)). But now I've run into a weird problem that I just can't figure out.

Early on in the porting process I ported my 'textwrite' function and it worked beautifully and didn't give me any problems at all. Then last night I was working the intro for the game and suddenly the textwrite function started behaving weirdly. I sat with it last night hoping I'd just confused some variables and somehow fooked it up, so I kept tweaking and tweaking and hoping I'd get it right...although it should've been working. It's not the first time I've made a textwrite function after all, so I know what goes into it.

In the end - last night - I decided that I couldn't solve the problem, so I just dropped it and decided to just continue at work today with the functioning version I had there. And it worked...just like it did yesterday.
So all day today I've been working on it - mostly on the menu system, and it's been working as it should. What a relief.

So I did what I always do after a session...at home or at work  - I RAR everything down and put it in my DropBox so I can pick up where I left.
Which I did tonight when I got home. Guess what? It didn't work at home. But it did at work. Gahh!!!

The problem with the textdrawing routine is that instead of drawing the expected characters I get the "unknown" character instead (the one I'm using when the program can't find data for it). For some reason it's usually the second character in a string that it can't find.

First a bit of code, but to be quite honest I don't think it's my code, because it's worked nicely in the original Windows version, in and Binary Land (which I also did in GLB) and in countless other games...until here last night.

To print text I do this; (the ¤ is the copyright character)

VectorFont("ipad",26.5,8.75,RGB(255,80,80),0,1,1,0)
VectorFont("¤(2011) by sokurah - www.tardis.dk", 9, 35, RGB(255,0,0), 0, 0.75, 0.75, 0)

VectorFont("play", 7.8, 7.5, RGB(255,64,64), 0, 2,1.5, 0)
VectorFont("settings", 8.75, 9, RGB(64,64,255), 0, 1.5,1.5, 0)
VectorFont("  credits", 7.25, 10.5, RGB(64,255,64), 0, 1.5,1.5, 0)


(the parameters are: text,x,y,color,rotation,xsize,ysize,not-important)

Now, the strange thing is that if I reverse those two first lines - like this - I get very different results.

VectorFont("¤(2011) by sokurah - www.tardis.dk", 9, 35, RGB(255,0,0), 0, 0.75, 0.75, 0)
VectorFont("ipad",26.5,8.75,RGB(255,80,80),0,1,1,0)

VectorFont("play", 7.8, 7.5, RGB(255,64,64), 0, 2,1.5, 0)
VectorFont("settings", 8.75, 9, RGB(64,64,255), 0, 1.5,1.5, 0)
VectorFont("  credits", 7.25, 10.5, RGB(64,255,64), 0, 1.5,1.5, 0)


Next up are two pictures showing how it looks with the 2 first code lines, then a picture where they are reversed. It's worth noting that although I said it's usually the second character that is fooked up - in the first picture it doesn't seem to be the case where it says 'credits', but it is - because there's two spaces before it, so the # character is actually in the second position. Also note that the copyright message at the bottom doesn't work at all with the lines the first way, but perfectly in the other way.

But when I change those two first lines around I get a lot more "unknown characters" - but the copyright message works...it doesn't make sense.

And please remember that it works perfectly at work, but not on my two computers at home. Sometimes I "only" get this problem...sometimes it just crashes and locks up.  :(

...and if you want a bit more code, then I'll insert a bit of the textroutine at the bottom, but to be honest I think it's somehow a combination of GLB and the hardware it's running on. I would be happy to get some help here.  :nw:





Code (glbasic) Select

//This is used to define the characters allowed, at the top of the program
GLOBAL font$=" abcdefghijklmnopqrstuvwxyz¤0123456789.,?=/-+()':;@!*>#"

//Then a bit of the print itself
FUNCTION VectorFont:str$, x#, y#, col%, ang#, xzoom#, yzoom#, precise%
FOR b = 0 TO LEN(str$)-1
str3$ = LCASE$(MID$(str$, b, 1))
a=INSTR(font$,str3$,0)
IF a<0 THEN a=54//replace unknown char.
//Do the vectorstuff here
x = x + 1
NEXT
ENDFUNCTION

Website: Tardis remakes / Mostly remakes of Arcade and ZX Spectrum games. All freeware. :-)
Twitter: Sokurah

MrTAToad

Looks nice!  Could you provide the complete executable (with graphics etc) so we can run it here.  And, importantly whether we get anything similar here.  By the way, there was a bug in INSTR in a previous version of GLBasic - are you running 9.033 ?

Have you minimised the game window whilst it's loading data ?

Sokurah

I forgot to mention it, but I'm running version 9.040 on all 3 computers.

Here's a Windows executable. It's VERY incomplete, but you'll see right away if it works or not.
...for some reason the 'settings' menu crashes for now...it didn't earlier (and I haven't changed anything).  :sick:

I'm not minimising anything - just pressing F5 and letting the game start.

Edit: Removed link to demoversion.
Website: Tardis remakes / Mostly remakes of Arcade and ZX Spectrum games. All freeware. :-)
Twitter: Sokurah

MrTAToad

I get :

By the way, is :

Code (glbasic) Select
a=INSTR(font$,str3$,0) correct, as the passed string is str$.

The most obvious place to start is, in debug mode, to find out what values are held in str$, a and font$.  It sounds like a is not finding characters, therefore something is wrong with str$ or font$.

If A is >=0 then its time to check to make sure the correct graphic is drawn...

One other thing to try is toggle between the two compiler modes, and delete everything in %TEMP%, or %TEMP%\glbasic if you like storing files in %TEMP%...

[attachment deleted by admin]

Sokurah

How strange...that it seems to work for you.  :doubt:

Quote from: MrTAToad on 2011-Mar-25
By the way, is :

Code (glbasic) Select
a=INSTR(font$,str3$,0) correct, as the passed string is str$.

The most obvious place to start is, in debug mode, to find out what values are held in str$, a and font$.  It sounds like a is not finding characters, therefore something is wrong with str$ or font$.

If A is >=0 then its time to check to make sure the correct graphic is drawn...

One other thing to try is toggle between the two compiler modes, and delete everything in %TEMP%, or %TEMP%\glbasic if you like storing files in %TEMP%...

Yes, it's correct. I'm passing str$ from the function call, then picking out the character I need, by finding its index in font$ and then placing it in str3$
I can't run the program in debug mode. Well, I can, but I only get this;

Quote_______________________________________
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.7.861 SN:9adeaed7 - 2D, WIN32
Wordcount:1802 commands
compiling:

linking:
success
_______________________________________
*** Finished ***
Elapsed: 27.0 sec. Time: 01:18
Build: 1 succeeded.

Start debug session.
_______________________________________
Injection started

All I get is a window the right size, for a brief moment, but nothing actually starts up and I'm returned to the IDE (in debug mode only).

I've just tried deleting everyting in my TEMP folder, but that didn't help.

I've tried using PRINT and write above each character what the calue of A is, and when I get the "unknown" char it's always -1.

My version of MingW isn't the latest version - could that be the problem...is it even needed? (I don't even think I've got it on all 3 computers).
Website: Tardis remakes / Mostly remakes of Arcade and ZX Spectrum games. All freeware. :-)
Twitter: Sokurah

MrTAToad

MinGW isn't needed, but older versions do cause problems, usually only when compiling though.

What operating system are you using ?

LineOf7s

I'm not sure if this is helpful to you or not, but I stumbled across this thread and just for fun I thought I'd download your test file and see what happened.

Downloaded, extracted, run.  Got the screenshot.  WinXP SP3, nVidia Geforce 7300 SE.





[attachment deleted by admin]

Sokurah

@LineOf7s
Yes, that is very useful - it shows it's not just my computer that's behaving weirdly.

@MrTAToad
Yes, let's talk specs. I've tried it on 7 computers now.
It works on the two green ones, but doesn't work on the 5 red ones.

First one has 32bit Windows 7 with a NVIDIA GeForce 9300 GE (plug-in card)

Second one runs WinXP SP3 with an Intel Q965/Q963 Express GPU (onboard). Processor is 3GHz P4.

Third one has WinXP SP3 and a Radeon HD 4670 GPU (plug-in card). Processor is an AMD 4050E (or something).

Fourth one has WinXP SP3 and a NVIDIA GeForce Go 7600 (onboard). Processor is Intel Core 2 T5600 @1.83GHz

Fifth one runs Windows Vista and has a Intel Core Duo T8100 @2.10GHz processor and a Mobile Intel 965 Express GPU (onboard).

Sixth one runs WinXP, SP2 and has a Intel Core Duo T8100 @2.10GHz processor and a Mobile Intel 965 Express GPU (onboard).

Seventh one runs Vista Business, SP1, uses a Core Duo E4600 @2.40GHz processor and has a ATI Radeon HD 2400 XT GPU.
Website: Tardis remakes / Mostly remakes of Arcade and ZX Spectrum games. All freeware. :-)
Twitter: Sokurah

Kitty Hello

debug what the INSTR returns to a text file. That sound much like a bug with buffer overflow or something.

It works fine on my PC (see specs in sig - ATI card - I have to update, wait ;) )

MrTAToad

Its probably time to get all Sweeny on the program, and thus I suggest the following :


  • Upgrade MinGW to the latest version
  • Update all drivers
  • Uninstall GLBasic, and remove program directory
  • Download, install and update GLBasic
  • Try compiling in debug mode

Sokurah

The weirdness continues.

I just took the game and copied the font and linedrawing stuff only, to a fresh project, just to see how a minimal version runs.
Then I ran it on one of the computers that has problems with the full program...and that runs without problems?
...so clearly it's not my code that is the problem (not in the font and linedrawing functions, anyway  :P).

@LineOf7s
What happens if you run this - does it look right or wrong?
http://dl.dropbox.com/u/2697142/OmegaFontTest1.rar

@Gernot
Is there some sort of built-in limitations in the free version?
Also, can you give me an easy way to show on screen how much memory is in use by the program?

Website: Tardis remakes / Mostly remakes of Arcade and ZX Spectrum games. All freeware. :-)
Twitter: Sokurah

Kitty Hello

I have no idea how to get the used memory. Just just a task manager.

There's no limitations in the free version if it does not show "DEMO" in the topleft corner when running. If it does that, your game will end after 10 minutes (you used 3D, networking or a non-free platform then).

Sokurah

Quote from: Kitty Hello on 2011-Mar-25
I have no idea how to get the used memory. Just just a task manager.

There's no limitations in the free version if it does not show "DEMO" in the topleft corner when running. If it does that, your game will end after 10 minutes (you used 3D, networking or a non-free platform then).

Using the task manager it says that it uses 23MB of memory.

And, no, it doesn't use any non-free stuff.
Website: Tardis remakes / Mostly remakes of Arcade and ZX Spectrum games. All freeware. :-)
Twitter: Sokurah

Kitty Hello

ok, fine. Omega font test runs fine here :(.

To test it - can you use the opengl32.dll from the Samples/3D/Shaders directory (that's a MESA software renderer) and put it in the exe directory to test? That way we can be sure it's (not) the driver.

Enigma

I have checked this and it works no problem for me. I have Windows 7 32bit SP1, nVidia GeForce 8800GTX.
Russ Hoy