Menu

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.

Show posts Menu

Messages - BdR

#286
:offtopic:
I work at a company that makes clinical research software and we had some extra work so we hired a freelance worker for 6 months for two projects. We work with a default framework (that we developed) it contains a lot of default screens, like inputscreen, codes-screen etc. because this really speeds up development. It also contains an about-screen that automatically shows the project name and version etc. You can also add a "programmer" string so that the aboutbox will display "programmed by J. Smith" for example.

Halfway through the project I told the freelancer "you can add your name on the about-screen", he was reluctant "oh no, I don't want my name there" but then he did put in his name. Then after he left I saw that he changed it to only his initials (for example "J.S.") I thought this was weird, why would you not take credit for your work?

Maybe a weird question, but do you always take credit for the software you write (in a credit screen, aboutbox or any other notice)? And if no, then why not? I know I always wan to take credit for any big project I work on.
:enc: thank you, yes I wrote this fantastic piece of sofware ;)
#287
A few years back I sometimes played "Titan Attacks" and I recognished the graphics style immediately. It's kind of like pixelart but distinctively different.
#288
Hi all, I have a question. I want to have a bullet follow a path from a start position to a goal position in a certain nr of steps. And when it reaches the goal position, it should do a hit check etc. But I can't get the compare of 2 floating point values to work. Here is an example code.
Code (glbasic) Select

SEEDRND GETTIMERALL()
WHILE (KEY(0) = FALSE)
  DEBUG " -- start test --\n"
  Test()
WEND

FUNCTION Test:

  // variables
  LOCAL iStep%, iCount%
  LOCAL x#, y#, xGoal#, yGoal#, xSpeed#, ySpeed#

  // start at bottom of screen
  x = 320
  y = 480
 
  // goal is random position at top of screen
  xGoal = RND(640)
  yGoal = RND(100)

  // set speed so that block moves from start to end in exactly 60 steps
  xSpeed = (xGoal - x) / 60.0
  ySpeed = (yGoal - y) / 60.0

  // do the steps
  iCount = 0
  WHILE (iCount < 100)

    // draw block and goal
    DRAWRECT xGoal, yGoal, 4, 4, RGB(192, 255, 0)
    DRAWRECT x, y, 8, 8, RGB(0, 192, 255)
    SHOWSCREEN

    // update all
    x = x + xSpeed
    y = y + ySpeed
   
    IF (x = xGoal) AND (y = yGoal)
      DEBUG "GOAL REACHED!\n"
    ELSE
      // goal not reached, check if close to goal
      IF (ABS(x - xGoal) < 10) AND (ABS(y - yGoal) < 10)
        DEBUG "Positions are NOT equal. x=" + x + " y=" + y + " <> xGoal=" + xGoal + " yGoal=" + yGoal + "\n"
      ENDIF
    ENDIF

    iCount = iCount + 1 // to stop WHILE loop
  WEND

ENDFUNCTION

So the code does the following:
1) divide length of path into 60 steps
2) increment start position with steps of divided length
3) check if goal position is reached

The check if x=xGoal and y=yGoal is almost never true (on rare occasions it is). I guess this is due to limited precision of floating points, causing the end result to being slightly off. For example the goal position is (123, 456) but the incremented result is (123.0003, 456.0001) or something like that. So I think you will run into the same problem when working with C or Java etc. not just GLBasic.

But it's strange because the debug output is for example this
Positions are NOT equal. x=116 y=34 <> xGoal=116 yGoal=34

I can add an iSteps variable and simply count the nr of steps. But my question is, what is the best way to check if the goal is reached using float variables?
#289
I have a question for the iPhone developers, where did you find the graphics artist for your games? Looking at some of the games such as Birdie In Trouble (by Ozden79) or Exodus (by fjsantosb) or DefCon Z (by kaotiklabs), they've got some nice artwork.

I'm nearing completion with one of my game projects and I've started looking for cartoonists/illustrators in the area of my hometown, but I'm not sure this is the best way to go.

I guess I could try to contact someone through a website like deviantart, they've got some GREAT artwork on there :nw: But working via e-mail/chat, never meeting face-to-face seems kind of weird to me. Also, what would be an estimated price range for, let's say, three A4-size drawing/illustrations with or without color?

Any thoughts on this?
#290
I'm having trouble erasing a section from an ini-file.

I save the current gamestate to an inifile, so I can reload it at next startup. After it has been reloaded it needs to be removed from the file. So wanted to erase my "savestate" section using the INIPUT command. But this doesn't seem to work properly, it looks like a bug.

For example, my settings.ini file contains this:

[gamesettings]
x=4
y=4
[customsettings]
sound=off
[savestate]
level=2
time=831
moves=4


And when I run the following GLBasic code, the section is not removed from the ini-file. The filedate of the ini-file isn't even changed, so it looks like it's actually not doing anything.

Code (glbasic) Select

  INIOPEN PLATFORMINFO$("DOCUMENTS") + "/settings.ini"
  INIPUT "savestate", "", ""
  INIOPEN ""
  // nothing has happened, savestate section still exists


However, when I first change one of the values in the section and then erase it, then it does work. For example like this:

Code (glbasic) Select

  INIOPEN PLATFORMINFO$("DOCUMENTS") + "/settings.ini"
  INIPUT "savestate", "level", "1" // <- change one value
  INIPUT "savestate", "", ""
  INIOPEN ""
  // this works, savestate section is now removed


Some of my system info, maybe it will help:
Windows XP
GLBasic IDE, Version: 7.341
Configuration: WIN32
GPC - GLBasic Precompiler V.6.922 SN:******** - 3D, NET
#291
On the iphone, does the PLATFORMINFO$("DOCUMENTS") return a folder that is only accessible to the running glbasic app? Or do other apps also write into this folder, just like the "my documents" folder in windows?

And also, can you create subfolders in this documents-folder using CREATEDIR()? I don't have an iPhone (yet) so I was wondering.
#292
Quote from: Kitty Hello on 2010-Feb-26
I'd go for an inline in this case. The [] operator is not as quick as a static array in C++
I didn't know about the INLINE statement, but I guess you mean something like this:

Code (glbasic) Select
GLOBAL TestFloat#
GLOBAL TestIndex%

TestIndex% = 3
TestFloat# = 0

DEBUG "Before INLINE: TestFloat#="+TestFloat#+"\n" // TestFloat#=0

INLINE // do some c++ code
  // the static array
  const double PrecalcFloats[ 5 ] =
  { 0.00, 0.25, 0.50, 0.75, 1.00 };
 
  // check for illegal index values
  if ( (TestIndex >= 0) && (TestIndex <= 5) ) {
    TestFloat = PrecalcFloats[TestIndex];
  } else {
    TestFloat = -1;
  };
ENDINLINE

DEBUG "After INLINE: TestFloat#="+TestFloat#+"\n" // TestFloat#=0.75


I use a 'static' array for the font widths in my current project. This is a glbasic-array which I fill with READ STARTDATA at program start and then when printing a string I read FontWidths[iLetter]. But I guess this INLINE plus a C++ array is faster then?
#293
If you really want to do many divisions for each frame, you can use a lookup table to speed things up. You only keep track of the integer values and don't recalculate the floating point values each time. When you need the floating point value, you use the integer value as an index in the precalculated lookup table.

I assume that in this case you only calculate color values, which are always between 0 and 255 (integer), or between 0.00 and 1.00 (float).

Code (glbasic) Select

GLOBAL PrecalcFloat#[]
DIM PrecalcFloat#[256]

// at program start-up
For i% := 0 to 255
  PrecalcFloat#[i] = i% / 255.0
Next //i

// .. and then when you need the color float values
TBGL_iSprite.iRed#   = PrecalcFloat#[red%]
TBGL_iSprite.iGreen# = PrecalcFloat#[green%]
TBGL_iSprite.iBlue#  = PrecalcFloat#[blue%]
#294
oh, and also.. This is probably a n00b question :doubt: but in the httppost example of Hello Kitty

Code (glbasic) Select
   // make a boundary string. That's a few "--" and some random characters
   boundary$ = "----------------bOunDarY-------"+INTEGER(GETTIMERALL()*1000.0)+"-"+RND(99999)+"--"


Why do you generate a random boundary for the HTTP-Post message? Why not just use a standard boundary that is the same everytime you post?
#295
Okay, it's been a while but recently I've found the time to continue on my project. I'm working on the server side of things and it is going great! :) I can't believe how easy and straight forward it all is. The php scripting is pretty easy too.

Here's how I want to do it:
I do a http post from GLBasic using the code example above, then the php script on the server handles the file and stores it. Also some sender information is sent, using PLATFORMINFO$("LOCALE") and PLATFORMINFO$("ID") etc. and this is also stored. The GLBasic program can request a list of available files, and then downloads each of these files.

:good: This all works now, but I do have 2 questions..

First of all how do you handle a re-upload of the same level or when a user sends an update of his levelfile? I think if I keep the md5-checksum and the PLATFORMINFO$("ID") to identify the sender, and then check for previously uploaded files using these 2 pieces of information will be enough. But any thoughts on this?

Second, how do you handle files with the same filename? For example, first a user sends a file called "mylevel.dat" and then another user also sends his "mylevel.dat". How do you distribute these two files to all other users? As "mylevel.dat" and "mylevel(1).dat"?
#296
Wow, judging by the video and screenshots it looks very professional. Nice game concept too, it looks like a mix between Panel-de-pon and Pipemania. Was it programmed with GLBasic or pure objective-c?

Also, it kind of reminds me of the 845-Combinations puzzle I have lying around. :)
http://www.asahi-net.or.jp/~rh5k-isn/Puzzle/845Combinations/
#297
Hi all :good: I have a question about array of types, and assignment of these array elements.

If you have an array of a custom type, you can assign the values of an element with a variable, if the variable is of the same type. See code example below, it works fine and as expected.

Code (glbasic) Select

TYPE TLevel
  Tiles[5][5]
  Difficulty
  Description$
ENDTYPE

GLOBAL LevelSet[] AS TLevel

DIM LevelSet[3]

LOCAL i, x, y
LOCAL tmpLevel AS TLevel

// initialise dummie test levels
FOR i = 0 TO 2
  LevelSet[i].Description$ = "Level "+i
  FOR y = 0 TO 4
    FOR x = 0 TO 4
      LevelSet[i].Tiles[x][y] = i
    NEXT //y
  NEXT //x
NEXT //i

// now move the items array around
tmpLevel = LevelSet[0]
LevelSet[0] = LevelSet[1]
LevelSet[1] = LevelSet[2]
LevelSet[2] = tmpLevel

// draw dummie levels
FOR i = 0 TO 2
  PRINT LevelSet[i].Description$, (i*80), 0
  FOR y = 0 TO 4
    FOR x = 0 TO 4
      PRINT LevelSet[i].Tiles[x][y], (i*80) + x*8, 32+y*8
    NEXT //y
  NEXT //x
NEXT //i

// display the results
SHOWSCREEN
KEYWAIT

My question is, does it actually do the assignment of all array elements (each integer in Tiles[][] etc.) or are the pointers switched around? Or are there are any other potential pitfalls I need to be aware of, when assigning typed-array elements this way?

I'd like to know, before I use this "trick" extensivly in my game code.
#298
Aha, CONSTANT instead of CONST.. I was wondering why that didn't work :) I had the same problem, I had already created a program with the demo version but in a newer version it didn't compile because of the CONST' s. I use it a lot for defining things like "direction-enumeration" and gameobjects, for example.
Code (glbasic) Select
CONSTANT DIR_UP    = 1
CONSTANT DIR_DOWN  = 2
// etc.

CONSTANT GAMEOBJ_NONE   = 0
CONSTANT GAMEOBJ_WALL   = 1
CONSTANT GAMEOBJ_LADDER = 2
// etc.


I assume GLBasic translates that to #defines in the C++ files, right?
Code (glbasic) Select
#DEFINE GAMEOBJ_NONE   = 0
#DEFINE GAMEOBJ_WALL   = 1
#DEFINE GAMEOBJ_LADDER = 2
// etc.


Occasionally it won't compile? Do you mean when there is a naming conflict or something? For example, when you use a CONSTANT with the same name as a global/local variable or as a function name?
#299
Wow, thanks for the examples, this is really helpful. I really like the idea of just using URLs and then base64 string parameters to send the binary data. For now, I'll finish the core of the game so I can decide on the level-file-layout, then I'll start on the php and server side of things. :good: Thanks again.
#300
I'm working on a puzzle game for the iphone using GLBasic and it will have a level editor so players can make their to own puzzles. A level is simply a grid with items, similar to Sokoban levels (but my game is not Sokoban ;))

But I also want to be able to send these user created levels to a website or server. Is it possible in GLBasic to send files to a server? What would be the best way to do this. I guess you could use PHP scripts, similar to the php script to send and recieve online-highscores.. But I don't know that much about it, how would you send an entire file using php? :doubt:

On the news page it says that Wumbo's Adventure will have an online level library so I guess it is possible. Will the next version of GLBasic have added features or commands to do these kind of things?