Jump to content


Kaeru

Member Since 17 Jul 2010
Offline Last Active May 03 2011 06:57 PM

Posts I've Made

In Topic: rts game sprites

05 January 2011 - 04:45 PM

have a look here:
http://reinerstileset.4players.de/

In Topic: Arrays

30 December 2010 - 01:26 PM

think of it like a table, where the lines is the specific weapon and the rows is the stats of each.

name              | load   | hitpoints
------------------+--------+-----------
"pistol"          |     6  |        3
"smg"             |    60  |       10
"bazooka"         |     2  |       50
"granade"         |     3  |       30
"bow'n'arrows"    |    20  |        1
"nuclear missile" |     1  |     1000

In Topic: Arrays

29 December 2010 - 09:34 PM

you can also put all data in one array...
w_name = 0
w_load = 1
w_hitpoints = 2
weapon[0,0]="pistol"
weapon[1,0]="smg"
weapon[2,0]="bazooka"
weapon[3,0]="granade"
weapon[4,0]="bow'n'arrows"
weapon[5,0]="nuclear missile"

weapon[0,1]=6
weapon[1,1]=60
weapon[2,1]=2
weapon[3,1]=3
weapon[4,1]=20
weapon[5,1]=1

weapon[0,2]=3
weapon[1,2]=10
weapon[2,2]=50
weapon[3,2]=30
weapon[4,2]=1
weapon[5,2]=1000

display_name = weapon[ number, w_name ]

hit = weapon[ number, w_hitpoints ]

if (load < 0) { load = weapon[ number, w_load ] }
well, at least I think I remember you can mix up strings and reals in an array... if not, use a ds_grid for this.

In Topic: Write Float in a binary file

29 December 2010 - 11:06 AM

lol... you don't need this formula.
what you need to know is, that a float is also just represented by some bytes in the memory.
what is relevant to you in this article is this part: http://en.wikipedia...._representation
as you can see, an 8byte float uses 51 bits for the mantissa and 11 for the exponent.
but whether those bytes are interpreted as a float or as an integer is irrelevant to the process of writing it to a file.

since GML can only write bytes to a binary file, you would need to cut the float (called real in GM) into 8 pieces and write them manually.
to get the internal representation of the real bytewise, you would need the pointer, but GML cannot handle pointers.

so, it's just not possible, because the purpose of GML is to create games, not to write a database handler.
this is the reason why GML can use DLLs. no language is an "Inspector Gadget".
Write your binary file I/O in another language and make a DLL of it, or use a common DLL like suggested.
if you just want to learn the how-to in some language, get the Demo of PureBasic and write a little program for file I/O.

In Topic: Write Float in a binary file

28 December 2010 - 06:30 PM

in other languages I would use a Structure Union to cover a Float with an Integer...
but most other languages have functions to write floats to files.

to learn how a flaot is stored in mem, read the wiki article: http://en.wikipedia..../Floating_point