Area – description/rules
Posted: August 12, 2012 Filed under: Uncategorized 2 Comments »so here’s a game that was played during breaks when I was at primary school, it’s really fun and I’ve not seen it anywhere else (even on the net) so here it is:
What you need:
- 1 netball court (nets not required)
- 1 tennis ball
- 2 or more people (preferably more, like 8, but many, MANY people can be fun too!)
Area is a team game, each team takes an opposite third of the court and takes turns trying to throw a tennis ball into the other team’s semi-circle for points.
Rules:
here’s a picture of the court:
I’ve coloured the team zones, one team takes red and the other team takes blue.
- To take a turn, a team member throws a ball from inside their team’s zone, and aims for the ball to land in the other team’s semi-circle. a point is scored if the ball touches the court inside a semi-circle (if a player drops the ball in their own team’s semi-circle, the other team scores a point).
- players must try to defend their semi-circle by catching or blocking the ball.
- if players throw the ball when outside their team’s zone it is a foul (so long as some part of their body is touching their team’s zone they are safe)
- when a player fouls, the other team takes a point and it is then their turn.
- No player should ever leave their team’s zone unless the ball is out of bounds.
- the ball is out of bounds if it’s anywhere other than one of the team zones (that means the center third of the court, or anywhere outside of the court.
- when the ball is out of bounds both teams can leave their zone and try and take the ball, when a player gets the ball then it is then their team’s turn and all players must return to their zone (no wrestling the ball from people!).
- players must never enter the other team’s zone, even if the ball is out of bounds.
- To start the game, place the ball in the center of the court and have all players enter their zones. each team agrees to all count from 3 to 0 together, and at 0 the game begins. since the ball starts out of bounds, the first team to rush out and claim it gets the first turn.
- the game ends when an agreed amount of time has passed or a certain score is reached (for us it was game-over when break time ended 😉 ). the team with the highest score wins.
Notes, variations & suggestions:
- as an alternative foul penalty, let the other team take a penalty shot, where they are allowed to throw from inside the center third of the court.
- Players on a team don’t have to take turns when throwing, teams decide amongst themselves who throws next, or players can throw the moment they catch the ball if they think it will help the team.
- try faking out the other team by letting them think a different player has the ball and throw when they aren’t ready.
- any throw is valid, low, high, under-arm, over-arm, fast, slow, rolling, bouncing etc.
- indoor courts are fine, but if you play on an outdoor court you can do sky throws if you’re good enough. 😉
- if a ball is lost (it lands in a busy street or into that garden with the big dog) the game is over, unless you have another ball in which case it’s the turn of whichever team didn’t lose the ball
- more players make the game more interesting! in some games half the fun is misleading the other team, and you can be more elaborate doing that with more players 🙂
I do recommend giving this game a try if you have a few people and a netball court handy. 🙂
finally, if you know this game by another name, please let me know!
Super-fast input in Unity!
Posted: July 23, 2012 Filed under: Techy stuff | Tags: swift*stitch 10 Comments »So ever since I mentioned that for SWIFT☆STITCH, I had input that was independent of framerate, I rarely go a few days  without somebody asking just how I did it, so to save myself lots of typing in the future, here’s the explanation 🙂
(UPDATE: Whilst this approach is an improvement on regular input in unity, it seems you can’t know what time inputs occurred at exactly, see here)
Why do it?
So here’s the thing, most input in unity is updated at the same rate as frames are drawn. here’s the rough process as simple as I can put it:
- Unity collects all the user’s inputs, and updates the Input class accordingly
- Unity runs your Update() functions, then draws a frame.
- Unity clears the Input class, and we go back to step 1
this means that when you ask for ‘Input.GetKeyDown(“space”)‘ you are asking if the space key has been pressed since the last frame. (which is why you shouldn’t look for such input in FixedUpdate() or OnGUI(), since it happens independent of framerate and you can miss it).
this is all fine and super cool (really!), so why would you ever need input to work any other way? well, what if you want user to be able to play the game faster than it is drawn?  in the case of SWIFT☆STITCH, even at framerates over a hundred, input was hindering me. I could click the mouse for a fraction of a second (less than a frame), but the ship would still react as if that input lasted an entire frame. in other cases, what if you want to be able to record multiple presses per frame?
these are rare things, and I’ve only ever needed to separate input and framerate for one game so far. however, I think it’s useful to consider frames as nothing more than snapshots, an approximation of what the world looks like. the user sees the frames and the game world is constructed from them in their head. the user isn’t waiting for frames to come around before acting, they act when it feels right to them. they are playing the game in the world that is in their heads, frames are just our way of assisting them in visualising that world.
as such, it’s better to not have the game world update at the rate of something so arbitrary as how fast a computer and screen can make pretty colours, but at the rate of the world we are trying to represent, as unlimited by technology as possible.
The framerate independent model;
so my approach is this;
- we grab input at the very moment the user makes it, we record all we care about and the precise time they happen
- when our Update() functions roll around, we simulate the game world taking into account all the inputs we have and exactly when they happened
- we clear our record of inputs before the frame is drawn, and we start over at 1 again
using this model, the user is interacting independent of the framerate, the world has no quirks based on the framerate (since we are using real time and not delta time).
How to do it in Unity:
so as mentioned above, the Input class is tied in to the framerate pretty closely. if you want to capture input as it happens we need to look elsewhere, and the place my come as a surprise; OnGUI().
that’s right, I didn’t typo, you didn’t misread. I said OnGUI()! you see, OnGUI() is triggered a bunch of times, by many different things. one of them, is user input. if the user presses space a hundred times since the last frame, OnGUI() will have run *at least* 200 times since the last frame too (remember, key releases are also 😉 ).
what we need is Event.current. drop this inside OnGUI() and you can find out just what event it was that triggered the function this time. and if it was keyboard or mouse input, the relevant information is passed along as part of Event.current. (no gamepad input here sorry, you’ll have to look elsewhere to make that framerate independent).
so, there you have it, you have captued input precisely when it happened, framerate has nothing to do with it!
but… you still don’t know WHENÂ it was pressed. like the Input class, most of the Time class you are familiar with is tied to framerate (yep, it’s only really Time.deltaTime and Time.time, but what else have you used lately? :P). what you really want, is Time.realtimeSinceStartup.
given you now have both a way of capturing input independent of framerate and recording precisely when they happen, the only step left is simulating the game world based on this information.
I suggest you add this information to a list, and when the next Update() rolls around, you step through this list, input by input, and simulate the game up to the time the next input happened (and not forgetting to simulate the time between the last frame to the first input, and the time from the last input to the present). then clear the list and you’re good to go again 🙂
Some excess blah blah:
- yes, it takes time for a user’s input to get from their brain, to their hands, through the keyboard and so on before it gets to the game. we aren’t recording input the instant it happens, but we’re doing it as damn close as we can 🙂
- really, the odds you even need to take advantage of framerate independent input are tiny. it’s a bit of extra hassle you don’t need unless your game plays so fast that you need crazy fast input too.
- I do think having framerate independent input is a little bit of an ideal when it comes to interactive worlds… but a framerate of infinity is also a similar ideal. this one is more attainable sure, but if a player never notices then it doesn’t matter too much. we’re magicians after all! why do real magic when a simple trick has the same effect? 🙂
- the unity docs have the following caution about realtimeSinceStartup: “Depending on the platform and the hardware, it may report the same time even in several consecutive frames” I’ve not had any such problems myself on PC/Mac (iOS is another story though). so be aware of that I guess
What July is about: Leaper!
Posted: July 17, 2012 Filed under: Leaper 8 Comments »So, my main thing right now is Leaper, the game pictured in that picture right there. and I’m pretty excited about it!
see, what it is, is an iOS gyroscope game, that’s all touchy and movey and stuff and as far as I know there isn’t anything like it yet. see, I had this:
which is really just a re-graphiced, iOS’d version of this.
I basically had that, just about ready to go, but I’ve been sat on it since I didn’t think I was using the idea to it’s full potential. then Terry said “how long would it take you to finish it?” and I said “Give me a deadline!” and he said “the end of the month.” and then I said “CHALLENGE ACCEPTED!”
so of course the first thing I did was gutted the game entirely and started from scratch! because I’m a moron, but I figure if the reason I was down about it before was because I wasn’t happy with it, then I have to make it something I AM happy with 🙂
so here’s what it is/will be and stuff:
- point your iOS device somewhere to look there!
- walk around, jump around, jump climbing and so-on!
- talk to characters who are super cute but being oppressed by a villain!
- controls in the game world are *in* the game world, just touch them, drag them etc on the screen 🙂
- to carry items, you actually have to hold on to them 😀
a lot of this probably doesn’t sound as cool as I think it is, but trust me it’s super cool when you actually give it a go!
my current progress with it is that I have some NPCs modeled, all the game verbs are there, there’s loading & saving and such. I just need to tie it all together by making the game locations, adding a few minor systems and testing the crap out of it. as of today, I have two weeks to do all that!
not too tricky you might say, but you would be an idiot to think that! and what’s more I have other things to work on too, I’m making some cute animal models for a game Michael Todd is working on, and I need to get the Swift*Stitch iOS update together too.
so that’s my July, busybusybusy! but exciting, and if all goes well come August I won’t be looking for another job! 🙂
(Lottie’s Dungeon people; I know I said I’d give you all non-Lottie games I make before I release Lottie, but this one will be a little tricky on account of the iOSness. but I’ll make it up to you as best I can, promise 🙂 )
SWIFT☆STITCH is now available for iOS!
Posted: July 5, 2012 Filed under: Swift*Stitch 7 Comments »yep, so that totally happened! thanks to the help from the wonderful guys at Nicalis, you can play SWIFT☆STITCH on your fancy touch-screen apple thingies 🙂
it’s free to try so download it now and let me know what you think!
(yes, this is what I was talking about whenever I mentioned a ‘<secret project>’ before now 😀 )
SWIFT☆STITCH on Desura
Posted: July 2, 2012 Filed under: Swift*Stitch Leave a comment »So SWIFT☆STITCH is on Desura now! if you haven’t already got it, check it out! 🙂
(if you have already got it, check your email! :D)