What I did today

Actually, the first thing I did was sort based on the lowest index number. It couldn’t compare to Tom’s algorithm. Hmm… I’m gonna try something similar though.

EDIT: So I tried something really simple:

  1. Sort triangles based on (i0 + i1 + i2).
  2. Reorder vertices in the order they are used by the triangles (= the pre-transform cache coherency optimization, step 3 in my previous long post).
  3. Repeat until the result gets stable.

The result was actually pretty good, but still not as good as Tom Forsyth’s algorithm.

EDIT 2: According to Forsyth, his algorithm can be implemented in linear time.

EDIT 3: Note that all the invocations counts are reported by the hardware of my Nvidia GPU. The numbers may be very different on AMD and Intel GPUs.

Try the average of the 3 verts as the sort key.

Cas :slight_smile:

It’s the exact same thing. The average is (i1 + i2 + i3) / 3, so I’m just sorting based on *3.

Hah, so it is of course.

Cas :slight_smile:

Oh I know! I took it home to show my wife and threw it out.

We used to call cocaine twat powder here. Because it turns ordinary people into twats.

Cas :slight_smile:

Yeah most people turn into twats. At the recording studio I used to work at, one of the engineers snorted 60k of the studio’s money. Then the owner found out, and it was not a pretty day that day.

Nice job)
I also may recommend try put draw in to DisplayList
– yes I know it deprecated – but you don’t lose anything trying)

Howdy all! :smiley:
There. That’s my introduction

Well, today (technically I started on it late yesterday, and finished today) I got curious as to how games implemented power systems, and rather than try to read their code, I decided to try and see if I could come up with my own way without other people’s code. It now can have “points” (a power source, a power consumer, or an intermediate point) that are connected to each other. I can find the shortest path of connections between two points (shortest distance, and then the least number of connections), as well as find the nearest power source. :smiley:

I feel the need to use this in a game now, but even this (despite being completely code based) made me incredibly happy to have achieved. :smiley:

I added a nice little shorthand to my console :slight_smile:
Instead of having to type

ent_input <entity name> <parameters>[] 

you can now do this:

<entity name>.input <parameters>

It’s not huge but I like the convenience. It also populates a suggestion list with all the available inputs.

RYG did an easy to understand breakdown of out-of-order optimization of some code by PhysX author Pierre Terdiman,

Good idea, but testing that would require half a rewrite of my model renderer ingame, so I’d have to write an artifical test for it… Also, the amount of optimization the drivers do will vary a lot between vendors, so I’m not sure the information would be that valuable.

Hmm. Is there any way could write code that would take advantage of that info in Java? Some pattern that helps Hotspot do the same thing I mean.

My thinking was more “how to think about costs” than the specific example. BTW, the original (not-complete) sequence is found here: http://www.codercorner.com/

i wrote java bindings to portmidi cos’ java midi-api is really not good.

Today I discovered one more reason to do a job right the first time. About 3 years ago I was “commissioned” (is it technically a commission if your “pay” is having membership fees waved?) for a group. Essentially they needed a custom dropbox/google drive system where they could host files and have them synced to authorized users computers. Meaning I needed the server and the client to go along side it. Long story short, the server host can go burn in a hole. :stuck_out_tongue: I have no idea what settings they have on that system, but they suck. Nearly all the files were popping up as being “invalidily named” and couldn’t be saved on the host (they worked on my test machine). The problem however didn’t really manifest until a few days ago, and by then we’ve had this system running for a long while. So, without destroying the system I had to rewrite the way that files were stored on the server to use a UUID for the file name, and then store the real file name in a database with a reference to the UUID of the file so that I could find it when someone searched for it’s name/downloaded the file.

TL;DR-> Do things right the first time, or you may have to do a major rewrite of crucial functions for a system that is under very active use.

You don’t need create new file system)
unique UUID is good idea for any file system, but
You can use - base Folder tree structure for users
Simple create new folder per user,
It direct sync with folder on user system
-if user try write duplicate files - behave as normal file system do)

(+ of course caching folders tree structure for faster search ^^)

As a side note, I don’t think it has an affect on the way it ended up being implemented: each user doesn’t have their own folder, the group uses the same folder, and no subfolders are allowed to be created. So, I inevitably have to stick everyone’s files together.

But the real reason I had to do that, was that at random times characters would be permitted in the file name (most of these files are news clippings and news agencies will occasionally use non ASCII characters in their file names. Windows and Mac typically don’t have a problem with those character, the host machine does and won’t save it). The real reason for the UUID was just to have a unique reference to a file that I knew would work. I could have used the old file name, and just replaced any “invalid” characters, but then it would/did show up as '“Tru___ cabinet pick is said to be the w_rst yet.” Which isn’t the end of the world, but it they go to search for it, they won’t find it very easily. Plus, Inevitably after the users reached 7020 files (which they have) grabbing the files was a few seconds slower than an SQL search, so I list the files/search for files via the database. When the files get listed, the database shows the name that was given to it on upload, and a link to the file with its UUID. The client reads both, downloads the file by its UUID, and then names it accordingly.

I do like the idea your presented, it’s sorta what I did at first, but didn’t work with the host machine like it did in my dev environment.

Hash the file content, e.g. with SHA-1. Use this as your UUID and file name. As a side effect, you gain the option to detect hash collisions / duplicates. You lose the 1:1 mapping of user to file ownership, but there are solutions to this problem too.

Now that I like. Don’t know why I didn’t think of that honestly. I do think that I want to wait until the slow season kicks in before I make that change though, so I’ll keep that in the back of my head for later.

Did a non work related thing today! :smiley:

Built a rough entity system so now I can spawn in entities, automatically have them removed if they die, and get an entity via it’s collision box (not sure how I feel about having to resort to that, but I can’t think of an alternative to find the entity).

I also got an ability system working, so I can swap out abilities for the player and essentially use that to make unique characters. I have a rewind ability (moves the player “back in time”), a slam ability (throws the player to the ground and creates a “smash” affect around them that damages entities), and a freeze ability that turns the player into a static body so that they can neither move, nor be moved. Mostly it’s just me experimenting with ideas I get. Not sure if any of those would be fun to play with, but they were fun to write. :smiley: