Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

1003 Excellent

About Lode

  • Rank

Personal Information

  • Role
  • Interests

Recent Profile Visitors

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

  1. Hi, I'd like to present LogicEmu, a new logic circuit emulator working in the browser: http://lodev.org/logicemu/ It's somewhat different from most logic circuit emulators, because it's cell based and internally with 2D ASCII diagrams, and it comes with a huge ton of circuits prebuilt which can be immediately selected from dropdowns to try out all kinds of cool stuff! How is it related to gamedev? It's an educational game, it's also vaguely like minecraft redstone, and may be useful for developing/testing/verifying such circuitry engines in games. It's open source on github to see how it works. Please let me know any feedback. Suggestions, bugs, overall impressions, critique, ... are all super welcome Thanks!
  2. OffscreenCanvas looks not well supported, only experimental in some browsers. Everything is red here: https://caniuse.com/#feat=offscreencanvas Do you mean this one by off-screen canvas, or does any regular canvas that is not visible work?
  3. What I was avoiding by doing the visibility hidden swapping, was redrawing of the lines. I will try it out with 1 big canvas and redrawing everything per frame (or even only the parts that changed, but that could very well be everything). I just will need to use blitting or copying then I guess, because I also already know the amount of lineTo moveTo etc.. to redraw everything per frame will be too slow. So I hope the copying will be fast.
  4. No screenshot, but I can describe: Imagine a grid of 100x100 tiles (it can be bigger, e.g., 150x400 should also work), forming a diagram. The diagram is a big line drawing formed by those tiles. Each tile has one of a few possible types, but its look depends on the neighbors. Examples: -there could be arrows or lines pointing at any combination of 0 to 8 neighbors --> that alone gives already 3 to the power of 8 combinations -there can be border around the tile, or on any subset of its 4 sides -it might have a special background color -it might have a letter on it So the above gives a combinatory explosion of what a tile could look like. If there were only 100 or so different looks, I would use 100 premade textures. But that's not how it is, the tiles need to be created when loading the map and they could in theory all look slightly different (in practice many may look the same due to regularities in maps but it's hard to guess which before starting to draw them). So for the same reason as 100 premade textures is not possible, I think having a few hidden ones as a buffer is difficult for the same reason. Depending on what happens, it is possible that almost every tile needs to be updated to the other one in a single frame. So each map tile has two possible looks (usually) and the updates per frame is that some change to the other look (and it is currently smart enough to only flip those that changed, but if I would instead go to a different type of rendering where everything is redrawn per frame then that doesn't matter of course) I will try if copying parts of a few pre-made ones existing out of only parts of a tile (like 1 of the 8 arrows, ...) will work, and if that will be fast enough every frame. Thanks for the suggestions! P.S. no matter how horrible it sounds, chrome can do it fast! I only discovered that it can be slow when trying it in firefox
  5. The difficulty is this: Each tile is not a nice predefined bitmap image, but a line drawing that depends on the environment. So I can't really use a set of textures, the texture is created with line drawings on the fly (what a tile looks like depends on neighbors etc..., like there may be connecting lines or arrows to neighbors, so it would be too much textures to have them for every possible combination) beginPath, lineTo and moveTo also seem pretty slow. So I need some fast way to draw the two line drawings of every world tile, and then once I have those I could indeed do the bitBlt. The two different line drawings per tile to toggle to are usually just a color change, but sometimes also a shape change or a letter character change. Any suggestion for how to create, for example, 100x100 such little individual line drawings fast?
  6. Hello, I'm working on a tile based engine in HTML5+canvas. I currently made every single tile in the world its own little canvas. The reason is, I make two canvases per tile, and depending on state display one of the other. This allows fast switching between the two with style.display.visiblity. However, while that actual showing and swapping visibility goes fast, what goes slow is creating them at the start of the game, in Firefox at least. In Chrome, this all goes super fast. In firefox, simply creating a couple of thousand canvases, especially calling getContext('2d') on each of them, goes super slow. Is there any alternative better way to have a 2D tile based engine where each tile can efficiently swap between two different graphics? Thanks!
  7.   How does that work? The cubic bezier on Wikipedia does not hit each control point, only the outer two - but then it's also 2D intead of 1D:   http://en.wikipedia.org/wiki/B%C3%A9zier_curve   Can this be calculated in a way similar to bicubic interpolation? I couldn't find anything.   THanks a lot!
  8. Lode

    Other uses for matrices in games?

    The entire game '2048' is a matrix :) If empty cells are zeroes.
  9. Awesome! That is a great idea and works great, thanks!   EDIT: never mind the other comment I posted here, Smoothstep does look visually better than http://dinodini.wordpress.com/2010/04/05/normalized-tunable-sigmoid-functions/ :)
  10. Lode

    good random permutation?

    World generation: On the left: ugly patterns of trees (the dots) On the right: good pattern of trees with your code :)  
  11. Lode

    good random permutation?

    Thanks for pointing that out. That last one works nicely. But if I remove the last 4 lines (before return x), then the patterns look ugly. Seems like that additional repetition of similar things fixes it. So, works great, but I'm going to experiment to try removing some lines :) Do you have any explanation why some of these give ugly patterns in results, while others look very random? Thanks!
  12. Hello,   Bilinear interpolation generates visible crosses, see image from wikipedia to see what I mean, I mean the horizontal and vertical structures and sharp edges:     Bicubic interpolation looks much rounder:         Imagine now that the colors are types of world (tundra, desert, grass, ...): the rounder shapes are *highly* preferable over the ugly "crosses" of bilinear interpolation.   However, bicubic interpolation has two disadvantages (the second being the most problematic for me):   1.) It requires 16 points, rather than only 4 points. It would be highly preferable for me to only have to use the 4 corners of a square zone, not corner points of neighboring zones as well 2.) Values can overshoot, that is, they can become lower or higher than the 4 corners of this zone. I really don't want this, "conditions" in a zone should be bounded by its corners for convenience reasons (predictable range of values in a zone).   So, the question is: Does there exist a way of 2D interpolating that only uses 4 corner points and only returns values in that range, but, looks "rounder" than bilinear interpolation? Thanks!
  13. Lode

    good random permutation?

    Thanks a lot!   In the end I went with a hybrid with Álvaro's suggestion and irreversible's example :)   With seed a fixed constant that determines the world, and x the input number, my first implementation was:       x ^= (seed ^ 1234567890);     x = (x + 1234567890) & 2147483647;     x = (x * 1000000001) & 2147483647;     x = (x >> 18) | (x << 14);     x = (x * 1000000005) & 2147483647;     return x;   But that had noticable patterns still so not good. But then I combined it with irreversible (the order in which things happen is based on it, the numbers not), giving this:       x ^= (seed ^ 1234567890);     x = (x * 1000000001) & 2147483647;     x = (x ^ ((x << 6) ^ (x >> 26))) & 2147483647;     x = (x * 1000000001) & 2147483647;     x = (x + ((x << 5) ^ (x >> 12))) & 2147483647;     return x;   And that seems to work quite well indeed :)
  14. Hello,   For a randomly generated world, I'm trying to find a way of randomly generating rivers in the landscape.   However, unlike for example in Dwarf Fortress, in my world the whole world is not known beforehand. DF generates the rivers with physical models on the entire landscape. That is not my intention.   In my case, the world is more like it works in Minecraft: a sector is only generated when you encounter it. Generating heights, humidity and so on is done this way with perlin noise, and that can work in independent sectors.   What I mean by "working in independent sectors" is that it is able to generate a sector with pseudorandom numbers, without any information about the other sectors, and yet if you zoom out and see the whole world, all the sectors smoothly connect together.   But for rivers, which of course go through many sectors, you sort of need to know where a begin and end is, so I can't find a way to generate it "independently". The fact that ideally the rivers would also flow from mountains to oceans makes it even more difficult. Same for roads: I want roads to connect cities, but a sector in-between ideally should not have to know which sectors contain the actual cities (as that is something that the city-sector alone can only know from its own pseudorandom values).   The simplest algorithm that does achieve that is to simply have a grid of cities (roads are the edges, a city at every intersection), but that is boring.   Are there algorithms for "independent" random river and road generation? And what is this concept called? Thanks!
  15. Lode

    good random permutation?

    Thanks! Yeah I didn't really know the exact scientific name of what I was looking for which made googling hard. Perfect hash, and random access random permutation, sound indeed like it.   It needs to be stateless because the whole world will not be generated at once, it generates a part only when you reach it. E.g. if you reach a part with a coordinate x + 65536 * y = 5000, it needs to give you the value for 5000.   About Java: I'm not even using it but if I would the world should be the same. So, it doesn't have unsigned integers. I don't like that, at all, but it is what it is. 64-bit integers can of course store the 32-bit value, but truth is the upper value doesn't really matter a lot so going up to 2 billion seems fine.
  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!