Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - FutureCow

Pages: 1 2 [3] 4 5 ... 10
31
I can't find it documented anywhere that it shouldn't work, nor can I find any posts about it.
Trying the following code (compiling it as a console program) you'll see that the key() commands aren't working

Console version

Code: (glbasic) [Select]
STDOUT "Press 1 to be server\n"
STDOUT "Press 2 to be client\n"

WHILE Done=0
IF KEY(02) = 1 // pressed 1
STDOUT "Server\n"
DEBUG "Server-debug\n"
ELSEIF KEY(03) = 1 // pressed 2
STDOUT "Client\n"
DEBUG "Client-debug\n"
ENDIF
WEND

Non console version to compare it to
Code: (glbasic) [Select]
WHILE Done=0
PRINT "Press 1 to be server\n",0,0
PRINT "Press 2 to be client\n",0,20

IF KEY(02) = 1 // pressed 1
PRINT "Server\n",0,30
DEBUG "Server-debug\n"
ELSEIF KEY(03) = 1 // pressed 2
PRINT "Client\n",0,40
DEBUG "Client-debug\n"
ENDIF
SHOWSCREEN
WEND

32
I'm putting this here in case someone has the same problem at some point.

I have been running two copies of my program simultaneously - one a client, the other a server. Once I started the client, the server would seem to freeze and the screen would be blank when I swapped back to it. To close it I had to force close the program (it. it went into "this program is not responding" status).
Similarly if I swapped to running the client then the server, the client would "freeze".
The problem was a actually rather obvious - the code was looping waiting for a particular response from the other program, and wasn't doing a SHOWSCREEN (as I had stupidly assumed the screen would still populated from the previous SHOWSCREEN when I wrote that bit of code). As I found in another post, SHOWSCREEN does more than just show the inactive buffer, and without it you have trouble closing windows.

So if you have this problem, check you're updating the screen with SHOWSCREEN's even when you don't think you need to.

33
Network / \0 terminated SOCK_RECV command
« on: 2010-Jan-21 »
The original SOCK_RECV() would chop your messages up nicely by stopping reading when a '\0' was read.
This was changed after I found I couldn't transmit binary files due to \0 characters through them.

Now I've found I could really do with two versions of the SOCK_RECV command.
1) The current one that will read \0 as part of the stream (for binary transfers)
2) One that terminates at \0 for non-binary transfers (i.e. the way SOCK_RECV used to work)

Currently if you send something like
Code: (glbasic) [Select]
SOCK_TCPSEND([socket],"SetLives=1")
SOCK_TCPSEND([socket],"SetLevel=14")
SOCK_TCPSEND([socket],"ResetHighScoreTable")

then do a
Code: (glbasic) [Select]
SOCK_RECV([socket],LivesString$,1023)
SOCK_RECV([socket],LevelString$,1023)
SOCK_RECV([socket],ResetString$,1023)
InputString will contain "SetLives=1SetLevel=14ResetHighScoreTable" and LevelString$/ResetString$ will probably be empty. And it's not always consistent that all the output will be in the first SOCK_RECV() output as it depends on the timing when you run the SOCK_RECV command.

Having a new command that terminates on the '\0' means I could do 3 separate SOCK_RECV() calls and get each parameter and its setting separately for processing. Without it, I'm currently having to do something similar to the following (this is just an example, mines slightly more efficient)
Code: (glbasic) [Select]
Server
=======
SOCK_TCPSEND([socket],"SetLives=1")

Client
======
while Message$=""
    SOCK_RECV([sock],Message$,1023)
wend
if Message$="SetLives"
    SOCK_TCPSEND([socket],"Acknowledged")

Server
=======
while Message$=""
    SOCK_RECV([sock],Message$,1023)
wend
if Message$="Acknowledged"
    SOCK_TCPSEND([socket],"SetLevel=14")

[...]
and so on which wastes time waiting for acknowledgements and causes excess network chatter, or some really annoying string manipulations to strip each different length string off the network stream.

34
I'm currently testing my board game's network mode and I'm trying to get all the bugs out of my code.

I'm running the "server" version of the app on one pc (no GLBasic, just running the .exe), and the "client" on the pc running GLBasic in debug mode.

The server stops after a couple of seconds if it doesn't get the right responses from the client (I've set up challenge/response communication to tell the client when to progress). Once the server has stopped executing though, my client (currently) sits in a loop checking for network messages and attempting to process them. After the server has stopped itself, any time the client runs a SOCK_RECV it is not returning a -1 length for error. Instead it's returning 0, and a GETLASTERROR command straight after the SOCK_RECV is returning Error : 0000 success.

My understanding is that SOCK_RECV should return -1 if there's a problem reading from the socket - and I think the socket closing would count as an error  :)

It's getting too late to write a test program here, but I'll try to write one tomorrow if noone has replied with a solution to catching the network dropout.

35
Network / Command to return MY IP address
« on: 2010-Jan-20 »
I can't figure out a way to know what my IP address is. Can you please provide a command to return it? (assuming I'm not overlooking some easy way to do it).


36
Very limited time birthday sale : pay what you want (as little as $0.01US) for crayon physics deluxe (winner 2008 Independant Games Festival). Normal price $19.95US
http://www.crayonphysics.com

37
I've found that with a project with multiple files in it, if I try to remove several one after the other, I can only remove one or two then I can't remove any more. If I then go and open one of the source files in the project, I can remove another one or two before I can't get rid of them again.

I had just had a crash (http://www.glbasic.com/forum/index.php?topic=4052.new#new) which may have corrupted something in GLBasic though other than just my gbap file.
I've tried it on two projects and found the same problem.

I just found it may only happen if you right click the file to delete then click delete it. If you left click to select the file, then right click to bring up the menu it works.

38
I never used to have problems prior to 7.230, but now I'm finding I'll be intermittantly running my code in debug and get a "program has done something unexpected and needs to close" type error.
The last one just corrupted my gbap file (it's looking for all my files in "d:\game projects" rather than "d:\game projects\battleship" and as a result can't find any files).
It's not frequent enough to pinpoint an exact problem so far, but I'll be interested to hear if anyone else is having issues.

39
GLBasic - en / Antialiasing(?) problem
« on: 2010-Jan-10 »
I have a 32x32 texture (right hand side of the image - resized to make it easily visible). It's saved as a 24bit png, but there's no alpha data, it's just a plain 3 colours.

I've created a 3D object (just a quad) as follows
Code: (glbasic) [Select]
O_GridHitMiss=GENX_OBJ()
X_OBJSTART O_GridHitMiss
X_OBJADDVERTEX   0, 0, 1, 1, 0, RGB(255,255,255) // Create quad
X_OBJADDVERTEX   0, 0, 0, 1, 1, RGB(255,255,255)
X_OBJADDVERTEX   1, 0, 1, 0, 0, RGB(255,255,255)
X_OBJADDVERTEX   1, 0, 0, 0, 1, RGB(255,255,255)
X_OBJEND

When I texture it with the image, and display it on screen
Code: (glbasic) [Select]
X_SETTEXTURE T_GridHit2, -1
X_MOVEMENT XLoop, 0, YLoop
X_DRAWOBJ O_GridHitMiss,0

I get the awful greeny colour around the edges of the "2". Anyone have any ideas how I stop that happening?

[attachment deleted by admin]

40
If your program ends successfully (for example you hit ESC to quit it), the debug tab's information isn't updated to show whatever values the variables contained on the program's end.

Also on an error, the information isn't updated - if your code hits an "Out of DIM array" error, the information in the debug tab doesn't get updated.
e.g.
Code: (glbasic) [Select]
GLOBAL b[]
LOCAL a

a=4
DIMDATA b[],1,2,3

DEBUG "b[a] = "+b[a]+"\n"

This is a pain if, in the above example, you were setting the value of "a" via a loop and wanted to know what value it was hitting when it exceeded the array bounds.

41
I just thought of an idea that might solve a lot of the bugs people have.

What do you think about making all the load commands (LOADANIM, X_LOADOBJ, X_OBJSTART, GRABSPRITE, LOADFONT etc) not work with ID = 0 ?

My justification :-
As a variable's value defaults to 0 on creation, when you forget to assign a value to your variable (or you have a bug somewhere in your code, or even just a typo in the name of the variable) your code will end up creating/loading over the top of object 0. You then have to work out why an object you haven't touched now has a funny texture or wrong image, or an unrelated sound has changed. If object 0 doesn't get seen much (or heard much if it's a sound) it can be a while before the bug shows itself and it can be a pain to track down. If the load/creation commands only worked for locations 1+ then I think you could stop a lot of bugs before they even happen.

With this, you'd need the GEN... commands to start at 1+ too. Actually, just changing the GEN commands at 1 without the other changes would probably solve a lot of issues (though I think changing all the commands would be better).

I realise this would break existing code, but I think the benefits (from this point forward) would outweigh the issues. What do you all think?

42
Network / SOCK_RECV manual entry change
« on: 2010-Jan-08 »
I think the manual page for SOCK_RECV is confusing and would like to see a change similar to the following.

Change
Quote
The return value could mean:
-2 : a non blocking socket is not ready to be read and would block. Try reading from that socket a bit later.

to
Quote
The return value could mean:
-2 : there are no network messages currently in the queue waiting to be processed. Try reading from that socket a bit later.

As it is currently written it's not clear how you determine whether there are network messages waiting to be processed or not.

43
IDE/Syntax / Replace in files
« on: 2010-Jan-06 »
The ability to "Replace in files" (as opposed to "Find in files") would be really handy.

44
I would've thought a white ambient light would really light up my scene. Why though do I get the following results? You'll see a screenshot of the same scene from my game - firstly with only an x_ambient_lt 0, rgb(255,255,255) ambient light scource, and then the scene with no lighting at all (ie. no x_ambient_lt or x_spot_lt commands).

Why is my scene with a pure white light ambient light darker than the one without any light source at all?


[attachment deleted by admin]

45
Off Topic / Help with 3D Models!
« on: 2009-Dec-21 »
Hi All!
This is for my competition entry so I'll understand if offers for help go strangely quiet   =D

I'm having serious trouble with my ship models for the game (Battleship). I've designed my models and they look fine in my model application (Doga - i.e. 3D for dummies!  :-[) Trying to convert them for GLBasic though is driving me nuts!!!

No matter which application I use -  Doga, Metasequoia, Deleg3D, Anim8or, Wings3D, Blender (and note, I don't know what I'm doing with just about all of these!) I cannot get a UV texture map that doesn't overlap all over the place for my models - and I can't work out how to fix it. All I'm trying to do is colour my model and have all the lines of the model showing.

So if you're an expert in [insert 3D modelling application of your choice here], know how to turn not very complex (<2000 polygons at a guess?) models into useful uv texture files that I can draw all over, and are happy to lend what will hopefully be just a small amount of your time to get your name in my game's credits - please let me know!

I'll update this post when I get home with a link to the models mine are based on so you can see how complex they are.

Pages: 1 2 [3] 4 5 ... 10