Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Game Mechanics / Re: Isolation / cheat prevention of third party code (multiplayer) on: 2013-01-04 14:04:23
I hoped that akka makes the networking cheap, but don't know how it will react on a SecurityManager. I will see. This will be some work and I hope some fun, too. ^^
2  Game Development / Game Mechanics / Re: Balancing computation power on: 2013-01-04 14:00:39
why does computation power matter? the game is running in logical ticks. When a match is simulated one just has to wait for both player-bots to finish the current tick before the simulation can proceed.
Yes, it is one possible design decision. The advantage is that it is guaranteed that every player got some CPU time and chance to calculate something. The disadvantage are possible delays if a player takes very long and that cycles are visible to the player implementation.

The other way would be execute a loop for each player and let it process the same amount of computation on each cycle. That way cycles are transparent to the players and if they take a bigger amount of computation this could be a disadvantage compared to the opponent player, but may result in a better decision of the player and all players would have the same chance to make good decisions per time unit which results in something like fairness, I hope.

Also, when both bots are run on the same processor both have access to the same power. You could of course measure the time each bot had used in total in a match and then use this to weight the match outcome.
I am not sure if this is true. What if the OS-scheduler, Thread-API scheduler or akka dispatcher / scheduler decides to give one player more CPU time than another one? Context switches are transparent to user space processes. I will have to look at java.lang.management what possibilites there are to measure CPU time.

But this can be abused of course, one could write a bot which maneuvers the opponent in positions for which it needs much time to decide what to do Smiley

Hehe, rules are there to be broken, eeh? Wink

Something like a Java bytecode interpreter API would be useful. => going googling
3  Game Development / Game Mechanics / Re: Isolation / cheat prevention of third party code (multiplayer) on: 2013-01-04 13:19:31
Run in seperate processes... seriously.

The more I think about it, the more I am convinced, that you are right. This would be fun, too:

1  
2  
3  
if(isFebruaryThe29th()) {
    System.exit(0);
}


Put this somewhere in an enterprise application.  Grin

OK, I will implement it to use separate processes, but will still have to think about what I want to allow and disallow these processes to do and maybe additionally use a SecurityManager to limit the processes's capabilities.

The other approaches might be interesting, too, but for third party code, this seems the best.
4  Game Development / Game Mechanics / Balancing computation power on: 2013-01-04 13:10:21
Introduction
I am writing a 2D soccer game which is kind of multiplayer. It is special in the way that players are driven by third party software. In short: Someone implements the given interface for controlling a soccer player, plugs his player implementation into the game engine together with the implementation of someone else's player implementation and both implementations will play a soccer match against each other. This is similar (but simpler) to RoboCup's Simulations Leage (http://www.robocup.org/robocup-soccer/simulation/, http://www.youtube.com/watch?v=BVWkndHk3AE) or MIT's Battlecode (http://www.battlecode.org/) competition. The game is written in scala with use the akka (akka.io) actors.

I will copy parts of this introduction to other questions refering to this game as necessary.

The balancing problem
I would would like to see, that a player wins a math, because of a superior algorithm and superior implementation and not because of other criterea like availible computation power. So resources, especially CPU, time must be balanced and ideally equally distributed over the players, resulting in a fair competition.

What general concepts, approaches and availible implementations / APIs exist to solve this problem?

Here are some approaches I can think of:
  • The battlecode implemtation does execute a limited amount of bytecode (I think per cycle). Cycles are completely transparent to the player implementation. I think they use ASM (http://asm.ow2.org/
), but I am afraid they made some customizations (don't know exactly).
  • Maybe I can use a custom scheduler, dispatcher or something similar (maybe rewriting some class of akka), to perform "round-robin" or something similar.
  • There is a discussion on this topic here: http://www.techtalkz.com/java/130899-byte-code-execution-count.html with a proposal to use java.lang.management to measure CPU time. Don't know more about this, yet.

Do you have experience with this problem, some hints or other approaches to share?

Thanks in advance.
5  Game Development / Game Mechanics / Re: Isolation / cheat prevention of third party code (multiplayer) on: 2013-01-04 12:29:52
maybe you could do it with multiple classloaders.
You start up your main App with the hole game simulation, controllers and so on. And then create an own classloader for each player, which does only have classpath access to some interface classes.

Thats just a wild guess I would probably investigate a bit if I would want to do something similar.

Thx, for your answer. Yes, I have heard of this. Could be a usable isolation in the first place, but I would like to know, if there is really impossible to find all the objects loaded by other classloaders. For example, Eclipse's debugger can do "heap walking" and find all instances of a type. I don't if that is limited to a classloader.

Anyway I don't think that anyone implementing a player will go so far, so this is a bit academic on that level, but I would like to know how far I can go.


On the other hand, can't you disallow reflection and so on when a security manager is set?

Yes, I think the default SecurityManager / policy (at least partially) prevents usage of reflection, but what if some part of the game uses or must use reflection? I don't know yet, if I can write a policy so that some part of the program is allowed to use reflection while another part can not do so.

As far as I remember e.g. there where some problems with Apache Tomcat when activating the SecurityManager. Persistence frameworks, don't they frequently use reflection? Just examples where IMHO you can shoot yourself into the foot, when disabling reflection completely, but I don't know all that exactly.

To make it clear: I did not use reflection myself in the program. Possibly there is some reflection going on under the hood (e.g. by akka), but I don't think so. Also I don't make use of a persistence framework,yet. So again, this is a bit academic, but beyond finding a practical solution for implementation I would like to understand.

So I am a slave for my passion and I am forced to years of research again.  Pointing Yawn Shocked Roll Eyes persecutioncomplex Cool
6  Discussions / General Discussions / Re: Registration Activation Quiz on: 2013-01-04 12:09:32
OK, now I see, I underestimated the effort that spammers perform to get into this site. ^^ Sry, not to read the whole thread right away, but don't worry, most of the time I do. Wink

I did not try to become an SCJP but in some of the test questions there is a Java code snippet and you have to analyse it and answer what's happening when trying to compile and execute the code. I think it's multiple choice where multiple answers might be correct. The offered answers on one and the same question might look like this:

[_] results in value A
[_] results in value B
[_] throws MyException at ...
[_] doesn't compile because of reason x
[_] doesn't compile because of reason y

Sometimes the task gets really hard, e.g. there are multiple nested for loops in the snippet with unexpressive variable names.
Anyway this is just an idea. I don't know all the details and can't do a final judgement. Additionally IMHO if the spammer puts enough effort into it, he will succeed in solving the CAPTCHA or whatever. For example he might use a program to copy the snippet compile and run it and use the result as the answer input.

People are crazy.
7  Game Development / Game Mechanics / Isolation / cheat prevention of third party code (multiplayer) on: 2013-01-04 10:48:31
Introduction
I am writing a 2D soccer game which is kind of multiplayer. It is special in the way that players are driven by third party software. In short: Someone implements the given interface for controlling a soccer player, plugs his player implementation into the game engine together with the implementation of someone else's player implementation and both implementations will play a soccer match against each other. This is similar (but simpler) to RoboCup's Simulations Leage (http://www.robocup.org/robocup-soccer/simulation/, http://www.youtube.com/watch?v=BVWkndHk3AE) or MIT's Battlecode (http://www.battlecode.org/) competition. The game is written in scala with use the akka (akka.io) actors.

I will copy parts of this introduction to other questions refering to this game as necessary.

Architecture overview
  • There are model classes like Ball, Body (of the players), SoccerField, Goal etc.
  • There is an interface which must be implemented by each player implementation.
  • There is a central class MatchController which controlls the game process like state and cycles.
  • Between the player implementations and the MatchController there are intermediate actors handling the communication between the players and the MatchController by message passing. The players can only see a limited interface implemted by these actors. The communication is transparent to the players. The players don't know anything about the MatchController. They event don't know that it exists. The only thing that the players know about is the limited interface provided by the intermediate actors.
  • The MatchController is partially responsible for cheat prevention as it must validate incoming messages. For example it must handle the case that a player tries to exeed maximum movement speed.

The isolation problem
Currently the player implementations are executed in the same process together with the MatchController. I assume that there are possibilities for player implementations to cheat or manipulate the game for example through use of reflection / meta programming.

In the middle or long term, I would like to isolate the player implementations from each other and the MatchController. Ideally even players of the same team and with the same implementation would be isolated from each other.

Which options do I have to get such isolation?
What are the advantages and disadvantages of these options?


Here are the ideas that came to my mind:
  • Each player in a separate operating system process. This looks most promising, because it is a well known and established way of isolation. Maybe this will consume much memory and swap space, at least this happens when I use Chromium on my Linux system (compared to Firefox), but this is a little bit speculative from my perspective. Memory consumption may be limited by JVM settings.
  • There is something like a Java Isolation API. Don't know much about it, but may reduce memory consumption.
  • Sandbox / Security Manager / Security Policy. Don't know if it is possible to create proper isolation of different parts of a Java program. Might be combined with the OS process aproach to prevent the player processes to perform disallowed actions. If I think of an unlikely but really evil player implementation it might e.g. discover the oponent's player processes and stop them. There where some vulnerabilities permitting a Java program easily bypass the Security Manager and break out of the sandbox, last year. I don't know if they are all fixed now.
  • I think there a couple of other aproaches trying to create isolation on the Java platform partially by modifiing the JVM's architecture, but I don't know if there are any of them at a usable state of progress in implementation and standardization.
  • JCSP. Don't know much about it, yet. http://www.cs.kent.ac.uk/projects/ofa/jcsp/, http://www.java-gaming.org/topics/jcsp-lw-isolated-processes-threads-in-java/2711/view.html

Do you have any more options or some hints or comments on isolation?

Thanks in advance.
8  Discussions / General Discussions / Re: Registration Activation Quiz on: 2013-01-04 09:57:56
Hi folks,

I am new here and just absolved the "trivia". First I though that the registration is to complicated, too. I read the activation email on my android phone and tried to do the trivia from there. This is just a pain. You need to run the code and I had no developer tools on the phone, so I had to do it on my desktop system, ok.

I don't read this thread completely, but this is my opinion:

I accept that you prefer programmers and similar people on this site, but maybe the need to execute code is unnecessary. For an experienced programmer there would be the chance to read the code and conclude the result just in the brain without executing the code. At least there is a chance to success. This would be in the stile of SCJP (https://en.wikipedia.org/wiki/Sun_Certified_Professional#Oracle_Certified_Professional_Java_SE_Programmer_.28formerly_the_Sun_Certified_Java_Programmer.29)

Maybe that would be a trade-off that makes registration a little more comfortable for experienced programmers and still reaching the goal to filter users. Just a proposal.
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (16 views)
2014-08-28 18:26:30

CopyableCougar4 (25 views)
2014-08-22 19:31:30

atombrot (38 views)
2014-08-19 09:29:53

Tekkerue (34 views)
2014-08-16 06:45:27

Tekkerue (32 views)
2014-08-16 06:22:17

Tekkerue (20 views)
2014-08-16 06:20:21

Tekkerue (30 views)
2014-08-16 06:12:11

Rayexar (66 views)
2014-08-11 02:49:23

BurntPizza (43 views)
2014-08-09 21:09:32

BurntPizza (34 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!