Jump to content


graham

Member Since 15 Mar 2006
Offline Last Active Feb 01 2011 07:58 PM

Topics I've Started

Drawing Depths

19 July 2010 - 04:56 PM

Hi. I'm using Don Arthuro's fake 3d engine and I'm encountering a problem I'm unsure of how to fix.

Here is the drawing code for the "3d" objects (called in draw event):
//f3d_draw_block(x1,y1,z1,x2,y2,z2,texid,rotate,roof)
/*
Below you see the surface of the block, with the names of the coordinates. 
These are called 'd'(draw), '1' or '2'(level of height), 'x' or 'y', '1' or '2' or '3' or '4'(the number of the corner)
So for example d2x3 is the x-coordinate of the right-under corner at the second level of the block.
       wx  |
    1------------2   
    |      |     |    
 wy |      |     |    
 ---|------mid   |                 
    |            |               
    |            |              
    4------------3 
    
*/

var x1,x2,y1,y2,z1,z2,texid,dir,lines,wx,wy,surf_mid_x,surf_mid_y,mid_x,mid_y,d1x1,d1y1,d1x2,d1y2,d1x3,d1y3,d1x4,d1y4,d2x1,d2y1,d2x2,d2y2,d2x3,d2y3,d2x4,d2y4,c1x,c1y,c2x,c2y;

/////////////////////////////////////////////Init\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
x1=argument0
y1=argument1
z1=argument2
x2=argument3 
y2=argument4 
z2=argument5 
texid=argument6
texroof=argument7
dir=argument8
wx=(x2-x1)/2 //width
wy=(y2-y1)/2 //width


//////////////////////////////////////////Setting 3d-coordinates\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//the middlepoint on the surface
surf_mid_x=x1+wx
surf_mid_y=y1+wy

//coordinates on the surface when rotated
d1x1=surf_mid_x+lengthdir_x(-point_distance(x1,y1,surf_mid_x,surf_mid_y),point_direction(x1,y1,surf_mid_x,surf_mid_y)+dir)
d1y1=surf_mid_y+lengthdir_y(-point_distance(x1,y1,surf_mid_x,surf_mid_y),point_direction(x1,y1,surf_mid_x,surf_mid_y)+dir)
d1x2=surf_mid_x+lengthdir_x(-point_distance(x2,y1,surf_mid_x,surf_mid_y),point_direction(x2,y1,surf_mid_x,surf_mid_y)+dir)
d1y2=surf_mid_y+lengthdir_y(-point_distance(x2,y1,surf_mid_x,surf_mid_y),point_direction(x2,y1,surf_mid_x,surf_mid_y)+dir)
d1x3=surf_mid_x+lengthdir_x(-point_distance(x2,y2,surf_mid_x,surf_mid_y),point_direction(x2,y2,surf_mid_x,surf_mid_y)+dir)
d1y3=surf_mid_y+lengthdir_y(-point_distance(x2,y2,surf_mid_x,surf_mid_y),point_direction(x2,y2,surf_mid_x,surf_mid_y)+dir)
d1x4=surf_mid_x+lengthdir_x(-point_distance(x1,y2,surf_mid_x,surf_mid_y),point_direction(x1,y2,surf_mid_x,surf_mid_y)+dir)
d1y4=surf_mid_y+lengthdir_y(-point_distance(x1,y2,surf_mid_x,surf_mid_y),point_direction(x1,y2,surf_mid_x,surf_mid_y)+dir)
d2x1=d1x1
d2y1=d1y1
d2x2=d1x2
d2y2=d1y2
d2x3=d1x3
d2y3=d1y3
d2x4=d1x4
d2y4=d1y4

//coordinates at the z level
if z1<>0
    {
    d1x1+=lengthdir_x(point_distance(global.mid_x,global.mid_y,d1x1,d1y1)/(view_wview[0]/z1),point_direction(global.mid_x,global.mid_y,d1x1,d1y1))
    d1y1+=lengthdir_y(point_distance(global.mid_x,global.mid_y,d1x1,d1y1)/(view_wview[0]/z1),point_direction(global.mid_x,global.mid_y,d1x1,d1y1))
    d1x2+=lengthdir_x(point_distance(global.mid_x,global.mid_y,d1x2,d1y2)/(view_wview[0]/z1),point_direction(global.mid_x,global.mid_y,d1x2,d1y2))
    d1y2+=lengthdir_y(point_distance(global.mid_x,global.mid_y,d1x2,d1y2)/(view_wview[0]/z1),point_direction(global.mid_x,global.mid_y,d1x2,d1y2))
    d1x3+=lengthdir_x(point_distance(global.mid_x,global.mid_y,d1x3,d1y3)/(view_wview[0]/z1),point_direction(global.mid_x,global.mid_y,d1x3,d1y3))
    d1y3+=lengthdir_y(point_distance(global.mid_x,global.mid_y,d1x3,d1y3)/(view_wview[0]/z1),point_direction(global.mid_x,global.mid_y,d1x3,d1y3))
    d1x4+=lengthdir_x(point_distance(global.mid_x,global.mid_y,d1x4,d1y4)/(view_wview[0]/z1),point_direction(global.mid_x,global.mid_y,d1x4,d1y4))
    d1y4+=lengthdir_y(point_distance(global.mid_x,global.mid_y,d1x4,d1y4)/(view_wview[0]/z1),point_direction(global.mid_x,global.mid_y,d1x4,d1y4))
    }
if z2<>0
    {
    d2x1+=lengthdir_x(point_distance(global.mid_x,global.mid_y,d2x1,d2y1)/(view_wview[0]/z2),point_direction(global.mid_x,global.mid_y,d2x1,d2y1))
    d2y1+=lengthdir_y(point_distance(global.mid_x,global.mid_y,d2x1,d2y1)/(view_wview[0]/z2),point_direction(global.mid_x,global.mid_y,d2x1,d2y1))
    d2x2+=lengthdir_x(point_distance(global.mid_x,global.mid_y,d2x2,d2y2)/(view_wview[0]/z2),point_direction(global.mid_x,global.mid_y,d2x2,d2y2))
    d2y2+=lengthdir_y(point_distance(global.mid_x,global.mid_y,d2x2,d2y2)/(view_wview[0]/z2),point_direction(global.mid_x,global.mid_y,d2x2,d2y2))
    d2x3+=lengthdir_x(point_distance(global.mid_x,global.mid_y,d2x3,d2y3)/(view_wview[0]/z2),point_direction(global.mid_x,global.mid_y,d2x3,d2y3))
    d2y3+=lengthdir_y(point_distance(global.mid_x,global.mid_y,d2x3,d2y3)/(view_wview[0]/z2),point_direction(global.mid_x,global.mid_y,d2x3,d2y3))
    d2x4+=lengthdir_x(point_distance(global.mid_x,global.mid_y,d2x4,d2y4)/(view_wview[0]/z2),point_direction(global.mid_x,global.mid_y,d2x4,d2y4))
    d2y4+=lengthdir_y(point_distance(global.mid_x,global.mid_y,d2x4,d2y4)/(view_wview[0]/z2),point_direction(global.mid_x,global.mid_y,d2x4,d2y4))
    }
//The middle point of the block
mid_x=surf_mid_x+lengthdir_x(point_distance(global.mid_x,global.mid_y,surf_mid_x,surf_mid_y)/(view_wview[0]/mean(z1,z2)),point_direction(global.mid_x,global.mid_y,surf_mid_x,surf_mid_y))
mid_y=surf_mid_y+lengthdir_y(point_distance(global.mid_x,global.mid_y,surf_mid_x,surf_mid_y)/(view_wview[0]/mean(z1,z2)),point_direction(global.mid_x,global.mid_y,surf_mid_x,surf_mid_y))

//Setting depth to prevent overlay. Not working 100%
depth = (point_distance(global.mid_x,global.mid_y,x1+wx,y1+wy))/100



/////////////////////////////////////////////DRAW\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

//////////wall 1-2
//Middlepoints of the wall
c1x=d1x1+lengthdir_x(point_distance(d1x1,d1y1,d1x2,d1y2)/2,point_direction(d1x1,d1y1,d1x2,d1y2))
c1y=d1y1+lengthdir_y(point_distance(d1x1,d1y1,d1x2,d1y2)/2,point_direction(d1x1,d1y1,d1x2,d1y2))
c2x=d2x1+lengthdir_x(point_distance(d2x1,d2y1,d2x2,d2y2)/2,point_direction(d2x1,d2y1,d2x2,d2y2))
c2y=d2y1+lengthdir_y(point_distance(d2x1,d2y1,d2x2,d2y2)/2,point_direction(d2x1,d2y1,d2x2,d2y2))
//check if it has to be drawn
if point_distance(mid_x,mid_y,c1x,c1y)>point_distance(mid_x,mid_y,c2x,c2y)
    {
    //light
    draw_set_color(make_color_hsv(global.light_hue,global.light_saturation,f3d_light_value(point_direction(d1x1,d1y1,d1x2,d1y2)-90)))
    //drawing rectangle
    draw_primitive_begin_texture(pr_trianglelist,texid)
    draw_vertex_texture(d1x1,d1y1,0,0)
    draw_vertex_texture(d1x2,d1y2,1,0)
    draw_vertex_texture(d2x1,d2y1,0,1)

    draw_vertex_texture(d2x1,d2y1,0,1)
    draw_vertex_texture(d2x2,d2y2,1,1)
    draw_vertex_texture(d1x2,d1y2,1,0)
    draw_primitive_end()
    }
/////////wall 2-3
c1x=d1x2+lengthdir_x(point_distance(d1x2,d1y2,d1x3,d1y3)/2,point_direction(d1x2,d1y2,d1x3,d1y3))
c1y=d1y2+lengthdir_y(point_distance(d1x2,d1y2,d1x3,d1y3)/2,point_direction(d1x2,d1y2,d1x3,d1y3))
c2x=d2x2+lengthdir_x(point_distance(d2x2,d2y2,d2x3,d2y3)/2,point_direction(d2x2,d2y2,d2x3,d2y3))
c2y=d2y2+lengthdir_y(point_distance(d2x2,d2y2,d2x3,d2y3)/2,point_direction(d2x2,d2y2,d2x3,d2y3))
if point_distance(mid_x,mid_y,c1x,c1y)>point_distance(mid_x,mid_y,c2x,c2y)
    {
    draw_set_color(make_color_hsv(global.light_hue,global.light_saturation,f3d_light_value(point_direction(d1x2,d1y2,d1x3,d1y3)-90)))
    draw_primitive_begin_texture(pr_trianglelist,texid)
    draw_vertex_texture(d1x2,d1y2,0,0)
    draw_vertex_texture(d1x3,d1y3,1,0)
    draw_vertex_texture(d2x2,d2y2,0,1)
    
    draw_vertex_texture(d2x2,d2y2,0,1)
    draw_vertex_texture(d2x3,d2y3,1,1)
    draw_vertex_texture(d1x3,d1y3,1,0)
    draw_primitive_end()
    }
///////////wall 3-4
c1x=d1x3+lengthdir_x(point_distance(d1x3,d1y3,d1x4,d1y4)/2,point_direction(d1x3,d1y3,d1x4,d1y4))
c1y=d1y3+lengthdir_y(point_distance(d1x3,d1y3,d1x4,d1y4)/2,point_direction(d1x3,d1y3,d1x4,d1y4))
c2x=d2x3+lengthdir_x(point_distance(d2x3,d2y3,d2x4,d2y4)/2,point_direction(d2x3,d2y3,d2x4,d2y4))
c2y=d2y3+lengthdir_y(point_distance(d2x3,d2y3,d2x4,d2y4)/2,point_direction(d2x3,d2y3,d2x4,d2y4))
if point_distance(mid_x,mid_y,c1x,c1y)>point_distance(mid_x,mid_y,c2x,c2y)
    {
    draw_set_color(make_color_hsv(global.light_hue,global.light_saturation,f3d_light_value(point_direction(d1x3,d1y3,d1x4,d1y4)-90)))
    draw_primitive_begin_texture(pr_trianglelist,texid)
    draw_vertex_texture(d1x3,d1y3,0,0)
    draw_vertex_texture(d1x4,d1y4,1,0)
    draw_vertex_texture(d2x3,d2y3,0,1)
    
    draw_vertex_texture(d2x3,d2y3,0,1)
    draw_vertex_texture(d2x4,d2y4,1,1)
    draw_vertex_texture(d1x4,d1y4,1,0)
    draw_primitive_end()
    }   
////////////wall 4-1
c1x=d1x4+lengthdir_x(point_distance(d1x4,d1y4,d1x1,d1y1)/2,point_direction(d1x4,d1y4,d1x1,d1y1))
c1y=d1y4+lengthdir_y(point_distance(d1x4,d1y4,d1x1,d1y1)/2,point_direction(d1x4,d1y4,d1x1,d1y1))
c2x=d2x4+lengthdir_x(point_distance(d2x4,d2y4,d2x1,d2y1)/2,point_direction(d2x4,d2y4,d2x1,d2y1))
c2y=d2y4+lengthdir_y(point_distance(d2x4,d2y4,d2x1,d2y1)/2,point_direction(d2x4,d2y4,d2x1,d2y1))
if point_distance(mid_x,mid_y,c1x,c1y)>point_distance(mid_x,mid_y,c2x,c2y)
    {
    draw_set_color(make_color_hsv(global.light_hue,global.light_saturation,f3d_light_value(point_direction(d1x4,d1y4,d1x1,d1y1)-90)))
    draw_primitive_begin_texture(pr_trianglelist,texid)
    draw_vertex_texture(d1x4,d1y4,0,0)
    draw_vertex_texture(d1x1,d1y1,1,0)
    draw_vertex_texture(d2x4,d2y4,0,1)
    
    draw_vertex_texture(d2x4,d2y4,0,1)
    draw_vertex_texture(d2x1,d2y1,1,1)
    draw_vertex_texture(d1x1,d1y1,1,0)
    draw_primitive_end()
    }

/////////////Roof
draw_set_color(c_white)
draw_primitive_begin_texture(pr_trianglelist,texroof)
draw_vertex_texture(d2x1,d2y1,0,0)
draw_vertex_texture(d2x2,d2y2,1,0)
draw_vertex_texture(d2x3,d2y3,1,1)

draw_vertex_texture(d2x1,d2y1,0,0)
draw_vertex_texture(d2x4,d2y4,0,1)
draw_vertex_texture(d2x3,d2y3,1,1)
draw_primitive_end()

This is the problem I'm encountering:
Posted Image

Is there a way that I could get the door to be drawn correctly?  I figured that having the door on a depth of 10 and the building on a depth or 0 could help, but it did nothing.  Any ideas?

Is there some way that I could get the depth of the top face of the cube to be drawn at a depth corresponding to the depth of the object?  That would cause the roof of the building to overlap, would it not?

Thanks for any help!

Simple Sprite Request

19 July 2010 - 03:15 AM

Hi, I'm not the best drawer so I'm looking for some help in making a few top down sprites.  I just need three sprites of line art, then I can texture them myself.  If this isn't too hard I'd really appreciate the help.  I'll credit you if you'd like.

96 x 96 pixels
Black 1px width line art
Top down

Sprite 1 - man, arms down at sides
Sprite 2 - man, arms in position to hold a gun

Sprite 3 - woman, arms down at sides

Thanks!

Keyboard DJ (14 July)

11 July 2010 - 04:31 AM

KBDJ


Description
KBDJ is a work-in-progress DJ program using SXMS that can be efficiently controlled without turntables, a mixer, or complicated MIDI mapping.  I've built it to be easy to use with just a mouse and keyboard controls.

Screenshot

Posted Image


Demo Video


Still need major work on the optimization; I couldn't run CamStudio and KBDJ or the audio would be terrible.  Early development demo.  Tracklisting:

Brazil - Deadmau5
Strobe (Club Edit) - Deadmau5
Better Run (Inpetto Remix) - Tocadisco ft. Nadia Ali



Download
3.2 MB, GameJolt, .zip file: Download
GM7 Pro, Does not change resolution, uses highest program priority

Brief Controls
To activate or deactivate a button, click it. To turn a knob, mouse over it and use Q to decrease and W to increase. Hold space while turning a knob to increase the turn amount. Right Click any knob, dropdown, or the crossfader to reset it.

Refer to the help file in the game folder for more detailed information and techniques.

Note
If the sound quality is bad on your computer, it is because your computer is having trouble handling KBDJ. Try closing down some programs. If the problem persists, it is because your computer does not have sufficient sound capabilities to run KBDJ.
KBDJ is still not really practical for any live use
The pitch control does not affect BPM, use the frequency for that
It's impractical to mix tracks without an efficient way of controlling BPM (Freq just doesn't really cut it)
The graphs are mostly impractical as they aren't for the full song

Bugs
Placeholder track ID3 tags unrecognized, garbage characters
Some ID3 tags not read
After playing a placeholder track, once reloaded the track will loop somewhere around 25%

To Do (*Possibility)
*Implement BPM detection, track sync
Fix loop bug
Fix track error bug
*Better ID3 reading
*Significant speed optimization (GM is at its limits)
Optimize effect modulation knobs
Keyboard Shortcuts (after more testing)
*Recording
Additional knob subimages
Help file
Change visualization to the song's wave graph

What to Mix?
If you need an idea on what to mix, I'll tell you what I like.  Unfortunately I can't put up any files on here for you, but try searching for artists like deadmau5, Benny Benassi, Afrojack, Crookers, or David Guetta.  Those are some house and electro artists that I like and are fairly common.

If you download, thank you, and please leave a comment! That's what WIP's are all about!
If you encounter any bugs or glitches, please post the message from Game Maker and describe the scenario if you think it could help.

Thanks!


sxms throwing error - solved

17 June 2010 - 04:55 PM

I'm working in Shatlif's SXMS wrapper and I'm having trouble streaming (from a local file, not network streaming) two concurrent sounds on separate channels.  FMOD is throwing an error (An invalid parameter was passed to this function.) when I load the second sound on the second channel, and I can't figure out why.

Object 1 handles Sound 0 on Channel 0: (all this works fine, fully tested)
filename = working_directory+"\deck1.mp3"; //get file

sxfmod_system_createSound(filename,sxms.FMOD_ACCURATETIME|sxms.FMOD_SOFTWARE|sxms.FMOD_CREATESTREAM|sxms.FMOD_2D,0); //load file, tags, sound index 0
track1 = sxfmod_system_playSound(0,0,1); //play sound, set to channel 0, pause on play

sxfmod_system_createChannelGroup(0); //bug fix, creates channel group 0
sxfmod_channel_setChannelGroup(track1,0); //assigns the track1 channel to channel group 0

drawLength = sxfmod_sound_getLength(0,sxms.FMOD_TIMEUNIT_MS); //drawing stuff
drawLengthFix = correctTime(drawLength); //drawing stuff
drawFormat = sxfmod_sound_getFormat(0,0); //drawing stuff
constant.visualreset = 1; //drawing stuff

Object 2 handles Sound 1 on Channel 1: (here's where the errors begin)

filename = working_directory+"\deck2.mp3"; //picks the sound for channel 2

sxfmod_system_createSound(filename,sxms.FMOD_ACCURATETIME|sxms.FMOD_SOFTWARE|sxms.FMOD_CREATESTREAM|sxms.FMOD_2D,1); //returns success in loading file to sound index 1 (sound index 0 is occupied by the sound from the other object)
track2 = sxfmod_system_playSound(1,1,1); //(sound index 1, channel 1, stop sound at start - 1) ERROR from sound index - why??? file was loaded correctly in the last function

sxfmod_system_createChannelGroup(1);
sxfmod_channel_setChannelGroup(track2,1); //ERROR from track ID - probably caused by the error in playSound

drawLength = sxfmod_sound_getLength(1,sxms.FMOD_TIMEUNIT_MS); //ERROR from the sound index, just like playSound
drawLengthFix = correctTime(drawLength);
drawFormat = sxfmod_sound_getFormat(1,0); //ERROR from the sound index, just like playSound
constant.visualreset = 1;

So it seems like FMOD loads the sound correctly, places it in index 1, and when it goes to get the sound, it throws an error.  Any ideas?
Thanks!

I was missing an argument in
xfmod_system_createSound(filename,sxms.FMOD_ACCURATETIME|sxms.FMOD_SOFTWARE|sxms.FMOD_CREATESTREAM|sxms.FMOD_2D,[1]); - that 1 was doing something different, it needs to be [0,1]

Please ignore the next question, already solved.

Can't figure this one out...

sxfmod_sound_release(0); //dump the old music
filename = get_open_filename("Music File|*.mp3;*.ogg;*.flac;*.wma;*.wav",""); //get new file

if (filename != "" && file_exists(filename)) //so here, if I press cancel or the file doesn't exist, it should skip the curly braces
{
    sxfmod_system_createSound(filename,sxms.FMOD_ACCURATETIME|sxms.FMOD_SOFTWARE|sxms.FMOD_CREATESTREAM|sxms.FMOD_2D,0); //however, if I hit cancel, FMOD always tries to load the non existing file and throws an error
}

So why is the code in the curly braces executing?  Shouldn't hitting cancel and returning the blank string keep from executing the code?  Everything works fine when I don't cancel, so the internals of the curly braces have no problems.

This seems too simple, am I missing something obvious?
Thanks


Keyboard Dj

10 June 2010 - 06:40 PM

KEYBOARD DJ

Introduction:
I've recently gotten into DJing (albeit cheaply; purchasing a Numark Total Control soon) and I've been fooling around with Tracktor Scratch Pro lately.  I've had a lot of fun with the program, and it came to my attention that I've found no real mixing software optimized entirely for use on a single computer or laptop.  Such a program has huge potential, whether for simply playing around or even DJing something like a friend's party on a budget.

Creating a keyboard and mouse mixing software would fill that void.  However, it's going to be a lot of work; building the program will also require areas of skills in which I am not familiar.  If you're a DJ, or even interested in DJing, and have skills to offer, you could be a great help.

Skill Sets:
Graphic Designer - I can do the graphics for the program, but I doubt I can pull off an entirely professional theme for the software.  If you're highly skilled and can make the program look as good as this or this, you're on board.

Audio Expert - The audio portion of the program is going to require a incredibly thorough knowledge of something like Shatlif's SXMS or icuurd12b42's GMFMOD SIMPLE engines, quite frankly I don't even know which would be better, or if there is a better engine.  If you can create an engine using an extension to manage and modify two concurrent tracks, determine BPM (very valuable but ultimately optional), and create wave graphics from the music, you're welcome to help.

If you have a further skill set that you think could be helpful to the effort, please contact me!

Reference:
Traktor, Cue, ITCH - DJ software

KEYBOARD DJ Mockup
Posted Image

Notes:
This system will use only the mouse and keyboard to manage the software, no external components (turntables, mic, mixer).
I don't think it's possible to add monitoring with headphones along with speaker output through Game Maker.

Conclusion:
If you can help, please send me a PM here.  I can provide a forum for collaboration.  These positions are not for profit.  You will be fully credited in game, and I will be happy to let you add in links to your websites or whatever else you would like.  Please do not apply if you are not dependable or mature enough to contribute efficiently.

Thanks, and I look forward to hearing from you!
graham