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
Vivian Darkbloom
Jul 14, 2004


General_Failure posted:

If I can find the Wiki PDF I made, and someone can tell me an easy way to share it I'll put it up for you if you want it.

Try Scribd or Google Docs.

Adbot
ADBOT LOVES YOU

Mug
Apr 26, 2005
I actually used wiki to learn how to do pathfinding and draw lines, but I've had a lot of trouble finding where I need to look to project a voxel object at a certain rotation/angle.

It doesn't matter right now because I'm not going to do voxels in my current project, but I do want to add them in at a later time.

Mug
Apr 26, 2005
I think I asked this in Games->Game Development Thread as well, but are there many goons here working on their own games that have twitter/facebook I can follow to keep up with them? I got a twitter not long ago and just kinda want to use it to follow other smaller/indie game developers.

General_Failure
Apr 17, 2005

Mug posted:

I think I asked this in Games->Game Development Thread as well, but are there many goons here working on their own games that have twitter/facebook I can follow to keep up with them? I got a twitter not long ago and just kinda want to use it to follow other smaller/indie game developers.

There seem to be quite a few, but how to track them I don't know because they don't always post where you would think.
Twitter usually just links to a more fleshed out blog like tumblr, blogger or whatever. It can be a pain so quite a few people wouldn't bother. I had a myspace page (before fb, twitter etc) which fell into disuse and now all that remains is the battered and bruised remains of a low effort website written using a combination of editplus and vi.

General_Failure
Apr 17, 2005
Here's the 39 page pdf I generated from Wikipedia on a few useful things. It was a good offline reference for me when I was using my netbook.

https://docs.google.com/open?id=0B2LpxKGTlpmmelZLc1hQQWNXU0k

Lucid Dream
Feb 4, 2003

That boy ain't right.

I spent awhile trying to implement this, but I couldn't seem to find any 4D simplex implementation/libraries that would let me control the frequency/octaves. This definitely seems like the "right" approach for what I want to do, but its been holding me up for too long already. You

prolecat posted:

There's this, but I've never actually tried it. Seems like it should work though.

I ended up implementing this, and it works, but it seems to be significantly slower than the above approach. Because I only need to do it on world generation I suppose its not a huge deal, but it starts to add up pretty quick considering I need to do a separate pass for each ore and such, so I'll probably go back and try the 4D simplex approach again eventually. Thanks for the info guys.

Lucid Dream fucked around with this message at 11:34 on Aug 18, 2012

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
http://staffwww.itn.liu.se/~stegu/simplexnoise/Noise.lua

EDIT: you talk about frequency/octaves. That's not actually part of the noise, that's part of fractal noise. The same exact fractal noise function that wraps the perlin noise function can be used.

Suspicious Dish fucked around with this message at 15:01 on Aug 18, 2012

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

General_Failure posted:

There seem to be quite a few, but how to track them I don't know because they don't always post where you would think.
Twitter usually just links to a more fleshed out blog like tumblr, blogger or whatever. It can be a pain so quite a few people wouldn't bother. I had a myspace page (before fb, twitter etc) which fell into disuse and now all that remains is the battered and bruised remains of a low effort website written using a combination of editplus and vi.
Twitter is where most indies hang out these days. G+ is also a decent target, if you can network your way into the gamedev circles - but still much smaller than the Twitter group.

(follow the dev accounts, not the studio accounts... I think most of us just use the studio accounts to blast out blog/news updates, whereas we geek out about game stuff on our personal accounts)

Lucid Dream
Feb 4, 2003

That boy ain't right.

Suspicious Dish posted:

EDIT: you talk about frequency/octaves. That's not actually part of the noise, that's part of fractal noise. The same exact fractal noise function that wraps the perlin noise function can be used.

Ahhh ok, I understand. its working perfectly now, thanks a bunch.

General_Failure
Apr 17, 2005

Shalinor posted:

Twitter is where most indies hang out these days. G+ is also a decent target, if you can network your way into the gamedev circles - but still much smaller than the Twitter group.

(follow the dev accounts, not the studio accounts... I think most of us just use the studio accounts to blast out blog/news updates, whereas we geek out about game stuff on our personal accounts)

Sage advice there. It may sound a little odd, but I know a lot of game developers. These ones I actually know it never crossed my mind to pay any attention to their professional lives. Possibly because of some bitterness. No, not jealousy. Not at all. Quite the opposite actually. Super teal deer version is poo poo happens. Deal with it. Plain old bad luck sent my life off on a massive tangent. Working on career reboot # 2 I think it is. Really, what else can a CS person specialising in games who is needed at home do? Been offered jobs but can't do them because I'm needed. So indie 4 lyfe I guess?

Azazel
Jun 6, 2001
I bitch slap for a living - you want some?

General_Failure posted:

Sage advice there. It may sound a little odd, but I know a lot of game developers. These ones I actually know it never crossed my mind to pay any attention to their professional lives. Possibly because of some bitterness. No, not jealousy. Not at all. Quite the opposite actually. Super teal deer version is poo poo happens. Deal with it. Plain old bad luck sent my life off on a massive tangent. Working on career reboot # 2 I think it is. Really, what else can a CS person specialising in games who is needed at home do? Been offered jobs but can't do them because I'm needed. So indie 4 lyfe I guess?

Did you just cut and paste a bunch of random developer tweets into a huge paragraph?

Jewel
May 2, 2009

Azazel posted:

Did you just cut and paste a bunch of random developer tweets into a huge paragraph?

General_Failure posted:

Sage advice there. It may sound a little odd, but I know a lot of game developers. These ones I actually know it never crossed my mind to pay any attention to their professional lives. Possibly because of some bitterness. No, not jealousy. Not at all. Quite the opposite actually. Super teal deer version is poo poo happens. Deal with it. Plain old bad luck sent my life off on a massive tangent. Working on career reboot # 2 I think it is. Really, what else can a CS person specialising in games who is needed at home do? Been offered jobs but can't do them because I'm needed. So indie 4 lyfe I guess?

Yeah I.. really can't parse that at all? It kinda hurts to read, it looks like the English is fine, but it's just the combination of sentences that.. I have no idea?

Jewel fucked around with this message at 15:11 on Aug 19, 2012

numeric_atrophy
Oct 18, 2003

Download Geared - FREE
(17 Million Downloads)

Windows 8
iOS
Android
WinPhone 7
Is anyone going to IndieCade this year?

General_Failure
Apr 17, 2005

Jewel posted:

Yeah I.. really can't parse that at all? It kinda hurts to read, it looks like the English is fine, but it's just the combination of sentences that.. I have no idea?

Sorry :( Been told I have a habit of doing that.

Un-obfuscated version. I have friends who are in the game industry. Most from before they were in the industry. I've never followed them or their associates' professional blogs before. It never really occurred to me.

I'm trained to make games. As are my friends as you may have guessed. But things happened a while back preventing me from following a real career path so my only real option is to be a solo operation indie developer.
The whole thing carries a bit of weight for me. Years of essentially wasted time and effort unless I can make a go of developing something. Looking at my friends progress / products really reminds me of that and while it makes me more determined it kind of puts me in the wrong mindset too.

However there are some that I don't know which I do follow their blogs, but not many because I don't actually know who develops what.

Paniolo
Oct 9, 2007

Heads will roll.
What do you mean, trained to make games? Did you go to DigiPen or something?

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

General_Failure posted:

I'm trained to make games. As are my friends as you may have guessed. But things happened a while back preventing me from following a real career path so my only real option is to be a solo operation indie developer.
The whole thing carries a bit of weight for me. Years of essentially wasted time and effort unless I can make a go of developing something. Looking at my friends progress / products really reminds me of that and while it makes me more determined it kind of puts me in the wrong mindset too.
What happened that prevents you from following games as a career path, but leaves you time to make a run at being indie?

(I know a great many life-fuckups that are doing quite well for themselves at AAA studios)


EDIT: VV Ah, yep. That'd be the one thing that I suppose would do it. Condolences, General_Failure - though frankly, the indie route's not bad lately. It's just draining, and requires a heck of a lot discipline.

Shalinor fucked around with this message at 00:13 on Aug 20, 2012

Unormal
Nov 16, 2004

Mod sass? This evening?! But the cakes aren't ready! THE CAKES!
Fun Shoe

Shalinor posted:

What happened that prevents you from following games as a career path, but leaves you time to make a run at being indie?

(I know a great many life-fuckups that are doing quite well for themselves at AAA studios)

Decoding his tweets makes it sound like there's a disabled or ill person that needs daily care.

Though honestly working at a AAA sounds like a bag of horrors; If you're going to work for an enormous soul-less profit machine, but love games, it seems like you should at least spend the soul-sucking hours in a high-paying industry, and make games for a hobby. :)

Paniolo
Oct 9, 2007

Heads will roll.
That's a pretty extreme perspective that may be true for some companies but is definitely not true for every AAA studio. Plus, there's some really interesting things you simply don't get to do working in the indie or mobile space, and especially not as a hobby.

General_Failure
Apr 17, 2005
A lot of things, including my presence as a carer prevent me from pursuing a "real" career. That aspect isn't as full on as it used to be. Nowhere near it thankfully but ...let's call it household management falls to me.
Add to that a recent accidental discovery by my doctor it's a bit of an unknown whether any longterm strategies are worthwhile. On that, apologies if I've been a little erratic.

Solo indie development isn't constrained by point of presence, hours per week etc. like working for a company can be.
For example last year I was offered a good job. QA and a few other things. Good pay, company equity, equipment etc but it involved fulltime hours which unfortunately is physically impossible. It really hurt turning that one down. It also forced me to realise my limitations. So I started to get my poo poo together, then for some reason every single bit of computer hardware decided to take turns failing. Just finished dealing with that mess more or less a few weeks ago. My netbook still isn't 100% and needs a new wifi card but everything else has at least has enough functionality to be useful.

In regard to training, I did the majority of a specialised CS degree. Didn't quite finish it because that was when things took a turn south. I actually got into that degree straight off because I was already working for a game company and had other certificates to my name including a diploma in IT.

As for why I didn't try to complete that degree, at least externally, well I inquired and the response was essentially "Enrol in the degree and once you are started then maybe we'll see if we can credit any of your units". Ouch. :(

That concludes e/n with General_Failure.

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!

Unormal posted:

Decoding his tweets makes it sound like there's a disabled or ill person that needs daily care.

Though honestly working at a AAA sounds like a bag of horrors; If you're going to work for an enormous soul-less profit machine, but love games, it seems like you should at least spend the soul-sucking hours in a high-paying industry, and make games for a hobby. :)
In addition to Paniolo's objection to this, there's also the problem where if your training and experience is all in game programming, it's not so easy to get a job in tedious high-paying database industry. I would totally go for a high-paying boring job over having my love of games corrupted by being obliged to work on games that I wouldn't want to play, for less money, but the more boring job just doesn't come up as an option for me.

vvvv Mind, I totally agree with you, and would prefer not to work for any big game house. Luckily I can't get a job with them either, due to indie-ing for the last ten years and not having anything up-to-date to show for it! So now my choices are "indie or die".

roomforthetuna fucked around with this message at 01:53 on Aug 20, 2012

Unormal
Nov 16, 2004

Mod sass? This evening?! But the cakes aren't ready! THE CAKES!
Fun Shoe
I probably should have phrased it "Being a small indie shop isn't that bad, cheer up brother."; I let my real feelings out instead :(

General_Failure
Apr 17, 2005

roomforthetuna posted:

In addition to Paniolo's objection to this, there's also the problem where if your training and experience is all in game programming, it's not so easy to get a job in tedious high-paying database industry.

Nailed it. while a lot I know does apply, there are holes in my knowledge. Like I did various things including SQL and databases when I was doing IT, but didn't touch it since. A lot of the "normal" development jobs out there require that sort of skillset which unfortunately I don't have. It's also the sort of thing where self taught counts for nothing. I know if I were hiring someone to maintain my mission critical database the risk management part of me wouldn't look twice at the seemingly knowledgeable person without the right certification.
Whereas say if I were hiring at a game dev company, the applicant could be a professional burger flipper for all it matters assuming they know their stuff (and can prove it) and their story checks out.

Both positions require different skillsets with one of the few commonalities is that they both need to be able to write code.

Unormal
Nov 16, 2004

Mod sass? This evening?! But the cakes aren't ready! THE CAKES!
Fun Shoe

General_Failure posted:

Nailed it. while a lot I know does apply, there are holes in my knowledge. Like I did various things including SQL and databases when I was doing IT, but didn't touch it since. A lot of the "normal" development jobs out there require that sort of skillset which unfortunately I don't have. It's also the sort of thing where self taught counts for nothing. I know if I were hiring someone to maintain my mission critical database the risk management part of me wouldn't look twice at the seemingly knowledgeable person without the right certification.
Whereas say if I were hiring at a game dev company, the applicant could be a professional burger flipper for all it matters assuming they know their stuff (and can prove it) and their story checks out.

Both positions require different skillsets with one of the few commonalities is that they both need to be able to write code.

Based on my pretty extensive experience, if you're capable of hobby/indie game programming, and you can get your foot in the door in an entry level software position at a typical large IT/business software shop, you're going to to be able to prove yourself cream of the crop just due to your ability to learn things on the internet.

It may take a bit, and you may have to try a couple shops, but I'd kill for any of you guys on many of the teams I've worked with, even if you had a little bit of learning to do. :)

...but I mean if you like AAA studio work, more power to you. ;)

Unormal fucked around with this message at 03:09 on Aug 20, 2012

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!

Unormal posted:

Based on my pretty extensive experience, if you're capable of hobby/indie game programming, and you can get your foot in the door in an entry level software position at a typical large IT/business software shop, you're going to to be able to prove yourself cream of the crop just due to your ability to learn things on the internet.
Yeah, if you can make a thing then you're absolutely good enough to be working at a big company, you're almost certainly better than half the people they already have working there (I've never worked somewhere where more than half the programmers were capable of making something), but the problem is you're not hireable enough to start working there. You can't go to a "serious job" interview and say "I can make games, here is an example, and also I learn fast". Well, you can, but the guy who shows up with "I've got some lovely certification that I paid for that doesn't reflect any practical skill at all" is going to get the job over you.

It's that "foot in the door" that's by far the hardest part.

Unormal
Nov 16, 2004

Mod sass? This evening?! But the cakes aren't ready! THE CAKES!
Fun Shoe

roomforthetuna posted:

It's that "foot in the door" that's by far the hardest part.

Yeah I completely agree with that; but it's important to note that if you spam jobs trying to get your foot in the door and succeed, you're not going to be sinking, you're (probably) going to have to try pretty hard to be diplomatic enough to not actively shame a lot of the guys that are already there. So if you're interested in that kind of work, I'd say have the confidence to spam job applications till you get a bite.

e: Very bad at English.

Unormal fucked around with this message at 05:41 on Aug 20, 2012

DrMelon
Oct 9, 2010

You can find me in the produce aisle of the hospital.
Does anybody have any tips for staying motivated / keeping focus? I sometimes have a really cool thing I'd like to try out, but within about two days of starting the project, my enthusiasm dies off entirely and the project goes nowhere.

Clearly I'm doing something wrong, but I'm not sure what it is.

Unormal
Nov 16, 2004

Mod sass? This evening?! But the cakes aren't ready! THE CAKES!
Fun Shoe

DrMelon posted:

Does anybody have any tips for staying motivated / keeping focus? I sometimes have a really cool thing I'd like to try out, but within about two days of starting the project, my enthusiasm dies off entirely and the project goes nowhere.

Clearly I'm doing something wrong, but I'm not sure what it is.

Force yourself to make even the tiniest bit of progress every day, even if it's tiny.

Every single day.

Once you get far enough in, enthusiasm will build just due to how cool the thing is. Getting over that initial dip, past the initial inspiration but before it starts to really pay off, just takes daily perseverance.

also, try to make a plan for the next couple things you're going to work on. Having even just a simple outline helps the *sit down, stare at the screen for 2 hours, leave having done nothing* effect. Just pick the next boring thing off your (pre-made) list and do it!

Mug
Apr 26, 2005

DrMelon posted:

Does anybody have any tips for staying motivated / keeping focus? I sometimes have a really cool thing I'd like to try out, but within about two days of starting the project, my enthusiasm dies off entirely and the project goes nowhere.

Clearly I'm doing something wrong, but I'm not sure what it is.

Every morning I, at the very least, play my game for a moment. Then while I'm at my day-job I just think about how cool it's coming along and that it's actually going to be a good game when it's done.

I also keep a blog with lots of screenshots of progress since the very start and scroll through it some times to see how far along I've come.

These things probably don't help very much if you're losing motivation at day 2, though.

Polio Vax Scene
Apr 5, 2009



Setting up screenshots and showing them off is a pretty big motivator, and you also get feedback from potential players.

One thing I like to do is define a list of short term goals using three word sentences. "Add enemy physics" "finish cutscene 2" and "improve weapon sounds".

Finally you can't get mired in feature creep, ask yourself what you want to do this hour and go straight for that, no diversions.

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

DrMelon posted:

Does anybody have any tips for staying motivated / keeping focus? I sometimes have a really cool thing I'd like to try out, but within about two days of starting the project, my enthusiasm dies off entirely and the project goes nowhere.

Clearly I'm doing something wrong, but I'm not sure what it is.
Set up some kind of forced "what you did today" tracker that you update. idonethis.com's kinda cool for that, but there are plenty of options. Even something as simple as a daily push to bitbucket.org works. Once you're doing that, you might find yourself working more, just so that your daily push/note isn't completely blank.

(using an online source control approach has the added benefit of helping you not forget to back your stuff up, too)

Don Mega
Nov 26, 2005
I recently started developing an online 2d rogue-like and have a few questions about network development. How much game logic should be done on the client vs the server? I know the less information the client knows the more secure it is but how much load can a server take before the game starts to lag? I am looking for a good ratio of security vs ease of programming. Over all security probably doesn't matter much because if my game breaks a hundred players I'll be surprised / happy. I am just trying not to go too complex too quickly and burn out.

Hubis
May 18, 2003

Boy, I wish we had one of those doomsday machines...

Don Mega posted:

I recently started developing an online 2d rogue-like and have a few questions about network development. How much game logic should be done on the client vs the server? I know the less information the client knows the more secure it is but how much load can a server take before the game starts to lag? I am looking for a good ratio of security vs ease of programming. Over all security probably doesn't matter much because if my game breaks a hundred players I'll be surprised / happy. I am just trying not to go too complex too quickly and burn out.

I would be surprised if a roguelike caused appreciable server lag. From a purely architectural/development standpoint, it's probably easiest to keep all the game logic on the server, and use a Model/View/Controller style interface where the client just serves as a view.

Don Mega
Nov 26, 2005
It will be more like a twitch based action rpg with sprites so there will be more computations than a traditional turn based rogue game. I will look into that though.

I Lost My Password
Nov 12, 2009

DrMelon posted:

Does anybody have any tips for staying motivated / keeping focus? I sometimes have a really cool thing I'd like to try out, but within about two days of starting the project, my enthusiasm dies off entirely and the project goes nowhere.

Clearly I'm doing something wrong, but I'm not sure what it is.

This is one of the biggest problems I have with solo projects. It is the perfect recipe for sitting by myself wallowing in self doubt. When I find that happening I tell my self: If I stop now I have nothing. In a year I will still have nothing and in five years I will have more of nothing. If I keep working, however slow, I will have that tiny bit more. In a year I will have a bit more than that and perhaps in five years I will have something cool that I made myself. But if I stop now I know I have nothing. I have to remind myself that cool stuff don't make itself and all the great things I love spent a crazy long time looking exactly like poo poo.

On days where I don't feel very inspired I do maintenance. Just getting something done, no matter how small, makes me feel a lot better about the project. My goal is to leave the project in a better state than when I started so when I do feel inspired I can just get down to work. This is some of my rainy day checklist.

Testing the game (play testing/bug testing)
Fix bugs I know about
Test the deployment. Does it work on other computers or just mine?
Refactor any messy code code
Give a demo to someone
Research my tools
Draw up any art I am missing. Programmer art is fine, just so long as I have something there.
Tidy up any art assets that I think could look less lovely.
Automate anything that can be.
Tell myself I should write some unit tests and then not do it.


Keeping focused while working alone is a non-trivial task and takes practice. The only advice I could give is just keep picking it back up and building the habit of returning to your work. You will get better at it and start producing larger projects.

Twobirds
Oct 17, 2000

The only talking mouse in all of Britannia.
I've been playing with using Python and libtcod, following the tutorial here. It's... actually kind of fun, I'm surprised at how easily I actually make something happen in Python (I only have a little programming experience). It's a great tutorial and got me rolling; I've managed to make a more complex dungeon generation system, implemented libtcod's A* pathfinding for monsters, and have a scrolling map.

Unfortunately the tutorial sticks to a single file for all the code (final version is here if you want to see it), which was driving me nuts - I spent half my coding time just scrolling to the right section. I've started trying to break it up, but it's a surprising amount of work and I'm worried I'm getting discouraged. Do you guys think such effort is worth it? At times it seems like I should just rewrite some of it to work in a multifile project, but I don't want to rewrite something that works already. I hope that isn't too vague.

This is a great thread, even if 90% of it is over my head, so thanks!

Hubis
May 18, 2003

Boy, I wish we had one of those doomsday machines...

Don Mega posted:

It will be more like a twitch based action rpg with sprites so there will be more computations than a traditional turn based rogue game. I will look into that though.

In that case, the standard FPS "dumb client" model is for the server to send the client updates about the state of the world, and for the server to do all the game logic -- but to share some of the physics/game code with the client so that it can "guess" what should happen for low-latency interactions (like collision, etc).

Hubis
May 18, 2003

Boy, I wish we had one of those doomsday machines...

Twobirds posted:

I've been playing with using Python and libtcod, following the tutorial here. It's... actually kind of fun, I'm surprised at how easily I actually make something happen in Python (I only have a little programming experience). It's a great tutorial and got me rolling; I've managed to make a more complex dungeon generation system, implemented libtcod's A* pathfinding for monsters, and have a scrolling map.

Unfortunately the tutorial sticks to a single file for all the code (final version is here if you want to see it), which was driving me nuts - I spent half my coding time just scrolling to the right section. I've started trying to break it up, but it's a surprising amount of work and I'm worried I'm getting discouraged. Do you guys think such effort is worth it? At times it seems like I should just rewrite some of it to work in a multifile project, but I don't want to rewrite something that works already. I hope that isn't too vague.

This is a great thread, even if 90% of it is over my head, so thanks!

It's definitely worth the effort, and you usually discover a lot about how your code is set up by doing so.

"Throw it away" is usually bad advice, but I find that when I am moving from a single file "toy" implementation to making it a real project, I tend to start with the files/structure I feel like I will need, and then start copying code out of my mega-file into it and refactoring appropriately. You'll probably find a lot of dependencies between systems that make things difficult, but this is a sign that you should re-factor that anyways and you'll end up with a code base that's a lot more ready for continued expansion when you are done.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

Hubis posted:

In that case, the standard FPS "dumb client" model is for the server to send the client updates about the state of the world, and for the server to do all the game logic -- but to share some of the physics/game code with the client so that it can "guess" what should happen for low-latency interactions (like collision, etc).
A common thing you can also employ in RPG type games is to have effects with animation times happen earlier on the server than they appear to happen on the client.

Paniolo
Oct 9, 2007

Heads will roll.

OneEightHundred posted:

A common thing you can also employ in RPG type games is to have effects with animation times happen earlier on the server than they appear to happen on the client.

http://downloads.bungie.net/presentations/David_Aldridge_Programming_Gameplay_Networking_Halo_final_pub.pptx

Highly recommended presentation on some of the tricks Bungie did in Halo: Reach to hide lag. Really it's just good overall reading for anyone doing netcode.

Adbot
ADBOT LOVES YOU

TastyShrimpPlatter
Dec 18, 2006

It's me, I'm the
I'm using Unity, and I'm implementing my own version of a command line interface, but I'm struggling with how I would block/wait for user input. My gut tells me I should be trying to emulate something along the lines of .NET's Console.Read(), which returns a string with the user's input.

I've got a solution that works in what feels like a really round-about way. I'm using coroutines to wait for user input, and when return is pressed, I set a private variable with the user input, and then access it after I call my Read() coroutine. It works, but it just feels messy.

Here's a stripped down version of what I have
code:
private string input;
private string keyboardInput;

private bool returnPressed = false;

void Start () 
{
	//initialize stuff
	StartCoroutine(StartGame());
}

void Update() 
{
	//Capture keyboard input (abbreviated for clarity)
	keyboardInput += Input.inputString;
}

private IEnumerator StartGame()
{
	WriteSomeText("Enter a value: ");
	yield return StartCoroutine(Read());
	string userInput = input;

	//Do stuff

	WriteSomeText("Enter another value: ");
	yield return StartCoroutine(Read());
	string userInput = input;

	//Do more stuff
}

private IEnumerator Read()
{
	input = "";
	keyboardInput = "";

	while(!returnPressed)
	{
		if(Input.GetKeyDown(KeyCode.Return))
		{
			returnPressed = true;
			input = keyboardInput;
		}
		yield return 0;
	}

	returnPressed = false;
}

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