Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Tann
Apr 1, 2009

There must be an algorithm somewhere you can copy, I think I adapted one I found. Google line intersect c# or something. I reckon that could do all the tests for you really fast.

Adbot
ADBOT LOVES YOU

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe
If your goal is to get a reasonably-spaced set of vertices and edges, look up Delaunay triangulations. They're closely related to Voronoi diagrams, which leper khan already brought up.

KillHour
Oct 28, 2007


I don't mind the overlapping paths - they would definitely exist in real life and I don't think they make it confusing to read.

xgalaxy
Jan 27, 2004
i write code
Eve Online has overlapping paths just like you've showed. However, each point is a representation of three dimensional space and they allow you to rotate the map which makes clear that the points aren't really as close together as they look from a particular view point.

I think doing something like Voronoi might make it look too unnatural if your goal is to have it look like stars in space. Your best bet would be to have tweak able parameters like:
- a minimum distance between points
- a cluster maximum, eg. only allow X number of stars to be clumped together within a certain distance of each other
- minimum & maximum length of a line
- maximum times a line can be crossed by another line / maximum times a line can cross other lines
- minimum distance allowed for a line passing by a point
- maximum lines to a single point

xgalaxy fucked around with this message at 22:04 on Apr 14, 2019

Joda
Apr 24, 2010

When I'm off, I just like to really let go and have fun, y'know?

Fun Shoe

Kibbles n Shits posted:

I think if I can just figure out a cheap way to remove the intersecting lanes

These are just line segments, and look very limited in length, so a simple sweep line algorithm should suffice.

Broken Loose
Dec 25, 2002

PROGRAM
A > - - -
LR > > - -
LL > - - -

Kibbles n Shits posted:

Can anyone recommend what data structure or techniques I should be researching to make a convincing galactic map where the stars are connected via warp lanes in a logical manner, as seen in Stellaris or Space Empires IV for example. I've been experimenting with connecting them based on distance but not only is it god awfully slow, the results usually look like a cluster gently caress



Actually Stellaris might be a bad example because I don't necessarily want a uniform distribution of lanes. It would be desirable to have clusters of distant stars that are approachable by fewer lanes, for example.

How big do you want the map to be when the game is done?

Kibbles n Shits
Apr 8, 2006

burgerpug.png


Fun Shoe

Broken Loose posted:

How big do you want the map to be when the game is done?

This very hypothetical finished game would probably have 500 stars at the upper limit, with a "standard map" being in the 200 to 300 range. Maybe even less, I'm not sure, but 500 seems like a good theoretical limit.

Kibbles n Shits fucked around with this message at 22:30 on Apr 14, 2019

big scary monsters
Sep 2, 2011

-~Skullwave~-

xgalaxy posted:

Eve Online has overlapping paths just like you've showed. However, each point is a representation of three dimensional space and they allow you to rotate the map which makes clear that the points aren't really as close together as they look from a particular view point.

I think doing something like Voronoi might make it look too unnatural if your goal is to have it look like stars in space. Your best bet would be to have tweak able parameters like:
- a minimum distance between points
- a cluster maximum, eg. only allow X number of stars to be clumped together within a certain distance of each other
- minimum & maximum length of a line
- maximum times a line can be crossed by another line / maximum times a line can cross other lines
- minimum distance allowed for a line passing by a point
- maximum lines to a single point

You could use an algorithm similar to Poisson disk sampling for the star generation perhaps: randomly select initial points on a grid, so that each grid square contains at most one point. Generate k candidate points at random within an annulus (between r and 2r from the initial point for some r) around each initial point. If the candidate point is no closer than r to any other points, insert it. If not, discard it. Generally you want your points fairly dense across the entire space so you ensure one initial point per grid square, however if you want more sparsely distributed clusters you could just select some squares at random to place an initial point instead. Likewise you usually use constant k to maintain density, but if you vary it your clusters will be differently sized. There are some pretty fast and easily implemented Poisson disk sampling algorithms out there if you take a look around and it's easily adapted to 3D too, I've found it very useful for generating random-looking but nicely spaced noise.

xzzy
Mar 5, 2009

Kibbles n Shits posted:

I've been tweaking the parameters, I think if I can just figure out a cheap way to remove the intersecting lanes, it will be exactly what I want.



Determining if two segments intersect is super easy. You got the XY of each end of the segments so just plug it in.

https://www.topcoder.com/community/competitive-programming/tutorials/geometry-concepts-line-intersection-and-its-applications/

If it's only done once at map creation I don't think it needs to be mega optimized. Brute force every single segment against every other one if you have to and get smarter when/if it becomes a problem.

Xerophyte
Mar 17, 2008

This space intentionally left blank
If you're already having problems with the generation being slow then it sounds like just testing everything against everything is actually an issue at this point. I'm a bit surprised that it's already problematic with 500 stars since that's just ~250k possible connections total which doesn't seem like that big a deal, but oh well.

Anyhow, if you need to do things like query all stars within distance k of a point p, find the closest star to another star, get all connections within a region, do hyperlane intersecton tests and so on without having to loop through every single star and connection you'll need to use spatial acceleration structures for your stars and hyperlanes. 500 stars is not a lot as spatial data goes so you're probably best off using something simple and cheap to update like a grid or quadtree. If terms like spatial acceleration structure, BVH and quadtree are unfamiliar then I think they're probably good things to google before you go further.


You also probably want to look into some type of stratified sampling and blue noise random sequences. Poisson sampling is one possibility, and works well if you know exactly how many samples you need beforehand, which is true for placing stars. If you need something more dynamic you can look at other low discrepancy sampling techniques like grid stratification or fixed sequences like Halton or Hammersley, etc. A very common approach for high quality blue noise is to just pre-generate a sequence or two of points that have perfect blue noise characteristics for the first k numbers, using some slow method like dart throwing. For sampling you then use some random rotation of that hardcoded, high-quality sequence.

Again, if any of these terms are completely unfamiliar then googling Poisson disk sampling, blue noise sampling, low discrepancy sampling, the Halton, Hammerlsey and Sobol sequences, jittered sampling, and so on is probably a good idea. The key thing is that you absolutely do not want uniformly distributed noise for a lot of the things you're trying to do: you want something that avoids placing any two samples/stars near each another yet is still roughly evenly distributed over the sample space.


I rather like sampling things so I'd be inclined to try and solve the connection problem itself by randomly sampling stars from the set and trying to connect them until I've reached a threshold for sufficiently connected. Something like
code:
While num_connections < desired_num_connections or not all stars mutually connected:
  Take Star s1 from front of queue
  Randomly sample a different Star s2, using some bespoke distribution weighted for coolness
  Check if connection intersects another connection:
    If yes, discard
    If no, add connection to map
  Add s1 to the back of queue
All the logic for what sort of connection I want then boils down to picking some other stars, weighting them based on how good a connection they'd make, then sampling that weighted PDF. Sampling and weighting only a limited number of stars should make it all reasonably quick. Possibly this only makes sense to me.

I remember trying to figure out Stellaris' approach in the patch after they switched to hyperlane only. I think they start the map generation by generating a minimum spanning tree for the initial hyperlanes, with an extra constraint of avoiding collisions plus some some extra weight for edges across the void between arms in spiral galaxy. Then they add random new lanes and wormholes to satisfy the player's specified lane and wormhole density parameters, in some way. That might be a complete misread, not like I've seen the code.

Alternatively you can start with a Delaunay triangulation and randomly add/delete connections to make it less well-ordered. That would be faster, but seems harder to control.


For the star positions, I'd be inclined to go with a two step process to be able to control the galaxy appearance:

First, generate a small (256x256 or so?) density map roughly matching some particular galaxy shape. N-arm spiral, uniform disk, attenuated ellipsis, bar, etc. Easiest and fastest to paint them manually, if you don't feel like finding a good algorithmic approximation. The algorithmic approach would involve finding a formula for a very regular galaxy of the requested type, then doing the usual adding of a couple octaves of Perlin noise to offset things like the spiral arm positions and final density map in order to get something nice.

Second, sample points on the density map using some aforementioned blue noise type distribution. The advantage of having a nice, noisy density map to begin with is that you can get away with doing this very cheaply and don't need a high quality sequence.

Kibbles n Shits
Apr 8, 2006

burgerpug.png


Fun Shoe
Wow, I appreciate you taking the time to write all that up. Unfortunately much of it is lost on my puny brain. As a personal project that will never see the light of day I think a "test every line against every other line" naive approach will be good enough. I clearly have much to learn. I'll probably end up closer to 200 stars at the high end, as this increasingly hypothetical space 4X game would be balanced around shorter playthroughs.

Kibbles n Shits fucked around with this message at 04:03 on Apr 15, 2019

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

Kibbles n Shits posted:

Wow, I appreciate you taking the time to write all that up. Unfortunately much of it is lost on my puny brain. As a personal project that will never see the light of day I think a "test every line against every other line" naive approach will be good enough. I clearly have much to learn. I'll probably end up closer to 200 stars at the high end, as this increasingly hypothetical space 4X game would be balanced around shorter playthroughs.
It sounds like you're running into a problem not so much of the n*n (since as mentioned 500*500 isn't really that much for a one-off generator) but rather that some sort of test beneath that is too expensive, such that you're doing n*n*n or something - you might just be needing to eg. put your existing star pairings into a hash table (keyed on the sorted pair of star IDs) so when you're checking to see if a pairing already exists that lookup is fast. Or attaching the pairings to the stars rather than searching the whole list of pairings, or something like that.

j.peeba
Oct 25, 2010

Almost Human
Nap Ghost
I'm into dirty simple tricks so I would generate a huuge source starmap with like 10k-100k stars as a mesh object in a 3D modeling software. It would be very easy to control the look and feel of the results and ensure that there are no overlapping paths or other, possibly even game breaking, edge cases. The mesh would be pretty simple to model procedurally: just generate a plane that has a random but pleasant-looking distribution of vertices on it and then delete bunch of vertices from it to punch holes in it. You may want to drive the vertex deletion with a perlin noise or similar instead of a pure random chance so that the granularity of the holes can be controlled. It would take like 10 minutes to do this in Houdini but should be very doable in other packages as well although some of the operations might be destructive. There's a lot of 3d modeling tricks that can be utilized to further customize the results too like additional noise, relaxing, localized random subdivisions or chamfering for tighter star clusters etc.

Then in Unity you just load the mesh, crop a small subsection of it by random, maybe rotate it too, and then fix or remove any islands that might have been left isolated by the cropping. Having a large enough source mesh ensures that the results will feel random to the player.

Doc Block
Apr 15, 2003
Fun Shoe
So I'm making a 2D game, and for part of it I want to have one of those cheesy 80s laser grid backgrounds. Easy enough to draw, buuuut I'd like it to be animated programatically. And this is a 2D engine, so I can't just drop in a 3D grid model and call it good.



Trying to do something like this, and have the horizontal lines move downwards over time to make it look like the player is moving forward. Drawing horizontal lines further and further downward over time is easy enough, but it doesn't look right since there's no perspective/foreshortening; the lines stay the same distance apart the whole time so it looks wrong.

So that's my question: can anyone point me in the right direction regarding figuring out how to spread the lines out as they move downward so they look right? Something simpler than generating a 3D grid at runtime and doing the matrix math myself (no 3D engine underneath)?

edit: I feel like the solution involves Pythagoras' theorem somehow, but I just can't seem to put it all together. Can you tell I'm bad at math?

Doc Block fucked around with this message at 20:18 on Apr 20, 2019

netcat
Apr 29, 2008
Doing simple 3d projections like what you need here is only a few lines of code really so I'd suggest just looking up the math for that

E: this is a pretty good tutorial https://github.com/ssloy/tinyrenderer

netcat fucked around with this message at 20:46 on Apr 20, 2019

Doc Block
Apr 15, 2003
Fun Shoe
Thx for the link. I haven't done any 3D math in a long time, so we'll see how long it takes my stupid brain to relearn all this stuff.

KillHour
Oct 28, 2007


Doc Block posted:

So I'm making a 2D game, and for part of it I want to have one of those cheesy 80s laser grid backgrounds. Easy enough to draw, buuuut I'd like it to be animated programatically. And this is a 2D engine, so I can't just drop in a 3D grid model and call it good.



Trying to do something like this, and have the horizontal lines move downwards over time to make it look like the player is moving forward. Drawing horizontal lines further and further downward over time is easy enough, but it doesn't look right since there's no perspective/foreshortening; the lines stay the same distance apart the whole time so it looks wrong.

So that's my question: can anyone point me in the right direction regarding figuring out how to spread the lines out as they move downward so they look right? Something simpler than generating a 3D grid at runtime and doing the matrix math myself (no 3D engine underneath)?

edit: I feel like the solution involves Pythagoras' theorem somehow, but I just can't seem to put it all together. Can you tell I'm bad at math?

Moving the horizontal lines down is the easiest way to go here. You're close in that you want trigonometry, but Pythagoras isn't quite right. You want the inverse tangent (arctan) of camera height/distance. That will give you the angle down from the camera's forward direction.

For instance, if you want to have a horizontal grid line every 10 ft and your camera's height off the ground is 6 ft, your first few lines would be:

tan-1(6/10) ≈ 30°
tan-1(6/20) ≈ 17°
tan-1(6/30) ≈ 11°
tan-1(6/40) ≈ 9°

Now, since you're drawing this on an orthographic camera instead of a perspective camera, you need this to be projected on a flat surface. Easy to do - just use trig again. This time we're going to use tangent because we're going from an angle to a scalar ratio. tan(30°) gives you ≈ 0.58, which is your opposite over adjacent (height over distance). We have a fixed distance to the projected surface, (you'll have to play around with it to get the right scale, but let's call it 10), so you just multiply by that distance to give you your height (5.8 of whatever units you're working in). This is distance below the horizon, remember.

Now wait, tan and arctan are inverses of each other, so taking the tangent of the inverse tangent just gives you the same thing you started with, and you can simplify to just the following:

lineOffset = cameraHeight / (i * lineDistance) * cameraDistance

I wrote a quick program in C# to show the concept.

code:
using System;

namespace Line_Draw_Test_CS {
	class Program {
		static void Main(string[] args) {
			Console.ForegroundColor = ConsoleColor.White;
			Console.SetWindowSize(400, 200);

			var lineDistance = 10.0;
			var lineCount = 10;
			var unitScale = Console.WindowHeight / 50.0;
			var horizon = 10.0 * unitScale;
			var cameraHeight = 6.0;
			var cameraDistance = 60;
			
			for (var i = 1; i <= lineCount; i++) {
				var lineOffset = cameraHeight / (i * lineDistance) * cameraDistance;
				Console.CursorTop = (int)Math.Round(horizon + (lineOffset * unitScale));
				for (var j = 0; j < Console.WindowWidth; j++) {
					Console.CursorLeft = j;
					Console.Write("_");
				}
			}

			Console.ReadLine();
		}
	}
}


Hope this helps!

KillHour fucked around with this message at 00:00 on Apr 21, 2019

Doc Block
Apr 15, 2003
Fun Shoe

KillHour posted:

Moving the horizontal lines down is the easiest way to go here. You're close in that you want trigonometry, but Pythagoras isn't quite right. You want the inverse tangent (arctan) of camera height/distance. That will give you the angle down from the camera's forward direction.

For instance, if you want to have a horizontal grid line every 10 ft and your camera's height off the ground is 6 ft, your first few lines would be:

tan-1(6/10) ≈ 30°
tan-1(6/20) ≈ 17°
tan-1(6/30) ≈ 11°
tan-1(6/40) ≈ 9°

Now, since you're drawing this on an orthographic camera instead of a perspective camera, you need this to be projected on a flat surface. Easy to do - just use trig again. This time we're going to use tangent because we're going from an angle to a scalar ratio. tan(30°) gives you ≈ 0.58, which is your opposite over adjacent (height over distance). We have a fixed distance to the projected surface, (you'll have to play around with it to get the right scale, but let's call it 10), so you just multiply by that distance to give you your height (5.8 of whatever units you're working in). This is distance below the horizon, remember.

Now wait, tan and arctan are inverses of each other, so taking the tangent of the inverse tangent just gives you the same thing you started with, and you can simplify to just the following:

lineOffset = cameraHeight / (i * lineDistance) * cameraDistance

I wrote a quick program in C# to show the concept.

code:
using System;

namespace Line_Draw_Test_CS {
	class Program {
		static void Main(string[] args) {
			Console.ForegroundColor = ConsoleColor.White;
			Console.SetWindowSize(400, 200);

			var lineDistance = 10.0;
			var lineCount = 10;
			var unitScale = Console.WindowHeight / 50.0;
			var horizon = 10.0 * unitScale;
			var cameraHeight = 6.0;
			var cameraDistance = 60;
			
			for (var i = 1; i <= lineCount; i++) {
				var lineOffset = cameraHeight / (i * lineDistance) * cameraDistance;
				Console.CursorTop = (int)Math.Round(horizon + (lineOffset * unitScale));
				for (var j = 0; j < Console.WindowWidth; j++) {
					Console.CursorLeft = j;
					Console.Write("_");
				}
			}

			Console.ReadLine();
		}
	}
}


Hope this helps!

Yes, this is exactly what I needed. Thank you!



:hellyeah:

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Doc Block posted:

Yes, this is exactly what I needed. Thank you!



:hellyeah:

Nice! If you want to make it more retro, you could try to get rid of the mush of very closely-spaced lines near the horizon. I think something like "fixed horizon line, draw 7 mobile lines starting from the bottom" would probably do the trick.

Doc Block
Apr 15, 2003
Fun Shoe
Yeah it needs some sort of GUI with a bunch of sliders so I can dial in juuuust the right look and then use it in the actual game.

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

TooMuchAbstraction posted:

Nice! If you want to make it more retro, you could try to get rid of the mush of very closely-spaced lines near the horizon. I think something like "fixed horizon line, draw 7 mobile lines starting from the bottom" would probably do the trick.
Another option (either in addition or instead) would be to make the lines' brightness a bit darker by distance (as a proxy for the lines getting thinner as they get further away, which they would in reality). You might also want to make them thicker when they get close!

KillHour
Oct 28, 2007


roomforthetuna posted:

Another option (either in addition or instead) would be to make the lines' brightness a bit darker by distance (as a proxy for the lines getting thinner as they get further away, which they would in reality). You might also want to make them thicker when they get close!

I would go with this. It's easy to add, because you can use the same math to figure out how that should fall off.

Looks great, though!

Kibbles n Shits
Apr 8, 2006

burgerpug.png


Fun Shoe
Been tinkering around with my Galaxy generator some more. All the awesome advice I received previously was a little too tedious and advanced for me, so I adopted a very "unity" solution and just cast rays from each star to search for neighbors to make connections with. It's actually faster than what I was doing before, and the results are almost exactly what I'm after .



There are still a few intersecting hyperlanes but it's much more readable. Sometime's it will generate little pockets of isolated stars, and that's very much intentional.

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

Kibbles n Shits posted:

Been tinkering around with my Galaxy generator some more. All the awesome advice I received previously was a little too tedious and advanced for me, so I adopted a very "unity" solution and just cast rays from each star to search for neighbors to make connections with. It's actually faster than what I was doing before, and the results are almost exactly what I'm after .
That's a bit horrifying, but if it works okay I guess!
If you're happy with a "unity" solution, and if you still want some performance improvement, you might want to go with some sort of sphere/circle collision in an area around each star, rather than raycasting, since that way you'll get all the nearby neighbors in one pass rather than presumably having to take many shots to find something with raycasting.
Edit: Physics.OverlapSphere or Physics2D.OverlapCircleAll.

Kibbles n Shits
Apr 8, 2006

burgerpug.png


Fun Shoe
Well the example I posted above is the largest galaxy size I've decided on and it took around 2 seconds to generate in the Unity editor so I'm not too worried about it, if it gets me what I want. I was using spherical collision before and I like the way this looks a lot more. I thought some sort of Planar graph would be best and I understand it on a conceptual level but I was spinning my wheels with the actual implementation. I just do this on occasion as a hobby.

Edit: I only cast 8 rays (at most) from each star, I don't repeat it indefinitely until a neighbor is found.

Kibbles n Shits fucked around with this message at 18:23 on Apr 21, 2019

Linear Zoetrope
Nov 28, 2011

A hero must cook
People were mentioning specific algorithms like Delauney triangulation, but the general term you were looking for was Planar Graph, which is a graph in which no edges intersect. Granted, searching "generate planar graph" is just going to get you Delauney triangulation or Voronoi diagrams so... :v:

Technically there is a technique called Planarization which has a step that involves finding the largest planar subgraph (the biggest set of nodes and edges which do not intersect, which is what you asked for) but it's... uh... NP-hard, though there are approximations available.

However, if/once you know a graph is planar for sure (which can be checked in O(|V|), that is, it can be drawn with no intersections, see the Wikipedia article for an algorithm), there's an O(|V|) algorithm for computing a proper straight line layout (called an embedding).

Doing what you're doing now works just fine and probably creates more interesting (i.e. not triangle shaped) graphs, though.

Linear Zoetrope fucked around with this message at 10:05 on Apr 23, 2019

Dirty
Apr 8, 2003

Ceci n'est pas un fabricant de pates

Doc Block posted:

Yes, this is exactly what I needed. Thank you!



:hellyeah:

Nice job, this looks rad!

Shaocaholica
Oct 29, 2002

Fig. 5E
Are fur shaders available or even do-able in unity on an iphone6(s)?

SnowblindFatal
Jan 7, 2011
To the fellow making the starmap:

One really easy optimisation for that kind of system is to have a grid, say 20x20, so that each star is placed in one cell. Now when you need to do some intersection, etc. calculations, you probably know that only the stars within the current star's grid coordinates +/- 4 grid units need to be taken into account.

Back when I was learning programming, I did a simple physics engine using this kind of pattern and it was able to handle an enormous number of objects whose physics were calculated 300 times a second.

https://www.youtube.com/watch?v=dMamNqJ3-XU

(yeah 240p like it's the 90s, but my PC couldn't handle recording too well back in the day)

The source is here: https://github.com/SnowblindFatal/Glomes

SnowblindFatal fucked around with this message at 13:13 on Apr 26, 2019

Joda
Apr 24, 2010

When I'm off, I just like to really let go and have fun, y'know?

Fun Shoe

Shaocaholica posted:

Are fur shaders available or even do-able in unity on an iphone6(s)?

Anything is possible on any platform, the questions are how well can you do it, how fast can you draw it and what balance do you need between the two?

E:For a more thorough answer, whatever you're thinking probably isn't doable in terms of performance and stuff. Like you don't have tesselation shaders and the power isn't there to do GOOD looking fur in an interactive time.

Joda fucked around with this message at 14:42 on May 2, 2019

c0burn
Sep 2, 2003

The KKKing
Hello friends

Because I'm a masochist, I'd like to program a DOS game, directly on the VGA hardware, either mode 13 or mode-X
I know C and C++ very well, but I've only ever learnt their standard libraries and and modern libraries like SDL and SFML and never did things on the "metal" like bios interrupts, dos.h and mem.h from the cool old days of DOS programming
I have access to a real DOS PC with 6.22 and Windows 3.1, also DOSBox, various Borland and MS compilers from the late 80's and early 90's - what's the best original compiler?
I looked into DJGPP but I probably want real mode not protected mode?

Can anyone recommend some good books from back in the day? Covering things like the DOS API/Interrupts, VGA hardware, Borland/MS C, maybe some Turbo Assembler/Microsoft Assembler?
I feel like things like the oft recommended Mike Abrash books are for people who already know the basics of DOS and VGA programming and I'd need to start simpler

Thank you

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

c0burn posted:

Hello friends

Because I'm a masochist, I'd like to program a DOS game, directly on the VGA hardware, either mode 13 or mode-X
I know C and C++ very well, but I've only ever learnt their standard libraries and and modern libraries like SDL and SFML and never did things on the "metal" like bios interrupts, dos.h and mem.h from the cool old days of DOS programming
I have access to a real DOS PC with 6.22 and Windows 3.1, also DOSBox, various Borland and MS compilers from the late 80's and early 90's - what's the best original compiler?
I looked into DJGPP but I probably want real mode not protected mode?

Can anyone recommend some good books from back in the day? Covering things like the DOS API/Interrupts, VGA hardware, Borland/MS C, maybe some Turbo Assembler/Microsoft Assembler?
I feel like things like the oft recommended Mike Abrash books are for people who already know the basics of DOS and VGA programming and I'd need to start simpler

Thank you

Review Fabian sanglards’s book on wolf3d

It’s new, but goes into good detail.

The junk collector
Aug 10, 2005
Hey do you want that motherboard?

c0burn posted:

Hello friends

Because I'm a masochist, I'd like to program a DOS game, directly on the VGA hardware, either mode 13 or mode-X
I know C and C++ very well, but I've only ever learnt their standard libraries and and modern libraries like SDL and SFML and never did things on the "metal" like bios interrupts, dos.h and mem.h from the cool old days of DOS programming
I have access to a real DOS PC with 6.22 and Windows 3.1, also DOSBox, various Borland and MS compilers from the late 80's and early 90's - what's the best original compiler?
I looked into DJGPP but I probably want real mode not protected mode?

Can anyone recommend some good books from back in the day? Covering things like the DOS API/Interrupts, VGA hardware, Borland/MS C, maybe some Turbo Assembler/Microsoft Assembler?
I feel like things like the oft recommended Mike Abrash books are for people who already know the basics of DOS and VGA programming and I'd need to start simpler

Thank you
It's not quiet as old as you want but years ago, my high school comp sci teacher wrote a series of books called "exposure c++". The first 4 books were introductory lessons covering up through basic data types, but the fifth book was a bonus for apt students and was basically nothing but api interrupts and graphics by bit banging the VGA ram. You can still find pdf copies of it floating around the internet and it was a great companion to Borland turbo c++ back in the day.

Claeaus
Mar 29, 2010

c0burn posted:

Hello friends

Because I'm a masochist, I'd like to program a DOS game, directly on the VGA hardware, either mode 13 or mode-X
I know C and C++ very well, but I've only ever learnt their standard libraries and and modern libraries like SDL and SFML and never did things on the "metal" like bios interrupts, dos.h and mem.h from the cool old days of DOS programming
I have access to a real DOS PC with 6.22 and Windows 3.1, also DOSBox, various Borland and MS compilers from the late 80's and early 90's - what's the best original compiler?
I looked into DJGPP but I probably want real mode not protected mode?

Can anyone recommend some good books from back in the day? Covering things like the DOS API/Interrupts, VGA hardware, Borland/MS C, maybe some Turbo Assembler/Microsoft Assembler?
I feel like things like the oft recommended Mike Abrash books are for people who already know the basics of DOS and VGA programming and I'd need to start simpler

Thank you

Please post updates in this thread or elsewhere because this sounds rad!

Catgirl Al Capone
Dec 15, 2007

c0burn posted:

Hello friends

Because I'm a masochist, I'd like to program a DOS game, directly on the VGA hardware, either mode 13 or mode-X
I know C and C++ very well, but I've only ever learnt their standard libraries and and modern libraries like SDL and SFML and never did things on the "metal" like bios interrupts, dos.h and mem.h from the cool old days of DOS programming
I have access to a real DOS PC with 6.22 and Windows 3.1, also DOSBox, various Borland and MS compilers from the late 80's and early 90's - what's the best original compiler?
I looked into DJGPP but I probably want real mode not protected mode?

Can anyone recommend some good books from back in the day? Covering things like the DOS API/Interrupts, VGA hardware, Borland/MS C, maybe some Turbo Assembler/Microsoft Assembler?
I feel like things like the oft recommended Mike Abrash books are for people who already know the basics of DOS and VGA programming and I'd need to start simpler

Thank you

If you've been googling you might have found this but there's a tutorial series online that might help: http://www3.telus.net/alexander_russell/course/introduction.htm

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
So I have this mesh generated from points on a grid. It's relatively flat and simple compared to the number of vertices it has. I'm trying to build a mesh collider without so many faces. As you can imagine it can be a lot simpler. I basically have vertices at every point on the grid but I can probably span some triangles out over much wider distances and save on a whole bunch of collision computation.

Am having trouble figuring out what algorithms there are for performing that optimisation.

Nolgthorn fucked around with this message at 23:03 on May 19, 2019

big scary monsters
Sep 2, 2011

-~Skullwave~-
3D convex hull? Or if you don't need it very precise just take the most extreme points in each axis and fit a capsule or cuboid collider.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
What's really cool is that I've switched to godot game engine and it seems to have what you mentioned built in. It's just not documented well, as you would expect. All I might have to do is figure out how to organise my nodes so that it's happy I may not need to worry about it.

big scary monsters
Sep 2, 2011

-~Skullwave~-
At first glance I thought you were looking for a player/enemy object collider but looking again I think maybe it's for terrain instead? In that case maybe what I suggested isn't going to be precise enough.

Godot does have some nice inbuilt meshing tools for objects that you just instance and use as is. But I did find that if you want to do procedural terrain you're maybe better off rolling your own vertex handling and only constructing the finished mesh "in engine" for rendering, pathfinding and collision. For one example I couldn't figure out how to allow shared vertices between triangles with SurfaceTool and MeshDataTool so mesh deformation was much more expensive than it needed to be. Also when I ended up wanting my vertices or triangles to be associated with additional properties beyond position, normals and colour I was having to build another data structure in parallel with the mesh anyway, so it made sense to me to combine the two (also potentially lets you offload the heavy lifting to a C++ library with GDNative). As you say, the documentation is a bit spotty in this area so it could be that I'm just dumb and there's a better way.

Adbot
ADBOT LOVES YOU

Absurd Alhazred
Mar 27, 2010

by Athanatos
Sounds like a perfect use-case for using GPU tesselation. Use a rougher mesh as the source for the collision and rendering mesh, then have the GPU split up the vertices and do a bit of deformation based on a bump-map. Could be that Godot just does that for you behind the scenes, not really familiar with it.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply