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 - mahan

#1
Quote from: kaotiklabs on 2010-Sep-11
Nobody had a problem when the french forum was opened so I don´t understand why you care so much now.

I wasn't around back then  =D  Sorry, couldn't resist.

Clarification: I am in no way in favor of any language before any other (except for English when it comes to computers ofc.) This is no thing i got against Spanish in any way, just to be perfectly clear.

Quote from: kaotiklabs on 2010-Sep-11
In the end is just a Gernot´s decision.

Yep, my contribution here was merely voicing my opinion. Gernot will ofc. decide what he deems good on his own forums  :good:
#2
Quote from: kaotiklabs on 2010-Sep-11
I know this is imposible because some german guys have difficulties with english, but..., why we have to be different?

This is a strange argument because:

Are you also arguing that if your 3 year old nephew has training wheels on his bike (i.e. he has "difficulties" with cycling), you should have training wheels on your bike too? I know that German people often prefer their own language over English, but the question is: What is more beneficial in the long term? Even for themselves? And if it's not beneficial to them, why should we follow?

Quote from: kaotiklabs on 2010-Sep-11
I´m sure there are more spanish people than frenchs in the forum, so why not? Would not be unfair?
[...]
Everybody agrees that a common language will be the best, but once you take the decision to allow several languages, you cannot force the rest to speak a common language. I believe it must be equal for all.

Fair and equal?

1.) This is a private forum, not "EUs democratic free speech center" or anything. The owner might very well decide that only Swahili and Afrikaans are the only languages to use, and he is in his full right to do so. I.e. it's a private decision to add or reject specific languages forums, not a question of "fair" or "equal".

2.) Nobody is "forced" to anything tbh. because it's a free choice to be on the forums in the first place.

2. ) I'm a Swedish citizen: Should I also ask for a forum?


Own language forums are a bit similar to training wheels for a bike, because they certainly make it easier from the start to get going, but part of the training is that you must at some point remove them. :)

Your own English is much more than adequate for communicating in English, if I may say so :)


just my 50 Swedish Öre :-)
#3
Let me go ahead and disagree with you there :-)

I think that all programming related material has more to gain from being written in English.

Look, how many times have you googled for some info about some computer related stuff and as a result got to a site with with text in a language foreign to you? You might swear inside because you look at the source and it seems to be very interesting to you, but to bad even the comments and variable names are foreign, so you can't easily make out how it works.

The scenario above might have happened to you on Russian, French, Dutch and German sites just to name a few popular languages. Now notice that the same happens to me when I go to a Spanish site, because I don't understand Spanish, right?

As you probably notice, English is not my first language, but I still prefer it to any other language, even my own first language, because we (all the internet users) collectively get more out of English info that any other.

Besides by not using English frequently (preferring just to talk to kinsmen etc.) you deprive yourself of good English training that could benefit yourself personally on an internationalized market world of today, which might very well be a loss of a nice career possibility.


Sorry for long rant, but that's my thoughts on the subject :-)
#4
If you omit the % or #, the compiler assumes a float-variable. (this is a difference to many other basics out there btw.)

Another important thing in the context is that, while % or # in subsequent usage (after the declaration is done) is optional, the $-sign after string variables is NOT optional iirc.

This is because $ is expanded by the precompiler to "_Str" in the intermediate C(++)-format and thus using the same name without the $ refers to a different name on that level.
#5
I'm a newbie in GLBasic so correct me if I'm wrong but:

Adding .0 after plain numbers/constants in the source, tells the compiler to treat this number/constant as a float variable.

The compiler (if it behaves like most other compilers, which I suppose since it's a precompiler for C(++)) expands expressions to the highest precision and does the calculations from there.

Test this:

Code (glbasic) Select

STDOUT (10/3)
STDOUT "\n"
STDOUT (10.0/3)
STDOUT "\n"
STDOUT (10/3.0)
STDOUT "\n"

KEYWAIT


Hope this somewhat clears the matters up.

EDIT: to run this go to menu Project-Options and check the "Console" checkbox.
#6
The sample HelloNet (part of GLBasic install) works very bad.

My post http://www.glbasic.com/forum/index.php?topic=5003.0 seems to indicate I'm not the only one with this problem.

Steps to reproduce:

1.) Compile HelloNet to .exe
2.) Start 1 process instance and make it host
3.) Start 1 process instance and make it client

Result: Both processes are more or less frozen and very rarely update the screen (~1 / 30 secs)

Maybe we got a little too much blocking with those blocking sockets? :-)

Tested on XP sp 3.

edit: added OS info
#7
Hi,

I updated GLBasic to v8 on my second PC (netbook) today and when i read the change log i stumbled upon the change to blocking TCP sockets.

So out of curiosity I fired up GLBasic and tried out the HelloNet sample and it works really bad now. The app is almost completely frozen now, although you can see something happen once like every 30 secs the application frame says "not responding" almost all the time.

Is this new behavior in the sample a result of the blocking sockets or something else?

#8
Thank you both, very much!  :)
#9
Hi guys,

How do you release generated handles to Sprites, Files, Sounds etc.?

Since GLBasic has commands like GENSPRITE(), GENFILE() etc, I'd expect functions to release the generated handles (and associated resources) somehow, but I just don't get how. You got a command or algorithm for that?

I'm pretty sure I've seen something about this before on the forums but I could not find it now.


(Search words for the future: FreeSprite, ReleaseSprite, Free, Release, Handle, KillSprite, Kill)
#10
This looks lovely!

Will there be inheritance also? I.e. types that can extend other types?
#11
Quote from: doimus on 2010-Apr-30
That is opposite, but great idea as well! It would be nice if GLB had a feature to include everything into a compiled file. While the scripting approach is good for bigger games/teams, compile-everything-into-exe is great for small games. I've got a folder with tons of single-exe indie games I downloaded from the web through the years.  Love them as much as I love Lua-scripted Baldurs Gate. :)

I'm pretty sure we are talking about completely different things:

What I presume you argue here is that it might be good if the compiler is able to include resources (binaries) inside the produced .exe-files in a manner where they can be easily used by the .exe itself, so the .exe in a way becomes self sufficient. I think this idea is interesting. sidenote: I have a license for a program called molebox that does exactly this kind of packaging for win32 .exes.

What I on the other hand was talking about in my previous post was a theoretical way of encoding all images/textures etc. as pretty much data statements in the source (i.e. "Image1.bmp: DATA <pixelvalue1>, <pixelvalue2>, <pixelvalue..n>") which is silly as it would require the compiler to parse wast amounts of extra (probably machine-generated) source, in addition to the actual program logic.
#12
I agree with Kitty:

I mean to take the absolute opposite, it's theoretically possible to encode all images/textures/levels/maps as DATA-statements and include them in the compile also, but most people would think that is outright silly :)

I.e. the idea is that you compile your game-engine as a .exe, but all the config-, game- and meta-data is loaded from text-files (or even an local SQLite DB or something) by this engine as needed.
#13
QuoteReally: I'm a professional C++ programmer in my full time job. I really know C++ and I'm fast with that. But when it comes to programming games, I stick to GLBasic because I'm much much quicker with that.. OOP starts to get interesting for large projects like Corel Draw.

When I spoke about speed in my reply above I was mainly talking about execution speed. (not the speed of development). When it comes to development time I agree with you that GLBasic is probably much faster when you write games compared with using most general purpose languages and start adding graphics/sound/physics-libs to that.

While I respect your opinion that OOP first becomes interesting in larger projects, I don't agree. In GLBasic you have a typical procedural language that supports structs (records). In my opinion you get advantages right away if you start to group functions together with the structs they operate on and generally modularize the programs so that you do the right things, and change the right data, in "the right module". That way you get programs that are much more manageable and you know where to go (in the code) to change something without the rest of the program getting too affected. Pretty much "light encapsulation" so to speak. I'd go so far as to say that once you split your source-code of a project to two files, you probably start to benefit from OOP-principles.

And that's why I made the little test-demo with the callback based "events", since they help when doing encapsulation, i.e. a module can allow other modules to register event-handlers, but does not need to know why or what those other modules want to do when the events are fired.

PS: My full time job is also in development (Delphi/C#/Java), but I love a little variation in my past time so that's why I recently picked up GLBasic to play around with. :)
#14
Thanks for your reply. Good hints on getting to write c++ (which surely has it's uses). I'll do it your way the day GLBasic is to slow for my purposes but for now I'll continue to write in the "basic"-part of GLBasic :)
#15
Let's build ourselves a basic OOP-like class like this (compiled as a console app):

(TPerson.gbas:)

Code (glbasic) Select


TYPE TPerson

_name$
_age%
onAgeChange[] AS TPerson_EventProto

ENDTYPE


PROTOTYPE TPerson_EventProto: person AS TPerson

FUNCTION TPerson_Create AS TPerson: name$, age%

LOCAL newPerson AS TPerson

newPerson._name$ = name$
newPerson._age = age

RETURN newPerson
ENDFUNCTION

FUNCTION TPerson_getAge%: person AS TPerson
RETURN person._age
ENDFUNCTION


FUNCTION TPerson_getName$: person AS TPerson
RETURN person._name$
ENDFUNCTION

FUNCTION TPerson_setAge%: person AS TPerson, newAge%
person._age = newAge%

FOR i = 0 TO LEN(person.onAgeChange[])-1
LOCAL currCallback AS TPerson_EventProto
currCallback = person.onAgeChange[i]
currCallback(person)
NEXT

ENDFUNCTION

FUNCTION TPerson_registerOnAgeChangeHandler: person AS TPerson, callbackFunc AS TPerson_EventProto
DIMPUSH person.onAgeChange[], callbackFunc
ENDFUNCTION



Now let's test out new "class" with this little test-app:

(OOPTest.gbas:)

Code (glbasic) Select
main()


FUNCTION printToStdOutOnAgeChange: person AS TPerson
STDOUT "EVENTHANDLER RESPONCE: Age was just changed to " + TPerson_getAge(person) + CHR$(10)
ENDFUNCTION

FUNCTION main:

LOCAL mahan AS TPerson

//Creating the Mahan instance
mahan = TPerson_Create("Mahan", 32)
// Registering eventhandler"
LOCAL tempFuncPtr AS TPerson_EventProto
tempFuncPtr = printToStdOutOnAgeChange
TPerson_registerOnAgeChangeHandler(mahan, tempFuncPtr)
//Uncomment line below to prove that several handlers will be called correctly
//TPerson_registerOnAgeChangeHandler(mahan, tempFuncPtr)


//testing "getters"
STDOUT "TPerson: name=" + TPerson_getName$(mahan) + ", age=" + TPerson_getAge(mahan) + CHR$(10)


STDOUT "Now changing age to see if callback fired: " + CHR$(10)

TPerson_setAge(mahan, 33)

KEYWAIT

ENDFUNCTION


This is of course not full OOP with polymorphism etc., but still a funny demo how functionality can be grouped together with a data-structure with event-handlers that can be stacked on single events :)

(note: Remember I'm a GLBasic newbie, so if I use something wrong or things can be written more nicely I'm eager to learn more)