Fencing Game

Posted in Fencing, GameDev with tags , on March 17, 2011 by bbarrett

 

New Project Announcement

I’ve been working on a fencing game for the last few months with a friend of mine. Its coming along nicely. We hope to have it finished during the summer, but we’re close to having an alpha of the primary gameplay, perhaps by the end of the month.
I thought I’d get time to work on the programming language tutorial set, but my energy has gone into this and I thought better than producing some half rate work.

About the Game

My friend Sean is the lead designer (being a fencer!) and also doing almost all of the art. I’m doing most of the programming, and acting as a sub-designer of sorts. It is interesting work, particularly writing game AI which I’ve never done before.

The game is quite simple. It is round based, you can attack, block and sprint. You can play against a friend using an XBox controller or play against the AI. For the full game we want to make a tournament system, where you control a team of fencers who will have different statistics. Winning will be partly about pairing off your fencers against the opposing team in the correct order as overcoming the individuals in the interactive fights.

Here is a quick video I made of the current gameplay. This features a bug (which has since been fixed), where the screen declaring the winner appears instantaneously and doesn’t tell you who won.

 The rounds are reasonably quick, it gets tense and more fun towards the end when you have only a couple of rounds left to go! The AI can be really mean, it does this thing where he can step back one pixel away from your attack, and then step in a pixel and hit you. It is also quite non-deterministic, but we’re thinking almost too much so at the moment.

We Need You!

What I’m hoping for is a few volunteers for testing the outcome of our next iteration. This will be primarily to get feedback on the gameplay, but also an initial test for deployment, performance issues on strange machines, etc. I’ve never deployed a C#/XNA game before so I hope it won’t be particularly tricky. What would be really great is if we could get someone who has an XBox controller they can use with their PC to try out the multiplayer for us.Let me know in the comments if you are interested.

Movie Marathon Markup – Seven Film Reviews

Posted in Uncategorized on March 6, 2011 by bbarrett

I spent the last week in the gorgeous south of France with my little sister. We spent the days basking around the various cafés, living off coffee, alcohol, pain au chocolat and crepes au chocolate (the French really know how to live). We spent the nights watching an eclectic mix of movies. I decided it might be worth cataloguing them. In no particular order:

  • The Room

    The unrivalled apex of the “its so bad its good” genre. I’m not usually a fan, but one cannot deny that this is a masterpiece! Perfect for watching with some friends and not a small amount of drink. I cannot really describe this movie, and I think any description could not do it justice. I will just say that this is one man’s honest attempt to write, direct and star in a movie which is just bad in almost every way. Bad acting, bad script, inconsistent plot, odd scenes and some just bizarre choices or oversights, such as massive continuity problems or the fact that all the picture frames in the scenes are filled with pictures of cutlery, presumably the stock photos they had when purchased. I don’t believe it would be possible to deliberately make a worse film.

    A quick warning however, the movie features no less than three sex scenes in the first 10 minutes (with another 2 during the rest of the movie, if memory serves). Power through this, for while it is certainly gratuitous, it is but another facet of the ridiculous nature of the film. The scenes come across as humorous rather than offensive, with hindsight. I really don’t think the film would be the same without them – which makes these thoroughly unnecessary sex scenes suddenly seem quite necessary… An odd thought.

  • Exit Through the Gift Shop

    This movie was thoroughly enjoyable, even if the real star was actually an slightly mad French cameraman rather than the elusive English artist Banksy. I think this was the right choice though, the man’s obsession pours through the screen. His enthusiasm and strange personality make the movie what it is. Such a hilarious character. You get the feeling that Banksy thinks he is nuts, but still kind of loves him. As do we all, I suspect.

  • Shaolin Soccer

    A lovely surprise from Stephen Chow, I had always assumed this was a poor movie… but it defies every and any expectation. I loved its commitment; any time you think they’ve gone as far as they could go, it manages to go to 110%, or more. Also strangely touching, though this could be just because it doesn’t comply with the Hollywood expectations that are almost subconciously expected by us. Relentless.
  • Due Date

    A rather forgettable comedy featuring Zach Galifianakis playing roughtly the same character as “The Hangover”. Depressingly, I suspect this one is probably the biggest earner of all these films in the box office (with the possible exception of “Alice in Wonderland”, though comparing blockbuster income from two films separated almost 60 years is obviously difficult). Its funny, but very much predictable and by the book. It looks weak in comparison to these other titans.

  • Kung Fu Hustle

    Another head scratcher, yet still a gem, from Stephen Chow. I didn’t enjoy it quite the same way as Shaolin soccer (I feel this might be because I wasn’t prepared for the kind of shenanigans he would try pull the first time round – surprise is the essence of comedy), but still a really good watch. One of those rare films where you cannot really predict anything. Most of the commentary from Shaolin soccer applies.

  • Alice in Wonderland (original Disney animation)

    Such a delightful film. The only one I had seen before (as you, dear reader, have almost certainly have), but more than worth watching again if it has been a while. Puts the recent reworking to shame. Beautiful nonsense, with some stunning animation – in particular the scenes with the playing card army.

  • MegaMind

    Quite hilarious, certainly a lot better than I expected. I had assumed it wasn’t great because I hadn’t heard anyone talk about it, but I thought it was rather charming in its own way.

Making a simple programming language – preramble

Posted in programming, Rasp on January 17, 2011 by bbarrett

I’m just cleaning up the code for the first article in my planned series. In particular I scrubbed C++0x from it, because not everyone will support it.

Cleanup

I’m debating on whether to add extensive comments. I intend for this to be aimed at people who know C++, but the question is how well. I make liberal use of the standard library data structures and algorithms. I’m planning on keeping it a mid to high level discussion of the various problems and my solutions to them. I do plan to discuss the implementation itself but not in exhaustive detail.

Publishing Schedule


I think it will be worth taking some time to write up this base code, as it presents the foundation of the rest of the series. It is simple enough. For the moment, I support number literals and functions defined in C++. There are a small set of functions predefined, including the basic math operators and a print and println function. A function can be passed to another, but this isn’t particularly useful yet. It does allow one to implement a library function like std::accumulate(), where the operation to be run is specified as part of the data. I’ll probably have to split the initial implementation into three or so articles to keep them short and readable.

Implementation Stuff

So far I’ve implemented a simple value based system, everything is passed and returned by value. Functions are hard coded at compile time. This means that multiple invocations of a function will incur copies. This is fine at the moment as a function is just a string and a function pointer, but when I move to support user defined functions I don’t want to be needlessly be copying them around.

The current implementation merely starts a REPL interpreter. There is no support as yet for loading from a file or any command line parameters at all.

Show me the Code!

The code is available on github: https://github.com/rip-off/rasp-lang. I haven’t put in a build system or committed the Visual Studio project files as yet. I’m testing it on Linux too, so I’m not sure how I’m going to do that just yet.

Onward!

Proto article series on creating a programming language – Roadmap

Posted in programming, Rasp on January 14, 2011 by bbarrett

There has been a lot of interest on the gamedev.net forums about creating custom programming languages. Since I have done this, I was thinking of doing a semi-retrospective, semi-rewrite to illustrate how to build a working programming language interpreter. I was considering doing this for quite some time, but I didn’t quite have the motivation to do so.

Rasp?

I’m going to start with a basic Lisp syntax, using a hand rolled parser. Integrating a proper parser is a hurdle that I don’t want to place too early in the process. I do plan to do it eventually so I can use a nice custom syntax. Most of my initial effort will be concentrated on getting the interpreter up to scratch. Its working title is “Rasp”, which is an ugly mix of my user name and “Lisp”.
Type System

I haven’t tied down all the details yet, but I’m aiming for a semi-dynamic language, with optional explicit but otherwise inferred strong typing. That is, a function can be written without mentioning types. If a variable are used in a context where the type is known (e.g. passed to a library function or explicitly typed) then the type will be inferred and an error occurs trying to invoke the function with an incorrect type. Types will be be inferred recursively, so a generic function calling a second generic function which calls a typed function will have the types propagated all the way back. In certain circumstances, I expect the type will not be deducible. For the moment, I’m going to do something similar to “autoboxing” where in such cases the program will generate type errors at runtime rather than compile time. A variable would be strongly typed, once given a type (explicitly via declaration or implicitly through first assignment) it would not be legal to assign it to an unrelated type.

Some or all of these ideas might be compromised if they end up contradicting each other, or if they overly complicate implementation or finally if they just aren’t nice to use. In any case, almost none of them will be present early on. Hopefully it won’t be too difficult to add them later.

Advanced Topics

Some of the more advanced things I’m interested in investigating are automatic type decomposition to enable “data oriented programming” without imposing a large burden on the programmer, or possibly an explicit way of separating the physical arrangement of the data from the logic arrangement, to put the programmer in charge of their data layout. Other ideas include a hybrid approach to memory, using RAII where possible and garbage collection only where cycles can occur. I think the type system I’m considering might cause the compiler to be unable to infer a useful type, it would end up inferring something like “Object” in managed languages, though I’d prefer to omit such an arbitrary base class from the language if possible. To achieve this I may be forced to use explicit types when defining data types. I’ll need to investigate.

I’d also like a language that helps programmers with multi-threaded code, or at least doesn’t hinder them in quite the same way that other languages do. The plans I have for this are more nebulous at the moment, we’ll see how it goes. Maybe something like language support for transactions, which can be rolled back and made a critical section.

I’m also thinking about an alternative to exceptions and error codes, or possibly merging them together – for example: checked return codes, the compiler will reject code that does not test the return value of marked functions. Investigate some kind of language support to ease the burden of passing error codes through a function call hierarchy, which might be aided by the inference engine I’m including. We’ll see.

Long term goals include optimising the implementation to the point that people might want to actually use it, and eventually JIT compilation using LLVM. I would consider targeting a prewritten VM but it don’t think it will allow me to get to some of the juicier advanced topics.

Coming soon

But the first few iterations will be very simple. I threw together an interpreter yesterday using my old “Lisp” project as a base. It lacks a parser. I’ll get something simple working for the weekend, during which I hope to publish (or at least write) my first “article”. I am currently testing it by building a raw instruction list and executing it. The first iteration will support integer literals and calling arbitrary C++ functions, hopefully even in a nested manner.

I started from scratch, not because I want to but because that is the best way to demonstrate the iterative process over the series of articles. Even stripped down to quite basic functionality, the base code is not small. I believe it is about the smallest useful size that will give me a good bit to talk about without being overwhelming. Hopefully it will be about the size that my intended audience can manage.

I know I can get it to the point where my last Lisp language was, which was reasonably powerful but with glaring omissions, notably user defined types. I should be able to get a few articles out until that point, then I can start braching into some of the topics I mentioned above.

Complications

The main complication is that my time is divided because I’m working on a game with a friend at the moment. We’re getting close to a potential test of a gameplay mockup, we’re aiming to have the program ready by the end of January and possibly conduct some tests in the months following.

Stay tuned,
– rip-off

ISPs enforcing copyright law, part deux.

Posted in Uncategorized on October 11, 2010 by bbarrett

Today,  IRMA lost a court case against UPC, which was aimed at putting UPC under similar pressure that Eircom apparently crumbled under. I believe this is an important victory for ISPs, who should not have to shoulder the cost for what their subscribers choose to do. I believe that copyright owners should pursue copyright infringement directly through the court system.

Eircom’s comment on the outcome:

A spokesperson for Eircom has said the internet service provider will be considering its position in light of today’s ruling.

I wonder what will happen next. Personally I would like to see Eircom back out of their “trial” they agreed with IRMA, as soon as possible. They should be far more aggressive in future in fighting any such deals. In particular

It is interesting to wonder then why Eircom chose to make a deal with IRMA in the first place. Their legal team surely would have thought that going to court would not mean certain loss given the outcome of UPC’s case. I simply don’t understand this deal from a business perspective, they are angering customers (who will likely move to ISPs showing more spine) and they are losing money by having to process these alleged file sharers on IRMA’s behalf.

In my research for this post I tried visiting the Pirate Bay, which is currently blocked by Eircom (as per a court order). Again, interesting that the other ISPs managed to avoid this. From some Googling I found some references to an ongoing court case, but from what I could find it would appear that Eircom are the only Irish ISP currently blocking the pirate bay.

In what was likely a burecractical oversight, the “warning page” that access to thepiratebay sends you to from an Eircom account includes the following text:

eircom would like to reassure customers that:

  • eircom will not monitor customer’s activities at any stage, nor will it place any monitoring equipment or software on its network in order to facilitate this block.
  • eircom will not provide personal details or any information relating to customers to any third party, including the record companies.

This information is clearly out of date.

In any case, this situation worries me even more than the IRMA deal. Eircom is entitled to revoke service from customers who are violating the terms of their agreement. Perhaps there is some business case, such as advertising deals or some other reason why Eircom has chosen to act the sheep in that relationship. But the Pirate Bay blocking is not a private agreement between two parties, it is a court order.

However, the censorship of the Pirate Bay is nothing to do with that deal, it stems from a court order. Merely visiting the Pirate Bay website is not an act of copyright infringement, no more than glancing inside a car to see if the key was left in the ignition is car theft. They might be highly suspicious actions, but I don’t believe in punishing thought crime.

While the Pirate Bay might have relatively minuscule legal content and use, I believe that censoring all access to it is a dangerous precedent to set (despite not strictly being legal precedent). Censorship, in my opinion, a massive violation of the freedoms of adults in any nation. It should be reserved for the most special cases, and only where no other way can be found to deal with the problem. This grave tool should not be even available here, the recording industry has simply not exhausted other avenues of dealing with the problem, despite what they might say.

One need look to the kind of countries in which Internet censorship has become normal practise to see the danger of such a slippery slope. There are valuable sites that feature questionable content, Wikileaks would be a perfect example. I wouldn’t like to think that companies and organisations start thinking that they can apply for court orders to censor material through ISPs.

The recording industry is not special, if their content is being pirated then they should do what any other group would have to do, take the individuals involved to court.


Links & Glossary:

New Game Idea

Posted in conq, GameDev on September 15, 2010 by bbarrett

I’ve had an idea brewing for some time for a new game. It is roughly like Civilisation, but more abstract, hopefully simpler and with a few ideas of my own I’d like to try out. I’m aiming for a proof of concept at the moment. So I’m not going to worry too much about the non-military aspects of such games. Diplomacy, economies and other such mechanics will come later, if necessary.

The basic idea is a space conquest game. This has definitely been done before. You have planetary systems you can conquer, and you build fleets using them and conquer more. There will be a simple galaxy generator that might populate 50-200 planetary systems (depending on the scale you might choose).

The abstractions are just removing lots of special cases. In most similar games I’ve played, you can build a wide variety of units (often accompanied by a varied research tree). I intend to replace this with a simple power/disposition system. Basically, variable statistics. So a particular fleet might have an offensive or defensive disposition, or neutral. It might have a fast or slow disposition, or a heavy/light one. Some statistics might be naturally exclusive, for example I might disallow fast/heavy dispositions. The power is basically a combination of the size, disposition and relative technology levels.

It will be turn-based, but each turn will be divided into two phases, decision and simulation. Orders are given during the decision phase. The combat is resolved in the simulation phase. I also intend combat to be a multi-turn process. Planets are captured by laying seige to them for a number of turns. Two armies facing each other will do damage based on their dispositions, only if at least one is in the aggressive disposition will notable combat take place. Two fleets both engaged in an offensive stance should be resolved fairly quickly, with victory mostly based on the power difference between the fleets. If one army is neutral and another is aggressive, the neutral fleet might fall back rather than take excessive damage in a single turn.

The inspiration for some of the interesting ideas come from recently reading The Forever War. I really liked his description of the implications of relativity on interstellar combat. One simple example is that the human space craft travel to the enemy space that a long time has passed for the aliens. This means that the humans are facing technology which literally didn’t exist when they set out. I don’t believe I can replicate the ideas in the book exactly, but I can offer mechanics which have similar effects.

It will obviously be necessary for fleets to travel faster than light. My ideas are still forming, but one is to drop the relative technology levels of fast moving fleets (in the absence of logistical support perhaps). Another might be to allow the enemy players see the fast-moving fleets from further off. This is obviously artificial – the speed of light forbids this, but this is a game! The point is to design a mechanic

Another idea is to make the galaxy change over time. So the planetary systems will rotate around the centre of the galaxy, but also around each other. This is partly the reason for a separate simulation phase. While individual star systems might have little effect on one another, galactic features like black holes and globular clusters might have noticeable local effects (which I will probably exaggerate for effect). I might simplify the gravitational interactions by grouping areas that are close together. Getting this to work will be the main technical challenge I believe. I will probably have to simulate thousands of non-populated star systems to give the system some stability. I would have to at least draw them anyway to create a nice background effect to give the impression of a galaxy. I’ll have to generate stable galaxies, where very few collisions will occur over the lifetime of the game. In particular, care must be taken to avoid the entire galaxy collapsing toward a single point. If it is infeasible to simulate gravity, I might just go for a very simplified system where the different star systems rotate around the centre of the galaxy at a fixed rate. But because different star systems rotate at different speeds, the same dynamic galaxy will be created.

My experience with the critter game taught me that I’ve a lot to learn about game design. This will be a huge test for me. I don’t know if I can make a good strategy game in a ever-changing world. It sounds like an interesting idea, so I am eager to try it out and see if it is any fun. It sounds like a bit of a nightmare though, you have to plan X turns down the line when your planets and ships are all in constant motion. Add to this the various real and theoretical/imaginary interstellar features that can be included, the aforementioned black holes and globular clusters, but maybe supernova, wormholes, nebula. I will include anything that has a bit of character, and can act as strategic key points. I’m not too concerned about realism, I will scale any feature to fit the game, even if it doesn’t really make sense. I might even include new ones, such as massive objects which have an inverse effect to gravity. These might be pre-populated features or might be created by the users, I’m not sure yet.

I don’t look forward to writing AI for such a system though! I expect it will be hard enough for a human to meaningfully plan ahead in such an dynamic environment. The interface will present a challenge. For example, if you order a fleet to move to a point that will take 10 turns, should that point be relative or absolute? Did the player want the fleet just to approach the galactic core, or did they intend that it end up close to a particular resource of interest. The strategic value of certain areas will change over time as they move. A once important planet might end up moving to the wrong position and become isolated and useless. This could feed into the economic system in the long term, if I take it that far.

I’ve only barely begun work on this project. The working title is “Conq”. This post is intended as a roadmap for future development. At the moment it is a top-down 2D game, but when I look at video’s like the Infinity Game Engine by Ysaneya (included below), I keep thinking how cool it would be to do this in 3D. Imagine a fleet surprise attacking – from perpendicular to the galactic plane!

ISPs enforcing copyright law

Posted in Uncategorized on May 25, 2010 by bbarrett

It has recently been announced that Eircom, Ireland’s largest ISP, will be processing IP addresses from suspected copyright infringing accounts and using the talked about “3 strikes” rule that will see copyright offenders warned, disconnected for a week and potentially disconnected from the internet for a year if the account persists in illegal file sharing. This action is being taken by IRMA, the Irish Recorded Music Association. The suspect IP addresses will be provided by a third party that apparently specialises in discovering the IP addresses of high volume peer to peer seeders.

This is a controversial measure. It is my belief that it is a step in the wrong direction, or perhaps multiple wrong directions. I am not opposed to IRMA taking steps against copyright infringers. This is their right, and they are free to excersize it. However, a number of things about the details of the approach worry me.

In particular, why aren’t infringers being brought to court? It is not for Eircom to punish persistent offenders – unless they choose to take action on usage terms violations. It would appear that IRMA and Eircom have created some kind of deal which cuts out the Irish judicial system from punishing crimes.

Cutting off Internet access is quite disproportionate response, in many ways. It is similar to turning off the electricity that is used to power the infringement. You will have houses with no clear account holder, such as in shared rental accomodation. It doesn’t make sense to cut off everyone for the actions of individuals. Collective punishment is a poor mockery of justice. Another problem is wireless leechers. While the first strike should hopefully motivate users to protect unsecured networks, this may not be enough. Technically savvy malicious users can often break into encypted wireless networks. Indeed, Eircom had a well publicised vulnerability in their default setup, it was possible to deduce the network key from the SSID. In any case, it is not inconceivable that neighbours might know enough about each other to break weak passwords through social engineering. Finally, I have heard that some peer to peer networks have taken to including spurious IP addresses in the torrents, to obfuscate attempts to track down offenders by adding noise to the signal.

An IP address doesn’t map to an individual, which works for and against IRMA. The Irish Data Protection Comissioner challenged the court case that resulted in this action, and this challenge was quashed on the basis that an IP address isn’t personally identifiable information. It would appear to me then that some extra piece of evidence is therefore needed before action should be taken.

It would be interesting to know what, if any, financial agreement was reached between IRMA and Eircom. My own view is that the bill for any additional burden on the ISP should be entirely IRMA’s They may choose to recoup this by prosecuting the pirates if they wish. But through the courts, please.

A quote from IRMA’s director general:

The European Parliament has been talking about internet access as a basic human right. It absolutely is not.

I think this statement is misguided. My understanding is that the European Parliament are talking about making it a right. However, the right to a fair trial is certainly one, and this effort seems to attempt to undermine it somewhat. If they are confident of their case against Irish citizens, let them bring it to court. I intensely dislike this somewhat secretive agreement these two parties have reached.

Copyright is a complex issue at the moment. Personally, I believe that if someone creates something of value, either physical or not, they should have a right to protect their work. However, intellectual property laws are certainly artifical, and have no basis in natural law. As a society, we are agreeing to give the copyright holder a temporary monopoly over the work. If IRMA want this social contract to remain, they would do well to remember this. I would like to see some changes to current copyright law, particularly the length of time for which copyright is granted. If they push too hard, they might find quite an unequal force pushing back at them.

This is a pilot scheme. I am curious as to what the criteria for success are. Is it based purely on feedback from IRMA, or what can/will Eircom do if they start haemorrhaging customers? IRMA and similar bodies are not very popular at the moment, and Eircom are exposing themselves to significant negative press for this.

Ireland’s second largest ISP, “UPC”, are in a similar legal battle with IRMA. It will be interesting to see how that resolves, as would any challenge made by an accused infringer over this. I am not a lawyer, but I would be fascinated by any good links that would shed some more light on some of the issues I have talked about. I personally want it fought. Eircom have already blocked the pirate bay, which the other ISPs have refused to do. Are Eircom afraid of IRMA?

While I would, if anything, stand to benefit from a internet connection that wasn’t quite as congested with P2P downloads, I believe this is the wrong way to go about it. I am considering boycotting any IRMA related products, until they choose a more reasonable and fair approach. Maybe a small, unimportant individual action, but maybe if others choose to do the same.

BBC story on the announcment
RTE story on the announcement
Silicon Republic commentary

Follow

Get every new post delivered to your Inbox.