Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,014 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
killing the VAR type? #411035
11/12/12 12:30
11/12/12 12:30
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline OP
Serious User
Rackscha  Offline OP
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
Something that still feels odd when working with gamestudio is the VAR type. Something like this doesnt exist outside of gamestudio, and even the CROSSL-Language SDKs(C++/Delphi) have to deal with functions exported with this odd type.

As we are not working in the closed CScript world anymore, my vote goes towards removing this type. In my eyes its an obsolete type and we should get rid of it asap.

Less converting when working with external non LiteC things, too.

By removing this, many things become more straight forward(i.e. creating an sdk for another external language).

Is there any real reason to keep VAR? (dont go with "This will break past code" wink )


MY Website with news of my projects:
(for example my current
Muliplayer Bomberman,
GenesisPrecompiler for LiteC
and TileMaster, an easy to use Tile editor)
Sparetime-Development

Re: killing the VAR type? [Re: Rackscha] #411101
11/13/12 10:20
11/13/12 10:20
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Wow, most people ask here for adding a feature, but you're the only one so far who asked for removing a feature.

If you only could ask for removing the same features that others want to be added, I could go in vacation. laugh

Re: killing the VAR type? [Re: jcl] #411103
11/13/12 10:27
11/13/12 10:27
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
haha, i think this will never happen laugh

but i support Rackschas opinion, wrapping the var type is really annoying and unneccessary if i want to use gamestudio from C#, C++, whatever

i'm not using var anymore in any lite-c projects just because i don't need it
float or double gives me floating point numbers, int gives me integers

(And also it won't break my past code)


Visit my site: www.masterq32.de
Re: killing the VAR type? [Re: MasterQ32] #411110
11/13/12 10:45
11/13/12 10:45
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
On the very long run this may be a good idea. But I'm pretty sure JCL would only change this for a major release. Addiitionally at the moment there is no compellable reason to do so in the near future.

But have you also though about the consequences? Floating point numbers have got some harsh surprises for newbies.


Always learn from history, to be sure you make the same mistakes again...
Re: killing the VAR type? [Re: jcl] #411113
11/13/12 11:03
11/13/12 11:03
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Originally Posted By: jcl
Wow, most people ask here for adding a feature, but you're the only one so far who asked for removing a feature.


That is not true, several people asked for it. Interestingly, I bought some days ago for nostalgic reasons the "Gamestudio 3D" book and I noticed, that the "var" type was used 'til then.

Since interactive graphics demand speed and floating point is not usually the fastest kind of arithmetic available on personal computers, fixed point arithmetic is a valid alternative, because it uses ordinary integer operations. That was cool back in the nineties, because almost all consoles like SNES, Sega Megadrive and the Gameboy didn't had floating point units (FPUs); even on the PC fixed point values were popular in games like Doom because it improved performance. Still today fixed point arithmetics are used on most low-cost embedded microprocessors and microcontrollers, that also still don't have a FPU.

That is also true for many lower-end Android devices, that is why e.g. the OpenGL ES standard supports fixed point arithmetic side by side with floating point arithmetic, too. But even though you use float's, vertices are always stored in fixed point format. On the other hand, all iOS devices come with FPUs, so, it would be a waste to use fixed point arithmetic there, because internally, all fixed point values are converted to 32bit floats for all arithmetic operations, as far as I know. And if you know, for instance, that your Android device has a FPU, it would be also not very clever to use only fixed points (with the exception for vertices).

From a convenience point of view, I vote also for replacing the fixed point "var" type with e.g. floating points; especially to overcome the +/- 99999.999 limit and to model values beneath 0.001. I also - literally - HATE doing conversions all the time.

But I can totally understand, why JCL would stick to fixed point arithmetic. If he would replace them, I guess the first candidate were floats just because of the same byte-size (4). I also don't know if this would be a hit on the overall performance; I don't know what tricks are used by JCL to increase performance (if any?), but I doubt that there would be a speed-hit on Desktop PCs.

Last edited by HeelX; 11/13/12 11:04.
Re: killing the VAR type? [Re: HeelX] #411315
11/15/12 14:01
11/15/12 14:01
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
The performance of float and var on a PC is about the same, but on low end devices there's a difference. However the main reason for vars is not performance, but better accuracy, better support of math operators and comparisons, and better access to beginners.

Vars will also be the basic variable type for the upcoming Android version.

Re: killing the VAR type? [Re: jcl] #411407
11/16/12 11:41
11/16/12 11:41
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline OP
Serious User
Rackscha  Offline OP
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
Originally Posted By: jcl
but better accuracy, better support of math operators and comparisons, and better access to beginners.


Mh better accuracy? Thought vars go only down to 0.001. Yes its true that fixed point math does not suffer from mantisa problems, but a float is more acurat when in comes to calculate smaller numbers.

About comparision: I think its very important to learn for a beginner, that you DO NOT '==' compare to values if they are not integers. See this quite often in code from beginners in other languages and they always wonder why this doesnt work. By using fixed Point, it seems that this operator works more often, so beginners are misslead and learn it "wrong".

The problem in gamestudio (I think) seems to be the small gab between easy entry and overall understanding of how things work. The later one is skipped more often, i think.

I did my first steps in Programming with A5 when i was 13/14 years old, and when i left the environment of CScript, i went into a wall.

Floitingpoint precision problems, structuring a Programm without a scheduler(wait). I learned pretty quick, so it wasn't a big problem. But i have seen others.


edit: And when someone starts to work in an external language, its expectable that he is not just a bloody beginner. But at this point the VAR type just blocks easy access to the engine(as you have to "move around" it)

Last edited by Rackscha; 11/16/12 11:43.

MY Website with news of my projects:
(for example my current
Muliplayer Bomberman,
GenesisPrecompiler for LiteC
and TileMaster, an easy to use Tile editor)
Sparetime-Development


Moderated by  aztec, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1