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

Topics - r0ber7

#21
Hi.

I've recently been focusing on app development for mobile phones. Since not all features of these devices work on GLBasic (like the camera, or voice recording), I was wondering if I could edit the files GLBasic produces. For Android I think I should be able to find some java files. I want to find the source files so I can modify the code directly, if possible.

So yeah, if I wanted to do this, where would I look? For Android, I have no idea where I can find the source code. There is a src directory but it seems to only be a test thing? I have no idea. Has anyone done this who could maybe give me some pointers? And I was also thinking, would this be a way to get ads into my apps? I suspect that the code to do advertising will be in java, so I figured I could paste it into the source somewhere. Any tips would be very helpful, thanks.  :good:

And for those of you who are wondering, yes I am still working on Red Wizard Island. It's a big project though, and multiplayer is definitely an ambitious goal. *grin*
#22
Question...

I'm drawing a text balloon on screen. The balloon is variable in width and height depending on the size of the text. I'm using a CREATESCREEN & GENSPRITE combination to make fitting balloons for all messages. But once I've made them, and displayed them, I really have no more use for the sprites I created with GENSPRITE.

Where do they go? :)

I assume they keep hanging around in memory, which is not ideal. Is there a way to free sprite memory allocated through GENSPRITE? If not, I'll probably use a looping array of sprite IDs or something.
#23
GLBasic - en / GM Scoreboard
2012-Nov-28
While this is originally intended for GameMaker games, we can use it also with the NET commands.

http://gmscoreboard.com/how-to-install-gm-scoreboard.php

It's an online scoreboard, for those who don't want to host that on their own server, it's free too.
#24
Hi!

I know there's a "where are you from and what's your story" thread, but bear with me here. I want to know where you're all from, because I have an idea.

Right now I'm developing a UDP multiplayer model based on the Quake 3 model, for my game. I'm still in early development right now, but once I have integrated my network model into my game, I will need testers. Testing with my friends nearby where I live would be somewhat ok, but I figured, if I really want to know how my algorithm treats UDP packet loss, I will have to have more testers, who are not so nearby.

Once I have set up my networking model in Red Wizard Island, I will post a thread on this forum inviting anyone who wants to play a game of Red Wizard Island against the other GLBasic members, to do so. I will host the game, and so I have to pick a time and date for the event (and hope you all show up!).

So, in order to pick a time during which most of you are available, I figured, I'd pick a time somewhere in the evening, probably on a saturday. I suspect most of you are from Europe, as I am, but who knows. So tell me, where are you from?

=D

Please note: I'm a long way from in-game multiplayer integration, but this will happen! I think it'd be cool to play against you guys. :)
#25
Hey.

The compiler just told me the weirdest thing. It said this:

Code (glbasic) Select

  given: DGArray<s_object>
  wants: DGArray<s_object>
"level_process.gbas"(172) error : wrong argument type : quicksort, arg no: 1


I'm doing this:

Function:

Code (glbasic) Select

FUNCTION quicksort : arr[] AS s_object, start, end
...
ENDFUNCTION


Function call:

Code (glbasic) Select

FOR p=0 TO 8
quicksort(s_objects[p], 0, s_objects_n[p]-1)
NEXT


s_objects[] is a two dimensional array of type s_object. It stores tiles for my levels. So if I wanted the x position of a tile, I would access s_objects[5][3].x for example. Any ideas? I've tried juggling around with brackets but that just gives me syntax errors.

The function is basically made to do just one thing, so I could hardcode the s_objects[][] array in there, but I don't like that solution, it's sloppy coding. :P Help!
#26
Hi.

While I am still patiently working on my game, a friend of mine asked if I could make a simple Android app for him. After a quick check of the forum, I have some questions still.

- I don't have an Android device. After compiling for Android, how do I get the app on his device? Is it as simple as copying the distribute directory? Or is there something specific about Android installation? (I have no idea since I don't own an Android device.)

- How do I bring up the keyboard? Should this be done with INLINE C? Or will INPUT work? One of the features includes editing text, so integration with the keyboard function (like in the browser) has to be available. I could of course write my own keyboard function, but only as a last resort.

Developing this for Android is a nice introduction for me. Eventually I want to make an Android version of my game, so this will be a good learning experience.

Thanks. :)
#27
Hi.

Ran into something weird, thought I'd mention it.
My game is using several tiles that use the color RGB(255,0,128) for their transparency. I've made one single sheet of tiles for easy editing, but the game itself loads all tiles seperately from independent PNG files. So I wrote a little program that takes the single sheet and slices it into seperate sprites which are then saved as PNG files. This is all working fine, but I noticed that the PNG files that are saved, when they are loaded into the game, the pixels with the color RGB(255,0,128) are not treated as transparent. But when I load those same PNG files into my graphics program, the value of the pixels is still RGB(255,0,128). And then, if I save the file from the graphics program, suddenly the transparency is back again... I think it's got something to do with the way SAVESPRITE writes a PNG file. Not a big problem, but odd nonetheless.
#28
Hey,

I made this little thing that takes the BPM of a music track and counts the beats, so you can do stuff synced to your music in a program. This could be useful for doing demo-like stuff. Me, I'm thinking of making the trees in my game bounce to the rhythm of the music. :P

Although I haven't coded it yet, it could be possible to use this in a workaround for the music loop problem GLBasic has. I think, if you know the length of your music file in beats, count until you're at beat n-1, STOPMUSIC, play a soundfile with PLAYSOUND at that point, and PLAYMUSIC after that finishes... But that's just an idea. Anyway, here's the code.

Code (glbasic) Select

// function that returns the ms per beat

FUNCTION beats_init :bpm

LOCAL bps

bps = bpm/60
mspb = 1000/bps

INC mspb, -1

RETURN mspb // milliseconds per beat

ENDFUNCTION

// function that counts the frames and determines whether a beat has been hit

FUNCTION beats_calc :

STATIC totalt //
STATIC oldtotal

IF ISMUSICPLAYING() = FALSE
PLAYMUSIC "Media/qd.mp3", 0
oldtotal = GETTIMERALL()-mspb
totalt = oldtotal+mspb
beat = 4
ELSE
totalt = GETTIMERALL()
ENDIF
// if the difference >= ms per beat, do a beat
IF totalt - oldtotal >= mspb

//STDOUT "dif: "+(totalt - oldtotal)+" mspb: "+mspb+"\n"

// subtract any additional stuff (if difference = 503 and mspb = 500, remove the 3)
IF totalt - oldtotal > mspb
//STDOUT "oldtotal = totalt("+totalt+") - dif("+(totalt - oldtotal)+")-mspb("+mspb+") \n"
//STDOUT "oldtotal = totalt("+totalt+") - "+((totalt - oldtotal)-mspb)+"\n"
oldtotal = totalt - ((totalt - oldtotal)-mspb)
ELSE
oldtotal = totalt
ENDIF

RETURN 1
ENDIF


RETURN 0

ENDFUNCTION


Example in attachment. I made the music in about ten minutes, but it's just a proof of concept. :)

Edit: never mind the //comments, they're old.

[attachment deleted by admin]
#29
Hi.

I code and compile on Linux. For this, I've coded my own script that handles the preprocessing, compiling, and linking. This works perfectly, except when I try to use the debug option in the preprocessor.
(I'm having some out of bounds errors and I'd like to see where the problem lies by using the debug option).
I add "-D" to the preprocessor command, which works, but when it's time to compile with g++, it throws me a bunch of errors:

Code (glbasic) Select
Wordcount:8075 commands
--> Compiling all .cpp files...
./out0.cpp: In function 'int __GLBASIC__::__MainGameSub_()':
./out0.cpp:15:3: error: '__VAR_CONTAINER' was not declared in this scope
./out0.cpp:15:19: error: expected ';' before '__l_dbg_cont'
./out0.cpp: In function 'DGInt __GLBASIC__::__end_main__foo__()':
./out0.cpp:363:3: error: '__VAR_CONTAINER' was not declared in this scope
./out0.cpp:363:19: error: expected ';' before '__l_dbg_cont'
./out10.cpp: In function 'DGInt __GLBASIC__::add_icon(__GLBASIC__::DGStr, DGInt, DGInt)':
./out10.cpp:15:3: error: '__VAR_CONTAINER' was not declared in this scope
./out10.cpp:15:19: error: expected ';' before '__l_dbg_cont'
./out10.cpp:16:15: error: expected primary-expression before ',' token


Etcetera.
I'd like to know if there are some options I could pass to g++ to make it understand what I'm trying to do... Does it have something to do with the -DNDEBUG option? It's not a big problem cause I could always switch to Windows and use the debugger from the IDE, but I'd like to avoid this if at all possible. ;)
#30
Hi everyone. Currently I'm working on expanding my game menu. I've started work on sliders, and I thought, hey, is there a command that adjusts gamma or brightness of the program? And if there isn't, what way would I go about to code something that can do that? All I can think of is the RGB() option with POLYs, but I'd rather not use that since I hear some systems run poorly when it is used. Any suggestions will contribute to my game being more awesome. ;)

Thanks!  :good:
#31
Hi!

For a long time now, I've wanted to be able to compile my GLBasic projects on Linux. Every time I wanted to work on my game, I'd have to switch to Windows, and I don't like Windows. :P

So, after some messing around, I created this shell script which compiles GLBasic projects on Linux.
For this to work, you'll need:

- the GLBasic compiler directory (usually found somewhere in C:\Program Files\GLBasic\Compiler)
- glblicence.inc (in c:\Users\username\AppData\Local\Temp\glbasic\, or somewhere else depending on your Windows version. Just run a search.)
- g++ installed on Linux
- my shellscript
- coffee

Copy the compiler directory and glblicence.inc to Linux, and you're good to go. Then, edit the shellscript according to your whishes, and run it in your project directory. For this to work, glblicence.inc has to be in the same directory as the project files.

Code (glbasic) Select


# this shellscript will compile glbasic projects on linux, for linux.
# note: the file called "glblicence.inc" should be in the directory from where the script is executed.
# the gbas files should also be in there.
# this will only compile standard linux executables. for console applications or xbox linux stuff, change the g++ commandline options
# according to platform.ini (found in Compiler/platform folder)
# hope this is of some help to someone.
# cheers!
#
# - r0ber7

# edit to suit your project. path to glbasic compiler
GLB_PATH="/home/robert/code/glbasic/Compiler/platform"

# edit to suit your project. .gbas files to pre-compile. start with main file, then add the rest.
GBAS_FILES="main.gbas file2.gbas file3.gbas"

# edit to suit your project. executable name
EXECUTABLE="foo"

# the actual compilation. you shouldn't have to change anything here.
echo "--> Pre-compiling .gbas files..."

$GLB_PATH/gpc-linux $GBAS_FILES

echo "--> Compiling .cpp files..."

g++ -static-libgcc -pipe -O3 -w -Wl,--allow-shlib-undefined,-rpath-link,"$GLB_PATH/Linux/Lib" -L"$GLB_PATH/Linux/Lib/" -I"$GLB_PATH/Include/" -DLINUX -DUNIX -DNDEBUG -DWANT_SDL -DHAVE_OPENGL ./*.cpp  -lGLBasicLinux -lpng-gf -lGL -lSDL_mixer -lSDL -o $EXECUTABLE

echo "--> Done!"
echo "$EXECUTABLE should now be in this folder."



If you have many seperate files, as I do, you could consider setting up a Makefile so you don't have to compile everything when you've just made changes to one file.
I hope this will be useful to someone.

Ciao!  8)

[attachment deleted by admin]
#32
Yesterday I had a conversation with my musician. He asked about the possibility of "hiding" the mp3 files used in game from the user, so that they would be hard to find and we could release the soundtrack of the game seperately.

This has got me thinking. I'd thought about it before, because right now all my level files are simple .ini files and I'd rather not have the user edit them for obvious reasons. If possible, I'd also like to protect the png files from editing in some way.

I've thought of these possibilities:

1. Encryption.
All files could be encrypted in some way (basic XOR encryption would suffice). When a level gets loaded from the game, it could decrypt the appropriate files, write them down temporarily, and load them with LOADSOUND(), LOADANIM(), etc. While this would definitely work, it has drawbacks I'd rather not have:
- longer loading times (really don't like this)
- unnecessary writing to disk

2. Store everything in big files
All files could be appended to eachother, seperated by a marker so the game would know where to look for specific data. The game would load the file and seperate the data. But then, what to do? Do I write those to disk, so that I can load them with LOADSOUND() etc.? If so, there would still be writing to disk of large chunks which I'd like to avoid as much as possible. Or is there a way to use any of the READ() functions and then store that data in memory and somehow assign a sound index/ sprite index to it so I can use the data with DRAWANIM/PLAYSOUND etc.? That would be ideal.

3. Rename files
Lastly, I could just rename the files to things like vcxzvrsfds.bin, making it harder to find the data. But, this would mean:
- a lot of editing
- not so good a way of protection
- confusing myself

Thoughts? :)
#33
Hello.

To determine the angle of a trajectory so I can rotate a sprite accordingly, I'm using ATAN.

Goes a little something like this:

Code (glbasic) Select

angle = ATAN(start_y - dest_y, start_x - dest_x)


I've noticed that it takes up some time to complete the calculation. I'm using tSIN and tCOS from amos' z-project code for quick calculations, and I was wondering whether someone has code for a quick ATAN lying around. ;)

If not, I might write one myself, but I don't like reinventing the wheel, plus I'd rather keep busy creating game content than to delve into math to figure this out.

Anyone?  =D

#34
Hi,

This has been bugging me a while so I thought I'd ask around. My problem:

The code for my game is divided over many seperate files. When I compile after changing code in one file, sometimes the Incredibuild thing skips that file, thinking it hasn't changed. The workaround I've been using for a while is to stop compilation, select debug mode, then unselect debug mode. That way all of the files get compiled and none get skipped. This works for me, but I'm getting to the point where I have a LOT of lines of code. So I'd really like to use the Incredibuild function. Sometimes, usually with relatively new files, Incredibuild doesn't skip them when changed. I'm not sure what's the cause of this. Using the cleaning option doesn't do anything. I store my files on a USB flash drive, perhaps that's the problem. Or it could be that sometimes the date and time of my laptop gets reset. (My laptop's battery is dead, so it needs a power cable to function. Sometimes I pull the power cable out, and when I plug it back in, the internal clock has been reset.)

Any help would be really appreciated, because the total compile time for my game has become quite long, which makes it very frustrating to test a change in a single line of code in one file.
#35
Why isn't it on the list?
#36
Hi there.

During my quest to warp a 32x32 grid for my game, I figured out how to draw spirals. If I want to warp the grid, I'll have to stretch the polygons to a logarithmic spiral. Anyway, I haven't figured out the grid warp yet, but I had so much fun creating this spiral I wanted to share it with you anyway.



If you want to see it swirl around you can download the source here. Pressing the up arrow resets the spiral.

If I succeed, the example code for the grid warp will be posted in this thread too.
#37
I'd like to switch to Chrome instead of Firefox, but when I go to this forum I get a page saying "It works!" but doesn't show anything else. What's up with that?
#38
Hello.

This year I made a small game for the Amiga in Blitz Basic 2. When I released the first version, I thought, I could make this game entirely for the Amiga but that would mean I'd have a select group of players and a pretty hard time battling memory/cpu problems. So I figured I would go look for a way to keep most of the original code, and be able to compile for other systems. I'm so happy I found GLBasic. :)

So, you play a red wizard whose homeland has been invaded by vikings. It's a platformer with some RPG elements. You can (of course) cast spells. Right now the fireball is more or less working. This is the version I  released for the Amiga:

http://www.youtube.com/watch?v=tXHC6mew6jU

This is the re-write which I'm currently working on:

https://www.youtube.com/watch?v=5L1yQZ-DSEI

You charge up the fireball. The longer you charge the bigger it gets (and the more damage it will do eventually).

All pixels done by myself in old-style pixeling fashion, with the exception of the glow of the fireball which I did in Gimp. Also, the stars in the background is an image I took from some website, temporarily functioning as a background.

The music will be done by a friend of mine. We're thinking of a laid back medieval tune.

Some of the things I plan to add:

- A viking chicken that poops explosive eggs (probably an endboss)
- Shops where you can buy new spells and other stuff
- Unlockable doors
- Flying around on the back of a bird
- Running around on the back of a wolf
- More spells of course!

I will update this thread to document my progress, and to keep myself motivated. :)
#39
Hi,

I'm trying to capture my GLBasic game with a screen capture software. Since it uses GL it seems normal capture software won't work. I've found Fraps, but that only takes a few seconds of video, and I can't really figure out the other software I've found. So I'd like to present my game to the internet, but how? Do you know of any screen capture software that can do this? (I know this isn't exactly GLBasic related, but I presume some of you have made videos of your games, so I figure I could ask.)
#40
GLBasic - en / Alpha in png?
2011-Oct-08
First off, hello everyone. I'm coding a game in GLBasic. Later more about that.  :good:

I've got a question, which seems like there should be an easy answer, but I can't find one.
I've added a nice glow to my spellcasting fire. In the attachments, you can see how it looks in my graphics program (the grey blocks are transparent area) and how it ends up looking in the game.
What gives?  :doubt: I've looked at SETTRANSPARENCY, but it only accepts color values and I don't know if there is a colour value for transparency? This is the first time I try using the transparent option of png files. Before this I simply used the standard (255,0,128) for my images, but because I'd like this to glow, I can't do that. Help?







[attachment deleted by admin]