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
Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

Internet Janitor posted:

Java is another solid option. Java and C# are very similar, so learning one will make picking up the other fairly painless. Java comes stock with a pretty solid and very easy to use 2D graphics API and there are third party libraries such as Slick2D, LibGDX and LWJGL which can be helpful for game development. Java makes it easy to target all three desktop platforms and can be used for Android development too. If you want something that will help you ease into Java or just for quick playing around, try out Processing, which comes with a lightweight IDE, easy-to-use 2D and 3D graphics capabilities and can compile Windows/Linux/OSX/Android/HTML5 standalone executables.
Once cool thing about Java (that I'm not sure applies to C#) is that it sets you up to do a good from-the-ground-up understanding of games programming. You wouldn't really want to make a serious game with it, but interacting with Canvas is a heck of a lot like interacting with old-school mode13h, and you end up learning all the same tricks (how drawing works, how to rotate sprites, polygon rendering, whatever). The neat bit being, it's "low level" in a sense, but also portable to anything. So kinda the best of both worlds.

If C# has an equivalent, then it'd be just as good, but I'm pretty sure C#/monogame just launches you straight into 3D. Which is cool, and ultimately more important, but you won't have the same understanding of what's actually going on under the hood.

(it's probably overkill if you just want to make games, but if you want that ground-up understanding, you could do worse)

Adbot
ADBOT LOVES YOU

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
That really has much more to do with your choice of libraries and tooling than language. The real distinction is between using a "games framework" (such as Unity) and a general-purpose programming language and graphics library. I would imagine the experience with C# is quite similar if you were to code against a DirectX or OpenGL library rather than using Unity.

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

Internet Janitor posted:

That really has much more to do with your choice of libraries and tooling than language. The real distinction is between using a "games framework" (such as Unity) and a general-purpose programming language and graphics library. I would imagine the experience with C# is quite similar if you were to code against a DirectX or OpenGL library rather than using Unity.
Eeeh, well no. The closest thing in DirectX would be DirectPlay, which is long since dead. DirectX/OpenGL don't really have a mode that just hands you a buffer of memory and says "have fun," shy of doing all the setup you'd need to do for a 3D scene, creating a write-only/discard texture, a sceen-sized polygon, etc. Way more complicated than your average novice is going to grok.

Java's (as far as I'm aware) unique in still offering the Canvas as a default option, as far as cross-platform stuff goes.

EDIT: (I'm not really committed to Java / I'm a C# person, this was just something that struck me after watching a guy's presentation last week on Java for beginner gamedevs - hadn't seen such a straightforward rendering function in years)

Shalinor fucked around with this message at 21:25 on Mar 1, 2014

a cyberpunk goose
May 21, 2007

Shalinor posted:

Once cool thing about Java (that I'm not sure applies to C#) is that it sets you up to do a good from-the-ground-up understanding of games programming. You wouldn't really want to make a serious game with it, but interacting with Canvas is a heck of a lot like interacting with old-school mode13h, and you end up learning all the same tricks (how drawing works, how to rotate sprites, polygon rendering, whatever). The neat bit being, it's "low level" in a sense, but also portable to anything. So kinda the best of both worlds.

If C# has an equivalent, then it'd be just as good, but I'm pretty sure C#/monogame just launches you straight into 3D. Which is cool, and ultimately more important, but you won't have the same understanding of what's actually going on under the hood.

(it's probably overkill if you just want to make games, but if you want that ground-up understanding, you could do worse)

None of those 'learn low level game programming' features are specific to Java or any language really. Manually interacting with a pixel buffer introduces a lot of constraints, rotation being a big one. Rotating sprites, from a technical feat standpoint and computational cost, is a natural constraint of doing things by hand and you can achieve this in any language.

If I were to recommend a "learn you how much frameworks save you time and effort and why you should avoid rolling your own tech from the ground up" project, I'd say try to do some game making with C++ and SDL without any hardware acceleration.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
The first thing I recommend people do when they're just starting out learning is to make their own vector graphics renderer and TrueType interpreter so they can show "Hello World!" on the screen.

poemdexter
Feb 18, 2005

Hooray Indie Games!

College Slice
I'd say it matters how you define "make a game".

* I really want to learn the engine piece of game development and how things are tossed on the screen, implementing collision detection, etc.
OR
* I really want to build out a proof of concept for my game quickly.

For the first, Java really isn't that bad of an idea. It's what I used before I moved on to XNA. Bonus points to Java because if you ever want to move on to the second definition, C# is almost 1:1 syntactically identical to Java.

For the second, just pick up C# and start playing with Unity. Unity keeps all the engine stuff out of your hair while you make games. If you're serious about your game, you can always dig deeper into Unity and get the performance you need.

xzzy
Mar 5, 2009

The biggest downside to Java is Oracle. :colbert:

gently caress that company all the way to hell.

Zizi
Jan 7, 2010

poemdexter posted:

I'd say it matters how you define "make a game".

* I really want to learn the engine piece of game development and how things are tossed on the screen, implementing collision detection, etc.
OR
* I really want to build out a proof of concept for my game quickly.

For the first, Java really isn't that bad of an idea. It's what I used before I moved on to XNA. Bonus points to Java because if you ever want to move on to the second definition, C# is almost 1:1 syntactically identical to Java.

For the second, just pick up C# and start playing with Unity. Unity keeps all the engine stuff out of your hair while you make games. If you're serious about your game, you can always dig deeper into Unity and get the performance you need.

This goon speaks sense.

Honestly, it seems to me you're asking about languages when you mean "I want to try making a game this summer, how do I do it". The answer to that is most probably either GameMaker Studio or Unity. If you want to get more of a programming experience on it, Unity's the better choice of those two, especially since 2D's a thing it does better than it used to.

Also: quite honestly, a summer project 'babby's first game' thing is not the sort of thing where you really need to worry about things like 'why don't people like UnityGUI' or 'what do I need out of the asset store'. For a first/second/third round of small learning projects, the built-in stuff is fine and serviceable.

SSH IT ZOMBIE
Apr 19, 2003
No more blinkies! Yay!
College Slice

OneEightHundred posted:

I think OverlapSphere exists for this case.

Box casts can be accomplished by using ray casts against enlarged boxes, or you could probably just insert a box into the world and detect the collision in the next frame to trigger the effect.

https://www.youtube.com/watch?v=VguaICzfGQ4

Overlapsphere works pretty well, actually. Thanks :o:
I want a bit more insight as to where a hit takes place though, and you lose the collision position doing that. Actually I'm now creating a few different spheres and spawn the hit animation in the center of the sphere where the hit took place. I might add a bit of a random offset to it to make it look a bit more organic.

Praseodymi
Aug 26, 2010

Seeing as I've got so much help making this from here and the C++ thread I figure I might as well let you guys see what I've done now it's been handed in.

Dropbox link. I've included the user guide from the report that went with it that tells you the controls.

Seeing as we've got a game jam coming up in a few weeks and the specifications are apparently for a platformer I'd absolutely appreciate any feedback you could give me, gameplay or programming wise.

EDIT: Just realised it says press Z to continue when it's actually X, and it doesn't mention you can navigate the menus with a controller.

DOUBLE EDIT: gently caress something's broke. Give me a sec.

TRIPLE EDIT: It's fixed now. hopefully.

Praseodymi fucked around with this message at 04:24 on Mar 2, 2014

TodPunk
Feb 9, 2013

What do you mean, "TRON isn't a documentary?"

Shalinor posted:

Eeeh, well no. The closest thing in DirectX would be DirectPlay, which is long since dead. DirectX/OpenGL don't really have a mode that just hands you a buffer of memory and says "have fun," shy of doing all the setup you'd need to do for a 3D scene, creating a write-only/discard texture, a sceen-sized polygon, etc. Way more complicated than your average novice is going to grok.

Java's (as far as I'm aware) unique in still offering the Canvas as a default option, as far as cross-platform stuff goes.

I believe what Internet Janitor is referring to is that something you'd make with Java's Canvas isn't necessarily the understanding of game internals, as the real distinction is less about 2D vs 3D, and more about getting into topics like setting up your windows, how you will do your debug tooling (do you have a separate console, or do you implement it onscreen somehow, or something else entirely?) are the real teachers of game programming. Without understanding all that, you just jump into something like Unity and stare at its IDE as it has crashed for the 10th time that day, and wonder what the hell your friend was thinking when he said Unity was so great. You don't appreciate your debugger tools, your asset loaders, etc, which Unity makes easy for you.

Granted, if someone just wants to jump into game design, rather than game programming, something like GameMaker/Unity/etc may be a better route. It's all a matter of choice between what your goals are, what your choice of tools are, what your understanding level of the stuff under the hood is (and maybe how to know when some of that is defined by the game you want to make. No 2D FPSes, for instance, means no Canvas/Bitmap, obviously).

On the subject of Canvas equivalents, C# does have System.Drawing.Bitmap which you can display a multitude of ways, Lua (via LOVE) has a couple image buffer formats if you prefer to go that route, and even Factor has the image and image-window objects to sort of handle that. I don't speak from experience on all of the languages ever, but programming a game really does boil down to the limitations of your language and libraries in every case I've come across. Java's great for a good starting language, but if someone already knows one and wants to just try this out, there's likely a good option for them in their current knowledge set.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

xzzy posted:

The biggest downside to Java is Oracle. :colbert:

gently caress that company all the way to hell.
The biggest downside to Java is that the language has been stagnant forever and features that should have been in it ages ago are winding up in .NET instead. It's especially annoying for games because structs are a great way to make vector math cheap without awful code contortions.

What languages are good to learn depends on what you're doing. Messing with internals, or messing with things that you expect to translate into professional development (which is largely C++) is very different from hammering something out for a web game (which will mostly be JavaScript/Flash) or Unity (which has several options, but C# is probably the most useful).

OneEightHundred fucked around with this message at 12:21 on Mar 2, 2014

Ireland Sucks
May 16, 2004

I'm trying to perform 'polygon clipping' on a triangle fan for lighting in a 2d sidescroller, but I'm having trouble coming up with a good method of doing it.

I've got a list of horizontal and vertical lines on the screen and I want to draw the triangle fan around them to create shadows.

Example:

(Video explaining it: https://www.youtube.com/watch?v=4BtjcH-iLR0&t=256s)

My current method of doing it is to trace along the edge of each of the 4 initial triangles, check for collisions between the ray of light and each line then draw the triangle fan based on collisions. It works, but it is very inefficient and somewhat error prone. Instead i'd just like to look at all the lines within the vicinity of the light (ie: the center of the quad) and somehow construct the fan around them.

The problem is that since I'm just dealing with a big list of points (using Pyglet for what it's worth) to trace out the 'light' and not actually chopping bits of the quad out, dealing with overlapping lines makes this a bit complicated and it's time to ask if there is a nice obvious method.

Example (just making a list of vertices to draw triangles around each line):


Probably not explained very well but hopefully you get the idea. Is there a specific algorithm for something like this?

iopred
Aug 14, 2005

Heli Attack!

Ireland Sucks posted:

I'm trying to perform 'polygon clipping' on a triangle fan for lighting in a 2d sidescroller, but I'm having trouble coming up with a good method of doing it.

Example (just making a list of vertices to draw triangles around each line):


Probably not explained very well but hopefully you get the idea. Is there a specific algorithm for something like this?

Here's a great article: http://www.redblobgames.com/articles/visibility/

Ireland Sucks
May 16, 2004


Oh wow that's perfect, thanks. How did I not think of just checking the end of each line :psyduck:

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
I saw something similar that used a BSP structure to do it, which I guess was designed to scale better with scene complexity (and work in 3D, where "sort by angle" isn't a valid concept). Insertion was done by inserting the occluder into the tree as multiple leaf nodes, generating a new split using the occluder plane, then generating more splits using the occluder edge. I think there was also a collapse optimization during insertion where if both sides of an insertion split failed to generate any new nodes from the edges, then the split was merged, because it meant that the split was caused by something behind the occluder.

I can diagram that if it doesn't make sense. I would suspect that it can be made much easier in 2D though.

OneEightHundred fucked around with this message at 22:01 on Mar 2, 2014

Baldbeard
Mar 26, 2011

I know this is kind of a broad question, but how big of an undertaking is the server/online portion of really simple text-browser based games? Stuff like Cookie Clicker, or little "set it and forget it" RPGs progress quest style. I've been making myself little mini games and stuff in ActionScript, and I would like to make a super simple game kind of like progress quest, and I'm wondering how deep into networking and server stuff I'm going to have to go.

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

Baldbeard posted:

I know this is kind of a broad question, but how big of an undertaking is the server/online portion of really simple text-browser based games? Stuff like Cookie Clicker, or little "set it and forget it" RPGs progress quest style. I've been making myself little mini games and stuff in ActionScript, and I would like to make a super simple game kind of like progress quest, and I'm wondering how deep into networking and server stuff I'm going to have to go.

Cookie Clicker didn't have a server component last I checked, though it may have changed since.

e: Here's the main script. The only server-client communication I can find is a check every half hour to see whether there's an update. Note though that while popular, it's not mandatory to structure your code in such a god-awful fashion.

coffeetable fucked around with this message at 23:47 on Mar 2, 2014

dupersaurus
Aug 1, 2012

Futurism was an art movement where dudes were all 'CARS ARE COOL AND THE PAST IS FOR CHUMPS. LET'S DRAW SOME CARS.'
A text-based server game eliminates the real hard stuff of networking like prediction. Depending on what you need it could just be some php scripts with database calls, up to something more persistant like chats or MUDs.

TodPunk
Feb 9, 2013

What do you mean, "TRON isn't a documentary?"

Baldbeard posted:

I know this is kind of a broad question, but how big of an undertaking is the server/online portion of really simple text-browser based games? Stuff like Cookie Clicker, or little "set it and forget it" RPGs progress quest style. I've been making myself little mini games and stuff in ActionScript, and I would like to make a super simple game kind of like progress quest, and I'm wondering how deep into networking and server stuff I'm going to have to go.

I think you'll find network programming and client/server architectures are never "simple." They don't have to be complicated, but your troubleshooting is going to be a nightmare if you don't understand the network in the first place. For a progress quest style game you're looking at less of a "game state" overall, so that simplifies how you would write its engine, but you will still need to deal with getting your clients authenticated as a specific "account" or whatever, to differentiate between Pat and Sam's characters.

Shorter version: not as deep as a real-time game with interactions to calculate, but deep enough you'll likely learn all the network level stuff anyway.

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY
For simple saves in simple games, you don't need user accounts or any of that lark. Cookies give you 4kb to play with, which should be more than enough to store attributes/level progress/inventory contents/etc in.

More, if you can do everything in the client - either by JS or by the Unity web player or something - then you can serve it in a static page, which means you can use GithubPages or similar as free unlimited hosting.

e: See also

https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage

coffeetable fucked around with this message at 03:49 on Mar 3, 2014

TodPunk
Feb 9, 2013

What do you mean, "TRON isn't a documentary?"

coffeetable posted:

For simple saves in simple games, you don't need user accounts or any of that lark. Cookies give you 4kb to play with, which should be more than enough to store attributes/level progress/inventory contents/etc in.

Except, you know, security and all. Always expect local files to be messed around with. Anything you do will equate with accounts in their functionality, and even ProgressQuest had a login.

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!

TodPunk posted:

Except, you know, security and all. Always expect local files to be messed around with. Anything you do will equate with accounts in their functionality, and even ProgressQuest had a login.
That's a nontrivial problem with networking too though. Witness the many many Flash games where the top 10 scores are all multiple billions scored by "fart lol", when the best real score is under 4 digits. At least if people are loving with a local file it's not visible to anyone else.

TodPunk
Feb 9, 2013

What do you mean, "TRON isn't a documentary?"
You are correct, and I wasn't meaning to dismiss the issue. What I meant is that if your only differentiator on the account info is an ID number in a cookie, you're going to have problems from more than "fart lol" and friends. If there's a server involved, and its tracking anything like score or progress, accounts are not something you can't worry about. (I'd argue people don't worry about them enough as it is.)

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY
I'm not saying 'use cookie storage to supplement accounts', I'm saying don't use accounts at all. If this is her first game and server interaction isn't part of the core functionality, KISS and remove servers from the equation completely.

TodPunk
Feb 9, 2013

What do you mean, "TRON isn't a documentary?"
Oh, yeah, if that's what you meant the rest of what you're saying is spot on. From his question, I thought the server bits were a requirement and hence the entirety of the question =cP

Obsurveyor
Jan 10, 2003

You've got even more space than cookies with the local client storage options any modern browser offers as well. Don't use cookies if the server doesn't need the data.

Baldbeard
Mar 26, 2011

Good points all around, cookies and local client storage should be able to handle the "save" function I was thinking of in the first place. Anything else such as high scores and a chat window or whatever would be handled separately and should be pretty simple.

duck monster
Dec 15, 2004

roomforthetuna posted:

That's a nontrivial problem with networking too though. Witness the many many Flash games where the top 10 scores are all multiple billions scored by "fart lol", when the best real score is under 4 digits. At least if people are loving with a local file it's not visible to anyone else.

Even Apples game center is filled with this poo poo. Its beyond non-trivial, its probably non solveable, short of running a game simulation at the server side to verify whats going on in the client. Major overkill.

Although I suppose you can run heuristics over it to look for fishy scores.

OtspIII
Sep 22, 2002

duck monster posted:

Even Apples game center is filled with this poo poo. Its beyond non-trivial, its probably non solveable, short of running a game simulation at the server side to verify whats going on in the client. Major overkill.

Although I suppose you can run heuristics over it to look for fishy scores.

One of my classmates actually wrote a paper on this. I think his conclusion was that there are some fairly easy ways to make it significantly harder for people to submit fake scores that basically nobody does (I think he said there was one exception among major scoreboard hosts that he found, which I think was the Apple Game Center). Taking this step won't stop people from being able to do it if they're dedicated, but it does raise the effort barrier to the point where you can at least get rid of the majority of them. If this is something people are interested I could ask him some more about it and write about it 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!

OtspIII posted:

One of my classmates actually wrote a paper on this. I think his conclusion was that there are some fairly easy ways to make it significantly harder for people to submit fake scores that basically nobody does (I think he said there was one exception among major scoreboard hosts that he found, which I think was the Apple Game Center). Taking this step won't stop people from being able to do it if they're dedicated, but it does raise the effort barrier to the point where you can at least get rid of the majority of them. If this is something people are interested I could ask him some more about it and write about it here.
Probably the best simple:effective ratio would be making the messages travel over https, so people can't just see what message to send to fake a high score by monitoring their own network traffic. Then (as the next step if you want to do a little better) a random session variable of "game ID" set (at both client and server) on game start and checked-and-cleared on score report would make it hard to craft a cheating score packet even if you already know the structure of a high score packet. It's far from foolproof, but it's probably enough to eliminate a good 95% of your cheaters for a fairly small and low-brain effort.

Chunderstorm
May 9, 2010


legs crossed like a buddhist
smokin' buddha
angry tuna
Hey guys, my non-goon roommate has run into a wall trying to figure something out, so I told him I'd ask.

Basically, he's trying to have AI followers cluster behind the player as they follow him. That way, if he has one or multiple followers, they still look good. He wants to use triangular circle-packing, but has no idea where to begin as far as the math is concerned. Has anyone had to do this before? He codes in C# and is using Unity, and Googling hasn't turned up anything useful.

e: Hell, I have my own question while I'm at it. In Unity, is there a way to detect collisions on one side of an object? Making another collision object inside doesn't work as well as I'd like, and raycasting still has a few issues for me, though is working pretty well for my purposes.

Chunderstorm fucked around with this message at 08:46 on Mar 4, 2014

aerique
Jul 16, 2008

Chunderstorm posted:

Basically, he's trying to have AI followers cluster behind the player as they follow him. That way, if he has one or multiple followers, they still look good. He wants to use triangular circle-packing, but has no idea where to begin as far as the math is concerned. Has anyone had to do this before? He codes in C# and is using Unity, and Googling hasn't turned up anything useful.

I would tell him to look into flocking behavior (pimping my own video here: http://www.youtube.com/watch?v=INeUifM2Bhg).

Different from standard flocking behavior I would designate one leader, move it first and then process the AI followers using flocking behavior. This will not give you the packing he wanted but I have no idea why you'd want that.

I think this is the website that started it all: http://www.red3d.com/cwr/boids/

edit: Now that I think more on it, if you keep the standard flocking behavior you'll have groups breaking off from the main group. I'll leave fixing that as an exercise to the reader.

aerique fucked around with this message at 09:40 on Mar 4, 2014

scissorman
Feb 7, 2011
Ramrod XTreme

down with slavery posted:

Just for the record, there are a plethora of tools and options outside of Unity, and while it is the flavor of the month on these forums, there are plenty of other reasonable options that won't have you working in a hulking ide pouring through broken documentation trying to figure out which third party plugins you need to create ground breaking game components like a GUI.

Speaking of which, what's the latest news on the new Unity GUI system?
I keep wanting to try out Unity but the lack of features I really expect to see is discouraging.
I know you can buy plugins for pretty much anything but I'm not really willing to spend 90$ for a hobby project, especially since there's no demo to try before you buy.

xgalaxy
Jan 27, 2004
i write code

scissorman posted:

Speaking of which, what's the latest news on the new Unity GUI system?
I keep wanting to try out Unity but the lack of features I really expect to see is discouraging.
I know you can buy plugins for pretty much anything but I'm not really willing to spend 90$ for a hobby project, especially since there's no demo to try before you buy.

It is in beta testing now.

scissorman
Feb 7, 2011
Ramrod XTreme

xgalaxy posted:

It is in beta testing now.

Thank you.
Is there somewhere you can follow along?
Also, is it a public beta?

Edit: Poking around in the forums, I found OpenGUI, which looks quite promising.
Has someone tried this?

scissorman fucked around with this message at 00:49 on Mar 5, 2014

Admiral Snuggles
Dec 12, 2008

:qq: Freedom :qq:
So I'm really freaking proud of the map generator I've made for the game I've been working on. It can make cool maps up to 300,000 tiles using less than a gig of memory. The one in the picture below is about 25,000 tiles, probably closer to what I'll use in the game.



My question is. How is something with tons of information like this typically shared in a multiplayer game?

I've implemented a (very) basic multiplayer version of my game without the map generator, so I do have experience with that.

A basic overview of my generator in its current state: What I've done is created an array and I've loaded every single tile you see into that array. So I've got a giant array of tiles. I think that my options for sharing this data with joining players would be one of the following.

1. Create each tile using an RPC, so the map is created for the server and all joined clients. This has the advantage of sending very little information over the network. However, each time a player joins they'll have to receive the entire RPC stack. This means I'll have to store the RPC stack on the server side. i.e. the server will need to hold the master client's tile array and an array to send out to new players. This is one hell of a load on the server I would think. It's also complicated. :(

2. Stream the array over the network and use it to build the map on the joined players side. This is much simpler than the above, but I imagine would send a ton more data. This would be a lot easier to troubleshoot and for me to generally add to if needed.

Part of me wants to try both and see which one works better. But both will be a good deal of work and I wanted to see if anybody on here had any experience with sharing randomly generated things over a network. I'm sure I'm missing something. :shrug:

dupersaurus
Aug 1, 2012

Futurism was an art movement where dudes were all 'CARS ARE COOL AND THE PAST IS FOR CHUMPS. LET'S DRAW SOME CARS.'

Admiral Snuggles posted:

So I'm really freaking proud of the map generator I've made for the game I've been working on. It can make cool maps up to 300,000 tiles using less than a gig of memory. The one in the picture below is about 25,000 tiles, probably closer to what I'll use in the game.



My question is. How is something with tons of information like this typically shared in a multiplayer game?

I've implemented a (very) basic multiplayer version of my game without the map generator, so I do have experience with that.

A basic overview of my generator in its current state: What I've done is created an array and I've loaded every single tile you see into that array. So I've got a giant array of tiles. I think that my options for sharing this data with joining players would be one of the following.

1. Create each tile using an RPC, so the map is created for the server and all joined clients. This has the advantage of sending very little information over the network. However, each time a player joins they'll have to receive the entire RPC stack. This means I'll have to store the RPC stack on the server side. i.e. the server will need to hold the master client's tile array and an array to send out to new players. This is one hell of a load on the server I would think. It's also complicated. :(

2. Stream the array over the network and use it to build the map on the joined players side. This is much simpler than the above, but I imagine would send a ton more data. This would be a lot easier to troubleshoot and for me to generally add to if needed.

Part of me wants to try both and see which one works better. But both will be a good deal of work and I wanted to see if anybody on here had any experience with sharing randomly generated things over a network. I'm sure I'm missing something. :shrug:

You might want to look into how minecraft does it since it's pretty much the same problem. Other than that, could you send the clients the seed, and if needed, keep a list of changes from the seed?

OtspIII
Sep 22, 2002

OtspIII posted:

One of my classmates actually wrote a paper on this. I think his conclusion was that there are some fairly easy ways to make it significantly harder for people to submit fake scores that basically nobody does (I think he said there was one exception among major scoreboard hosts that he found, which I think was the Apple Game Center). Taking this step won't stop people from being able to do it if they're dedicated, but it does raise the effort barrier to the point where you can at least get rid of the majority of them. If this is something people are interested I could ask him some more about it and write about it here.

I actually asked him about this today and he said that the Apply Game Center actually does pretty much nothing to prevent faked high scores. The one that was actually fairly good about it was, of all places, Newgrounds.

Adbot
ADBOT LOVES YOU

Jewel
May 2, 2009

I wonder how dwarf fortress does it's terrain generation since there's a world map. Here's a randomly generated world map (right click view image to truly get the full, amazing size of it).



Each tile of that map is a region tile. A region tile contains a 16x16 grid, then each tile of that grid is 48x48 real tiles that the characters move around on in game.

So each "region" tile contains 768x768 real tiles.

In a "large" world there is 257x257 region tiles, so there's a total of 197376x197376 real tiles in a world. Which is 38,957,285,376 tiles total.

The thing is, there's also 400 Z Layers on each tile, so that makes the world 197376x197376x400 tiles. Which is actually 15,582,914,150,400 tiles total. 15 billion tiles in a single world! And this world has thousands of years of history generated into it, simulating civilisations and wars and demons, and in the upcoming update, even travelling parties and civilisation takeovers get simulated. And on the lower scale, in game there's even footsteps calculated, things actually leave tracks that you can examine in the upcoming update. Dwarves also have thoughts and emotions, their emotions are tracked and even based off their own personal likes and dislikes. This is a lot of data!

It's mostly a really good system of abstracting levels. You don't have to simulate a war on the per-tile level, you can simulate it on the regional level, or process movement via chunks of regions on the world map. Stuff like that. It's all about efficiently abstracting your tiny data into chunks of larger data. Overall a DF map only takes 100-500mb or so to store the save file (which does grow as you play, more small-scale history being generated like who you've personally killed). It doesn't take too much ram either from what I remember, I've played on a really really bad laptop, and while the game ran bad, that was mostly CPU usage from processing so much, not data itself. It still simulates the stuff outside of the current embark zone too as you play, just at a much larger non per-tile scale.

This was mostly me writing up my thoughts on DF's world generation after being inspired by your post, but some of this does apply to yours. For example splitting the world into chunks is definitely a good first step if it's not being done. You stream chunks with a ChunkPosition and then a TilePositionWithinChink (minecraft uses 16 tiles per chunk, so this would be 0-16 in X and Y. This way you only have to stream chunks that are being viewed, so the viewer says "I need this chunk: 20, 17" and the server sends back 16x16 tiles of data back.

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