ID:2066831
 
I have honestly searched and tried to understand each post and code snippet and tried it myself, but I can't seem to get it. I am having a problem with going about the entire thing, I guess.

I want to do Pixel Movement. Easy. But I want to disable movement with the arrow keys, which is no problem to me and I would like to move with right clicks. Moving to the turf is ideal, but I would like to get to the exactly pixel location that I click or a roundabout of it.

Any insight?
Moving to a location you click is easy enough just look into the click procedure. As for the exact pixel I'm not sure. I looked into this in 2009 and the reply I got at that time was that there was no way to identify the specific pixel clicked. A lot has changed since then so I imagine things have improved in that department.

Off the top of my head I would say you could change the icon_size variable to a lower value to make it more precise. The problem with this is it can slow things down a lot the lower you make it. Setting it to one crashed Dream Maker for me a couple months ago. Not sure if this is a viable option that will solve your problem or not. I haven't really dabbled in DM for over five years.
With having Mouse-Click-Movement you're going to want to invest some time in a good pathfinding system. It's never fun trying to get your character to move somewhere when they get stuck running into a tree.

Click() has three arguments that you can pull information from. Click(location,control,params)

Turn params into a legible list with params2list().

Looking under the reference for mouse-control it describes:

"The params argument is text, and can be converted to a list using params2list(). It may contain any of the following properties, which will only be set if they are used:

icon-x, icon-y: Pixel coordinates within the icon; 1,1 is the lower left
screen-loc: Pixel coordinates in screen_loc format ("[tile_x]:[pixel_x],[tile_y]:[pixel_y]")
left, middle, right: Mouse buttons pressed/held/released
ctrl, shift, alt: Keys held down during the mouse action
drag-cell, drop-cell: Cells involved if using a Grid control"

So, "icon-x" and "icon-y" is what you'll want to get the pixel-precise location of where you want your end point to be. You can also use "right" to specify that your movements only happen with right-clicks.
So, then combine your Click(), your pathfinding-aided movement procedure, and the icon-x and icon-y of the ending location and you're good to go!
you could always create an object where you click then call walk towards and get rid of the object once you reach it that way you dont have to make any custom path finding system

guess not

just make sure you delete or better yet relocate the object once you get there also make sure you set something up so it stops if you can't find a path im not sure if walk towards already has that since ive never used it
In response to Zagros5000
That doesn't seem to wise since you can always just use the locate() to get an actual location.

Imagine someone deciding to spam a bunch of right-clicks and thus creating thousands of /obj's. Bad times unless you re-use the same /obj.

This still doesn't solve problems of actual path-finding if there's a wall in the way because DM doesn't have a built-in pathfinding for more than 1 obstacle in the path.

Walking around this:

______
___#__
______
______

Where _ is blank and # is an obstacle, would be fine.

However, DM cannot handle:

______
_###__
______
______

Which would cause the character to either continuously walk without stopping into the wall, or completely stop at the wall.

Click-Movement games on BYOND almost require a separate functioning path-finding to avoid useless /obj creation and to avoid player frustration.

If you are going to go the /obj way, don't delete the /obj ever.
When the client connects to their /mob, create an /obj dedicated to being the target-locator. When you're done using the /obj, move it into the void but keep a reference on it so it's not deleted. Then, when you need to move again, call that /obj back out to work again. You're going to use less performance that way since new instances aren't created every single time. Imagine someone clicking 10,000 different locations within a few seconds? That would mean you'd create 10,000 /obj within a few seconds (Dream Daemon and Dream Seeker doesn't like 5,000 /objs created within a few seconds let alone 20 people creating 10,000 within a few seconds. Even with an i7 and 16GB DDR3 the language isn't that powerful enough to handle it. I threw 5k /obj on my client screen and DS was choking.
In response to Maximus_Alex2003
what good is locate in this situation? makes no difference
also you have a point just
re-use the same /obj.
but even then creating an object and setting its loc to null barely uses any memory if u get rid of it at the right time

i find it hard to believe that DM can't handle

However, DM cannot handle:

______
_###__
______
______

creating your own path-finding system for pixel-movement would be too hard for a newb and even if done would use too much memory
Pretty sure Rushnut has done this, ask him.
In response to Zagros5000
The point is not whether it's "too hard for a newb", the point is "What is it that you want to accomplish, and in what sort of efficient way?"

If you want a broken abusive-able low-key way: Use /obj.
If you want an efficient but complex way: Pathfinding/Click().

DM cannot handle more than 1 obstacle in the way. The game goes "Gee boss. I have no ideal which way you want to go. The target is right behind this wall, but the wall is more than 1 space too wide so I have no ideal where you are telling me to go."

_____
__x__
_###_
__o__

x being the target. # being a wall. o being the player.
yikes didnt know walk towards/walk to was that bad
If you follow an incredibly naive design philosophy, yes. Pathfinding is notoriously difficult, computationally, even in fairly-ideal scenarios and on machines running code more low-level than BYOND. When doing pathfinding, you have to be clever in order to do it well, for example by using navmeshes.
Just gonna throw this out there.

There is no such thing as perfect pathfinding.

If you can solve that problem, you'll be a billionaire.

Pathfinding is always at best a hack.

BYOND's pathfinding is purely tile-based, and it has to iterate over the complete nodegraph every single time you want to take a step because it cannot predict node connectivity/access changes.

Further, it doesn't comply with any changes to Enter()/Exit()/Cross()/Uncross() behavior that you make. BYOND's built-in pathfinding only depends on density because it is a naive solution.

Writing your own pathfinding or obstacle avoidance algorithm is a necessity and no engine anywhere is going to do all of the work for you to any reasonable level.
In response to Ter13
Ter13 wrote:
There is no such thing as perfect pathfinding.

If you can solve that problem, you'll be a billionaire.

If you define a perfect pathfinding algorithm as "an algorithm that will always find the shortest path on some space provided it exists" then it certainly does exist for finite, discrete spaces (i.e., the spaces that computers are essentially required to work in): it's called a bruteforce search.

Pathfinding is always at best a hack.

What an utterly bizarre way to describe something like this.
Would really like to avoid semantics as much as possible if that's okay by you today.

The summary of what I was saying was merely that an acceptable game-ready pathfinding solution is often finding a balance between accuracy and speed.

If you want speed, usually have to sacrifice accuracy or versatility. If you want accuracy, usually you have to sacrifice speed.

Point being that pathfinding is not a "general" concept and has no place in an engine that only provides a general, easy-to-use, versatile framework for making games by laymen.

The "best" solution will always have to be designed according to factors particular to the specific implementation, but the general characteristics of the algorithm will usually be pretty similar across the board.
In response to Ter13
Ter13 wrote:
Would really like to avoid semantics as much as possible if that's okay by you today.

That's fine by me, but I see being a snide cunt—unnecessarily—is allowed by the house rules today.

If you want speed, usually have to sacrifice accuracy or versatility. If you want accuracy, usually you have to sacrifice speed.

Speed vs. accuracy is a recurring theme in algorithms: the faster something is the less-accurate it often becomes and vice-versa. Unless a massive chunk of computer science—including many existing algorithms—are hacks, pathfinding is not a hack at all. It may not always be optimal in the sense of being at least polynomial time, but it's hardly a hack.

The "best" solution will always have to be designed according to factors particular to the specific implementation, but the general characteristics of the algorithm will usually be pretty similar across the board.

I disagree. As their core, all pathfinding algorithms are abstractions that consider arbitrary graphs with arbitrary edge lengths. Now, it is necessary that all decent implementations will require programmer input, and the quality of that programmer input can be a deciding factor on whether algorithm flows like molasses or flows like water, but there isn't really a compelling reason a library need be designed for a particular implementation. We've been studying pathfinding algorithms for about sixty years, so it's not like they're poorly-understood or have bad implementations.

There could, perhaps, be an issue of your given situation requires—optimally—an algorithm that is not provided by a particular library, but if the library contains the exact algorithm you need and the library implements it very well, then writing your own algorithm is most likely going to be like replacing a wheel of rubber with a wheel of wood. Of course, as soon as either of those factors are gone this argument goes out the window, but thinking that someone should generally build their own pathfinding approach over pre-existing ones is a thought that is probably going to, on average, lead to more work for less pay.
That's fine by me, but I see being a snide cunt—unnecessarily—is allowed by the house rules today

Welcome to the other half of the forum that's on the pagerban list. You won't be missed. For someone that throws around insults like "whiny bitch and cunt" like they were rice at a wedding, you'd think you'd be a little less of a seeping vagina yourself.

You are only here to be smug and stir shit. You just prattle on about theory with no implementation and absolutely no care whatsoever for anything other than being literally the most correct person in the room at all times. Especially when you are belaboring points that weren't phrased quite autistically enough for you to agree with despite having the exact same factual components as your own.

I've been the bigger man on a lot of interactions between the two of us recently, but you just can't go more than a few days without taking offense and calling names, now can you? Your value to any future interaction has crossed into the strictly negative territory.

Cheers. This would have been fun, and by fun I mean a waste of time for everyone who bothered to read it.
In response to Ter13
I'll reply for fun as a distraction from debugging (it should be pretty clear at this point that I enjoy writing for writing's sake, anyways), though I'd hazard a guess you'll look anyways at some point, smugly roll your eyes while reading this and briefly consider replying, and then won't even though I have doubt you'll refute the claims in nary more minds than your own.

Ter13 wrote:
For someone that throws around insults like "whiny bitch and cunt" like they were rice at a wedding

http://www.byond.com/ forum/?command=search&forum=8&text=author%3Apopisfizzy+bitch
http://www.byond.com/ forum/?command=search&forum=8&text=author%3Apopisfizzy+cunt
http://www.byond.com/ forum/?command=search&forum=8&text=author%3Apopisfizzy+assho le

I guess I've been throwing grains of rice at a miser's wedding, then? I add far more flourish to my insults than that unless I feel the directness is warranted, and that directness is typically only directed at people who are blithely and obscenely unaware of their own behavior.

(And it's interesting that 2/3 of those are directed at you.)

you'd think you'd be a little less of a seeping vagina yourself.

You mean, like pagerbanning someone after they call you out directly on your petty behavior? Writing a paragraph of text and then running before they can respond, like a child lighting a bag of dog turds on fire and then dashing to giddily cower in the bushes? I may not be kind in calling someone out on what they're doing, but I am absolutely not being wrong, because

Would really like to avoid semantics as much as possible if that's okay by you today.

this is absolutely nothing more than a petty—and the pettiest—of jabs. Can you defend yourself? If you had not taken your toys and marched back home, locking the door behind you, would you have even tried? Of what relevance was it here? Just digging up a grudge for no other reason that the fact that it still clouds your mind?

You may think I'm a ~~seeping vagina~~, but you are nothing more than a man with the emotional maturity of the littlest of boys, indignant and unjustifiably angry at the idea of someone calling you out when your behavior is out of line or your ideas are ill-conceived and groundless.

You are only here to be smug and stir shit.

I mean, they're both fun, but the fact that I've made contributions flies in the face of that notion, does it not?

You just prattle on about theory with no implementation

I'm working on implementing large integers and arbitrary precision integer arithmetic in BYOND, and those will be complemented with floating point numbers at some point, and functions on them. These are all things that require a fair amount of theoretical understanding to do well. I'm curious, what barrel's bottom are you scraping to throw baseless insults at me, because it is no barrel I've ever owned. I won't deny I love theory—I would like to get a Ph.D. in pure mathematics of some variety, so it comes with the territory—but when it comes to programming my implementation game is still very strong. I simply don't abide by the naive viewpoint that theory and practice are divided by a line of utter clarity; they are complementary and denying the validity of one is the work of a baboon who doesn't know their craft as well as they think they do.

and absolutely no care whatsoever for anything other than being literally the most correct person in the room at all times.

Yeah, I've been accused of this before and it's not quite wrong. It has its benefits, though: when I argue a point I'm wrong on, it's soon corrected so I can be right in the future. Perhaps you don't mind being stubbornly wrong?

(As an aside, I have quite recently admitted to being wrong, so take from that what you will)

Especially when you are belaboring points that weren't phrased quite autistically enough for you to agree with despite having the exact same factual components as your own.

XD XD DAE AUTIST SPERGLORD XD XD

Seriously? I think I've made quite clear the points I've disagreed on and clarified when they were not as clear as I'd hoped; meanwhile you marched on unimpeded and unlabored by the heavy weight of absorbing and internalizing someone else's thoughts.

I've been the bigger man on a lot of interactions between the two of us recently

I think the factual inaccuracy of this can really speak for itself, but if anyone would like some sources I submit example a and example b (and example b, addendum i). Not that I claim to have been the most gentlemanly participant, but at least I don't pretend our mudslinging match remained clean on one side.

but you just can't go more than a few days without taking offense and calling names, now can you?

When offense is deliberately given, you shouldn't be taken aback by offense taken. I suppose if I had used kinder language than I did, you would not have been so insulted, but then again I am the one being accused of having thin skin so i dunno lol ¯\_(ツ)_/¯

Your value to any future interaction has crossed into the strictly negative territory.
Cheers. This would have been fun, and by fun I mean a waste of time for everyone who bothered to read it.

You have your opinions.

I'll put the summary of this point right here, plain to see, as well as some points I did not make in the above: you are a competent, but atrociously flawed programmer. You have an inability to respect viewpoints other than your own and an inability to see those points as anything else but completely flawed and utter invalid. You are unable to respond positively to well-formed, extended criticism of either your understanding of the theory belying your trade or your own behavior, and are equally-incapable of internalizing and really understanding points made. You are extremely hostile to even beginning to have an understanding of the very theory that your trade is based on. You are a highly-competent programmer, that I do not deny. The unfortunate problem is that you have, possibly without even noticing, relegated yourself to the role of a code monkey and proudly fenced yourself in. Which is not to say that you are an untalented code monkey—indeed, you are the troop leader of code monkeys. But there is room for considerations outside the realm of the four fenceposts you've built to yourself that you are nothing but hostile towards.

Could I have been less hostile? Yes, and most probably I should have been. But I, despite your claims, have a very thick skin to insults and will wade through them rather than run away (as I have quite clearly demonstrated). I suppose I should not expect others share the same thick skin.
*ahem*
WORLDSTAAARRRRR OHHHHHHHH WORRRLLDDDSTAAARRRRR
Minor correction: Autistically was an inelegant choice of words. "Pedantically" would have been a much better thing to say.

I shouldn't rag on disabilities as hard as I do, considering I myself suffer from one or two. Sorry for the derail. I'll see myself out.