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
Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!

scissorman posted:

I'm planning on using block-based terrain, with each block having individual properties, so I don't have any empty/homogenous space for quadtrees to take advantage of.
And your blocks are all the same size and don't move? If so, you already have an implicit structure within the blocks themselves. You can just store them as a 2D array (or array-of-arrays) when you load them, and then you can index into that array to figure out which blocks are visible based on your camera.

Adbot
ADBOT LOVES YOU

scissorman
Feb 7, 2011
Ramrod XTreme

Orzo posted:

And your blocks are all the same size and don't move? If so, you already have an implicit structure within the blocks themselves. You can just store them as a 2D array (or array-of-arrays) when you load them, and then you can index into that array to figure out which blocks are visible based on your camera.
Do you mean that I should assemble the vertices etc. every frame based on what's visible?
Wouldn't it be faster to have prepared vertex buffers for each chunk and just throw those at the graphics card and let it cull those that aren't on screen?

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!

scissorman posted:

Do you mean that I should assemble the vertices etc. every frame based on what's visible?
Wouldn't it be faster to have prepared vertex buffers for each chunk and just throw those at the graphics card and let it cull those that aren't on screen?
Oh, I missed the part about how you're using chunks. Yeah your approach will probably work out nicely. By 'prepared' vertex buffers, that's the same as static vertex buffers right (sorry, I only know DirectX, and that's the term they use for vertex buffers you create not-every-frame)?

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

scissorman posted:

Do you mean that I should assemble the vertices etc. every frame based on what's visible?
Wouldn't it be faster to have prepared vertex buffers for each chunk and just throw those at the graphics card and let it cull those that aren't on screen?
There's actually a trick you can pull, if you want to stream the terrain in one chunk at a time but keep it in a single vert buf. Google "toroidal arrays," or just read up on Geometry Clip Maps.

The actual purpose of the algorithm is for huge view distances, and variable vertex density with smooth transitions between. If you ignore the layers beyond layer 0 and don't do the blending, though, shazam - it becomes a pretty fantastic algorithm for smoothly scrolling a window across a gigantic terrain.

The gist is that you pan the logical zero point of the array around as you move through the world. By doing that, it makes it simple and logical to use the space left over from unloaded off-screen terrain as a spot to dump in new terrain data and stitch it in. You just set your VB to write-only.

scissorman
Feb 7, 2011
Ramrod XTreme

Orzo posted:

Oh, I missed the part about how you're using chunks. Yeah your approach will probably work out nicely. By 'prepared' vertex buffers, that's the same as static vertex buffers right (sorry, I only know DirectX, and that's the term they use for vertex buffers you create not-every-frame)?

Yeah, I'm talking about using static buffers.

DeathBySpoon
Dec 17, 2007

I got myself a paper clip!

Suspicious Dish posted:

BGM1-004.mp3 is your favorite song too? I can't get it out of my head!

Apparently he took that screen while looking at my post in the Making Games Megathread:



Has anyone here written a CRT / Scanline HLSL shader? I'm fairly new to shaders and I'm not 100% sure how to go about it, so I'm looking for resources on writing one. My game runs at a fairly low resolution so I figure a neat CRT effect would be a good way to upscale it (I'd leave nearest neighbor as an option for those who prefer it, though). Also any suggestions for retro / pixel art friendly scaling filters, really. I'd like to avoid stuff like 2xSai though, I think that'd make it feel too much like a poorly emulated game. Basically I just want to find a way to make my game look good on different screens while keeping it at the current resolution internally, and a scaling shader seems like a good option. I'm working in XNA with C#, for what it's worth.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
https://www.shadertoy.com/view/4sf3Dr

Something stupid like this? Most of the work in that shader is because I can only use one fragment shader. If you were doing this for real, you'd do this as several post-processing effects by rendering each step to an FBO if possible.

The effect is also exaggerated. You'd want to tone it down for the final product.

scissorman
Feb 7, 2011
Ramrod XTreme

Shalinor posted:

There's actually a trick you can pull, if you want to stream the terrain in one chunk at a time but keep it in a single vert buf. Google "toroidal arrays," or just read up on Geometry Clip Maps.

The actual purpose of the algorithm is for huge view distances, and variable vertex density with smooth transitions between. If you ignore the layers beyond layer 0 and don't do the blending, though, shazam - it becomes a pretty fantastic algorithm for smoothly scrolling a window across a gigantic terrain.

The gist is that you pan the logical zero point of the array around as you move through the world. By doing that, it makes it simple and logical to use the space left over from unloaded off-screen terrain as a spot to dump in new terrain data and stitch it in. You just set your VB to write-only.

I'm sorry but could you elaborate on that?
From what I read, you basically use a number of static buffers for the local (x,y) coordinates and get your global z from the elevation map.
So what do you mean by dumping new terrain in the VB?
Wouldn't you have to manipulate the elevation map instead?

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

scissorman posted:

I'm sorry but could you elaborate on that?
From what I read, you basically use a number of static buffers for the local (x,y) coordinates and get your global z from the elevation map.
So what do you mean by dumping new terrain in the VB?
Wouldn't you have to manipulate the elevation map instead?
The elevation map is just the data blob you load from, which is probably sitting somewhere on disk. In geo clip map, you're probably paging chunks of the elevation data into memory as you near them, and using that to fill out your single VB of terrain mesh data.

... and if this isn't making sense, I'd probably just suggest ignoring the algorithm. It's a cool optimization / data trick for large terrains, but practically speaking, I doubt you're doing anything that would require it. There's nothing wrong with a VB per terrain chunk and just loading them up as you reach them. That's effectively the Chunk LOD method of terrain rendering, incidentally.

DeathBySpoon
Dec 17, 2007

I got myself a paper clip!

Suspicious Dish posted:

https://www.shadertoy.com/view/4sf3Dr

Something stupid like this? Most of the work in that shader is because I can only use one fragment shader. If you were doing this for real, you'd do this as several post-processing effects by rendering each step to an FBO if possible.

The effect is also exaggerated. You'd want to tone it down for the final product.

Your link doesn't work.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Gah, it's my first time using this "share a GLSL snippet" site, and I might have hosed up the permissions. Try now.

SupSuper
Apr 8, 2009

At the Heart of the city is an Alien horror, so vile and so powerful that not even death can claim it.

DeathBySpoon posted:

Apparently he took that screen while looking at my post in the Making Games Megathread:



Has anyone here written a CRT / Scanline HLSL shader? I'm fairly new to shaders and I'm not 100% sure how to go about it, so I'm looking for resources on writing one. My game runs at a fairly low resolution so I figure a neat CRT effect would be a good way to upscale it (I'd leave nearest neighbor as an option for those who prefer it, though). Also any suggestions for retro / pixel art friendly scaling filters, really. I'd like to avoid stuff like 2xSai though, I think that'd make it feel too much like a poorly emulated game. Basically I just want to find a way to make my game look good on different screens while keeping it at the current resolution internally, and a scaling shader seems like a good option. I'm working in XNA with C#, for what it's worth.
I'd suggest digging around emulator websites, they have heaps of shaders from the most pixel-accurate to the most realistically-aggravating that you could probably learn off, although most are written in GLSL. There's a bunch of them here.

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!

Suspicious Dish posted:

Why do you need substr? indexOf gets you the next space, then you use charAt to read the character after the space, and then do whatever you want with the data in between that and the next index. Perhaps you want to use a binary file format that you parse with ArrayBuffer? I don't know.
substr would be needed for getting that "data in between". :)
Thanks though, charAt hopefully makes it a little bit less bad, and even better still is charCodeAt (which you couldn't have known since I hadn't specified what I wanted that clearly, but charAt reminded me, so thanks!)

What I'm doing is parsing a dictionary file (word dictionary not programming-concept dictionary) into an 'object' (because that's Javascript's hash) for nice quick random access - the one character is my concession to cutting down the file size; I've converted the dictionary file from an alphabetical list of words into a sequence where, eg. "BANANA BANANAS BANGLE" would get encoded as "BANANA [chop0]S [chop4]GLE", with the "chop" markers being encoded as single characters.

Turns out that encoding the dictionary this way turns it from over 3MB to just over 1MB, so quite the saving, even though it gets re-inflated in RAM.

And yes, I realize that having a dictionary for word verification running client-side is weird in an HTML5 game. It only gets loaded for hotseat (or versus-AI) games, so that when the game is turned into an app it can work offline. For online games the server checks words with a mysql query.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
That's usually handled with a trie,

DancingPenguin
Nov 27, 2012

I ish kakadu.

scissorman posted:

What's the advantage of using voxels?
Do you know how fast a javascript application like this runs vs traditional programming languages?


I thought about using Minecraft as a base but I see two problems with that:
a) The simulation would primarily use a top-down, RTS-style camera, which is probably not what the engine is optimised for.
b) I'm mostly interested in the simulation and thus want to keep the rendering simple. All the additional stuff in Minecraft would just take away from that.

Sorry for the slow response, did not see your post.
Since I rarely see voxels used, and do not use it myself, I will shamelessly provide you with this Google thing I found.

About the top-down camera, I do not believe this engine will have any problem with it.
What you should check for is if you can use skyboxes/planes/domes or such, as to get a nice background for it, otherwise just fill the entire screen with <insertyoursimulationhere>.
Well all this engine really uses is blocks, so "all the additional stuff" (By which I suppose you mean the textures), is just added by:
code:
  generateVoxelChunk: generator,
  texturePath: './textures/',
  materials: ['grass', 'obsidian', 'dirt', 'whitewool', 'crate', 'brick']

DancingPenguin fucked around with this message at 22:55 on Apr 26, 2013

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!

Suspicious Dish posted:

That's usually handled with a trie,
In memory sure. It's the serialized storage I was concerned with though.

scissorman
Feb 7, 2011
Ramrod XTreme

DancingPenguin posted:

About the top-down camera, I do not believe this engine will have any problem with it.
What you should check for is if you can use skyboxes/planes/domes or such, as to get a nice background for it, otherwise just fill the entire screen with <insertyoursimulationhere>.
Well all this engine really uses is blocks, so "all the additional stuff" (By which I suppose you mean the textures), is just added by:
code:
  generateVoxelChunk: generator,
  texturePath: './textures/',
  materials: ['grass', 'obsidian', 'dirt', 'whitewool', 'crate', 'brick']
With "additional stuff" I was mostly talking about Minecraft and its non-graphics related sub-systems.
I don't know how the game is structured but, since I wouldn't use all the gameplay code, it would just add unnecessary complexity.

seiken
Feb 7, 2005

hah ha ha

roomforthetuna posted:

What I'm doing is parsing a dictionary file (word dictionary not programming-concept dictionary) into an 'object' (because that's Javascript's hash) for nice quick random access - the one character is my concession to cutting down the file size; I've converted the dictionary file from an alphabetical list of words into a sequence where, eg. "BANANA BANANAS BANGLE" would get encoded as "BANANA [chop0]S [chop4]GLE", with the "chop" markers being encoded as single characters.

Turns out that encoding the dictionary this way turns it from over 3MB to just over 1MB, so quite the saving, even though it gets re-inflated in RAM.

Surely there's a Javascript implementation of a real compression algorithm like gzip or whatever you can use instead of this hand-rolled thing?

DancingPenguin
Nov 27, 2012

I ish kakadu.

scissorman posted:

With "additional stuff" I was mostly talking about Minecraft and its non-graphics related sub-systems.
I don't know how the game is structured but, since I wouldn't use all the gameplay code, it would just add unnecessary complexity.

Check the "About" page, all of the extra stuff seems to be assets that are not there unless you download them.
I believe that the actual gameplay code has to be created manually.
Might I ask what kind of simulation we are talking about?

Space Kablooey
May 6, 2009


I'm thinking of developing a game with Unity, and my current laptop (a HP G60 from 2009 :gonk:) really isn't cutting it anymore.

So:
Is there any specific recommended laptop to develop with Unity? If not, what laptop should I go for? I don't plan on going crazy on graphical effects, and I can't really afford the more gamey ones.
Are there any laptops that comes with Windows 7 anymore? If not, how's Unity compatibility with Linux?
I feel kinda silly asking this, but how's Unity compatibility with PS3 controllers on Windows (the MotionInJoy driver)?

FuzzySlippers
Feb 6, 2009

I think almost every single video or screenshot I've seen of a Unity developers desktop has been on a Mac. I develop on a beefy Windows desktop but take that for what you will.

Unity can compile to a linux binary but the editor doesn't run in linux.

The Gripper
Sep 14, 2004
i am winner

HardDisk posted:

I'm thinking of developing a game with Unity, and my current laptop (a HP G60 from 2009 :gonk:) really isn't cutting it anymore.

So:
Is there any specific recommended laptop to develop with Unity? If not, what laptop should I go for? I don't plan on going crazy on graphical effects, and I can't really afford the more gamey ones.
Are there any laptops that comes with Windows 7 anymore? If not, how's Unity compatibility with Linux?
I feel kinda silly asking this, but how's Unity compatibility with PS3 controllers on Windows (the MotionInJoy driver)?
Just pick up a laptop with a decent GPU and OpenGL support and <whatever specific features you require>. If you're deploying to Mac/iOS then you'd probably lean towards a Macbook, otherwise the choice is down to preference. If you can wait til after June the new Intel Haswell chipset Laptops will be in the wild, and it looks to be a frontrunner for this kind of development.

Unity3D works perfectly on Windows 8 if you're worried about that too, I've been using it for months with no issue. Apart from the start menu you can ignore all the Metro/WinRT parts and use it exactly as you would Windows 7. Plus it still has downgrade rights to Windows 7 if you really want to do that.

Azazel
Jun 6, 2001
I bitch slap for a living - you want some?
For anyone with any interest in pathfinding algorithms: http://qiao.github.io/PathFinding.js/visual/?buffer_share=3da1d

I wasn't familiar with the Jump Point Search. What are the drawbacks to it? Because it seems quite fast.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

Azazel posted:

I wasn't familiar with the Jump Point Search. What are the drawbacks to it? Because it seems quite fast.
Looks like this:
http://harablog.wordpress.com/2011/09/07/jump-point-search/

The drawback is that it only works on a uniform-cost grid.

Space Kablooey
May 6, 2009



I also own a fairly beefy desktop, but I am barely home nowadays. I'm planning using the laptop to develop on the downtime I have while I wait for classes to start.



Macbooks are out of my range for now, and those new processors will probably be out of my range as well. I don't know poo poo about laptop graphics adapters, if you could point me to a more specific one, it would be great. Knowing that I should look for OpenGL support helps a lot already.

Are the Intel adapters still completely terrible?

Thanks! :)

The Gripper
Sep 14, 2004
i am winner

HardDisk posted:

I also own a fairly beefy desktop, but I am barely home nowadays. I'm planning using the laptop to develop on the downtime I have while I wait for classes to start.


Macbooks are out of my range for now, and those new processors will probably be out of my range as well. I don't know poo poo about laptop graphics adapters, if you could point me to a more specific one, it would be great. Knowing that I should look for OpenGL support helps a lot already.

Are the Intel adapters still completely terrible?

Thanks! :)

Intel GPUs are decent enough now as long as you're not aiming for bottom-of-the-barrel, like in netbooks. I don't know about ultrabooks but even those probably support OpenGL 3.2 now.

scissorman
Feb 7, 2011
Ramrod XTreme

DancingPenguin posted:

Check the "About" page, all of the extra stuff seems to be assets that are not there unless you download them.
I believe that the actual gameplay code has to be created manually.
Might I ask what kind of simulation we are talking about?

I'm writing an artificial life simulation, starting with a simple predator-prey sim and expanding it from there.
There are a couple things I want to try out, like adaption to a changing environment, maybe some learning and evolution.

Torch Dexter
Dec 3, 2006

HardDisk posted:

I also own a fairly beefy desktop, but I am barely home nowadays. I'm planning using the laptop to develop on the downtime I have while I wait for classes to start.


Macbooks are out of my range for now, and those new processors will probably be out of my range as well. I don't know poo poo about laptop graphics adapters, if you could point me to a more specific one, it would be great. Knowing that I should look for OpenGL support helps a lot already.

Are the Intel adapters still completely terrible?

Thanks! :)

Just for reference, Unity on windows actually runs in Direct3D, not OpenGL (as it does on Mac and Linux). It's kind of a moot point anyway, as I don't think anyone's made PC graphics cards/chips that don't support both in the past 15 years.

From my experience with Unity (at least in 3.5, I've never made the transition to 4) it's basic graphical requirements are fairly low. I've even seen the editor running on a netbook with intel graphics (though not particularly well). Unity still runs decently on my 2009 mac mini which has a 9400M graphics chip (a high-middling laptop chipset at the time) but I do mostly work on 2D, or graphically simple 3D games.

It might be a good idea to ask for recommendations on the Unity forums, as they're generally pretty helpful, and there should be a lot of people running different hardware setups.

FuzzySlippers
Feb 6, 2009

Is doing a replacement for coroutine waiting in c# like this common?

I thought it was pretty clever but maybe that's because I do things the dumb way. Recently I was coding my spell targeting and when the spell gets used I hit up my main spell coroutine which then waits on another coroutine to pass along the mouse-pointer-to-world-point vector on mouse click or cancel on the escape key. Using his method I got rid of that nonsense and it was a lot cleaner.

DancingPenguin
Nov 27, 2012

I ish kakadu.

scissorman posted:

I'm writing an artificial life simulation, starting with a simple predator-prey sim and expanding it from there.
There are a couple things I want to try out, like adaption to a changing environment, maybe some learning and evolution.

That just sounds like AI and random seed generation. (To change the environment)
But mainly it seems like you want to focus on AI, and that can be done with almost any engine, so just go for whichever you might like.

DancingPenguin fucked around with this message at 13:29 on Apr 27, 2013

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!

seiken posted:

Surely there's a Javascript implementation of a real compression algorithm like gzip or whatever you can use instead of this hand-rolled thing?
SOWPODS.txt -> 2906k
SOWPODS.txt.7z -> 549k
dictionary.js (my quick-squashed version including the code to expand it) -> 1099k
dictionary.js.7z -> 272k

Which is to say, it's nice to do both! (I tested with 7z rather than gzip because it's just what happened to be convenient.)

I also turned on quick single-pass gzip compression on the server, because apparently the Javascript implementation of the inflate algorithm is horrible and slow (for a single pass on load I'm sure it'd be not too bad really, but why bother when it can be done by the browser before javascript even sees it, and as a bonus be compressing all the html and other js files too).

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!

HardDisk posted:

Is there any specific recommended laptop to develop with Unity? If not, what laptop should I go for? I don't plan on going crazy on graphical effects, and I can't really afford the more gamey ones.
A low-end Alienware (now a subsidiary of Dell) is what I use, and it works great for Unity (plus I can even just about play GTA4 on it!)

But it looks like they don't go as low as this any more. I got a 13 inch one for $800, but now the Alienware site starts at $1500 and at the Dell site starts at $1000 and 14 inch (the M14X). That's still not a bad price for a laptop with a gaming graphics card in it, but a shame they don't do the small one any more. (And the screen resolution is still the same as on the small one.)

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

Torch Dexter posted:

I don't think anyone's made PC graphics cards/chips that don't support both in the past 15 years.
Intel's OpenGL drivers on Windows are insufferable. They didn't support GLSL at all until very recently, and it's currently very buggy. A lot of features that are common on other vendor cards are either unavailable (i.e. numerous texture formats) or fall back to software (i.e. vertex texture fetch).

I mean, it still doesn't matter since Unity for Windows uses D3D, but if you develop a game using OpenGL right now, you are pretty much excluding Intel GPU users from your audience. The only reason it works as well as it does on MacOS is because the Mac OpenGL implementation is designed in a way that most of the functionality is handled by vendor-independent code written by Apple and what's exposed to the hardware is very low-level.

OneEightHundred fucked around with this message at 17:00 on Apr 27, 2013

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch
Does anyone have or know where to get some sample bitmap fonts to use with Unity and Futile? BMFont is being completely broken for me and I don't want to buy a license for Glyph Designer, I just need some sample fonts I can throw into an atlas and mess around with.

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!
How is it being broken? Not that I can help, just wondering since I'm probably going to be toying with it in the next week or so.

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch
None of my settings are saving for some reason. I go and change the font, the size, the background color and then save and export and...it's the default lovely looking font at the default size on a black background. If I go into Font Settings or Export Options and change anything at all and hit okay everything is back to its default as soon as I open the menu again. I can't do anything with the program at all.

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!
Did you do this? From http://www.anbsoft.com/middleware/ezgui/docs/page28/page30/page30.html

quote:

From BMFont's Options menu save the configuration settings file (extension: .bmfc) by choosing Save configuration as... And then save the bitmapped font itself by choosing Save bitmap font as... If you ever need to tweak it again, load the .bmfc file to restore the same settings with which you've created the .fnt file. It's a good idea to name both files identically.

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch
Oh weird apparently now it's working. I was definitely following that page before, I'm not sure what went wrong.

Ugh I'm way too tired.

Opinion Haver
Apr 9, 2007



Picked up working on that old Haskell game I had; right now you can shoot at the blue 'chaser' objects, but there's no collision detection or anything. Only 250 lines, though, and I'm using bare OpenGL/GLFW.

Adbot
ADBOT LOVES YOU

Twernmilt
Nov 11, 2005
No damn cat and no damn cradle.

yaoi prophet posted:

Picked up working on that old Haskell game I had; right now you can shoot at the blue 'chaser' objects, but there's no collision detection or anything. Only 250 lines, though, and I'm using bare OpenGL/GLFW.

Are you using OpenGL or OpenGLRaw? I've been playing with OpenGLRaw and the foreign function interface recently. It was a little bumpy in the beginning due to the lack of FFI examples out there, but now I'm enjoying it quite a bit.

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