Official BlitzMax Q&A Thread

Blitz3D Forums/Blitz3D Programming/Official BlitzMax Q&A Thread

skidracer(Posted 2004) [#1]
Due to popular demand, this is the official thread for Blitz3D users wanting to ask questions about BlitzMax. If you haven't already done so, please read Si Harrison's excellent FAQ in BlitzNews issue 13 before posting here.


Gabriel(Posted 2004) [#2]
Prompted by a discussion on Blitzcoder, I got to wondering how BlitzMax handles images with non-standard size. I mean, essentially, all images are textures in BMax, aren't they? And since videocards have the old power of 2 limitation, does BlitzMax resize non-power-of-2 images as Blitz3d does or does it fill the rest of the image with blank space and adjust the UV coordinates automatically so that you only get to see the image you loaded? Or something different?

And thanks for providing a good place to ask these questions.


skidracer(Posted 2004) [#3]
Currently Images are scaled to a power of 2 similar to the way the Blitz3D texture system works.


skidracer(Posted 2004) [#4]
Currently Images are scaled to a power of 2 similar to the way the Blitz3D texture system works. There are some very good packing algorithms around (including one by Birdie in the BlitzMax samples folder which we didn't want to lose track of) so I wouldn't be suprised if something along the lines of what you mention is implemented in the future.


Genexi2(Posted 2004) [#5]
Just two small questions here....

1) How big is the exe on a simple "Hello World!" example?

2) The mac release requires you to have XCode installed to work the Mac release of BMAX, will you require them installed to run the compiled exe's?


skidracer(Posted 2004) [#6]
1) 37K
2) No


morduun(Posted 2004) [#7]
Any plans for supporting additional native data types -- unsigned ints, for instance?


po(Posted 2004) [#8]
Is GoTo still there?


Michael Reitzenstein(Posted 2004) [#9]
Currently Images are scaled to a power of 2 similar to the way the Blitz3D texture system works.

I believe this is incorrect. Loaded images of non power of two sized are placed on a larger texture without being scaled, and the UV coordinates are adjusted accordingly. This means that images of non standard sizes are pixel perfect rather than blurred when loaded and rendered.


EOF(Posted 2004) [#10]
Blitzers might find this handy:
                       Blitz3D/Plus   BlitzMax
comments                   ;            '
labels                     .            #
statement separators       :            ;
decarations                .            :
accessing type fields      \            .

Example

**** Blitz3D/Plus ****


; test
Print "boo" : x=x+1
a.Alien = New Alien
a\x = a\x + 5
a\alienframe=a\alienframe+56
Goto myLabel

.myLabel
End

**** BlitzMax ****

' test
Print "boo" ; x=x+1
a:Alien = New Alien
a.alienframe:+56     ' shorthand coding!
a.x = a.x + 5
Goto myLabel

#myLabel
End


po,
Goto is in but Gosub has been removed.

Q: Max is the fastest version of Blitz.
Mark once posted a benchmark showing Max to be around 4 times faster than Blitz Plus.
Is this still the case?


Damian(Posted 2004) [#11]
Synchronizing Modules

I have seen messages on the BlitzMax Forums about synchronizing modules to get the lastest version. Since this requires an internet connection and my Dev machine at home doesn't have one.

Will I be able to update the modules, etc, via another method should I purchase BlitzMax.

Regards
Damian

P.S. I do all my internet access at work.


big10p(Posted 2004) [#12]
How does the sprite rotation/scaling system work in BMax? I mean, if I create a sprite and give it a rotation, will it maintain that rotation or do I have to apply the rotation every time I want to display it?

How well does the pixel-perfect collision system work with rotated/scaled sprites (assumiong there is one :)?


skidracer(Posted 2004) [#13]
We will need to look into the offline synchronization issue. The Mac release version shipped with modules but we have shipped the beta Windows and Linux versions without so yes they currently require an internet connection. We will definitely be discussing/revisiting this issue before the proper Windows and Linux Blitzmax launch.

The drawing commands in BlitzMax use a global rotation / scale system so once you call SetRotation all of the drawing commands use the new transformation. Similiar to position a sprite object will need to keep track of it's own rotation and scale so it can use them for refreshing itself on the screen every frame.

The pixel-perfect collision system should not stuff up no matter what scale and roatation values are active when the CollideImage and CollideRect commands are called.


skn3(Posted 2004) [#14]
Damian Dowling

You could sync your mods on the work pc and then copy the mods folder to a cdr. Then take it home and move the files across.


Bot Builder(Posted 2004) [#15]
I suppose that that sytem in the end makes it all faster since setting the rotation for all future drawing commands is the way OGL works. And, if we want we can make a simple lib over the 2d one that makes the images managed like the Blitz3D engine. So then you create images and then if necessary change their position, frame in an animation, etc.

Oh, and for lazy people like myself:

http://www.blitzbasic.com/newsletter/newsletter.php?issue=13


Qube(Posted 2004) [#16]
I know that BMAX will eventually get a 3D system. But what about a GUI system?. Is a GUI system in the list of ToDo's from BRL???


WendellM(Posted 2004) [#17]
I love what I've been seeing about BlitzMax (optional Strict, double-precision floats, etc.) and really look forward to getting into it. However, I'll be holding off on it (even the demo) for a while in order to finish up a couple of Blitz3D projects first (I don't want to start confusing syntax and capability among Blitz versions <g>).

Thus, I'm asking here whether BlitzMax has static local variables for functions. Something like:
Function Foo()
	Static Local Bar
	Bar = Bar + 1
	Return Bar
End Function
so that Foo returns 1 the first time that it's called, 2 the second time, etc. This would be a nice improvement over having to use Globals for this purpose (which cuts across scope boundries) as Blitz3D currently requires. Does BlitzMax have this handy capability?


skidracer(Posted 2004) [#18]
You can have Globals inside types which sorts out the scope thing quite nicely. There is some information regarding planned gui stuff here.


Damian(Posted 2004) [#19]
@ skn3[ac]

I have though of that - but we have security software that monitors all the software on the clients. Any unknown programs and alarms bells go off.

I could add BlitzMax to the list of safe programs but then it would be listed for all to see - including my boss.


@ skidracer

Thanks for the info - looks like I will have to wait for the official launch of the windows version, which is what I was waiting for anyway.

Congrats on getting BlitzMax out.

Regards
Damian


WendellM(Posted 2004) [#20]
I do thank you for the reply, skidracer (though your link gives me an "ERROR:Internal error").

Also, "Globals inside types"? Does that only work within type functions? Sorry - it sounds like I might be making some fundamental Blitz error having not yet tried out BlitzMax... I'd have expected a capability of "static locals" that didn't need Types, but which were local to functions (and not just functions "attached" to types). Are all user functions now attached to Types in BlitzMax, or am I way off base?

And as for scope issues... Could you please show an example of how that works like having static local variables (which exist solely inside a function, and not outside of it)?

Thanks,

Wendell (limited to Blitz3D for now <g>)


skidracer(Posted 2004) [#21]
I just tried it and you can infact declare Globals inside plain functions that are only scoped to that function, neat. So I think that satisfies the static local definition you were after.
Strict
function inc()
global a
print a
a:+1
end function
inc
inc
inc

prints 0 1 2 and if you try and add a print a to the end of the code you get identifier 'a' not found. Without the strict it prints an extra 0 as the compiler auto creates a globally scoped (there must be a better term) local a variable old skool style.


That gui thread is in the BlitzPlus forums here:

http://www.blitzbasic.com/Community/posts.php?topic=41587


big10p(Posted 2004) [#22]
Thanks for the answers, skidracer. ;)

Like WendellM, I've missed having static function variables. I like to keep variable scope on a need-to-know basis. I guess this is going to be a lot easier in BMax, due to all it's OOP goodness. :)

It's good to see we can define static function variables the way you demonstrate, skidracer, but I think the declaration 'Global' is a bit of a misnomer.


slenkar(Posted 2004) [#23]
it seems that the thread has been deleted?
41587?


JoJo(Posted 2004) [#24]
Where is the private forums area? Is it only for BlitzMax owners?

I want to download Win32 BlitzMax.


VIP3R(Posted 2004) [#25]
Hi JoJo,

The Win32 BlitzMax beta is only available to registered BlitzMax users I'm afraid. Registering the MacOS version will give you full access to the Win32 beta though.


Paul "Taiphoz"(Posted 2004) [#26]
OH CRAP. now you tell me.


The Win32 BlitzMax beta is only available to registered BlitzMax users I'm afraid. Registering the MacOS version will give you full access to the Win32 beta though.



Thanks m8, up until this point I have been hapy, just sitting back waiting on my student loan knowing that as soon as its in I'll get the mac version they get PC version when its out. but now I know I am actually missing out on something. :(

OK, Q time.

Itteration. hows that going to work in max ?

bad example comeing.
Strict
function searchlist(Str:findit)
  Global Int:x
  x:+1
  if somearray(x)=findit
       return x
       Freevariable X << this needed ?
     else
       searchlist("me")
  end if
end function


syntax is a guess of course ..

[EDIT - 1 Day and counting....] - and here I was told that Id get a reply to questions quickly. I wonder how long id have to wait if I posted this in the max forum.

[Edit - this is the EXECT reason that this thread is daft and we should be allowed to post to the correct forums.]


WolRon(Posted 2004) [#27]
Once again, I was browsing the Max forum and noticed that I could help answer someones question, but ONCE AGAIN, got upset that I'm locked out...

Just because I don't own BM, doesn't mean that I don't know about OO techniques or many other things.

One of the main reasons I come to these forums is because I like to try to help others when I can.

BR doesn't want me to do that anymore except for people in my CLASS. <-- Hey, look, an OO topic...


Picklesworth(Posted 2004) [#28]
There was mention of a B3d to BMax conversion tool a while back - does that still (or did it) exist?


Perturbatio(Posted 2004) [#29]
There was mention of a B3d to BMax conversion tool a while back - does that still (or did it) exist?

yes, it's part of the bmk program.


VIP3R(Posted 2004) [#30]

Itteration. hows that going to work in max ?


Yavin, I feel compelled to help you as it was me who recommended you use this thread. But, I don't fully understand this stuff myself yet so please forgive me if I'm giving you dodgy info ;)

I think you may find TLists (linked lists) suitable there, and it is a LOT more simple than the example you've posted.

You can create a linked list, add objects dynamically (strings in this case) to the list, then search through or modify the list in several ways (there are quite a few commands for lists). One way would be a simple 'For a$=EachIn list' loop which could be used to return the string (a similar thing can be done with arrays), or 'ListContains(list:TList,value:Object)' which would return true or false depending on whether the string exists.

I'm not sure if you can read them or not without registering, but here are a couple of threads about using the TLists. (may or may not help you)

http://www.blitzmax.com/Community/posts.php?topic=41548
http://www.blitzmax.com/Community/posts.php?topic=41708

Hope this helps answer your question :)


Paul "Taiphoz"(Posted 2004) [#31]
[Edit - Viper I took about 20 mins to write this reply so didnt see yours before clicking post .. ]

@ Skidracer : This is a complete waste of forum space, the thread is failing to do the job you want it to, its an attempt to solve the forum issue and I think its clear that everyone can see it for what it is. a really bad and poor attempt at a fix.

[Edit - post removed ]


VIP3R(Posted 2004) [#32]
I don't think you'ld get a much faster response in the Max forum tbh, most people are still getting to grips with the new syntax and things themselves. This thread should work fine in good time, by then a better way of doing it might be found anyway. Patience fella, only 12 days to go now ;)

Btw, did that answer help?


Paul "Taiphoz"(Posted 2004) [#33]
12 days till what ?

and sort of, its itteration m8 ie calling a function from within itself more than once its used for searching binary tree's and stuff like that as its extreamly fast.

well it is in c++ at least. Id guess that if it is possible then its going to be just as fast in max.

Just need some one to test it out with the win32 demo if possible.


VIP3R(Posted 2004) [#34]

12 days till what ?


The loan you're waiting for... remember? lol :)


big10p(Posted 2004) [#35]
You mean 'recursion', Yavin.

I don't have BMax but if it dosn't support recursive functions, I'll eat my head. B3D supports it fine, too.


Paul "Taiphoz"(Posted 2004) [#36]
yeah little news flash on the loan, My PC just blew up, so there goes my new gfx card and blitz max.

If I'm lucky it will just be the PSU thats gone and I'll still be able to get max and ma new card, if I'm not lucky though then I wont be joining anyone in the max forums :(


JoJo(Posted 2004) [#37]
When your accessing members, member functions and etc; is there some type of intellisense that comes up?


WendellM(Posted 2004) [#38]
Thanks for the " 'Global' variable in a function" info, skidracer - that looks like it'll do what's needed!

@big10p: I'm with you that putting a "Global" inside a function looks weird, but with BMX's flexibility, I expect that we could optionally redefine it as "StaticLocal" or whatever makes more sense to each of us.


big10p(Posted 2004) [#39]
Oh, OK, that's fair enough, I guess. I actually know very little about BMX. I really can't afford it at the mo'. I know it's only 50 quid but, yes... I AM THAT SKINT! :P

And in the off-chance anyone in the know is still watching this thread: does BMax support inline functions?


Paul "Taiphoz"(Posted 2004) [#40]
this thread is a waste of time and forum space please un sticky it.

Either that or link / sticky it in the Max forums so some of the people who could help can help.


big10p(Posted 2004) [#41]
That's a far too sensible suggestion to ever be put into effect around here, Yavin. :P


Gabriel(Posted 2004) [#42]
And in the off-chance anyone in the know is still watching this thread: does BMax support inline functions?


I was wondering this. I haven't found inline functions yet, but the docs are a bit.. sparse, so that doesn't necessarily mean anything. I haven't seen anyone mention them in the BMax forums though.


skidracer(Posted 2004) [#43]
I think the answer on that one is Not Yet.


Paul "Taiphoz"(Posted 2004) [#44]
If this dont get a Bmax answer soon then Im just gona start posting questions I have in the open forum.

You see just about all Pro games, or at least a big number of them allowing for support for both OpenGL and directX, normally through some option in the games Menu.

I'm wondering how easy this is going to be with Max, Given of course there there is a DX module added at some stage.

I mean is it going to involve codeding the game in both renderer's ? double the code ? or will it be simple with some switch/case statments picking which render functions you call..

I know this might be a hard one to answer so I guess its gona need some BR guys to reply.


big10p(Posted 2004) [#45]
I don't really understand the thinking behind having an option to change renderers. What's the point? I doubt 99.9 per cent of users know/care what renderer's being used. Or am I wrong? (highly likely :)


skidracer(Posted 2004) [#46]
I would assume it will be a flag in the Graphics command or an alternative Graphics command. Calling Graphics3D at present completely resets the device losing all textures so there's nothing stopping it using a different type of device altogether.


Paul "Taiphoz"(Posted 2004) [#47]
big10p : Half life for example allows you to use DX or OGL.

I found DX was better on one system, and OGL was better on another, both with diff hardware and CPU architecture.

I guess having this options just lets the user pick whats best for their hardware.


Réno(Posted 2005) [#48]
HI,

I have some questions on "Blitz max".

1/BM can make scale and rotations on images... but can it make scale an rotations on all the buffer ? In "simple" 2D plateforme game I draw "only" what's on the screen... in BM I'll have to draw more tiles when scaling ?

2/There is no "Gosub" in BM ???

3/Can we strech the buffer ? Ex : making a game in 400x300 and strech it in Bi-linear 640x480.

4/Can we load 8bits ( and keep in in 8bits in Vram ) images and draw them en 32bit mode to make blur/scale/rotations/strech ?

5/Is the sound commands are like BB2D/BB3D ?

6/Can we change the palette color in real time when drawing images ?

7/>Please mark, can you do something to force 60hz mode, something that the use could active before playing the game<

Thank you.