Jump to content
  • Advertisement

Wyrframe

Member
  • Content count

    1369
  • Joined

  • Last visited

  • Days Won

    1

Wyrframe last won the day on May 31

Wyrframe had the most liked content!

Community Reputation

2450 Excellent

About Wyrframe

  • Rank
    Contributor

Personal Information

  • Role
    Programmer
  • Interests
    DevOps
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. That would be where it goes if you mirrored across the X axis only. Mirror across the P0,P1 line, and you'll see it's very close (within the error of the size of your circles, as far as I can tell). It doesn't look like you're checking tx,tz for being in valid range; if they're out of [0,1] range, then don't include them in extrema-point calculation. Are the green/red points the bounds of the calculated rectangle? If not, what are those? And by double-check your math, a good process is to do it by hand using some simple, integer coordinates. If you can't get sane results, the technique is wrong. If you get sane results but your code doesn't reproduce it, debug the code one step at a time to find the divergence.
  2. It looks like your extrema is mirrored to the wrong side of the v_0, v_2 line. Double-check your math. Otherwise, your process appears correct.
  3. If you're limiting yourself to just one noise channel, just one dimension... then yes, any continuous function will only produce continuous values. But if you have, for example, an "A" and a "B" channel, and make decisions based on both... A < 0.40, B anything: lake/ocean A < 0.45, B < 0.6: beach A < 0.45, B >= 0.6: cliff/rocks A < 0.60, B < 0.3: grass/plains A < 0.60, B >= 0.3: savanah A < 0.9, B < 0.4; deep forest A >= 0.9, B >= 0.8: mountains Otherwise: light forest Now you can have several different kinds of terrain butt up against another, while still being able to define which ones may be adjacent. Diagrammatically:
  4. Wyrframe

    Creating A Grid of Images

    You don't need to load a separate Image for every Sprite. You can load your two brick images once each, and then create any number of Sprites which all use one or the other of those Images. That's the difference between an Image and a Sprite; the first is just simple bitmap data, and the other is a scene graph element which describes what to draw and where. For that sharp of a drop, I bed there's something odd about how you're creating and using Brick. I'm guessing you're instantiating a Brick once per frame, instead of once per scene reset? class BrickGrid(): def __init__(self, space): self.batch = pyglet.graphics.Batch() self.sprite_list= [] # I really don't know Python, there must be a better way to do this: # Create a list of brick images, and load each file in turn. brick_images = ['brick1.png', 'brick2.png'] for index in range(len(self.brick_images)): brick_images[index] = pyglet.image.load(brick_images[index]) for x in range(7): for y in range(7): body = pymunk.Body(body_type=pymunk.Body.KINEMATIC) body.position = x * 100 + 75, y * 30 + 340 image = brick_images[random.randint(0, len(brick_images) - 1)] sprite = pyglet.sprite.Sprite(image, x=body.position.x, y=body.position.y, batch=self.batch) self.sprite_list.append(sprite) shape = pymunk.Segment(body, (0, 0), (50, 0), 6) shape.elasticity = 0.80 shape.collision_type = collision_types['brick'] space.add(body, shape)
  5. Wyrframe

    Need library/engine/whatever

    http://love2d.org ? Built-in Box2D, OpenGL, Lua, has thread and socket libraries built in, pretty good performance thanks to LuaJIT but you can also build and load C/++ DLLs if you need something closer to metal.
  6. Wyrframe

    Creating A Grid of Images

    Doesn't look like you're creating a sprite for each brick; you're iterating over a range, moving one of two randomly picked sprites (and only two sprites ever exist, mind you) to the corresponding position on the grid, and then moving on. Also, does `space.add()` copy its arguments and create a new rigid body as described, or does it add a new body which uses those arguments are its position-and-shape parameters (so if you update them later, it updates that body's position and shape)? Either way, I suspect `space.add()` should be returning something you should store in Brick somewhere.
  7. I gotta know; why do you need this information? Because you can extract it from the same API that debug overlay is getting it from, if it's that important.
  8. Wyrframe

    Custom size_t

    Is there a reason you need a target-platform-agnostic integer interpretation of a pointer to void? It doesn't even make sense to me for serialization/marshalling, since if you're using C++, you really should not be using void* for anything except interfacing to non-C++ code. The traditional "size-type" is just "whatever unsigned integer is most efficient for the CPU to operate upon". That can be all sorts of sizes, on all sorts of platforms.
  9. I don't think swapping rows does you any good with the `gen_bits()` algorithm. After swapping (e.g.) the borders, what change does that have on the neighbour-adjacency data of the border-adjacent simulation cells? Answer: it does nothing. You'd need to subtract the virtually-living border cells from the border-adjacent cells' neighbour counts, then swap borders, then re-add the newly arrived virtually-living border cells to the border-adjacent cell's counts.
  10. Wyrframe

    Remomended Resolution for HTML 5 Games

    Objects are mispositioned? Or are elements in your GUI mispositioned? The former sounds like a view/model conflation; decouple the two to fix it. The latter is a matter of making your UI work at any resolution you choose to support. But as for what resolutions to support? Well. To start at the easy end, let's just say you should pick either landscape or portrait to support, based on what works best for your UI, and then don't assume anything about exact resolution or even aspect ratio ever again. Maybe pick a minimum resolution, like 1024(long) by 512(short) (whether that's 1024x512 or 512x1024), but don't assume anything after that. Usable area might be bigger, might be smaller.
  11. He's deliberately trying two algorithms; "gen_sum()" is the traditional count-and-test that you're used to; "gen_bits()" is a different one which actively updates a cell's neighbour's "neighbour" counts each time a cell dies or is reborn.
  12. 'k, I'm understanding now what `swap_borders()` is supposed to be doing. I don't think it has that effect, though. What you effectively have is a 2-cell wide semi-inert border at all four sides that you're trying to use to "pass" neighbourhood information from one side of the board to the other. By doing it like that you're causing an artificial 1-cycle lag in information propogation from one side of the board to the other, whereas true wraparound does not have that problem. If you're seeing it work in one axis, my best guess is that it is doing so as an artefact or a misinterpretation of your test data. Try setting up a figure-8 or any other N oscillator centered on a supposedly wrapping boundary.
  13. Your algorithm is only iterating over the cells from index 1 through index GW/GH-1, exclusive. Don't you mean to be iterating over *every* cell? Once you fix that issue, you will have an out-of-bounds issue unless you calculate the true array index of the adjacent cells. Pre-calculating the previous and next Y coordinates once per Y loop, and the previous and next X coordinates once per X loop, would be sufficient. For example (again, I barely know python)... for j in xrange(0, GH): # If you stick to strictly positive values, modulus works fine. jAfter = (j + 1) % GH # Most languages have bad behaviour with negative numbers and the modulus operator, # so I use this construct to avoid that unnecessary testing. jBefore = GH-1 if j == 0 else j-1 # and then when used, e.g. in the "kill cell" condition... cellmaps[curr][j][i] &= ~1 alive_cells -= 1 cellmaps[curr][jBefore][iBefore] -= 2 cellmaps[curr][jBefore][i] -= 2 cellmaps[curr][jBefore][iAfter] -= 2 cellmaps[curr][j ][iBefore] -= 2 cellmaps[curr][j ][iAfter] -= 2 cellmaps[curr][jAfter ][iBefore] -= 2 cellmaps[curr][jAfter ][i] -= 2 cellmaps[curr][jAfter ][iAfter] -= 2 Last of all; if you have two copies of the tile field in the array `cellmaps`, why are you `deepcopy`ing the current one before every iteration? Why aren't you just swapping the values of `prev` and `curr`?
  14. Wyrframe

    Button Syle Confusion

    Are you compiling against Common Controls Library (aka ComCtl32) 6.00 or later? https://msdn.microsoft.com/en-us/library/windows/desktop/hh298349(v=vs.85).aspx
  15. So... looking at the initial calculation for floorX/floorY... why is the player's position involved a calculation that tries to determine the color of the floor at a given world-space X/Y position? Also, if this is Java or Processing code? Every cast costs a full-depth type check, equivalent to, for a typical depth-5-heirarchy type with a couple Interfaces thrown in, usually about 50-200 comparisons and 10-25 function calls per cast. Eliminate the casting of minimalIntersection to a PointF by passing it in as the correct type, or at least move the cast out of the loop. I'm just gonna leave your egregious use of singletons where they are. If you don't already know that's terrible code, this forum post is not gonna be enough space to explain otherwise.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!