Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411423 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 19, 2024, 03:24:42 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogs▲ Startron ▲ (The procedurally generated ASCII space sandbox)
Pages: 1 2 3 [4] 5 6 ... 17
Print
Author Topic: ▲ Startron ▲ (The procedurally generated ASCII space sandbox)  (Read 27951 times)
JobLeonard
Level 10
*****



View Profile
« 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
Level 9
****

C++ professional, game dev sparetime


View Profile WWW
« Reply #61 on: October 06, 2020, 04:17:00 AM »

Is somebody in this room using signed short for a item count? Hm? HM?  Grin
Logged

Snake World, multiplayer worm eats stuff and grows DevLog
Rogod
Level 3
***



View Profile WWW
« Reply #62 on: October 06, 2020, 08:11:21 AM »

Grin You caught me Tongue

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

Rogod
Level 3
***



View Profile WWW
« Reply #63 on: October 06, 2020, 02:04:26 PM »

Update v0.46
Now with physics! Gomez


List of updates/fixes
  • Suns, planets & moons now use sub-cell pixels to effectively double the vertical resolution (look here for a good example of how it was before)

  • Added spinny particles to mimic an accretion disk around black holes (I'll probably do something similar for worm holes later)

This was just a small inconsequential update but you can see both these graphical improvements (and some clouds Gomez) in the rough fly-about video below:



Next up is more colony management and maybe some space tourism


« Last Edit: April 05, 2021, 08:48:26 AM by Rogod » Logged

JobLeonard
Level 10
*****



View Profile
« 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
Level 3
***



View Profile WWW
« 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:
Code:
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. Sad

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
Code:
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
o
Level 10
*****


eurovision winner 2014


View Profile
« Reply #66 on: October 07, 2020, 11:47:15 AM »

This looks great, following.  Smiley
Logged
Rogod
Level 3
***



View Profile WWW
« Reply #67 on: October 07, 2020, 02:20:20 PM »

Update v0.47
100% less janky! Gomez


List of updates/fixes
  • Fixed spikey celestial bodies

  • Added the ability to store a coloured marker on a system (visible from the cosmos overview and the system view)

  • Fixed clouds getting stuck near the poles on planets

  • Fixed the sun appearing to traverse in the wrong direction around an entity when viewing it close up (only took me 46 versions to notice that lol - hooray for shonky heuristic lighting Wink )

I wasn't intending to do another version so quickly but these bugs just erked me a bit so I wanted to get them out the way before I focused on new mechanics - thanks for the support though guys :D


Logged

JobLeonard
Level 10
*****



View Profile
« 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
Level 3
***



View Profile WWW
« Reply #69 on: October 08, 2020, 04:29:05 AM »

Hmm, I think you might be correct Wink; 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
Level 10
*****



View Profile
« Reply #70 on: October 08, 2020, 05:35:02 AM »

Yeah I highly doubt this is a bottle-neck in your code Cheesy
Logged
Schrompf
Level 9
****

C++ professional, game dev sparetime


View Profile WWW
« 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
Level 3
***



View Profile WWW
« Reply #72 on: October 08, 2020, 05:56:51 AM »

Hah, Sin/Cos tables being 2003 doesn't worry me; Startron is hardly modern. Wink (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-
Level 2
**


View Profile
« 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
Level 3
***



View Profile WWW
« 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) Wink (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 Wink
« Last Edit: October 15, 2020, 03:11:13 AM by Rogod » Logged

Rogod
Level 3
***



View Profile WWW
« Reply #75 on: October 14, 2020, 03:19:59 PM »

Update v0.48
There are a lot of people in that bar... Gomez


List of updates/fixes
  • You can now pick up life forms in the bar! (Nowhere near as exciting as that sounds; you just need them for manning the dwellings down on the surface)

  • Life forms will now die if they are manning a dwelling next to pollution Sad
    Remember refineries produce pollution (the purple bits in this screenshot)

  • Added an explanation of how controllers work with splitter conveyors into the database

  • Updated the story transmissions to prompt you to populate dwellings from your cargo bay

  • Refactored a whole bunch of code and organised it into more useful folders at the same time as well as renaming and chopping things up better (yawn - this is no fun for anyone to read)

  • As part of that refactoring though, I paved the way for how internationalisation would work in the code if I added other languages (it's all still EN-GB for now and my first test would likely be EN-US anyway)

  • Which side of a planet or moon you were on when you quit is now saved too (not sure how I missed that)

  • Fixed circles (suns/planets/moons) drawn in a previous system ghosting into the next one for 1 frame (buffers, yay)

  • Fixed a missing green arrow on the cosmos overview to prompt the user how to return the way they'd just come

Oh and I should mention there's now an itch.io site for Startron too (because that seems to be what people do nowadays) https://startron.itch.io/startron Shrug


Logged

JobLeonard
Level 10
*****



View Profile
« 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
Level 3
***



View Profile WWW
« Reply #77 on: October 15, 2020, 02:23:00 AM »

Oh shoot really? You didn't say you couldn't run it Sad Howcome?

I figured you'd tried a really early version and were just casting an observing eye these days xD
Logged

JobLeonard
Level 10
*****



View Profile
« Reply #78 on: October 15, 2020, 02:41:27 AM »

Linux - maybe I forgot to mention that, my bad Smiley
Logged
Rogod
Level 3
***



View Profile WWW
« Reply #79 on: October 15, 2020, 02:45:04 AM »

Ahh, butts. Cry

I haven't gotten around to replacing the dead HDD in my Linux computer otherwise I'd have probably tested it on Linux by now.

I assume just installing the .net runtimes is not good enough because it's an .exe?

(I must admit the world of "Code something on Windows in Visual Studio and run it on Linux" is a bit alien to me, so I'm not even sure what is required yet. - Presumably some kind of Linux native executable launcher or other witchcraft)



EDIT:
Had a tip-off from a friend that this can be solved just by running a command in a VM, so am gona try that



EDIT2:
Right, it's nowhere near as simple as Microsoft makes out because I am using a bunch of user32.dll and kernel32.dll commands to achieve the fast-console rendering and have no idea what a Linux equivalent would be. (Need someone who codes C# console apps in Linux for that know-how/conversion really.)
« Last Edit: October 15, 2020, 06:11:48 AM by Rogod » Logged

Pages: 1 2 3 [4] 5 6 ... 17
Print
Jump to:  

Theme orange-lt created by panic