|
Possibly a dumb question! I'm using Unity and C#, and I have a situation where I want to trigger an event if my character moves within 5 meters of a certain object, but have the object itself only have a collision radius of one meter. I thought I'd solved it by creating the object with just the collision, and then giving it an invisible child object with just a trigger and no collision. So my hierarchy looks like this: code:
I've tried using this, which seems to be the accepted way to get a gameObject's parent: code:
code:
Or is there a way to sidestep the issue entirely and give an object a trigger radius that's larger than its collision radius, so that I can do away with PlutocratTriggers? (I haven't found one, but I only started using Unity this week.) e: unbreaking the tables, sorry!
|
# ? Nov 16, 2012 20:21 |
|
|
# ? May 25, 2024 01:06 |
I know nothing about Unity and this is more a C# answer but can you cast Transform into a Plutocrat? ((Plutocrat)myParent).getEnergy();
|
|
# ? Nov 16, 2012 20:46 |
|
Manslaughter posted:I know nothing about Unity and this is more a C# answer but can you cast Transform into a Plutocrat?
|
# ? Nov 17, 2012 02:48 |
|
If you are trying to call a method from another script you need to use GetComponent to get access to the script. Right now you are trying to access the method on the transform, and the transform itself has no methods to access.code:
code:
Also you may need to get the gameObject of the parent, as if I remember right parent returns the transform. it would just be "myparent.gameObject" if that is the case. Bondematt fucked around with this message at 03:54 on Nov 17, 2012 |
# ? Nov 17, 2012 03:45 |
|
Bondematt posted:
But in C# you can also do myParent.GetComponent<Plutocrat>().GetEnergy() which is a little bit less verbose and awkward.
|
# ? Nov 17, 2012 03:54 |
|
Awesome. Thank you guys. This is really Baby's First Unity Game but I at least want to make it playable!
|
# ? Nov 17, 2012 04:27 |
Bondematt posted:
I think GetComponent() is slow as poo poo. If you're going to be using it often, you probably want to store a reference in a variable. Centripetal Horse fucked around with this message at 23:55 on Nov 17, 2012 |
|
# ? Nov 17, 2012 19:37 |
|
I'm pretty interested in game development, and for the last week have been doing python and java tutorials. I just wanted to get a feel for where you guys started, since I'm in the midst of programming a text adventure from the command line and want to know if I've got a good start.
|
# ? Nov 17, 2012 20:52 |
|
Ryen Deckard posted:I'm pretty interested in game development, and for the last week have been doing python and java tutorials. I just wanted to get a feel for where you guys started, since I'm in the midst of programming a text adventure from the command line and want to know if I've got a good start. I would say a pretty large number of professional game developers started in exactly that same way. For me, the progression was text-based number games, then text-based CYOA games, then top-down shooters with ASCII graphics - all in QBASIC. Next game I made was a 2-player Tron lightcycle game in C, then a weird 3D tetris type game in OpenGL and C++, and then a lot of misc tech demos and half-finished game engines. Feels weird describing a 12 year progression in a single paragraph. But anyway, as long as you're making something that you are learning from, you're on the right track.
|
# ? Nov 17, 2012 20:58 |
|
Ryen Deckard posted:I'm pretty interested in game development, and for the last week have been doing python and java tutorials. I just wanted to get a feel for where you guys started, since I'm in the midst of programming a text adventure from the command line and want to know if I've got a good start. Next step from that for me was picking some simple graphics drawing, input handling, sound playing library. Try Pyglet or Slick2d. Former is for Python, latter for Java. After that (I'm more or less at this step, even though I've done some simple opengl stuff) I'd say that you should pick up some real game engine like Unity3d, because who the hell except John Carmack makes their own engines these days.
|
# ? Nov 17, 2012 21:24 |
|
Thanks for the responses, I did about a week straight of tutorials (learn python the hard way, then java for total beginners, then thenewboston videos) then decided to try and make a game. I keep throwing new problems at myself that I don't know yet, so I feel like I got that learning thing down pat.SnowblindFatal posted:Next step from that for me was picking some simple graphics drawing, input handling, sound playing library. Right now, I want to get this text game going, then I'll try out Slick2d. I want to stick with Java for the time being since I'm going to college for Computer Science and want to end up with a java development job first and foremost. Don't want to work for the game industry after hearing too many horror stories, would rather do this as a hobby. I'll try out Slick2d after I feel I've got a decent grasp of arrays, switches, etc. I don't want to add more libraries to my repertoire until I'm comfortable with the baseline java. Edit: There is no way I will be coding my own 3d engine, but I would like to give my own 2d engine a shot. I might try a basic 3d engine down the line though, because I would really love to have something like even a rudimentary 3d engine in my resume.
|
# ? Nov 17, 2012 22:06 |
|
Hey, another wannabe game maker here. I've got my heart set on making something for iOS, and I've started fiddling around with Core Graphics stuff, but this "Unity" thing is apparently the way to go, right? Is it possible to at least try out the engine on actual devices without paying some kind of licensing fee, or is that only for PC stuff?
|
# ? Nov 18, 2012 02:24 |
|
http://unityvs.com/ Just started using this and I love it; debugging unity in visual studio! Beautiful.
|
# ? Nov 18, 2012 02:36 |
|
Unormal posted:http://unityvs.com/
|
# ? Nov 18, 2012 18:35 |
|
Was really hoping I could keep going without asking for help, but looks like I'm stuck. Before I catch any flak, I have been programming for a week and I know this code is probably terrible, but I just want it to be functional at this point as I keep learning. Anyway, I can't seem to get my room1 function to keep looping and accepting inputs while you are still in that room. http://pastebin.com/cineCNPU If anybody can help me out here, I would really appreciate it, since I am totally lost. Edit: I didn't add any other classes since they're all working fine, the error is that the code will just keep pulling inputs after the first one, and never return. Ryen Deckard fucked around with this message at 20:40 on Nov 18, 2012 |
# ? Nov 18, 2012 20:34 |
|
First of all, you keep looping when first is true, but you never set it otherwise. Was that meant to be an if statement? Second, you make the classic mistake of assignment vs. comparison (= vs. ==) in your torch loop.
|
# ? Nov 18, 2012 20:42 |
|
Ryen Deckard posted:Was really hoping I could keep going without asking for help, but looks like I'm stuck. Learn to use a debugger, dude. It's the best advice anyone can possibly give you; it's the programming equivalent of teaching a man to fish. Shalinor posted:Ok, so this wouldn't work if you're using the Unity UI heavily, but... jesus. This plus Futile must be an absolute dream, as far as "making Unity act like any other multiplatform engine." That looks sweet, but $125 with no demo is pretty steep for hobby work.
|
# ? Nov 18, 2012 20:44 |
|
I'm not a java programmer, but in addition to what Suspicious Dish already said this part looks problematic:Java code:
Java code:
PDP-1 fucked around with this message at 20:57 on Nov 18, 2012 |
# ? Nov 18, 2012 20:46 |
|
Paniolo posted:That looks sweet, but $125 with no demo is pretty steep for hobby work.
|
# ? Nov 18, 2012 21:03 |
|
I fixed the issues you guys pointed out above, and updated the paste. I don't want to poo poo up this thread, but if anybody can send me a pm with advice that would be fantastic. Regarding the debugger, I'm using eclipse, and just found out that it includes a debugger so I'll be reading up on that. Thanks.
|
# ? Nov 18, 2012 21:07 |
|
The Gripper posted:That's my thoughts about it too. I like the VS UI and debugger, would love to use something like UnityVS, but it's something I'm not willing to pay $125 for just on hobby projects. I don't think even a demo would do much to sway me. Yeah, it's pricey; but for the amount of hours I spend wanting to strangle Unity, it was worth it for me to at least feel enraged in a nice IDE. They'd probably be doing themselves a huge favor to release a $20 or $30 "indie" version though.
|
# ? Nov 19, 2012 00:38 |
|
I'd imagine at a $25-35 price-tag for individuals they'd make a lot more money out of it too. It'd probably make the non-individual license price look overpriced, though, so I guess that's a consideration.
|
# ? Nov 19, 2012 00:42 |
|
Ryen Deckard posted:I fixed the issues you guys pointed out above, and updated the paste. I don't want to poo poo up this thread, but if anybody can send me a pm with advice that would be fantastic. I don't have PM, but you can email me at (my username)@msn.com The main thing I see occuring is when the user changes input from "go left" to "open door" or "go right" it will fail the "go left" check and never get to those encapsulated if statements. You are also assigning torch to true in an if instead of comparing the values. To avoid this it is best to just use the bool and no comparison as the bool is true or false already. And this while loop can be done with an if code:
code:
code:
I'd also recommend placing comments on what it should be doing as you go through. It helps a lot with logic especially when things get complex. The best part is it makes it so when you have a fresh set of eyes they know what you are trying to accomplish. Definitely learn to use the debugger as it is probably throwing fits right now.
|
# ? Nov 19, 2012 01:52 |
|
Bondematt posted:I don't have PM, but you can email me at (my username)@msn.com I appreciate this, and I might e-mail you later. I actually solved all the issues I was having on my own, and I think I'm done with this project now. The engine works properly, now all I need to do is add rooms and enemies to fight, but that would take this from a "can I make a working game" to "make an entire text adventure" and I just wanted to prove to myself that I could get an engine running. I really do appreciate the tips though, as that's all stuff I didn't know and it's good to see I can make my code more efficient.
|
# ? Nov 19, 2012 02:42 |
|
Vivian Darkbloom posted:Sooo, I'd really like to make a Paradox-style game, only turn based and with all my own mechanics. Paradox games are strategy games with maps like this, where you control a country in a historical setting: I've started playing around with this project. Is there any recommended way to make a province map, where the provinces are irregular shapes instead of tiles or hexes? I guess I'll need to make a digital copy of my province map and get it into pygame somehow. e: I'm using PyGame! I thought of maybe drawing all the borders between provinces as vectors and writing some code to infer the provinces from those lines? I'd prefer not to do this with a big ol' bitmap, even though it's a 2D game. Vivian Darkbloom fucked around with this message at 16:14 on Nov 19, 2012 |
# ? Nov 19, 2012 15:56 |
|
Vivian Darkbloom posted:I've started playing around with this project. Is there any recommended way to make a province map, where the provinces are irregular shapes instead of tiles or hexes? I guess I'll need to make a digital copy of my province map and get it into pygame somehow. I was working on a game project that did this same basic thing, and was storing the territories as a collection of points, but as I was driving around the other day in the car, it dawned on me that something like a Flood Fill algorithm probably would have been a lot faster. Could even save the results as your "map" file. So - select a point, flood fill to find the limits of the territory and there you go. Assuming your territories are actually closed, that is.
|
# ? Nov 19, 2012 16:46 |
|
Vivian Darkbloom posted:I've started playing around with this project. Is there any recommended way to make a province map, where the provinces are irregular shapes instead of tiles or hexes? I guess I'll need to make a digital copy of my province map and get it into pygame somehow. One of the worst things about pygame imo is the inability to draw textured (or even solid) n-dimensional polygons of any shape. The only way you could do it is probably just create the maps dynamically via some kinda.. maybe voronai algorithm subdivided with some random noise displacement added? That might give the best result, dunno though! If you did that, however, you'd be stuck with just lines, no color fills, unless there's an extension for pygame that can draw triangle strips/fans/whatnot, but I haven't found any. Edit: vvvv Holy poo poo, I can't believe my way is actually how they seemingly do it. That's kickass. Jewel fucked around with this message at 16:53 on Nov 19, 2012 |
# ? Nov 19, 2012 16:46 |
|
Vivian Darkbloom posted:I've started playing around with this project. Is there any recommended way to make a province map, where the provinces are irregular shapes instead of tiles or hexes? I guess I'll need to make a digital copy of my province map and get it into pygame somehow. I bastardized this tutorial: http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/ In order to create a map generation system similar to a paradox style map: http://devblog.phillipspiess.com/projects/mapgen/ (Click the map and use the arrow keys to show different modes.) I'm totally available via PM or whatever if you have any questions.
|
# ? Nov 19, 2012 16:47 |
|
What's the preferred JSON parser for Unity? I'm using MiniJSON right now, but it's got some performance issues with larger files. (Bonus if it works with Unity Android/iPhone as well.)
|
# ? Nov 19, 2012 17:44 |
|
Pfhreak posted:I bastardized this tutorial: http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/ Awesome, thank you! I will be going through that closely.
|
# ? Nov 19, 2012 18:45 |
|
Jewel posted:One of the worst things about pygame imo is the inability to draw textured (or even solid) n-dimensional polygons of any shape. http://www.pygame.org/docs/ref/draw.html#pygame.draw.polygon ? edit: this is only solid, but you could maybe fake textured polys by maybe making a surface, blitting the texture to it, then blitting a solid poly over that with the color key set to the color of the poly. Bunny Cuddlin fucked around with this message at 20:48 on Nov 19, 2012 |
# ? Nov 19, 2012 20:31 |
|
Jewel posted:One of the worst things about pygame imo is the inability to draw textured (or even solid) n-dimensional polygons of any shape. n-sided surely! A note to the guy that was asking about Agile junk a while back, I've recently discovered that my breakdown into small components to work on, while helpful for the most part, was inadequately small chunks when it comes to client-server (or peer-to-peer) communication. I think when breaking down that sort of thing, where you're inevitably implementing the same thing twice (once for what to send, once for what to do with it), it's helpful to break it right down to that level - "client sends XYZ / server receives XYZ / server parses XYZ / server puts XYZ-based data into database / server replies with ABC / client receives ABC / client parses ABC". Not only does having this written out help you not forget to implement a piece of the communication because you got distracted by another piece, but it also helps you spot if you're going to be missing some vital information before you start.
|
# ? Nov 19, 2012 20:51 |
|
Bunny Cuddlin posted:http://www.pygame.org/docs/ref/draw.html#pygame.draw.polygon ? Here's some code to demonstrate the edit: Python code:
Bunny Cuddlin fucked around with this message at 21:03 on Nov 19, 2012 |
# ? Nov 19, 2012 21:01 |
|
The futile/Unityvs stack looks like something that would get me interested in unity again, but yeah, $125 is too steep for me. $30 or so would be a different story!
|
# ? Nov 19, 2012 23:00 |
Unormal posted:Yeah, it's pricey; but for the amount of hours I spend wanting to strangle Unity, it was worth it for me to at least feel enraged in a nice IDE. They'd probably be doing themselves a huge favor to release a $20 or $30 "indie" version though. Speaking of strangling Unity, I spent this past weekend cranking out a few hundred lines of code, perfecting some particle effects, and adding objects to a scene, only to have Unity turn my work into vapor. I saved constantly while working, but as soon as I closed Unity, everything disappeared. All my scripts, which were opened and edited in Mono, are gone (all I can find are old version), my scene reverted back to what it was at the beginning of the week, my particles and other objects are simply gone... I started a thread on the Unity support forum, but drat... How the gently caress does that happen? No warnings that I am saving to a temp folder, or that my changes are not going to stick, or something? Just let me work for almost three straight days, then set fire to all my changes when I close the IDE?
|
|
# ? Nov 19, 2012 23:26 |
|
Bunny Cuddlin posted:http://www.pygame.org/docs/ref/draw.html#pygame.draw.polygon ? Ahah, oh, woah, thanks. I don't quite remember that existing, hmh. roomforthetuna posted:
|
# ? Nov 20, 2012 02:38 |
|
Relatively straightforward question for folks proficient with Unity: is there a straightforward means to load a music file into an audio source at runtime? So far the closest thing I've found to a solution is using WWW to load up the file like so (using C#):code:
|
# ? Nov 20, 2012 03:09 |
|
Centripetal Horse posted:Speaking of strangling Unity, I spent this past weekend cranking out a few hundred lines of code, perfecting some particle effects, and adding objects to a scene, only to have Unity turn my work into vapor. I saved constantly while working, but as soon as I closed Unity, everything disappeared. All my scripts, which were opened and edited in Mono, are gone (all I can find are old version), my scene reverted back to what it was at the beginning of the week, my particles and other objects are simply gone... I started a thread on the Unity support forum, but drat... How the gently caress does that happen? No warnings that I am saving to a temp folder, or that my changes are not going to stick, or something? Just let me work for almost three straight days, then set fire to all my changes when I close the IDE? Unity always saves your work to the actual files, not some temporary location. This seems really really weird. Unity does not keep older versions of the project around and there is no inbuilt local VCS. I have no idea how this could happen at all. Did you run a windows rollback or a time machine restore or something?
|
# ? Nov 20, 2012 06:03 |
|
Mo_Steel posted:Is there a pay feature to unlock that functionality for PC platform games, or another method to import audio files specified by the user during runtime? Didn't see anything on the Asset Store. The top answer here has an explanation and two workarounds: http://answers.unity3d.com/questions/168678/why-mp3-cant-work-on-webstandalone.html?sort=oldest And I think there's a price to pay if you distribute over 5000 units: http://mp3licensing.com/royalty/games.html
|
# ? Nov 20, 2012 06:22 |
|
|
# ? May 25, 2024 01:06 |
|
Strumpy posted:Unity always saves your work to the actual files, not some temporary location. This seems really really weird. Unity does not keep older versions of the project around and there is no inbuilt local VCS. I have no idea how this could happen at all. Did you run a windows rollback or a time machine restore or something? It could also possibly happen if your project directory is in %USERNAME% or %APPDATA% and for some reason your system has loaded you into a temporary profile. In that case you could check C:\Users\ for any temporary users (I think they're named <YourUsername>.<RandomCharacters> e.g. "CentripetalHorse.dghsd"). I'm not sure whether that would have you working on a separate copy of your unity project, but it can't hurt to check.
|
# ? Nov 20, 2012 08:32 |