[Haskell-cafe] Modeling space for a MUD - revisited.
Michael Litchard
michael at schmong.org
Fri May 20 16:47:17 UTC 2016
This is a continuation of a conversation started in the following two links.
https://groups.google.com/forum/#!searchin/haskell-cafe/michael$20litchard|sort:date/haskell-cafe/n0Tc29UUgoQ/iitt3z3PCwAJ
https://groups.google.com/forum/#!searchin/haskell-cafe/michael$20litchard|sort:date/haskell-cafe/qD2kaZ9qpEA/jTDAp8KoCgAJ
I am trying to model a 3-D space for a mudlike. Here's the criteria I have
so far:
(1) Objects in space will be either ships that can move or stationary
things like non-moving game-controlled ships, space-stations , moons and
planets.
(2) Objects will not have spatial extent
(3) Space is non-continuous
(4) Collision happens only when one object is stationary or each moving
objects are moving directly toward each other, on the same line.
(5) Movement happens by setting a destination vector and a speed. There's
no steering exactly, but you can change destination while moving, slow down
or stop suddenly.
(6) Octree looks like the data structure I want to use for modeling. I'm
looking at http://hackage.haskell.org/package/Octree as best library for my
application, if I am right about how to go about updating. I'm not sure I
am.
I think I can use the octree to track things in space, rather than having a
node for each point.
At most there will be say, 200 objects in space, therefore at most 200
nodes in the tree. So I am visualizing the following steps:
(1) Begin with a [(Vector3
<http://hackage.haskell.org/package/Octree-0.5.4.2/docs/Data-Octree.html#t:Vector3>,
a)]. This includes stationary objects and ships already in space.
(2) If a new ship entered this space, add it to end of list.
(3) make Octree a from above list
(4) ships move by setting destination vector and then speed, calculate next
Vector3 they will be at next tick
(5) Make a new [(Vector3
<http://hackage.haskell.org/package/Octree-0.5.4.2/docs/Data-Octree.html#t:Vector3>,
a)]
(6) Go to (1)
The first problem with this is in creating a new Octree from a list, when I
would rather just recreate the new tree with a subtree of the nodes that
changed. The library I am considering does not offer that operation. Maybe
this is not a real problem considering the maximum objects in space will be
200.
There may be other problems with my thinking here. I look to haskell-cafe
for any insight it may offer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160520/a20241f9/attachment.html>
More information about the Haskell-Cafe
mailing list