I recently installed freebsd at home to use it as a gateway for my internal network. When my firewall is setup up as "open", I have no problems playing Unreal tournament, but most of the other games just won't start a multiplayer session. When I set my firewall to "simple", none of the games comes through. I already figured out this had something to do with the ports on which the game server replies and I know that there are scripts like ip_masq_quakeII for linux, but I am wondering whether there were scripts like that for freebsd.

are those scripts hard to write for yourself? I hope not, because I play a lot of games and to write a new script for al of my games would be very time-consuming ;o), Or is it possible to add a rule to the firewall like ipfw add divert tcp from x{port} to y{internal adres of computer} ?????

Some games use multiple ports. The Half-Life client, for instance, sends udp packets to a server on 27010 (if I recall correctly) and expects responses from that port (which is fine because natd will set up a dynamic rule for it) but also expects to receive udp packets from the server port 27015 (again, if I recall correctly). This means that you'll need to add a static rule to natd with "-redirect_port udp GAMES_MACHINE_LOCAL_IP:27015 27015". Depending on how paranoid your firewall is you might need to add accept rules for this traffic with something like "ipfw add accept udp from any 27015 to GAMES_MACHINE_LOCAL_IP" or ("echo pass in quick udp from any port = 27015 to GAME_MACHINE_LOCAL_IP | ipf -f" for IPFILTER) (When playing with these rules, remember that packets go through the firewall twice, once with destination IP of the external interface and once with that of the private IP).

A good way to find out which ports you need to hack is to run netstat on both your Windows box and the FreeBSD box and check the firewall logs to see what's trying to come in. This was the technique I used to figure out Half-Life. However there are sites out there that give you instructions for various games. http://www.tmservices.com/masq/catlist.php3?Games is a good one (Linux-centric, has commands for ipfwadm/ipchains) with a big list of games. Sadly I never did get Aliens v Predator to work...

firewall.rules
pass in on tun0 proto tcp from any to LOCAL_IP keep state
pass in on tun0 proto udp from any to LOCAL_IP keep state
pass out on ep0 proto tcp from any to LOCAL_IP keep state
pass out on ep0 proto udp from any to LOCAL_IP keep state