|
Orzo posted:The anchor is always the center of the rectangle. Thanks for the input, seems like the solution to every problem is 'convert it to local coordinates' and work from there. Any other suggestions are welcome, I suppose I'll mess around with this on paper.
|
# ? Jan 12, 2011 19:58 |
|
|
# ? May 3, 2024 17:35 |
|
Not true, dragging one vertex moves the center towards that vertex by half the amount. e.g. a rectangle defined by (0,0) - (4,4) with no rotation, drag (4,4) to (8,8) and the center moves from (2,2) to (4,4)
|
# ? Jan 12, 2011 20:05 |
|
If that's how you choose to do it, sure. Doesn't seem like a great idea to have objects anchored by their center in every context except scaling, though. My way, if your rectangle was (0,0) - (4,4) with no rotation, if you drag (4,4) to (8,8) then the new rectangle would be (-4,-4) - (8,8) The downside of my way is you can't scale by a single pixel, the upside is you get a consistent interface where rotations, scalings and positionings are all based on the center. (And it's marginally less effort to code because it's consistent.)
|
# ? Jan 12, 2011 20:24 |
|
I don't understand what mean by 'except scaling'. The objects are defined by a center point, two rectangle edge sizes, and a rotation. This is the way the data is stored and has nothing to do with the level editor itself. You also seem to be suggesting that if a user drags one vertex, the opposite one moves by itself. This is exactly the behavior that I don't want, nor do I think anyone else would be happy with it.
|
# ? Jan 12, 2011 21:00 |
|
By "except scaling" I mean when you rotate the thing in the editor it's going to be rotating around the center point. When you move it, you're going to be moving it by the center point. When you scale it is the only time you're going to be interacting with it as if it's not anchored on its center point. But if you don't think your users will like it scaled from the center then don't scale it from the center, that's fine. I don't know what sort of entities you're considering - for me, I would rather game-monsters and other such moving objects scale from the center, but if I was making floors and things I'd probably want them to scale from the ... hell, I don't know, nothing really makes consistent sense for floors, because you'd want them to anchor from the other 'surface' side, while moving the surface, but that would give you no interface for thickening a piece of floor. So I wouldn't care between center or opposite-corner scaling, they'd both be equally frustrating.
|
# ? Jan 12, 2011 23:12 |
|
You make a good point, but indeed this is primarily for floors, walls, etc. I want to easily be able to drag vertices and have them snap to the grid, but I don't want to change a perfectly good data model.
|
# ? Jan 13, 2011 00:16 |
|
Wow, I just discovered Unity. I had heard you guys talking about it before, but never thought to give it much of a go. I guess I was stuck in that programmer, "Pfff... I'll just write it myself" mindset. You can probably guess the number of projects I've started that ended as soon as I had to figure out how to handle things like 'animation' or 'complexity of any kind.' I'm looking for some good resources on getting started, particularly those targeted at C# developers. The community is pretty good, but I thought I'd poke my nose in here as well.
|
# ? Jan 13, 2011 02:51 |
|
Orzo posted:You make a good point, but indeed this is primarily for floors, walls, etc. I want to easily be able to drag vertices and have them snap to the grid, but I don't want to change a perfectly good data model. code:
|
# ? Jan 13, 2011 03:12 |
|
I think the data model will allow for skewing as well, it just won't play as nice with resizing and snapping to the grid during editing. I understand what you're saying about skewing, but for your example, I'd rather just use two triangles and a square in the middle (a triangle will be a quad that (A) has half transparency and (B) has an underlying intersection model that's a triangle, rather than a rectangle). Not only is this a bit easier to work with, but I feel like a skewed floor would give you uglier graphics, while dedicated 'corner' sprites for the slope would end up looking better.
|
# ? Jan 13, 2011 03:32 |
|
Fair enough, good to see you've considered it, and you're right that (for steep slopes at least) dedicated shaping sprites will look a lot nicer.
|
# ? Jan 13, 2011 03:48 |
|
Pfhreak posted:Wow, I just discovered Unity. I had heard you guys talking about it before, but never thought to give it much of a go. I guess I was stuck in that programmer, "Pfff... I'll just write it myself" mindset. You can probably guess the number of projects I've started that ended as soon as I had to figure out how to handle things like 'animation' or 'complexity of any kind.' Woah, I think you might be me (and several other people reading these threads as well. I really want to get into Unity, but I always have trouble due to the lack of a good project or resources or something else. Maybe we could get in touch and help each-other out a little bit.
|
# ? Jan 13, 2011 03:51 |
|
roomforthetuna posted:Fair enough, good to see you've considered it, and you're right that (for steep slopes at least) dedicated shaping sprites will look a lot nicer.
|
# ? Jan 13, 2011 04:49 |
|
ambushsabre posted:Woah, I think you might be me (and several other people reading these threads as well. I really want to get into Unity, but I always have trouble due to the lack of a good project or resources or something else. Maybe we could get in touch and help each-other out a little bit. That pretty much describes me as well. Been wanting to get into Unity, but I'm completely void of any imagination at the moment so I pretty much sit down and go "okay, today I'll try making... uh.. nevermind". I do 3D character modelling too, so I could even try whipping up some resources if that sounds interesting!
|
# ? Jan 13, 2011 18:50 |
|
I hesitate to start a collaborative project with goons, we know how those end... But it might be fun to all try and build a similar style of game together and share some of the pains and Aha! moments. My friend and I were going to start with a shmup, maybe with an aquatic theme because shmups are pretty basic games. So I'd invite you both to get started with one as well. The issue I'm running into with Unity is that there doesn't seem to be a consistent user story for how to appropriately collaborate with the free version. I'm used to working with SVN, but all the resources I've found online suggest that SVN and Unity do not play well together. People have been suggesting dropbox as well, but others suggest that is a maniac idea. The 'team' I'll be a part of is just me doing developing and my friend doing modelling and sound, so we won't be walking over each other as far as assets are concerned. Does anyone have a decent collaboration workflow for Unity out there? (Or can assuage my fears about using SVN?) Ideally the workflow will have a minimum number of steps, as my artist friend isn't necessarily as savvy to source control as I am.
|
# ? Jan 13, 2011 21:07 |
|
Pfhreak posted:The issue I'm running into with Unity is that there doesn't seem to be a consistent user story for how to appropriately collaborate with the free version. I'm used to working with SVN, but all the resources I've found online suggest that SVN and Unity do not play well together. People have been suggesting dropbox as well, but others suggest that is a maniac idea. Just dropping in quickly to give my advice regarding SVN and Unity. I worked on a project of 7 people using Unity and SVN and the only caveat was there was a folder called "Library" that contained a bunch of weird Unity-specific files that caused some sort of mess. I didn't personally look into it so I don't know all the specifics, but we got around it apparently by zipping up the Library folder whenever we made changes that affected it and everyone could unzip it on their end. It was kind of a pain in the rear end, especially because only one person could make "library" changes at a time, but it might be a decent solution for a dynamic duo instead of a sizable team.
|
# ? Jan 13, 2011 21:57 |
|
I'm trying to figure out the best way to tell my UI system what a button should do when it is clicked. Right now the button has a delegate member that is assigned during construction and called when the button is clicked. Currently the delegate has no arguments, but I want to add buttons that will need at least one parameter for the click event. This would require delegates with new signatures, some code to tell which signature to use, fields for the different possible parameter types...it feels like there should be a better way to do this. I could probably use a catch-all signature that would have nulls passed to unneeded parameters, but I still feel like I'm missing something.
|
# ? Jan 14, 2011 01:28 |
|
nibe posted:I'm trying to figure out the best way to tell my UI system what a button should do when it is clicked. Right now the button has a delegate member that is assigned during construction and called when the button is clicked. Currently the delegate has no arguments, but I want to add buttons that will need at least one parameter for the click event. This would require delegates with new signatures, some code to tell which signature to use, fields for the different possible parameter types...it feels like there should be a better way to do this. I could probably use a catch-all signature that would have nulls passed to unneeded parameters, but I still feel like I'm missing something. Why would two different buttons need two different delegate patterns? Also, this is why WinForms uses the pattern where the delegates look like void MyClickHandler (object button, ClickEventArgs args) so that you can change ClickEventArgs to add new fields, etc., without having to change the delegate pattern.
|
# ? Jan 14, 2011 02:05 |
|
Ugg boots posted:Why would two different buttons need two different delegate patterns? Also, this is why WinForms uses the pattern where the delegates look like void MyClickHandler (object button, ClickEventArgs args) so that you can change ClickEventArgs to add new fields, etc., without having to change the delegate pattern. But maybe I just need to understand delegates better. In your example, why is the button passed in the function? In my code the definition of the delegate is in the Button class, and I create functions elsewhere that are passed to the Button on instantiation, and stored in the delegate. As I mentioned, they don't have any parameters right now. When the Button decides it was clicked, it calls its delegate. Based on what you posted, it looks like WinForms does it differently.
|
# ? Jan 14, 2011 02:55 |
|
The best way to handle something like this depends partly on what language support you have for various things. Are you working in C#?
|
# ? Jan 14, 2011 16:35 |
|
nibe posted:One button might perform a simple function that doesn't need any arguments, and another button might "spawn x," where I would like to pass x to the delegate. I don't know much about delegates and how you're supposed to use them so I could be doing it wrong. I haven't used WinForms, but that pattern seems like a better version of my catch-all idea. I've written my own UI (twice) for windows and xbox, so I can try to answer some. Often passing the button in to the function isn't useful and you can ignore it, but sometimes you want to have different behaviour based on which button was used to trigger the delegate (maybe theres 2 or 3 buttons for the same task in various windows). Or you might want to adjust the button to display some indication that an action was recieved. All of my widgets are set up to fire events which have an event code, and a parameter struct much like the ClickEventArgs example above. When a button is clicked, it tells a global EventManager to trigger event X, which in turns notifies anything that wants to be told about event X's (typical producer/consumer deal). This lets the widgets not really care about what object they need to be hooked up to etc.
|
# ? Jan 14, 2011 16:49 |
|
It will also help you a lot, if you haven't done it, to give the button its own ability to do basic state changes in response to clicks (changing highlight or image, etc) and handle mousedown/tracking rect/mouseup or cancel rather than trying to handle all that in backend code.
|
# ? Jan 14, 2011 16:52 |
|
nibe posted:One button might perform a simple function that doesn't need any arguments, and another button might "spawn x," where I would like to pass x to the delegate. If button #1 does something that doesn't need X and button #2 does something that does need X, X should be part of the scope of the code subscribing to the click event, not part of the delegate signature. For example: code:
quote:But maybe I just need to understand delegates better. In your example, why is the button passed in the function? In my code the definition of the delegate is in the Button class, and I create functions elsewhere that are passed to the Button on instantiation, and stored in the delegate. As I mentioned, they don't have any parameters right now. When the Button decides it was clicked, it calls its delegate. Based on what you posted, it looks like WinForms does it differently. Hopefully this makes sense, I can clear it up more if you want. In general though the Winforms event handlers are poorly designed and I don't blame you for being confused about designing your own delegates when Winforms are your reference.
|
# ? Jan 14, 2011 16:58 |
|
Bizarro Buddha posted:The best way to handle something like this depends partly on what language support you have for various things. Are you working in C#? Orzo posted:Hopefully this makes sense, I can clear it up more if you want. In general though the Winforms event handlers are poorly designed and I don't blame you for being confused about designing your own delegates when Winforms are your reference. code:
edit: vvv Oh, I get it now, ok. That would work. nibe fucked around with this message at 21:30 on Jan 14, 2011 |
# ? Jan 14, 2011 20:08 |
|
Orzo is right that lambdas are a good way to do this. That means that your delegate type will take no arguments, but you dynamically generate new functions to set as delegates on buttons.code:
|
# ? Jan 14, 2011 20:13 |
|
I'm sure this is a typical and overdone question, but here goes. So we want to make a game. We have plans for a larger game (still a relatively simple one, but may involve some basic 3D), but for now to get started we are making a simple War style card game. Just to get some work under our belt. The problem is we're all artists...so we have the art down, but I figured I'd give my hand at coding a simple game. I'm not a programmer, but I have some very rudimentary understanding of code so the concept itself isn't utterly foreign to me. The War game is our proof of concept and we wanted to do it for phones/windows. I decided that XNA/App Hub was the way to go since it seems to have a decent ecosystem to learn in. I installed all the tools they offer but goddamn I just don't even know what's what. Am I utterly doomed? Is there somewhere that gives a good actual beginners walk through to this stuff? Should I just hire actual programmers? edit: As a further example of what I'm asking for...Channel9.com has a good video series/course about making your very first Windows Phone 7 app. http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Series-Introduction It really is for "absolute beginners" and basically treats you like a baby at first. That's what I need. I'm sure that series will help generally, but I'm looking for something a little more game related. BonoMan fucked around with this message at 02:15 on Jan 17, 2011 |
# ? Jan 17, 2011 01:20 |
|
BonoMan posted:Should I just hire actual programmers? As a designer what would you think if I said something like: I have made a game, the functionality is all there but it doesn't look very pretty. I'm thinking of buying photoshop and playing around. I'm looking for some tutorials on the web that'll show me how to make some art, step by step. I think with a few months of messing around my art will be good enough. You'd be thinking 'oh god he has no idea what is involved in making things look good', and my art would probably be garbage.
|
# ? Jan 17, 2011 03:09 |
|
iopred posted:As a designer what would you think if I said something like: Yeah true. But since it wasn't completely foreign to me and something I wanted to try, I figured I'd give it a shot. And by give it a shot I mean spend a considerable amount of time trying to learn. I'm talking year or two...not months.
|
# ? Jan 17, 2011 03:11 |
|
If your goal is to make money then I think you should keep your team small. 3 people max, really. Otherwise it's tougher to communicate between multiple people who have different levels of involvement and motivation, people start fighting eventually about who owns what, drama unfolds, yadeya. If you can manage with a smaller group than that's smart and when the money comes in you'll have less mouths to feed. That ship may have already sailed for your project though. If it's just for fun though then yeah "hire" a programmer.
|
# ? Jan 17, 2011 03:24 |
|
Vino posted:If your goal is to make money then I think you should keep your team small. 3 people max, really. Otherwise it's tougher to communicate between multiple people who have different levels of involvement and motivation, people start fighting eventually about who owns what, drama unfolds, yadeya. If you can manage with a smaller group than that's smart and when the money comes in you'll have less mouths to feed. That ship may have already sailed for your project though. Yeah it's really just for fun and experience. The team is only 3 or 4 people and it's honestly just a supplemental thing to a larger (already handled) project.
|
# ? Jan 17, 2011 03:26 |
|
Just use Unity3D, it's pretty easy to get into and is designed to be easy to get into, I know at least 3 different ex or current industry artists who have made their own games through it, including one who had a lot of success as an indie with an iOS title. It costs money to get iPhone or Android licenses though and a significantly larger sum to get the Pro version and the pro versions of the smartphone export stuff. I think the idea that you need dedicated programmers for hobby projects that don't have some tech basis is rapidly becoming outdated, it just requires the people taking over that role to put in more work than someone who's heavily experienced in it. You can totally avoid a large majority of the complicated 3D math, specific API and optimisation knowledge thanks to prebuilt solutions like Unity or Shiva or even flixel/flashpunk.
|
# ? Jan 17, 2011 17:17 |
|
Oh wow. Totally going to look into that. Could be just what we need! Thanks a ton!
|
# ? Jan 17, 2011 18:15 |
|
I've got a problem that seems to come up a lot. I'll explain the latest example: So I've got a game with several player teams. Each team has some cities, and some units. And of course the game takes place on a map with tiles. The teams keep track of which units and cities they own. The units and cities keep track of which tiles they're on. Now let's say I have a unit, and I want to know what team its on. One solution would be to look through every unit of every team until I find a match, but that introduces performance issues. More importantly, it requires that I pass around the master list of teams to everything that's going to require this information, or some class which holds the list and can do the look up, which is just very messy and annoying. Add to this the looking up of city teams, and what units and cities are on a given tile, and it gets messy pretty fast. Another solution would be to have every unit remember what team it's on, but that lets bugs creep in because it's possible for the program to be in a state where the unit thinks it's part of team A while team A doesn't think it owns the unit. If I'm careful this won't happen, but the possibility is there, especially with the unit - tile relationship and the units moving around and dieing. This seems like a fairly common class of problem that I've run into. I've got four examples of it in this one program (Unit-Team, City-Team, Unit-Tile, City-Tile), and I've ran into it before, usually using one of the above two solutions. I'm thinking about some better ways to solve this with interfaces, but before I go for that I figured it would be a good idea to post about it here to see if anyone else has encountered this and how they solved it, or if they have any ideas.
|
# ? Jan 18, 2011 21:07 |
|
Pretty much every non-trivial game engine ends up with lots of parallel data structures affording optimised lookup of entity relationships (spatial, logical, structural, behavioural, resource usage, etc). Keeping track of these to ensure the indices/references don't get muddled is one of the inescapable challenges. Unit tests are your friend here.
|
# ? Jan 18, 2011 21:26 |
|
It seems like the problem is something unit tests wouldn't be so great at covering--namely, if Team A has a reference to Unit X and some data structure elsewhere indicates that Unit X doesn't have a reference Team A, there's a bug. And it sounds like an integration bug. Although I don't have too much experience with this type of thing, it sounds like the biggest concern is that client code might introduce an error--for example, you might transfer a unit from Team A to Team B and forget to update the additional data structures. To solve this problem, you might want to introduce some sort of manager through which ALL of these operations are performed, so that you won't (and can't) 'forget' to update the extra structures.
|
# ? Jan 18, 2011 21:56 |
|
HappyHippo posted:Another solution would be to have every unit remember what team it's on, but that lets bugs creep in because it's possible for the program to be in a state where the unit thinks it's part of team A while team A doesn't think it owns the unit. If I'm careful this won't happen, but the possibility is there, especially with the unit - tile relationship and the units moving around and dieing. It does give you more opportunity for bugs if every time something updates it has to be updated in five different places, but you should be boiling that update action down into one function anyway. Also, it seems weird to me to have teams bother to remember what units are on them - when do you need to do an action on an entire team? Is it really critical that such a lookup not be a mere 6 times slower [do you have 6 teams?] It makes a lot more sense to me to have the unit store what team it's on, because that's the way round you'd be needing to check most often. (eg. when you click a unit, you'd first find the unit hopefully from some sort of location-based lookup, then you'd need to know what team it's on.) The only reason I can think of to have the team store a list too is if there's a big performance saving during rendering by rendering all the guys with color scheme A first then all the guys with color scheme B, saving on changing a setting back and forth - and I really don't think the performance loss of just going through the whole list of units 6 (?) times, once for each color, would be that bad. (Unless you have thousands of units per team.)
|
# ? Jan 18, 2011 21:57 |
|
Orzo posted:It seems like the problem is something unit tests wouldn't be so great at covering--namely, if Team A has a reference to Unit X and some data structure elsewhere indicates that Unit X doesn't have a reference Team A, there's a bug. And it sounds like an integration bug. The unit test for that method (preferably written first a la TDD) verifies that the post-conditions of calling it are what you expect. You write unit tests against methods, not raw data structures.
|
# ? Jan 18, 2011 22:02 |
|
Yes, you can write unit tests for what I suggested, I was referring to the original problem, where the updates were called all over the place.
|
# ? Jan 18, 2011 22:10 |
|
Sorry, I got confused 'tween posters - long day. Yeah, that's just code at high risk of bug rot over time regardless of anything else.
|
# ? Jan 18, 2011 22:14 |
|
Yeah it looks like that's what I'll have to do. It's just kind of annoying because I'll basically be coding the same pattern 4 times over (well almost, cities don't move between tiles, although they can be destroyed).
|
# ? Jan 18, 2011 22:34 |
|
|
# ? May 3, 2024 17:35 |
|
Why are you coding the same pattern 4 times? What language are you using?
|
# ? Jan 18, 2011 22:36 |