Jump to content


NikaB

Member Since 18 Aug 2009
Offline Last Active Oct 05 2012 07:05 AM

Topics I've Started

3d Physics Engine with GM8.1

08 January 2012 - 04:32 PM

Hello GMC...
I'm now programming grenades for my online FPS, and I've got a little problem concerning its physics (collision reactions).
I use P3DC 6.00 for collision checking which do not require physics (like for the player). So everything works well until now...
I know GMNewton and GMBulletPhysics, but I don't know if they are compatible with GM8.1...
Could you tell me if they are or not ?
Or could you just tell me an advice on how to proceed or how to use one of these engines ?
Thanks !

Best way about simulating pointers in GM (Debate)

24 December 2011 - 09:58 AM

Basically, a pointer is a variable which indicates a memory address. For example, the variable POINTER=14; will indicate to the value stored in the 15th (don't forget the 0 !) place in the memory.
It is used in situations like this one :
You are loading music files at the beginning of the game. You save the variable whithin you loaded this file (address where they are stored) into a text file. Then, you reboot the game, and you want to know the music file you saved last time, so you read the text file. But now, you'll see that the values are different, because different memory address were used when loading the file (beginning of game). And now you'll need pointers. For each soundtrack, you'll make an "id" variable (for "sndtrack1", you'll say id=0; or for "sndtrack2" you'll say id=1 etc)
In the text file, you will save this value, and then when reading the text file, attributing the right soundtrack to the newly loaded "id" variable.
So in the game's main controller object, I usually make a ds_list.

Game Start
//Declaring my "memory"
global.CustomMemory=ds_list_create()
ds_list_add(global.CustomMemory,sound_add(...,snd0)) // now, it's the 1st place of the memory
ds_list_add(global.CustomMemory,sound_add(...,snd1)) // now, it's the 2nd place of the memory
//Etc...

Then, you save the text file

file_text_write_real(file,0) //you are saving value 0 (1st place in memory)
file_text_write_real(file,1)//you are saving value 1 (2st place in memory)

Rebooting, so memory address of loaded files are different.

Reading :

dummyVar[0]=file_text_read_real(file) //you are getting value you saved (here, 0)
dummyVar[1]=file_text_read_real(file) //you are getting value you saved (here, 1)

Assimilating :

sound_play(ds_list_find_value(dummyVar[0]))
//or 
sound_play(ds_list_find_value(dummyVar[1]))

Basically, this is my way of simulating pointers.

PS : Nocturne, I'm very sorry didn't think to do all of that (except for being lazy), I edited this first post.

P3DC 6.00 Fails Loading .d3d

10 December 2011 - 02:08 PM

Hello GMC !
So, I saw some people around the GMC who were complaining about P3DC's model loading system. Me too, I noticed that my map models, made in Sketchup and converted using GMModelFix, are drawn by GM's d3d_model_draw() function really well. But, when I load the map into P3DC, I get an unexpected error at the beginning of the game. I know that some people already know that error, and brett14 posted his model loading source, but I think it's really time to do something, it ruins everything ! If anyone knows how the models must be to for P3DC, please post it.
Reacting would be very appreciated !

PS : Here's my model. You can view it through GMModelfix. .obj and .d3d formats in the zip.
Link

Rotate a model around a custom axis ?

19 November 2011 - 09:09 AM

How can I rotate a model around a custom axis, not around the axis relative to the model ?

TOP VIEW (left) :
FRONT VIEW (right)
Red is y axis
http://imageshack.us.../3dproblem.png/

Blue z axis
Red y axis
So the axis I want to rotate around is the red axis at the bottom left. How can I achieve this (I don't know how to use d3d_transform_add_rotation_axis(....))

Dealing with String/Real values and variables.

13 September 2011 - 05:50 AM

Hi, GMC !
The main question in this topic is Can a string-containing variable be equal to the string NAME of another variable ?

I explain :

At the beginning of the game, I've got global.BGM1=sound_add(...). So it sets to global.BGM1 a real value, changing every time you boot the game again.
In the game rooms, obj_music has a mus variable which contains the music to play. (eg. mus=global.BGM1; or mus=global.BGM2 etc)
At checkpoints, every object's data is saved to a file (not built-in function). So the current music is saved as obj_music.mus, which equals global.BGM1 (or global.BGM2 or something) which equals to a value which, as said before, changes when I boot the game again. So when I rebooted the game and loaded the data saved previously, I obtain the value saved in the last built. So Values do not match. So nothing is played.

Now I was talking about strings and reals because the first idea the came to me was to set the variable which had to be saved as the STRING NAME OF THE VAR, not its real value.
And then load it as a string and transform it into a real number so it can recognize the var.

Please suppose me another way to do if this one is impossible. Otherwise, explain how can I do this.
Thanks !