Hi there, Im looking to add mulitplayer to a game I am working on, and have been looking at the different multiplayer dll's in an attempt to find one that allows easy game browsing. it seems none of them have a built-in way to make this easy (you need to know the external ip of the host). So I have come up with an idea which should get around this, but before I spend time working on it, I was hoping people experienced in 39dll (or other multiplayer dll's) could tell me if the functions required to carry out the below are available in these systems :
inside the game it contains a HTTP address to a text file stored on a server
when you host an internet game, the application reads the contents of this file, and if your external IP address is not stored inside, it appends your external ip to the end of the file.
once this is done your game is hosted and you are placed in the lobby, awaiting players to connect
joe, jack and jill start the game up and head to join an internet game
there application connects to the server, and reads the contents of this text file.
it then attempts to connect to each IP address and request game information from the host
if the host fails to return game information to the client, the client application modifies the server text file and flags the host as unresponsive
for this particular client, this game from that host is not shown, although the host remains in the list until
5 clients flag an IP address as unresponsive, the client removes this ip from the server text file
if the client recieves information from the host however, its unresponsive flag is reset, and the game information is displayed in there browser
theoretically, this will allow people to host and browse games from anywhere over the internet providing that the server with the text file is available.
in the game there will be an "official server" and the ability to enter a custom server address (so that if for some reason the default server goes down, people can make there own)
so, can this be done? would it work as I think it would?
- Game Maker Community
- → Viewing Profile: Topics: templargfx
templargfx
Member Since 08 Mar 2004Offline Last Active Apr 05 2012 04:40 AM
Community Stats
- Group New Member
- Active Posts 1940
- Profile Views 2871
- Member Title GMC Member
- Age 32 years old
- Birthday June 3, 1980
-
Gender
Not Telling
-
Location
Australia
0
none
Topics I've Started
Multiplayer Game Browser
05 October 2009 - 03:40 AM
Command A Space Ship - Design Concept
30 September 2009 - 11:47 AM
Hi all,
I have thought about this many times, and after watching another run through the awesome TV show Firefly. I thought I would flesh out my idea on here.
OVERVIEW :
You play as a thief/smuggler/crook who has just hit the big ticket from a heist you were brought in on, with a large wad of cash in your account, you set out to the shipyard to purchase yourself a ship, then its off to find a crew, head out into the void and make a name for yourself.
The game is about the joys and the pains of being a captain of a ship, liasing with contacts, interacting with your crew, running jobs, avoiding/negotiating with authorities etc. each crew will have "sims-esk" needs and wants, which will need to be fullfilled (to a degree) in order to keep them happy
When in space, the game will focus on story telling inside the ship, rather than just being you flying around space controlling the ship. The pilot you hire will be the one to do most of the flying, not to say you cant fly, but if you fly all the time yourself, you are going to annoy your pilot! (he may even quit!)
You will be free to move around your chosen ship, check out the different systems, interact with your crew, check the Core (aka internet) for jobs/contacts (legal or otherwise), order parts, book repairs/outfits etc.
The game will play completely from the top-down perspective, you will control your character with the keyboard/mouse, used like a point and click adventure, moving your character, looking at objects, interacting with objects/people etc. When using different systems on your ship (helm, radar, turret, nav system etc) controls will change to best suit the purpose of that system (keyboard ship movement, mouse weapon targetting etc)
to make things smooth and seemless, the ship will be split into layers/floors, of which you can move around and explore, these layers will be directly drawn into the game world, beneath the outer ship graphics, zooming in to the fullest when you are moving around the ship, or zooming out when flying the ship/using the radar (without ever changing rooms or having loading screens).
When walking around (directly controlling your character) the size will be like most TDS shooters you see on here, with characters wieghing it at around 128x128 (for detail), when controlling the ship, scale will decrease to around 25%, with the ability to zoom in our out to the limit of your sensors/radar (not as far out if you are piloting yourself). There will be no quick access menu, if you want to fly the ship, you will first need to walk to the bridge, and activate the pilot controls. to talk to a crew member on the other side of the ship, you will need to use the intercom, or walk up to them to talk in person (or use the intercom and tell them to come to you). The idea behind this is to really convey the size and scale of the ships, as you wont be flying around in little fighters, but larger multi-crew cargo haulers, cruisers, science vessals etc.
Gameplay :
Like I said, the game will focus more on the captaining side, than the flying around shooting stuff angle. that being said, you will be able to plot courses to planet/systems, land on planets/stations and then exit the ship (with or without your crew) and interact with people on that planet/ship. you can haul legal cargo from point a to point b, hold-up establishments, steal artifacts, all that sort of thing. Or you could just fly around space exploring, finding derelict space craft, uncovering mysteries etc. The crew you hire will have to be similarily minded as you (gun-slinging bad boys wont enjoy flying around space just to see whats there for example, or scientists arent going to be of much help when holding up a bank).
Each crew member (yourself included) will have statistics, skills and experience. And different crew members will be needed to do different things (pilot probably wont be able to fix an engine malfunction, and your engineer probably wont be able to fly your ship with any amount of grace, and heaven help you should things go wrong). When on a planet or another ship(or if yours is boarded) and a fight breaks out you will control your character much like a normal TDS with weapons and cover etc. any damage done to your or your crew will need a medic and time to fix (no healthpacks or insta-heals) so avoiding fights wherever possible will be the best option (unless you have built up a well equipped strike force whose sole purpose IS warefare)
There will be a universal story that will play out as you progress (such as first contact with aliens is made, or the primary ruling government collapses, this I havent decided) and at some point you will be dragged into this (although you can try and avoid it for as long as possible if you wish). Different territories/sectors will have there own good and bad organisations, and some will not like each other, working for one may close doors elswhere, or open doors in others. As you complete more jobs, or complete tasks of recognition, people/authorities will start to have heard of you, increasing your renown (and therefore cost) and also increasing the chances a bounty hunter may decide your worth the trouble of catching.
this is all I have for the moment, I am working on a basic test of the idea at the moment, with the seemless shifting between character control to ship control etc so hopefully I will have something soon to give you a better understanding of what I mean.
Descriptive example of gameplay :
you start out standing at the entrance to a ship yard, you walk in to the yard and are immediately approached by a salesman who asks you what you are looking for, you tell him your just looking around, he points out a few interesting ships, then walks off promising to come back later. exploring the shipyard, you check out the exterior of a few ships, reading there statistics on the sales boards, showing particular interest in one of the ships, the salesman returns, asking if you would like to see inside, answering yes, the salesman opens the ship up, and you enter inside, as you are taken on a tour, the salesman mutters on about different systems, the pros and cons of this ship over others etc. Liking what you see, you head back to the main office with the salesman and negotiate a sales price. coming to an agreement, you sign the papers and the ship is yours. The salesman explains it will take 24 hours for your new ship to be moved from the shipyard to the dock. While you wait for this to happen, you head into the city and make your way to a bar known to be a good place to find crew. walking in you order a drink, and mingle with the patrons, discussing backgrounds/likes-dislikes and offering positions to those people you feel will be of the most use to you. some of the people you approach will organise to come and see your ship before making a decision, or will want others to be hired aswell. The following day you make your way to the docks where you find your ship ready to go, some of your new crew have already arrived, others are nowhere to be found. after giving your crew a look around the ship, and the remaining members have arrived, you call them all into the mess-hall for a quick discussion on what everyone wants to do, and where to go from here. Your engineer talks about the good and bad things about the ship the salesman "forgot" to mention, and requests parts to be purchased before heading out. You pay each crew there first wage and give money to your engineer for him to pick up some badly needed parts, and get the other crew to buy supplies. a few hours later they return with there goods, and the engineer gets to work fixing what needs fixing, your pilot heads to the bridge to start pre-flight checks and the other crew make themselves comfortable while you all wait to take off. once your pilot and engineer give you the go-ahead, you jump onto the com-system and request clearance to take of from the dock master. Clearance is granted, so you order your pilot to take you out of atmo and into space...
I am looking for suggestions/feedback on the gameplay elements I have described above, and on the whole idea in general.
thankyou for spending the time to read this far!
I have thought about this many times, and after watching another run through the awesome TV show Firefly. I thought I would flesh out my idea on here.
OVERVIEW :
You play as a thief/smuggler/crook who has just hit the big ticket from a heist you were brought in on, with a large wad of cash in your account, you set out to the shipyard to purchase yourself a ship, then its off to find a crew, head out into the void and make a name for yourself.
The game is about the joys and the pains of being a captain of a ship, liasing with contacts, interacting with your crew, running jobs, avoiding/negotiating with authorities etc. each crew will have "sims-esk" needs and wants, which will need to be fullfilled (to a degree) in order to keep them happy
When in space, the game will focus on story telling inside the ship, rather than just being you flying around space controlling the ship. The pilot you hire will be the one to do most of the flying, not to say you cant fly, but if you fly all the time yourself, you are going to annoy your pilot! (he may even quit!)
You will be free to move around your chosen ship, check out the different systems, interact with your crew, check the Core (aka internet) for jobs/contacts (legal or otherwise), order parts, book repairs/outfits etc.
The game will play completely from the top-down perspective, you will control your character with the keyboard/mouse, used like a point and click adventure, moving your character, looking at objects, interacting with objects/people etc. When using different systems on your ship (helm, radar, turret, nav system etc) controls will change to best suit the purpose of that system (keyboard ship movement, mouse weapon targetting etc)
to make things smooth and seemless, the ship will be split into layers/floors, of which you can move around and explore, these layers will be directly drawn into the game world, beneath the outer ship graphics, zooming in to the fullest when you are moving around the ship, or zooming out when flying the ship/using the radar (without ever changing rooms or having loading screens).
When walking around (directly controlling your character) the size will be like most TDS shooters you see on here, with characters wieghing it at around 128x128 (for detail), when controlling the ship, scale will decrease to around 25%, with the ability to zoom in our out to the limit of your sensors/radar (not as far out if you are piloting yourself). There will be no quick access menu, if you want to fly the ship, you will first need to walk to the bridge, and activate the pilot controls. to talk to a crew member on the other side of the ship, you will need to use the intercom, or walk up to them to talk in person (or use the intercom and tell them to come to you). The idea behind this is to really convey the size and scale of the ships, as you wont be flying around in little fighters, but larger multi-crew cargo haulers, cruisers, science vessals etc.
Gameplay :
Like I said, the game will focus more on the captaining side, than the flying around shooting stuff angle. that being said, you will be able to plot courses to planet/systems, land on planets/stations and then exit the ship (with or without your crew) and interact with people on that planet/ship. you can haul legal cargo from point a to point b, hold-up establishments, steal artifacts, all that sort of thing. Or you could just fly around space exploring, finding derelict space craft, uncovering mysteries etc. The crew you hire will have to be similarily minded as you (gun-slinging bad boys wont enjoy flying around space just to see whats there for example, or scientists arent going to be of much help when holding up a bank).
Each crew member (yourself included) will have statistics, skills and experience. And different crew members will be needed to do different things (pilot probably wont be able to fix an engine malfunction, and your engineer probably wont be able to fly your ship with any amount of grace, and heaven help you should things go wrong). When on a planet or another ship(or if yours is boarded) and a fight breaks out you will control your character much like a normal TDS with weapons and cover etc. any damage done to your or your crew will need a medic and time to fix (no healthpacks or insta-heals) so avoiding fights wherever possible will be the best option (unless you have built up a well equipped strike force whose sole purpose IS warefare)
There will be a universal story that will play out as you progress (such as first contact with aliens is made, or the primary ruling government collapses, this I havent decided) and at some point you will be dragged into this (although you can try and avoid it for as long as possible if you wish). Different territories/sectors will have there own good and bad organisations, and some will not like each other, working for one may close doors elswhere, or open doors in others. As you complete more jobs, or complete tasks of recognition, people/authorities will start to have heard of you, increasing your renown (and therefore cost) and also increasing the chances a bounty hunter may decide your worth the trouble of catching.
this is all I have for the moment, I am working on a basic test of the idea at the moment, with the seemless shifting between character control to ship control etc so hopefully I will have something soon to give you a better understanding of what I mean.
Descriptive example of gameplay :
you start out standing at the entrance to a ship yard, you walk in to the yard and are immediately approached by a salesman who asks you what you are looking for, you tell him your just looking around, he points out a few interesting ships, then walks off promising to come back later. exploring the shipyard, you check out the exterior of a few ships, reading there statistics on the sales boards, showing particular interest in one of the ships, the salesman returns, asking if you would like to see inside, answering yes, the salesman opens the ship up, and you enter inside, as you are taken on a tour, the salesman mutters on about different systems, the pros and cons of this ship over others etc. Liking what you see, you head back to the main office with the salesman and negotiate a sales price. coming to an agreement, you sign the papers and the ship is yours. The salesman explains it will take 24 hours for your new ship to be moved from the shipyard to the dock. While you wait for this to happen, you head into the city and make your way to a bar known to be a good place to find crew. walking in you order a drink, and mingle with the patrons, discussing backgrounds/likes-dislikes and offering positions to those people you feel will be of the most use to you. some of the people you approach will organise to come and see your ship before making a decision, or will want others to be hired aswell. The following day you make your way to the docks where you find your ship ready to go, some of your new crew have already arrived, others are nowhere to be found. after giving your crew a look around the ship, and the remaining members have arrived, you call them all into the mess-hall for a quick discussion on what everyone wants to do, and where to go from here. Your engineer talks about the good and bad things about the ship the salesman "forgot" to mention, and requests parts to be purchased before heading out. You pay each crew there first wage and give money to your engineer for him to pick up some badly needed parts, and get the other crew to buy supplies. a few hours later they return with there goods, and the engineer gets to work fixing what needs fixing, your pilot heads to the bridge to start pre-flight checks and the other crew make themselves comfortable while you all wait to take off. once your pilot and engineer give you the go-ahead, you jump onto the com-system and request clearance to take of from the dock master. Clearance is granted, so you order your pilot to take you out of atmo and into space...
I am looking for suggestions/feedback on the gameplay elements I have described above, and on the whole idea in general.
thankyou for spending the time to read this far!
Mask Creation Screws Up With Transperant Sprites
17 September 2009 - 03:45 AM
****I had to repost this because the forum not only truncated a large portion of my post, but it also obliterated by ability to edit the post (the fast reply is actually IN my post now) Heres hoping this one doesnt do the same!
ok, this is a little complicated, so bare with me!
in my game, I use a layer of 512x512 tiled surfaces to draw all my room graphics to, these surfaces are then used in conjunction with another layer of 512x512 tiled surfaces to create solid masks of areas not containing any graphics.
it works completely fine, until I turn on the extra detail sprites, which have transparent areas, as soon as I do. the graphics is still created fine, but the blocking masks treat the extra detail sprites as blocking areas (does that make sense? hopefully these pics will help)

graphics and masks created without transparent sprites. works fine

graphics and masks created with transparent sprites. doesnt work well at all
what I cannot understand is how this is possible, here is the process the graphics generator goes through :
create instances with unique sprites to create all the graphics for the room
draw instance sprites onto tile_surface for room graphics and remove instances
draw tile_surface graphics onto blocker_surface using c_black image_blend
create a sprite from blocker_surface to be used for collisions
now, what makes no sense to me is the fact that all the graphics are drawn to a surface, and then these surfaces are drawn to another surface.
the blocker surface is cleared with c_purple, and then the surfaces are drawn with a blend color of c_black, making any area of the sprite that has color, be black when drawn. so, if the graphics surfaces look fine, then how is the blocker_surface making purple areas for where the extra details are placed?
the graphics are drawn in 80x80 grids, first the underlay is drawn (non transperant 80x80 sprite) then the floor is drawn (another 80x80 non transperant sprite) and finally the extra detail is drawn ontop of that. if 2 80x80 squares that are completely opaque are drawn first onto a single surface, how does blocker_surface create a mask that only includes the extra detail!?
here is the code for creating the instances with the graphics (scary long, but you only need to worry about the top section that deals with extra detail)
ok, this is a little complicated, so bare with me!
in my game, I use a layer of 512x512 tiled surfaces to draw all my room graphics to, these surfaces are then used in conjunction with another layer of 512x512 tiled surfaces to create solid masks of areas not containing any graphics.
it works completely fine, until I turn on the extra detail sprites, which have transparent areas, as soon as I do. the graphics is still created fine, but the blocking masks treat the extra detail sprites as blocking areas (does that make sense? hopefully these pics will help)

graphics and masks created without transparent sprites. works fine

graphics and masks created with transparent sprites. doesnt work well at all
what I cannot understand is how this is possible, here is the process the graphics generator goes through :
create instances with unique sprites to create all the graphics for the room
draw instance sprites onto tile_surface for room graphics and remove instances
draw tile_surface graphics onto blocker_surface using c_black image_blend
create a sprite from blocker_surface to be used for collisions
now, what makes no sense to me is the fact that all the graphics are drawn to a surface, and then these surfaces are drawn to another surface.
the blocker surface is cleared with c_purple, and then the surfaces are drawn with a blend color of c_black, making any area of the sprite that has color, be black when drawn. so, if the graphics surfaces look fine, then how is the blocker_surface making purple areas for where the extra details are placed?
the graphics are drawn in 80x80 grids, first the underlay is drawn (non transperant 80x80 sprite) then the floor is drawn (another 80x80 non transperant sprite) and finally the extra detail is drawn ontop of that. if 2 80x80 squares that are completely opaque are drawn first onto a single surface, how does blocker_surface create a mask that only includes the extra detail!?
here is the code for creating the instances with the graphics (scary long, but you only need to worry about the top section that deals with extra detail)
up = collision_point(x,y-80,tile_obj,0,1);
down = collision_point(x,y+80,tile_obj,0,1);
left = collision_point(x-80,y,tile_obj,0,1);
right = collision_point(x+80,y,tile_obj,0,1);
upleft = collision_point(x-80,y-80,tile_obj,0,1);
upright = collision_point(x+80,y-80,tile_obj,0,1);
downleft = collision_point(x-80,y+80,tile_obj,0,1);
downright = collision_point(x+80,y+80,tile_obj,0,1);
//create floor
with (instance_create(x,y,tile_part_a_obj)) //underlay
{
depth=992;
image_angle = 0;
sprite_index = sprite_init.underlay[other.tileset];
image_speed = 0
}
with (instance_create(x,y,tile_part_a_obj)) //tile
{
depth=991;
image_angle = choose(0,90,180,270);
//image_xscale = choose(-1,1);
//image_yscale = choose(-1,1);
if (image_angle == 0){x-=40;y-=40}
if (image_angle == 90){x-=40;y+=39}
if (image_angle == 180){x+=39;y+=39}
if (image_angle == 270){x+=39;y-=40}
image_index = choose(0,0,0,0,0,1,1,1,1,2,3,4,5,6);
sprite_index = sprite_init.tiles[other.tileset];
image_speed = 0
}
if (0 == 0) //extra detail
{
with (instance_create(x,y,tile_part_a_obj))
{
depth=990;
image_angle = choose(0,90,180,270);
image_index = floor(random(sprite_init.extra_count));
sprite_index = sprite_init.extra[other.tileset];
image_speed = 0
}
}
//create corners
if (!upright && up && right)
{
with (instance_create(x+40,y-81,tile_part_a_obj))
{depth=989;image_angle = 90;image_xscale = -1;other.corner = id;sprite_index = sprite_init.inner_corner[other.tileset]}
}
if (!downright && down && right)
{
with (instance_create(x+80,y+40,tile_part_a_obj))
{depth=989;image_angle = 0;image_xscale = -1;other.corner = id;sprite_index = sprite_init.inner_corner[other.tileset]}
}
if (!downleft && down && left)
{
with (instance_create(x-41,y+80,tile_part_a_obj))
{depth=989;image_angle = -90;image_xscale = -1;other.corner = id;sprite_index = sprite_init.inner_corner[other.tileset]}
}
if (!upleft && up && left)
{
with (instance_create(x-81,y-41,tile_part_a_obj))
{depth=989;image_angle = 180;image_xscale = -1;other.corner = id;sprite_index = sprite_init.inner_corner[other.tileset]}
}
if (!up && !upright && !right)
{
with (instance_create(x+40,y-41,tile_part_a_obj))
{
depth=989;
image_angle = 90;
sprite_index = sprite_init.outer_corner[other.tileset];
image_index = 0;
image_speed = 0
}
}
if (!right && !downright && !down)
{
with (instance_create(x+40,y+40,tile_part_a_obj))
{
depth=989;
image_angle = 0;
sprite_index = sprite_init.outer_corner[other.tileset];
image_index = 0;
image_speed = 0
}
}
if (!left && !downleft && !down)
{
with (instance_create(x-41,y+40,tile_part_a_obj))
{
depth=989;
image_angle = 270;
sprite_index = sprite_init.outer_corner[other.tileset];
image_index = 0;
image_speed = 0
}
}
if (!left && !upleft && !up)
{
with (instance_create(x-41,y-41,tile_part_a_obj))
{
depth=989;
image_angle = 180;
sprite_index = sprite_init.outer_corner[other.tileset];
image_index = 0;
image_speed = 0
}
}
//create walls
if (!up)
{
with (instance_create(x-1,y-40,tile_part_a_obj))
{
depth=990;
image_angle = -90;
sprite_index = sprite_init.walls[other.tileset];
image_index = choose(0,0,0,0,0,0,floor(random(sprite_init.wall_count)));
image_speed = 0
}
}
if (!right)
{
with (instance_create(x+40,y,tile_part_a_obj))
{
depth=990;
image_angle = 0;
sprite_index = sprite_init.walls[other.tileset];
image_index = choose(0,0,0,0,0,0,floor(random[color="#000000"](sprite_init.wall_count)));[/color]
[color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color]
[color="#0000FF"]image_xscale[/color] [color="#000000"]=[/color] [color="#000000"]-1;[/color]
[color="#000000"]}[/color]
[color="#000000"]}[/color]
[color="#000000"]if[/color] [color="#000000"](!down)[/color]
[color="#000000"]{[/color]
[color="#000000"]with[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"],[/color][color="#0000FF"]y[/color][color="#000000"]+39,tile_part_a_obj))[/color]
[color="#000000"]{[/color]
[color="#0000FF"]depth[/color][color="#000000"]=990;[/color]
[color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]90;[/color]
[color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.walls[other.tileset];[/color]
[color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,0,0,0,0,0,[/color][color="#000080"]floor[/color][color="#000000"]([/color][color="#000080"]random[/color][color="#000000"](sprite_init.wall_count)));[/color]
[color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color]
[color="#0000FF"]image_xscale[/color] [color="#000000"]=[/color] [color="#000000"]1;[/color]
[color="#000000"]}[/color]
[color="#000000"]}[/color]
[color="#000000"]if[/color] [color="#000000"](!left)[/color]
[color="#000000"]{[/color]
[color="#000000"]with[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-40,[/color][color="#0000FF"]y[/color][color="#000000"],tile_part_a_obj))[/color]
[color="#000000"]{[/color]
[color="#0000FF"]depth[/color][color="#000000"]=990;[/color]
[color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color]
[color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.walls[other.tileset];[/color]
[color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,0,0,0,0,0,[/color][color="#000080"]floor[/color][color="#000000"]([/color][color="#000080"]random[/color][color="#000000"](sprite_init.wall_count)));[/color]
[color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color]
[color="#000000"]}[/color]
[color="#000000"]}[/color]
_linenums:0'>[color="#000000"]up[/color] [color="#000000"]=[/color] [color="#000080"]collision_point[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"],[/color][color="#0000FF"]y[/color][color="#000000"]-80,tile_obj,0,1);[/color][color="#000000"]down[/color] [color="#000000"]=[/color] [color="#000080"]collision_point[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"],[/color][color="#0000FF"]y[/color][color="#000000"]+80,tile_obj,0,1);[/color][color="#000000"]left[/color] [color="#000000"]=[/color] [color="#000080"]collision_point[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-80,[/color][color="#0000FF"]y[/color][color="#000000"],tile_obj,0,1);[/color][color="#000000"]right[/color] [color="#000000"]=[/color] [color="#000080"]collision_point[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]+80,[/color][color="#0000FF"]y[/color][color="#000000"],tile_obj,0,1);[/color][color="#000000"]upleft[/color] [color="#000000"]=[/color] [color="#000080"]collision_point[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-80,[/color][color="#0000FF"]y[/color][color="#000000"]-80,tile_obj,0,1);[/color][color="#000000"]upright[/color] [color="#000000"]=[/color] [color="#000080"]collision_point[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]+80,[/color][color="#0000FF"]y[/color][color="#000000"]-80,tile_obj,0,1);[/color][color="#000000"]downleft[/color] [color="#000000"]=[/color] [color="#000080"]collision_point[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-80,[/color][color="#0000FF"]y[/color][color="#000000"]+80,tile_obj,0,1);[/color][color="#000000"]downright[/color] [color="#000000"]=[/color] [color="#000080"]collision_point[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]+80,[/color][color="#0000FF"]y[/color][color="#000000"]+80,tile_obj,0,1);[/color][color="#008000"]//create floor[/color][color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"],[/color][color="#0000FF"]y[/color][color="#000000"],tile_part_a_obj))[/color] [color="#008000"]//underlay[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=992;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.underlay[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color][color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"],[/color][color="#0000FF"]y[/color][color="#000000"],tile_part_a_obj))[/color] [color="#008000"]//tile[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=991;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,90,180,270);[/color] [color="#008000"]//image_xscale = choose(-1,1);[/color] [color="#008000"]//image_yscale = choose(-1,1);[/color] [color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"]([/color][color="#0000FF"]image_angle[/color] [color="#000000"]==[/color] [color="#000000"]0){[/color][color="#0000FF"]x[/color][color="#000000"]-=40;[/color][color="#0000FF"]y[/color][color="#000000"]-=40}[/color] [color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"]([/color][color="#0000FF"]image_angle[/color] [color="#000000"]==[/color] [color="#000000"]90){[/color][color="#0000FF"]x[/color][color="#000000"]-=40;[/color][color="#0000FF"]y[/color][color="#000000"]+=39}[/color] [color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"]([/color][color="#0000FF"]image_angle[/color] [color="#000000"]==[/color] [color="#000000"]180){[/color][color="#0000FF"]x[/color][color="#000000"]+=39;[/color][color="#0000FF"]y[/color][color="#000000"]+=39}[/color] [color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"]([/color][color="#0000FF"]image_angle[/color] [color="#000000"]==[/color] [color="#000000"]270){[/color][color="#0000FF"]x[/color][color="#000000"]+=39;[/color][color="#0000FF"]y[/color][color="#000000"]-=40}[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,0,0,0,0,1,1,1,1,2,3,4,5,6);[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.tiles[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](0[/color] [color="#000000"]==[/color] [color="#000000"]0)[/color] [color="#008000"]//extra detail[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"],[/color][color="#0000FF"]y[/color][color="#000000"],tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=990;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,90,180,270);[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000080"]floor[/color][color="#000000"]([/color][color="#000080"]random[/color][color="#000000"](sprite_init.extra_count));[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.extra[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color] [color="#000000"]}[/color][color="#008000"]//create corners[/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!upright[/color] [color="#000000"]&&[/color] [color="#000000"]up[/color] [color="#000000"]&&[/color] [color="#000000"]right)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]+40,[/color][color="#0000FF"]y[/color][color="#000000"]-81,tile_part_a_obj))[/color] [color="#000000"]{[/color][color="#0000FF"]depth[/color][color="#000000"]=989;[/color][color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]90;[/color][color="#0000FF"]image_xscale[/color] [color="#000000"]=[/color] [color="#000000"]-1;<strong class='bbc'>other</strong>.corner[/color] [color="#000000"]=[/color] [color="#0000FF"]id[/color][color="#000000"];[/color][color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.inner_corner[<strong class='bbc'>other</strong>.tileset]}[/color] [color="#000000"]}[/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!downright[/color] [color="#000000"]&&[/color] [color="#000000"]down[/color] [color="#000000"]&&[/color] [color="#000000"]right)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]+80,[/color][color="#0000FF"]y[/color][color="#000000"]+40,tile_part_a_obj))[/color] [color="#000000"]{[/color][color="#0000FF"]depth[/color][color="#000000"]=989;[/color][color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color][color="#0000FF"]image_xscale[/color] [color="#000000"]=[/color] [color="#000000"]-1;<strong class='bbc'>other</strong>.corner[/color] [color="#000000"]=[/color] [color="#0000FF"]id[/color][color="#000000"];[/color][color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.inner_corner[<strong class='bbc'>other</strong>.tileset]}[/color] [color="#000000"]}[/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!downleft[/color] [color="#000000"]&&[/color] [color="#000000"]down[/color] [color="#000000"]&&[/color] [color="#000000"]left)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-41,[/color][color="#0000FF"]y[/color][color="#000000"]+80,tile_part_a_obj))[/color] [color="#000000"]{[/color][color="#0000FF"]depth[/color][color="#000000"]=989;[/color][color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]-90;[/color][color="#0000FF"]image_xscale[/color] [color="#000000"]=[/color] [color="#000000"]-1;<strong class='bbc'>other</strong>.corner[/color] [color="#000000"]=[/color] [color="#0000FF"]id[/color][color="#000000"];[/color][color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.inner_corner[<strong class='bbc'>other</strong>.tileset]}[/color] [color="#000000"]}[/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!upleft[/color] [color="#000000"]&&[/color] [color="#000000"]up[/color] [color="#000000"]&&[/color] [color="#000000"]left)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-81,[/color][color="#0000FF"]y[/color][color="#000000"]-41,tile_part_a_obj))[/color] [color="#000000"]{[/color][color="#0000FF"]depth[/color][color="#000000"]=989;[/color][color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]180;[/color][color="#0000FF"]image_xscale[/color] [color="#000000"]=[/color] [color="#000000"]-1;<strong class='bbc'>other</strong>.corner[/color] [color="#000000"]=[/color] [color="#0000FF"]id[/color][color="#000000"];[/color][color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.inner_corner[<strong class='bbc'>other</strong>.tileset]}[/color] [color="#000000"]}[/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!up[/color] [color="#000000"]&&[/color] [color="#000000"]!upright[/color] [color="#000000"]&&[/color] [color="#000000"]!right)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]+40,[/color][color="#0000FF"]y[/color][color="#000000"]-41,tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=989;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]90;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.outer_corner[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color] [color="#000000"]}[/color] [color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!right[/color] [color="#000000"]&&[/color] [color="#000000"]!downright[/color] [color="#000000"]&&[/color] [color="#000000"]!down)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]+40,[/color][color="#0000FF"]y[/color][color="#000000"]+40,tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=989;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.outer_corner[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color] [color="#000000"]}[/color] [color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!left[/color] [color="#000000"]&&[/color] [color="#000000"]!downleft[/color] [color="#000000"]&&[/color] [color="#000000"]!down)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-41,[/color][color="#0000FF"]y[/color][color="#000000"]+40,tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=989;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]270;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.outer_corner[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color] [color="#000000"]}[/color] [color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!left[/color] [color="#000000"]&&[/color] [color="#000000"]!upleft[/color] [color="#000000"]&&[/color] [color="#000000"]!up)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-41,[/color][color="#0000FF"]y[/color][color="#000000"]-41,tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=989;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]180;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.outer_corner[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color] [color="#000000"]}[/color][color="#008000"]//create walls [/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!up)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-1,[/color][color="#0000FF"]y[/color][color="#000000"]-40,tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=990;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]-90;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.walls[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,0,0,0,0,0,[/color][color="#000080"]floor[/color][color="#000000"]([/color][color="#000080"]random[/color][color="#000000"](sprite_init.wall_count)));[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color] [color="#000000"]}[/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!right)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]+40,[/color][color="#0000FF"]y[/color][color="#000000"],tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=990;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.walls[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,0,0,0,0,0,[/color][color="#000080"]floor[/color][color="#000000"]([/color][color="#000080"]random[/color][color="#000000"](sprite_init.wall_count)));[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#0000FF"]image_xscale[/color] [color="#000000"]=[/color] [color="#000000"]-1;[/color] [color="#000000"]}[/color] [color="#000000"]}[/color] [color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!down)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"],[/color][color="#0000FF"]y[/color][color="#000000"]+39,tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=990;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]90;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.walls[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,0,0,0,0,0,[/color][color="#000080"]floor[/color][color="#000000"]([/color][color="#000080"]random[/color][color="#000000"](sprite_init.wall_count)));[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#0000FF"]image_xscale[/color] [color="#000000"]=[/color] [color="#000000"]1;[/color] [color="#000000"]}[/color] [color="#000000"]}[/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!left)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-40,[/color][color="#0000FF"]y[/color][color="#000000"],tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=990;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.walls[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,0,0,0,0,0,[/color][color="#000080"]floor[/color][color="#000000"]([/color][color="#000080"]random[/color][color="#000000"](sprite_init.wall_count)));[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color] [color="#000000"]}[/color]
Mask Creation Screws Up With Transperant Sprites
16 September 2009 - 01:59 PM
ok, this is a little complicated, so bare with me!
in my game, I use a layer of 512x512 tiled surfaces to draw all my room graphics to, these surfaces are then used in conjunction with another layer of 512x512 tiled surfaces to create solid masks of areas not containing any graphics.
it works completely fine, until I turn on the extra detail sprites, which have transparent areas, as soon as I do. the graphics is still created fine, but the blocking masks treat the extra detail sprites as blocking areas (does that make sense? hopefully these pics will help)

graphics and masks created without transparent sprites. works fine

graphics and masks created with transparent sprites. doesnt work well at all
what I cannot understand is how this is possible, here is the process the graphics generator goes through :
create instances with unique sprites to create all the graphics for the room
draw instance sprites onto tile_surface for room graphics and remove instances
draw tile_surface graphics onto blocker_surface using c_black image_blend
create a sprite from blocker_surface to be used for collisions
now, what makes no sense to me is the fact that all the graphics are drawn to a surface, and then these surfaces are drawn to another surface.
the blocker surface is cleared with c_purple, and then the surfaces are drawn with a blend color of c_black, making any area of the sprite that has color, be black when drawn. so, if the graphics surfaces look fine, then how is the blocker_surface making purple areas for where the extra details are placed?
the graphics are drawn in 80x80 grids, first the underlay is drawn (non transperant 80x80 sprite) then the floor is drawn (another 80x80 non transperant sprite) and finally the extra detail is drawn ontop of that. if 2 80x80 squares that are completely opaque are drawn first onto a single surface, how does blocker_surface create a mask that only includes the extra detail!?
here is the code for creating the instances with the graphics (scary long, but you only need to worry about the top section that deals with extra detail)
Here is the code for the surface creation of tile_surface
[font="Courier New"] [color="#000000"]with[/color] [color="#000000"](tile_surface)[/color]
[color="#000000"]{[/color]
[color="#000000"]my_surface[/color] [color="#000000"]=[/color] [color="#000080"]surface_create[/color]
in my game, I use a layer of 512x512 tiled surfaces to draw all my room graphics to, these surfaces are then used in conjunction with another layer of 512x512 tiled surfaces to create solid masks of areas not containing any graphics.
it works completely fine, until I turn on the extra detail sprites, which have transparent areas, as soon as I do. the graphics is still created fine, but the blocking masks treat the extra detail sprites as blocking areas (does that make sense? hopefully these pics will help)

graphics and masks created without transparent sprites. works fine

graphics and masks created with transparent sprites. doesnt work well at all
what I cannot understand is how this is possible, here is the process the graphics generator goes through :
create instances with unique sprites to create all the graphics for the room
draw instance sprites onto tile_surface for room graphics and remove instances
draw tile_surface graphics onto blocker_surface using c_black image_blend
create a sprite from blocker_surface to be used for collisions
now, what makes no sense to me is the fact that all the graphics are drawn to a surface, and then these surfaces are drawn to another surface.
the blocker surface is cleared with c_purple, and then the surfaces are drawn with a blend color of c_black, making any area of the sprite that has color, be black when drawn. so, if the graphics surfaces look fine, then how is the blocker_surface making purple areas for where the extra details are placed?
the graphics are drawn in 80x80 grids, first the underlay is drawn (non transperant 80x80 sprite) then the floor is drawn (another 80x80 non transperant sprite) and finally the extra detail is drawn ontop of that. if 2 80x80 squares that are completely opaque are drawn first onto a single surface, how does blocker_surface create a mask that only includes the extra detail!?
here is the code for creating the instances with the graphics (scary long, but you only need to worry about the top section that deals with extra detail)
up = collision_point(x,y-80,tile_obj,0,1);
down = collision_point(x,y+80,tile_obj,0,1);
left = collision_point(x-80,y,tile_obj,0,1);
right = collision_point(x+80,y,tile_obj,0,1);
upleft = collision_point(x-80,y-80,tile_obj,0,1);
upright = collision_point(x+80,y-80,tile_obj,0,1);
downleft = collision_point(x-80,y+80,tile_obj,0,1);
downright = collision_point(x+80,y+80,tile_obj,0,1);
//create floor
with (instance_create(x,y,tile_part_a_obj)) //underlay
{
depth=992;
image_angle = 0;
sprite_index = sprite_init.underlay[other.tileset];
image_speed = 0
}
with (instance_create(x,y,tile_part_a_obj)) //tile
{
depth=991;
image_angle = choose(0,90,180,270);
//image_xscale = choose(-1,1);
//image_yscale = choose(-1,1);
if (image_angle == 0){x-=40;y-=40}
if (image_angle == 90){x-=40;y+=39}
if (image_angle == 180){x+=39;y+=39}
if (image_angle == 270){x+=39;y-=40}
image_index = choose(0,0,0,0,0,1,1,1,1,2,3,4,5,6);
sprite_index = sprite_init.tiles[other.tileset];
image_speed = 0
}
if (0 == 0) //extra detail
{
with (instance_create(x,y,tile_part_a_obj))
{
depth=990;
image_angle = choose(0,90,180,270);
image_index = floor(random(sprite_init.extra_count));
sprite_index = sprite_init.extra[other.tileset];
image_speed = 0
}
}
//create corners
if (!upright && up && right)
{
with (instance_create(x+40,y-81,tile_part_a_obj))
{depth=989;image_angle = 90;image_xscale = -1;other.corner = id;sprite_index = sprite_init.inner_corner[other.tileset]}
}
if (!downright && down && right)
{
with (instance_create(x+80,y+40,tile_part_a_obj))
{depth=989;image_angle = 0;image_xscale = -1;other.corner = id;sprite_index = sprite_init.inner_corner[other.tileset]}
}
if (!downleft && down && left)
{
with (instance_create(x-41,y+80,tile_part_a_obj))
{depth=989;image_angle = -90;image_xscale = -1;other.corner = id;sprite_index = sprite_init.inner_corner[other.tileset]}
}
if (!upleft && up && left)
{
with (instance_create(x-81,y-41,tile_part_a_obj))
{depth=989;image_angle = 180;image_xscale = -1;other.corner = id;sprite_index = sprite_init.inner_corner[other.tileset]}
}
if (!up && !upright && !right)
{
with (instance_create(x+40,y-41,tile_part_a_obj))
{
depth=989;
image_angle = 90;
sprite_index = sprite_init.outer_corner[other.tileset];
image_index = 0;
image_speed = 0
}
}
if (!right && !downright && !down)
{
with (instance_create(x+40,y+40,tile_part_a_obj))
{
depth=989;
image_angle = 0;
sprite_index = sprite_init.outer_corner[other.tileset];
image_index = 0;
image_speed = 0
}
}
if (!left && !downleft && !down)
{
with (instance_create(x-41,y+40,tile_part_a_obj))
{
depth=989;
image_angle = 270;
sprite_index = sprite_init.outer_corner[other.tileset];
image_index = 0;
image_speed = 0
}
}
if (!left && !upleft && !up)
{
with (instance_create(x-41,y-41,tile_part_a_obj))
{
depth=989;
image_angle = 180;
sprite_index = sprite_init.outer_corner[other.tileset];
image_index = 0;
image_speed = 0
}
}
//create walls
if (!up)
{
with (instance_create(x-1,y-40,tile_part_a_obj))
{
depth=990;
image_angle = -90;
sprite_index = sprite_init.walls[other.tileset];
image_index = choose(0,0,0,0,0,0,floor(random(sprite_init.wall_count)));
image_speed = 0
}
}
if (!right)
{
with (instance_create(x+40,y,tile_part_a_obj))
{
depth=990;
image_angle = 0;
sprite_index = sprite_init.walls[other.tileset];
image_index = choose(0,0,0,0,0,0,floor(random[color="#000000"](sprite_init.wall_count)));[/color]
[color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color]
[color="#0000FF"]image_xscale[/color] [color="#000000"]=[/color] [color="#000000"]-1;[/color]
[color="#000000"]}[/color]
[color="#000000"]}[/color]
[color="#000000"]if[/color] [color="#000000"](!down)[/color]
[color="#000000"]{[/color]
[color="#000000"]with[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"],[/color][color="#0000FF"]y[/color][color="#000000"]+39,tile_part_a_obj))[/color]
[color="#000000"]{[/color]
[color="#0000FF"]depth[/color][color="#000000"]=990;[/color]
[color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]90;[/color]
[color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.walls[other.tileset];[/color]
[color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,0,0,0,0,0,[/color][color="#000080"]floor[/color][color="#000000"]([/color][color="#000080"]random[/color][color="#000000"](sprite_init.wall_count)));[/color]
[color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color]
[color="#0000FF"]image_xscale[/color] [color="#000000"]=[/color] [color="#000000"]1;[/color]
[color="#000000"]}[/color]
[color="#000000"]}[/color]
[color="#000000"]if[/color] [color="#000000"](!left)[/color]
[color="#000000"]{[/color]
[color="#000000"]with[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-40,[/color][color="#0000FF"]y[/color][color="#000000"],tile_part_a_obj))[/color]
[color="#000000"]{[/color]
[color="#0000FF"]depth[/color][color="#000000"]=990;[/color]
[color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color]
[color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.walls[other.tileset];[/color]
[color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,0,0,0,0,0,[/color][color="#000080"]floor[/color][color="#000000"]([/color][color="#000080"]random[/color][color="#000000"](sprite_init.wall_count)));[/color]
[color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color]
[color="#000000"]}[/color]
[color="#000000"]}[/color]
_linenums:0'>[color="#000000"]up[/color] [color="#000000"]=[/color] [color="#000080"]collision_point[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"],[/color][color="#0000FF"]y[/color][color="#000000"]-80,tile_obj,0,1);[/color][color="#000000"]down[/color] [color="#000000"]=[/color] [color="#000080"]collision_point[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"],[/color][color="#0000FF"]y[/color][color="#000000"]+80,tile_obj,0,1);[/color][color="#000000"]left[/color] [color="#000000"]=[/color] [color="#000080"]collision_point[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-80,[/color][color="#0000FF"]y[/color][color="#000000"],tile_obj,0,1);[/color][color="#000000"]right[/color] [color="#000000"]=[/color] [color="#000080"]collision_point[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]+80,[/color][color="#0000FF"]y[/color][color="#000000"],tile_obj,0,1);[/color][color="#000000"]upleft[/color] [color="#000000"]=[/color] [color="#000080"]collision_point[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-80,[/color][color="#0000FF"]y[/color][color="#000000"]-80,tile_obj,0,1);[/color][color="#000000"]upright[/color] [color="#000000"]=[/color] [color="#000080"]collision_point[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]+80,[/color][color="#0000FF"]y[/color][color="#000000"]-80,tile_obj,0,1);[/color][color="#000000"]downleft[/color] [color="#000000"]=[/color] [color="#000080"]collision_point[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-80,[/color][color="#0000FF"]y[/color][color="#000000"]+80,tile_obj,0,1);[/color][color="#000000"]downright[/color] [color="#000000"]=[/color] [color="#000080"]collision_point[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]+80,[/color][color="#0000FF"]y[/color][color="#000000"]+80,tile_obj,0,1);[/color][color="#008000"]//create floor[/color][color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"],[/color][color="#0000FF"]y[/color][color="#000000"],tile_part_a_obj))[/color] [color="#008000"]//underlay[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=992;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.underlay[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color][color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"],[/color][color="#0000FF"]y[/color][color="#000000"],tile_part_a_obj))[/color] [color="#008000"]//tile[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=991;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,90,180,270);[/color] [color="#008000"]//image_xscale = choose(-1,1);[/color] [color="#008000"]//image_yscale = choose(-1,1);[/color] [color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"]([/color][color="#0000FF"]image_angle[/color] [color="#000000"]==[/color] [color="#000000"]0){[/color][color="#0000FF"]x[/color][color="#000000"]-=40;[/color][color="#0000FF"]y[/color][color="#000000"]-=40}[/color] [color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"]([/color][color="#0000FF"]image_angle[/color] [color="#000000"]==[/color] [color="#000000"]90){[/color][color="#0000FF"]x[/color][color="#000000"]-=40;[/color][color="#0000FF"]y[/color][color="#000000"]+=39}[/color] [color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"]([/color][color="#0000FF"]image_angle[/color] [color="#000000"]==[/color] [color="#000000"]180){[/color][color="#0000FF"]x[/color][color="#000000"]+=39;[/color][color="#0000FF"]y[/color][color="#000000"]+=39}[/color] [color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"]([/color][color="#0000FF"]image_angle[/color] [color="#000000"]==[/color] [color="#000000"]270){[/color][color="#0000FF"]x[/color][color="#000000"]+=39;[/color][color="#0000FF"]y[/color][color="#000000"]-=40}[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,0,0,0,0,1,1,1,1,2,3,4,5,6);[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.tiles[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](0[/color] [color="#000000"]==[/color] [color="#000000"]0)[/color] [color="#008000"]//extra detail[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"],[/color][color="#0000FF"]y[/color][color="#000000"],tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=990;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,90,180,270);[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000080"]floor[/color][color="#000000"]([/color][color="#000080"]random[/color][color="#000000"](sprite_init.extra_count));[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.extra[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color] [color="#000000"]}[/color][color="#008000"]//create corners[/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!upright[/color] [color="#000000"]&&[/color] [color="#000000"]up[/color] [color="#000000"]&&[/color] [color="#000000"]right)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]+40,[/color][color="#0000FF"]y[/color][color="#000000"]-81,tile_part_a_obj))[/color] [color="#000000"]{[/color][color="#0000FF"]depth[/color][color="#000000"]=989;[/color][color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]90;[/color][color="#0000FF"]image_xscale[/color] [color="#000000"]=[/color] [color="#000000"]-1;<strong class='bbc'>other</strong>.corner[/color] [color="#000000"]=[/color] [color="#0000FF"]id[/color][color="#000000"];[/color][color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.inner_corner[<strong class='bbc'>other</strong>.tileset]}[/color] [color="#000000"]}[/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!downright[/color] [color="#000000"]&&[/color] [color="#000000"]down[/color] [color="#000000"]&&[/color] [color="#000000"]right)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]+80,[/color][color="#0000FF"]y[/color][color="#000000"]+40,tile_part_a_obj))[/color] [color="#000000"]{[/color][color="#0000FF"]depth[/color][color="#000000"]=989;[/color][color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color][color="#0000FF"]image_xscale[/color] [color="#000000"]=[/color] [color="#000000"]-1;<strong class='bbc'>other</strong>.corner[/color] [color="#000000"]=[/color] [color="#0000FF"]id[/color][color="#000000"];[/color][color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.inner_corner[<strong class='bbc'>other</strong>.tileset]}[/color] [color="#000000"]}[/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!downleft[/color] [color="#000000"]&&[/color] [color="#000000"]down[/color] [color="#000000"]&&[/color] [color="#000000"]left)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-41,[/color][color="#0000FF"]y[/color][color="#000000"]+80,tile_part_a_obj))[/color] [color="#000000"]{[/color][color="#0000FF"]depth[/color][color="#000000"]=989;[/color][color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]-90;[/color][color="#0000FF"]image_xscale[/color] [color="#000000"]=[/color] [color="#000000"]-1;<strong class='bbc'>other</strong>.corner[/color] [color="#000000"]=[/color] [color="#0000FF"]id[/color][color="#000000"];[/color][color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.inner_corner[<strong class='bbc'>other</strong>.tileset]}[/color] [color="#000000"]}[/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!upleft[/color] [color="#000000"]&&[/color] [color="#000000"]up[/color] [color="#000000"]&&[/color] [color="#000000"]left)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-81,[/color][color="#0000FF"]y[/color][color="#000000"]-41,tile_part_a_obj))[/color] [color="#000000"]{[/color][color="#0000FF"]depth[/color][color="#000000"]=989;[/color][color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]180;[/color][color="#0000FF"]image_xscale[/color] [color="#000000"]=[/color] [color="#000000"]-1;<strong class='bbc'>other</strong>.corner[/color] [color="#000000"]=[/color] [color="#0000FF"]id[/color][color="#000000"];[/color][color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.inner_corner[<strong class='bbc'>other</strong>.tileset]}[/color] [color="#000000"]}[/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!up[/color] [color="#000000"]&&[/color] [color="#000000"]!upright[/color] [color="#000000"]&&[/color] [color="#000000"]!right)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]+40,[/color][color="#0000FF"]y[/color][color="#000000"]-41,tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=989;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]90;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.outer_corner[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color] [color="#000000"]}[/color] [color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!right[/color] [color="#000000"]&&[/color] [color="#000000"]!downright[/color] [color="#000000"]&&[/color] [color="#000000"]!down)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]+40,[/color][color="#0000FF"]y[/color][color="#000000"]+40,tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=989;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.outer_corner[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color] [color="#000000"]}[/color] [color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!left[/color] [color="#000000"]&&[/color] [color="#000000"]!downleft[/color] [color="#000000"]&&[/color] [color="#000000"]!down)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-41,[/color][color="#0000FF"]y[/color][color="#000000"]+40,tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=989;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]270;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.outer_corner[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color] [color="#000000"]}[/color] [color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!left[/color] [color="#000000"]&&[/color] [color="#000000"]!upleft[/color] [color="#000000"]&&[/color] [color="#000000"]!up)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-41,[/color][color="#0000FF"]y[/color][color="#000000"]-41,tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=989;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]180;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.outer_corner[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color] [color="#000000"]}[/color][color="#008000"]//create walls [/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!up)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-1,[/color][color="#0000FF"]y[/color][color="#000000"]-40,tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=990;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]-90;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.walls[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,0,0,0,0,0,[/color][color="#000080"]floor[/color][color="#000000"]([/color][color="#000080"]random[/color][color="#000000"](sprite_init.wall_count)));[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color] [color="#000000"]}[/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!right)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]+40,[/color][color="#0000FF"]y[/color][color="#000000"],tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=990;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.walls[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,0,0,0,0,0,[/color][color="#000080"]floor[/color][color="#000000"]([/color][color="#000080"]random[/color][color="#000000"](sprite_init.wall_count)));[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#0000FF"]image_xscale[/color] [color="#000000"]=[/color] [color="#000000"]-1;[/color] [color="#000000"]}[/color] [color="#000000"]}[/color] [color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!down)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"],[/color][color="#0000FF"]y[/color][color="#000000"]+39,tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=990;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]90;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.walls[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,0,0,0,0,0,[/color][color="#000080"]floor[/color][color="#000000"]([/color][color="#000080"]random[/color][color="#000000"](sprite_init.wall_count)));[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#0000FF"]image_xscale[/color] [color="#000000"]=[/color] [color="#000000"]1;[/color] [color="#000000"]}[/color] [color="#000000"]}[/color][color="#000000"]<strong class='bbc'>if</strong>[/color] [color="#000000"](!left)[/color] [color="#000000"]{[/color] [color="#000000"]<strong class='bbc'>with</strong>[/color] [color="#000000"]([/color][color="#000080"]instance_create[/color][color="#000000"]([/color][color="#0000FF"]x[/color][color="#000000"]-40,[/color][color="#0000FF"]y[/color][color="#000000"],tile_part_a_obj))[/color] [color="#000000"]{[/color] [color="#0000FF"]depth[/color][color="#000000"]=990;[/color] [color="#0000FF"]image_angle[/color] [color="#000000"]=[/color] [color="#000000"]0;[/color] [color="#0000FF"]sprite_index[/color] [color="#000000"]=[/color] [color="#000000"]sprite_init.walls[<strong class='bbc'>other</strong>.tileset];[/color] [color="#0000FF"]image_index[/color] [color="#000000"]=[/color] [color="#000080"]choose[/color][color="#000000"](0,0,0,0,0,0,[/color][color="#000080"]floor[/color][color="#000000"]([/color][color="#000080"]random[/color][color="#000000"](sprite_init.wall_count)));[/color] [color="#0000FF"]image_speed[/color] [color="#000000"]=[/color] [color="#000000"]0[/color] [color="#000000"]}[/color] [color="#000000"]}[/color]
Here is the code for the surface creation of tile_surface
CODE
[color="#000000"]{[/color]
[color="#000000"]my_surface[/color] [color="#000000"]=[/color] [color="#000080"]surface_create[/color]
Cached Lighting Using Ds_list's Running Slow
13 September 2009 - 01:57 AM
Hi everyone,
you might have seen my previous questions about lighting and string conversion, this is the end result, working thanks to you guys. but I was expecting much less fps hit from this idea than I am getting.
My light stores the distance from the light to a collision with a static caster in a ds_list (one entry per direction). then finds all doors in range of it, stores there id's in another ds_list
for each door the light creates a seperate ds_list containing strings, each string is an angle of light that collides with the door when closed, and the distance to that collision ('xxxyyy' xxx=angle yyy=distance).
The original ds_list of static collisions (my_light_static) is copied into a new ds_list (my_light_c) this ds_list is used to store the current distances to any collision along each angle. my_light_c is used to create a triangle fan primitive, centred on the light. the distances in the ds_list are used with lengthdir_x/lengthdir_y to build a shape of light.
each step the light checks each door in its ds_list to see if it is active. if it is, the light copies either the distance from the stored door collision ds_list to my_light_c or copies the distance stored in my_light_static to my_light_c.
It works well, much better than actually doing it dynamically, which I was before. but I thought that using ds_lists and storing all the data would make it have practically no performance hit, but on my computer it runs at around 1000fps with no doors active and around 100fps with all 14 doors active, with 4 lights.
here is the code for the light :
heres the gmk :
I have commented the whole thing as best I can
Fake Door Lighting test (GMK Pro)
you might have seen my previous questions about lighting and string conversion, this is the end result, working thanks to you guys. but I was expecting much less fps hit from this idea than I am getting.
My light stores the distance from the light to a collision with a static caster in a ds_list (one entry per direction). then finds all doors in range of it, stores there id's in another ds_list
for each door the light creates a seperate ds_list containing strings, each string is an angle of light that collides with the door when closed, and the distance to that collision ('xxxyyy' xxx=angle yyy=distance).
The original ds_list of static collisions (my_light_static) is copied into a new ds_list (my_light_c) this ds_list is used to store the current distances to any collision along each angle. my_light_c is used to create a triangle fan primitive, centred on the light. the distances in the ds_list are used with lengthdir_x/lengthdir_y to build a shape of light.
each step the light checks each door in its ds_list to see if it is active. if it is, the light copies either the distance from the stored door collision ds_list to my_light_c or copies the distance stored in my_light_static to my_light_c.
It works well, much better than actually doing it dynamically, which I was before. but I thought that using ds_lists and storing all the data would make it have practically no performance hit, but on my computer it runs at around 1000fps with no doors active and around 100fps with all 14 doors active, with 4 lights.
here is the code for the light :
var modd;modd = 0; //reset primitive recalc switchtester = 0; if (init == 0) //not yet initialised { var dir,temp, tempa,tempb,tempc, tempd,tempe,tempf, tempx,tempy, col, numa,numb, done, distance, temp_list; temp = 1; tempa = 0; with (door_obj) { if (collision_line(other.x, other.y, other.x + lengthdir_x(other.max_dist, point_direction(other.x, other.y,x,y)),other.y + lengthdir_y(other.max_dist, point_direction(other.x, other.y,x,y)), id,1,0) > 0) { ds_list_add(other.door_list, id); //if door is in range of light add to light door list } } for (i=0;i<ds_list_size(door_list);i+=1) { door_shadow_array[i] = ds_list_create(); } for (setup=0;setup<=light_angle;setup+=acc) //cycle through range of light { distance = light_los_scr_a(x,y,setup,max_dist,static_blocker_par); if (distance < 0) { distance = max_dist; } ds_list_add(my_light_static,distance); //add static collision distance to list } temparraya[0] = -1; //data is xxxyyyyyy... xxx = vertex engle yyyyy = distance to collision with door temparrayb[0] = -1; //arraya stores positive vertex's arrayb stores negative vertex's from centre for (door=0;door<ds_list_size(door_list);door+=1) //loop through doors { tempb = ds_list_find_value(door_list, door); //door id tempc = 1 dir = (point_direction(x,y,tempb.x, tempb.y)/acc)*acc; //light_angle nearest to door centre tempd = dir+acc; tempe = 0 while (tempc > 0) //while loop increases angle until no collision with door { tempc = light_los_scr_a(x,y,tempd, max_dist,tempb); tempf = light_los_scr_a(x,y,tempd, max_dist,light_blocker_par) tempd += acc; if (tempc > 0) { if (tempd >= 360) { tempd -= 360; } temparraya[tempe] = round(tempf); //store collision distance tempe += 1; } } ta_count = tempe-1; //store number of times collision was found in positive tempc = 1; tempd = dir-acc; tempe = 0 while (tempc > 0) //while loop decreases angle until no collision with door { tempc = light_los_scr_a(x,y,tempd, max_dist,tempb); tempf = light_los_scr_a(x,y,tempd, max_dist,light_blocker_par) tempd -= acc; if (tempc > 0) { if (tempd < 0) { tempd += 360; } temparrayb[tempe] = round(tempf); //store collision distance tempe += 1; } } tb_count = tempe-1; //store number of times collision was found in negative temp = dir+acc; tempa = dir-acc; if (tempa < 0) { tempa += 360; } if (temp >= 360) { temp -= 360; } while (ta_count >= 0 || tb_count >= 0) { if (ta_count >= 0) { if (temparraya[ta_count] < 0){temparraya[ta_count] = max_dist} numa = string_format(temp+(acc*ta_count),3,0); //set numa to nearest light_angle list index for current loop ds_list_add(door_shadow_array[door], numa + string_format(temparraya[ta_count], 3,0)) //add 3 char light_angle + collision distance into array as string } if (tb_count >= 0) { if (temparrayb[tb_count] < 0){temparrayb[tb_count] = max_dist} numb = string_format(tempa-(acc*tb_count),3,0); //set numb to nearest light_angle list index for current loop ds_list_add(door_shadow_array[door], numb + string_format(temparrayb[tb_count], 3,0)) //add 3 char light_angle + collision distance into array as string } ta_count -= 1; tb_count -= 1; } numa = string_format(dir,3,0); tempa = light_los_scr_a(x,y,dir,max_dist,tempb); if (tempa < 0){tempa -= max_dist} ds_list_add(door_shadow_array[door], numa + string_format(tempa, 3,0)); //add light_angle nearest centre to end of array } ds_list_copy(my_light_c,my_light_static); //copy static list into current lighting list init = 1; modd = 1; }var doorid;for (door=0;door<ds_list_size(door_list);door+=1) //loop through doors { doorid = ds_list_find_value(door_list,door); if (doorid.active == 1) { if (doorid.shadow_pos < ds_list_size(door_shadow_array[door])) { modd = 1; temp = ds_list_find_value(door_shadow_array[door], doorid.shadow_pos); tempa = real(string_copy(temp,1,3)); //grab angle from first 3 char if (doorid.open == 0) { tempb = real(string_copy(temp,4,3)); //grab distance from rest of char ds_list_replace(my_light_c,tempa/acc,tempb); //replace current lighting distance with static collision distance } else { ds_list_replace(my_light_c,tempa / acc,ds_list_find_value(my_light_static, tempa / acc)); //replace current lighting distance with static collision distance } } } }if (modd == 1) //redraw primitive to surface with current lighting distances { tester = 1; surface_set_target(my_surface); draw_clear_alpha(c_black,0); draw_set_color(c_white) draw_primitive_begin(pr_trianglefan); draw_vertex(max_dist,max_dist); var alpha; for (vertex=0;vertex<ds_list_size(my_light_c);vertex+=1) //go through all vertex's in list { alpha = 255*(1 - (point_distance(max_dist,max_dist,max_dist + lengthdir_x(ds_list_find_value(my_light_c, vertex),vertex * acc),max_dist + lengthdir_y(ds_list_find_value(my_light_c, vertex), vertex * acc))) / max_dist); draw_vertex_color(max_dist + lengthdir_x(ds_list_find_value(my_light_c, vertex),vertex * acc),max_dist + lengthdir_y(ds_list_find_value(my_light_c, vertex), vertex * acc), make_color_rgb(alpha, alpha, alpha),1); } if (light_angle == 360-acc) //if light is a full circle, join first and last up { alpha = 255 * (1 - (point_distance(max_dist, max_dist, max_dist + lengthdir_x(ds_list_find_value(my_light_c, 0),0), max_dist + lengthdir_y(ds_list_find_value(my_light_c, 0),0))) / max_dist); draw_vertex_color(max_dist + lengthdir_x(ds_list_find_value(my_light_c, 0), 0), max_dist + lengthdir_y(ds_list_find_value(my_light_c, 0), 0), make_color_rgb(alpha, alpha, alpha),1); } draw_primitive_end(); draw_set_alpha(1); surface_reset_target(); }heres the gmk :
I have commented the whole thing as best I can
Fake Door Lighting test (GMK Pro)
- Game Maker Community
- → Viewing Profile: Topics: templargfx
- Privacy Policy
- GMC Rules and Forum Rules ·



Find content