JobLeonard
|
|
« Reply #60 on: October 06, 2020, 03:45:56 AM » |
|
255 you say? What an oddly specific number... Is the limit now 32,768 by any chance? :p
|
|
|
Logged
|
|
|
|
Schrompf
|
|
« Reply #61 on: October 06, 2020, 04:17:00 AM » |
|
Is somebody in this room using signed short for a item count? Hm? HM?
|
|
|
Logged
|
Snake World, multiplayer worm eats stuff and grows DevLog
|
|
|
Rogod
|
|
« Reply #62 on: October 06, 2020, 08:11:21 AM » |
|
You caught me Yea I had the inventories as byte[,] arrays because there are less than 255 different items in the game, but this also limited the quantity as well. So I've just had to accept there now being 32768 possible items in the game for the sake of allowing 32768 of each to be stored. I suppose it's not out of the realms of possibility that there be more than 255 different kinds of item in the game eventually - I mean look how many block types there are in Minecraft nowadays compared to the 9 it started with. xD
|
|
|
Logged
|
|
|
|
|
JobLeonard
|
|
« Reply #64 on: October 07, 2020, 01:09:23 AM » |
|
It's worse than that, it's physics Jim! Cool bit of polish! Also, I just noticed that your circles are "pointy", I guess you're using the Bresenham circle algorithm? RedBlobGames suggest adding a +0.5 radius to the radius to fix that. See here: https://www.redblobgames.com/grids/circle-drawing/#aesthetics
|
|
|
Logged
|
|
|
|
Rogod
|
|
« Reply #65 on: October 07, 2020, 09:14:54 AM » |
|
Heh, I'd like to say "Sure I'm using that algorithm" but no, I'm literally just doing this: for (int angle = 0; angle < 360; angle += angleIncrement) { for (int r = 1; r <= radius; r++) { int x = (int)(Math.Sin(angle * Constant.RAD_VALD) * r), y = (int)(-Math.Cos(angle * Constant.RAD_VALD) * r); exampleBufferOrSomething[x, y] = 1; } } (Where RAD_VALD is Math.PI/180 as a double and angleIncrement is usually something like 3 or 5) The thought of making it perform a distance check worries me that it'll slow the draw call down loads as this is being done once per frame, then due to the sub-cell rendering it's processed & buffered at least once before making it to the screen draw routine. (Also not to mention there is a randomizer on the pixel being output in this as well.) Previously when I was faced with spikey circles I simply changed all the radii to be an odd number (+=1.0) and this fixed it - no such luck this time round. I would like to heed the advice of adding 0.5 to the radius when it runs this algorithm but I can't think of a way to do that without decreasing the radius increment to some arbitrary decimal value. EDIT:Wow, I'm a derp - if you literally just change the inner for-loop to for (float r = 1; r <= radius + 0.5f; r += 0.5f) it works perfectly and is just O(2n²) over the original O(n²) which I can cope with
|
|
« Last Edit: October 07, 2020, 09:24:24 AM by Rogod »
|
Logged
|
|
|
|
s0
|
|
« Reply #66 on: October 07, 2020, 11:47:15 AM » |
|
This looks great, following.
|
|
|
Logged
|
|
|
|
|
JobLeonard
|
|
« Reply #68 on: October 08, 2020, 01:33:56 AM » |
|
The thought of making it perform a distance check worries me that it'll slow the draw call down loads Aren't trig functions way slower than a few multiplications? Remember, for these types of distance checks you don't need to take the sqare root, you just calculater r² once and compare to dx² + dy². On top of that you can keep r², dx² and dy² all in the integer range, potentially speeding things up even more because you avoid casts to and from floating point
|
|
|
Logged
|
|
|
|
Rogod
|
|
« Reply #69 on: October 08, 2020, 04:29:05 AM » |
|
Hmm, I think you might be correct ; never thought about it as a distance check to allow omission of Cos/Sin. That being said, I do have an item in my tech debt list to pre-calculate an array of Cos/Sin results to improve performance later (this avoids having to convert with RAD_VALD too), so we'll see which one I end up doing in the end. - Everything runs fine by my eyes for the time being, so it's not super urgent.
|
|
|
Logged
|
|
|
|
JobLeonard
|
|
« Reply #70 on: October 08, 2020, 05:35:02 AM » |
|
Yeah I highly doubt this is a bottle-neck in your code
|
|
|
Logged
|
|
|
|
Schrompf
|
|
« Reply #71 on: October 08, 2020, 05:36:10 AM » |
|
Sin/Cos tables are sooo 2003. Don't do that. Yes, sqrt(), sin(), cos() are slower than a multiplication, but you can still do a few hundred million of those per core per second. So don't worry, do your math, return to it only when a profiler complained about it. I mean... look at your gfx! You can count those pixels with your own eyes :-)
|
|
|
Logged
|
Snake World, multiplayer worm eats stuff and grows DevLog
|
|
|
Rogod
|
|
« Reply #72 on: October 08, 2020, 05:56:51 AM » |
|
Hah, Sin/Cos tables being 2003 doesn't worry me; Startron is hardly modern. (Besides, we've got the RAM and array access speed now to make that an attractive alternative to Math functions nowadays, especially for something as low intensity as this. - And like Carmack once said: "Save what you can, because it all adds up" (or something like that - I'm paraphrasing)) But yez, graphics & performance are not a priority for me right now, it gets a pass at "good enough" while I code the fun stuff. (Simply swapping all of this to quads in OpenGL would speed it up exponentially anyway - it's all relying on some backdoor quick-update hack one can leverage with the Windows console right now so it's less than ideal.)
|
|
|
Logged
|
|
|
|
a-k-
|
|
« Reply #73 on: October 08, 2020, 08:49:07 AM » |
|
Great aesthetics and presentation! The website rocks, too. Is it generated or edited manually? It looks pretty consistent.
|
|
|
Logged
|
|
|
|
Rogod
|
|
« Reply #74 on: October 08, 2020, 08:59:04 AM » |
|
Heh, first person to see the website; it's all done by hand, just plain old HTML & CSS (oh and some jQuery to inject the nav bar and gallery) (My day job is developing a web platform, so I'm used to making things tidy and consistent.) Thanks for the look in :D EDIT:The site is due an update to be fair - there are some pretty out-of-date things on there now. EDIT2:Should be a little more accurate and easier to read now
|
|
« Last Edit: October 15, 2020, 03:11:13 AM by Rogod »
|
Logged
|
|
|
|
|
JobLeonard
|
|
« Reply #76 on: October 15, 2020, 12:14:47 AM » |
|
Oh man, that zoomed in planet looks so good
(remember, I can't run your game and am judging it solely on the screenshots and descriptions you share here)
|
|
|
Logged
|
|
|
|
Rogod
|
|
« Reply #77 on: October 15, 2020, 02:23:00 AM » |
|
Oh shoot really? You didn't say you couldn't run it Howcome? I figured you'd tried a really early version and were just casting an observing eye these days xD
|
|
|
Logged
|
|
|
|
JobLeonard
|
|
« Reply #78 on: October 15, 2020, 02:41:27 AM » |
|
Linux - maybe I forgot to mention that, my bad
|
|
|
Logged
|
|
|
|
|
|