Author Topic: Graph Caster: Draw a graph with lasers. Alpha. With demo lightning bolt.  (Read 2444 times)

I plan on doing a lot of little projects so I thought I'd stake out a thread.  The first one takes a graph (in the sense of a collection of nodes and edges) and draws it on the screen with lasers.  This is a very very early version I'm putting here for proof of concept and to solicit ideas.

http://bulletforge.org/u/tubercular-ox/p/graph-caster/v/0

The comment I'm dreading is "Why didn't you just do this instead?" to which the answer is "I didn't think of that."  I tried to make it library-like, but if you have any ideas on how to make it more portable please share.

One oddity is that instead of passing arrays to functions and returning them I used global arrays and name-mangled functions.  Tests I've run have shown array *access* to be relatively cheap compared to array *creation*, so I went ahead and planned for the future and got rid of as much array copying as possible.

Otherwise here are my plans:

Parameterize more variables so you can easily change how an edge looks from one spot. This is trivial and I'd've waited until this was done to post but I'm tired of coding today and want this up here for comments.

Have options to be able to assign separate values for variables for each edge on the graph, rather than have all edges be the same. You will be able to turn these options on and off individually as each one you turn on is going to involve an additional performance hit whether you use it or not.

Frame delay feature. CastGraph will be a task, and you will be able to specify at what frame you want each edge to show up in.

Create a randomized fractal-based lightning generator. It can be done. Worst case scenario is you create as many bolts as you need in @Init, then cast them later. Depending on how intense your bolts are your framerate may plummet at the start of the card, but the card itself should play fast.

Make the generator breathe.  Make it a task where you can control how often it yields, so you can be generating a new bolt in between frames while still doing other things.

A move node feature. After the graph is cast, it will keep track of which objects are attached to each node. When you move a node, it will go through all objects attached to that node and move them accordingly. Not sure how intense this will be processor-wise, but the intent is, if breathing a new bolt takes too long, you can just mangle the existing bolt predictably until it's ready.  Already you can do this by changing the nodes in the node array, deleting the old graph, and recreating the new one in the same frame, but obviously it'd be faster to avoid that.

Make a player that shoots randomized lightning.  If I can get the performance right I want it to be their shot, but I'll settle for it being a bomb.  No, not Emperor Palpatine.  Or maybe it *should* be Emperor Palpatine?  The hard part will be making sure they have consistent screen coverage so you're not a luck-based dps.  Or at least not too luck based.

Anyone know any fractal lightning algorithms?
« Last Edit: January 07, 2011, 08:53:28 PM by Tubercular Ox »