lol is this trivia?

An object is a predefined collection of data and functions that gets instanced within a list, thereby locating it somewhere. Its data is often updated automatically by its built-in functions, or user defined ones. It may also interact with other objects by updating their vars as well.

A list is simply a variable that contains a list of data. It doesn't do anything special (unless built-in), except accepts changes to its content whenever a proc alters it.
Kaiochao wrote:
So you're trying to use the object-oriented language to do something that isn't object-oriented, but still actually is object-oriented? You have a particle engine datum (object) that manages every projectile (data stored in a list) and sets the appearance of screen objects.

Or, you use an object.
It has its own data.
It has its own functions.
It was designed to work with the engine.

Instead of this:
 every tick:

for every projectile:
move projectile by its velocity

You want to do something like this:
 every tick:

for every set of data in the list that represents projectiles:
particle_data[relevant_projectile_data_set][position_x] += particle_data[relevant_projectile_data_set][velocity_x]
particle_data[relevant_projectile_data_set][position_y] += particle_data[relevant_projectile_data_set][velocity_y]

// check collisions
for every nearby atom
if relevant projectile's position intersects the atom
projectile hits atom and dies

for every client
for every screen cell
if there is a projectile at this cell
set appearance to particle_data[relevant_projectile_data_set][icon_state]
else clear the cell
Yes, that's pretty much what I had in mind. However, it's biased to think that the larger code is going to be less efficient than the smaller one in this case. The problem with your first pseudo code snippet is that you are not seeing all the built in functions that update the projectiles' vars automatically, whenever they do things like cross tiles and cross bounds.

A datum doesn't have locs, bounds, or other things to weigh it down, so it will update much faster.
Kaiochao wrote:
But the data you're manipulating does have locs, bounds, and other things that are required for bullets to physically function properly.

The built-in functions don't actually do anything by default. There's nothing wrong with that. There's no problem with the built-in way of doing things.

Why don't you make a shooter using pixel movement and see how laggy it is? Mine was made before native pixel movement and runs fairly well over good internet connections.
Kaiochao wrote:
But the data you're manipulating does have locs, bounds, and other things that are required for bullets to physically function properly.

Yes, the vars pertaining specifically to things like location, velocity, and acceleration would need to be maintained. However, does every single projectile need to contain all of these vars, some of which will likely update every few ticks?

Built-in atom vars:
atom/var
contents
density
desc
dir
gender
icon
icon_state
invisibility
infra_luminosity
loc
layer
luminosity
maptext
maptext_width
maptext_height
mouse_over_pointer
mouse_drag_pointer
mouse_drop_pointer
mouse_drop_zone var
mouse_opacity var
name
opacity
overlays
override
parent_type
pixel_x
pixel_y
pixel_z
suffix
tag
text
type
underlays
vars
verbs
x
y
z


Built-in movement vars:
atom/movable/var
animate_movement
bound_x
bound_y
bound_width
bound_height
locs
screen_loc
glide_size
step_size
step_x
step_y


No? Didn't think so. That's why a datum would be better for this sort of thing. These "virtual objects" would only hold the data specifically necessary for being a projectile, and nothing more. If BYOND had a built-in object type made just for projectiles, then that would be better, but it doesn't.

The built-in functions don't actually do anything by default.

They don't or they do? This confuses me. As far as I know, the built-in functions check for a certain thing to happen every single tick, and when it does they update a specific built-in var.

Why don't you make a shooter using pixel movement and see how laggy it is?

I don't have much interest in making a shooter. I'm currently working on some other powerful datums that can vastly increase the power a mob has over the entire world. Making good datums is essential to having a robust game that's easy to develop. I am also learning a lot from it. I actually find the procedural side of things to be easier than object oriented, because the encapsulation often gets in the way of what I want to accomplish.
Kaiochao wrote:
The only variables and functions required:
 density
icon
icon_state
loc
x
y
z
bounds (the combination of x, y, width, and height)
step_x
step_y
locs

var vel_x, vel_y

The only variables that change during flight:
 loc
locs
x
y
z
step_x
step_y

The procs called that matter (only when collision detection is necessary):
 Move
Enter
Cross

No problems here. Variables and procedures that aren't used cause no lag issues.

Your way involves a bunch of objects (most of which aren't used) being managed by some datum you wrote yourself that handles all the physics.

The built-in way is managed by the BYOND engine. If you think you can beat the built-in framework, go ahead and do it. You're simply using the wrong engine and programming language to begin with, but good luck.
I pseudo-moved this from the About Pixel Projectile's Hub Forum.
This is a bad approach to the problem. Not only is it wasteful, it's incredibly inflexible.

Most of the delay in pixel projectiles is based on how long it takes the server to notify the client that the projectile has moved.

In a normal client-server model, this wouldn't be a problem, because projectiles are mostly just processed on the server on origin, the client just plays back the path asynchronously.

In BYOND, the client can't know what the server hasn't told it, hence the problem with massive numbers of projectiles.

The only reason that animated icons are faster than manually moving the projectile each step is because BYOND's internal C code actually handles the tile animation flipping, and no network communication is really necessary.

Even if you used your approach, you would run into the exact same delay in moving projectiles acrost the network, because you have to manually change the icon states. That's about 1 update per frame to the client per projectile.

Moving the projectile generates 1 update per frame to the client per projectile --only, with the added benefit of not spamming the world with unused objects and bogging down network communication that much further.
Ter13 wrote:
Even if you used your approach, you would run into the exact same delay in moving projectiles acrost the network, because you have to manually change the icon states. That's about 1 update per frame to the client per projectile.

It may seem like that, but because this is done manually, I would be able to optimize and reduce the total number of updates for large groups of these projectiles. The key is that it works well on very large numbers, which is not something Move() is really designed for.

I should also add that when using the Move() method, the data is kept within each projectile instance, instead of being centralized within the datum, and that could cause a delay in the actual built-in search functions for accessing the data contained in those instances.
Multiverse7 wrote:
Most programmers today probably take no notice of the bitwise operators, but perhaps they can be very effective in BYOND.

This is exactly why I said I think you just discovered the concept of bitwise operators and it's now your panacea to all of your problems; first and foremost, bitwise operators are rarely needed, even in industrial applications. Bitwise operators are also only performed on integers(or binary numbers), so they don't expand beyond that nature. I'm not sure where you're getting this idea from that bitwise operators can be applicable in any situation and it will vastly improve your program, which can be true for some things, such as parsing hexadecimal colors or an optimized version of Perlin Noise(or any algorithm where bitwise operators seem fit). Actually, in most Comp Sci. courses(mine, at least), bitwise operators are least of a professor's priority because they're not a vital tool for programmers(only if you're getting close to the hardware level, which is a completely different thing).

Magnum2k wrote:
Bitwise operators are also only performed on integers(or binary numbers), so they don't expand beyond that nature.

This is where you are wrong. I'm sure many image editors and sprite engines have made direct use of the bitwise operations on the actual binary data of images. I wouldn't be surprised if the BYOND engine itself did that on some level. Often this makes for one of the fastest changes you can make on any image, at a low level.

Let me show you what I'm talking about here. Welcome to the twilight zone of bitwise operations!

The following images are all royalty free.
First original image:
Second original image:
Combined using binary AND:
Combined using binary OR:
Combined using binary ZOR:

Since bitwise operations require about the same processing power as multiplication, they can make for a very fast method of image manipulation. Of course this is a special case, and is probably quite obscure.
In response to Multiverse7
Multiverse7 wrote:
Since bitwise operations require about the same processing power as multiplication

Multiplication is much slower than bitwise operations. Don't talk if you don't know.
Zaoshi wrote:
Multiplication is much slower than bitwise operations. Don't talk if you don't know.

That was true back in the 90s, when we had dinosaur computers. Now, processors work on a somewhat higher abstraction level, which is why regular mathematical functions have made bitwise operations nearly obsolete, and they fell out of use.
In response to Multiverse7
I think you're missing the one missing the point.

I'm sure many image editors and sprite engines have made direct use of the bitwise operations on the actual binary data of images.

And what do binary data consist of?
In response to Multiverse7
Multiverse7 wrote:
That was true back in the 90s, when we had dinosaur computers. Now, processors work on a somewhat higher abstraction level, which is why regular mathematical functions have made bitwise operations nearly obsolete, and they fell out of use.

You're right, but that's still not true. In SOME MODERN compilers, it'll still covert that same mathematical arithmetic using bitwise operators. :)
Binary data is all lots of 0s and 1s. Ultimately all images, and everything else stored on a computer is made up of this binary data.
In response to Multiverse7
Exactly, which leads me back to this

Magnum2k wrote:
Bitwise operators are also only performed on integers(or binary numbers), so they don't expand beyond that nature.
Magnum2k wrote:
Bitwise operators are also only performed on integers(or binary numbers), so they don't expand beyond that nature.

Everything consists of binary numbers, so that statement is self-contradicting.
In the interest of seeing this thread going in a direction that isn't in circles, perhaps you could put together a proof of concept demo to show off this method of handling particles/projectiles? Because otherwise you guys are just going to continuously argue theory until the discussion goes sour and this thread most likely has to be locked.
I won't be developing a demo for this idea for a while. I just wanted to get some feedback on what other people think of the concept, well before I go making some complex library using concepts that have never been brought together before, at least in BYOND.

From the responses I'm getting, I see now that this is radically different from how pretty much anyone handles things in BYOND. The most similar idea to this one is probably Forum_account's Dynamic Lighting. Of course the techniques used there were a bit more obvious in that case. The perceived lack of understanding in how this concept works actually encourages me to demonstrate this radical new idea.

Anyway, I always try to keep my cool in a heated debate. I think of this more as a learning experience than defending an argument. All BYOND developers should act as both teachers and students. Sometimes though, someone will see a discussion differently, and think it's all just trolling, when in reality there is constructive criticism going on.

I appreciate constructive feedback. It helps me learn how to improve on certain things, that I otherwise wouldn't see.
Page: 1 2 3