Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

  • Days Won


Wyrframe last won the day on May 31

Wyrframe had the most liked content!

Community Reputation

2456 Excellent

About Wyrframe

  • Rank

Personal Information

  • Role
  • Interests

Recent Profile Visitors

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

  1. Well, do some analysis yourself. Make a test program which emits the sizeof(), the address, the relative address of ::saveStart and the relative address of ::saveEnd... and compare the output in debug and release builds. And if they come out identical... be sure to post your test-program's code when you post your results here.
  2. Remember the sizeof() a struct/class includes some things you're not supposed to reason about as a user of the language, such as the VTable if the type (or any of its supertypes) have any virtual methods. You may need to re-do your serialization from scratch. If you are going to use C-isms like fwrite() and fread(), which means casting to/from void pointers, you must restrict yourself to serializing only structs/classes which contain no pointers, and have no virtual methods.
  3. Wyrframe

    Recommend a simple .net 2D library

    So... a web browser?
  4. Space Engineers ( https://store.steampowered.com/app/244850/Space_Engineers/ ) is one of several games which does precisely this, for bodies as small as 50m asteroids, and as large as >100km-diameter planetoids.
  5. Wyrframe

    C++ Game Asteroid

    Placeholder values like 0xCD or 0xDEADBEEF are often used by debug builds to catch initialization errors like this. The error message in the first screen suggests to me that `Game::bullet_` is nonzero but also uninitialized; find out why. Are you sure you deserve the job, if you don't know C++ and debugging skills?
  6. You're always passing a Rect(0, 0, W/2, H/2) into the call to `subsurface()`. That means all cameras are going to use the same (0,0, W/2, H/2) sub-rectangle of the action_surface for their blitting. You'll want to vary the X,Y position of the rect for each camera if you want them to target separate areas. Also, in your update() method, you seem to be blitting each camera's surface to its portion of the main screen surface... why? If you're using subsurfaces of action_surface, you can just copy the entire action_surface over to the screen at once, saving you the overhead of multiple blit calls and position re-calculations.
  7. Here's another design pattern for you. This code has not been compiled, but the idea is roughly there. class ColorChannel : public Channelled<ColorChannel> { // ... float r, g, b; template<> ColorChannel mix(float tween, const ColorChannel& other) const { float inv = 1.0 - tween; return ColorChannel(r * tween + other.r * inv, g * tween + other.g * inv, b * tween + other.b * inv); } }; class ScalarChannel; class PositionChannel; template<class T> class Tuner { T& getChannel<T>(); }; class ColorRect : public Rect, public Tuner<ColorChannel> { // ... ColorChannel color; ColorChannel& getChannel() { return &color; } }; // ... template<class T, class V> class Animation { T * target; V from, to; float duration, position; void update(void) { float tween = MAX(0.0f, MIN(duration / position, 1.0f)); target.getChannel() = from.mix(tween, to); } }; // ... void main() { // ... Animation<ColorRect, ColorChannel> anim(&blueRect, blueColor, whiteColor, 4.0f); while(true) { // ... anim.position += deltaTime; anim.update(); blueRect.draw(); }; }
  8. Wyrframe

    Java's Weaknesses in Game Creation

    Seriously, though, Java is very solid for anything which is not compute-heavy, and even then it can go a long way. Meaning, if you could scale your algorithm's performance up by using SIMD, and that algorithm is critical to your program, you would be better off with using another language, because even the libraries which give you SIMD intrinsics will require a lot of handshaking back and forth as a performance penalty. If, however, your program is not extremely compute-heavy (e.g. most of the real work done per second is done by the GPU), or if it is heavily I/O bound (e.g. most of the time is spent waiting on the network or on the disk), or you just want to learn Java... use Java. It's a useful, high-composability language, with a very good JIT compiler built into nearly all of its runtimes, and with a very large (if spread-out) community of libraries available. Disclaimer: I learned C++98 and Smalltalk in school, graduated 12 years ago, used Java near-exclusively for all professional and personal projects for 8 years, and am now primarily a JavaScript/WebGL programmer who does C++17 stuff in his free time.
  9. 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.
  10. 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.
  11. 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:
  12. 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)
  13. 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.
  14. 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.
  15. 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.
  • 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!