Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

caution, brainstorming ahead. beforewarned that there is an 80% probability of the overuse of phrases like "i think" and "could potentially"

i personally don't think it should be turn-based; i think some things should have to take a certain amount of time (like maybe moving) but leave as much as possible up to the robot itself; that way there is a good reason to optimize your algorithms for speed.

for instance, make them move the bullet themselves, and just provide a few arena methods for them to call. for instance, $arena->collide($bullet, $enemy) might return true if $bullet and $enemy occupy any of the same space, and automatically damage $enemy.

actually, further thought reveals that they'd maybe gain more by optimization if each one forked off and communicated back to a parent with requests. which starts to stray from the ultra-simple goal. do others think that gaining something by optimizing your code is worthwhile?

and really, you may only need to create a small handful of arena "commands" --

Create
creates a new object, likely a bullet. this perhaps has size ("mass") limits, both on individual items, and on total mass of all objects in existance for a particular owner.
Move ($obj, direction) or ($obj, location)
moves an object. automagically checks for collisions, deals damage, etc. probably has a maximum distance to move an object that is inversely related to the item's "mass" (number of pixels). probably automatically destroys objects that leave the arena or take too much damage -- a 2x2 bullet takes a lot of damage from a 20x20 tank, presumably.
Destroy $obj
maybe not necessary, since most objects should be destroyed by Move at an appropriate time, but if you want to auto-destroy bullets that stray too far from you without waiting for them to hit something, maybe you should be able to.
Look $direction or $location
get data about a part of the playing field. presumably in some pre-determined, easily digested form. possibly not.
for extra panible possibly make these more restrictive. for instance, make objects only able to move themselves (which means each object (read: bullet) needs to do its own looking, but still comes through your pipe, and make Move and Look rely on an object's curent Direction property, which can only be set via a call to Turn:
Turn
turns an object, changing its direction. making this only work up to 1 degree per call would potentially severely limit the movement algorithms for bullets.
both of these could potentially reduce the threat of heat-seeking missles and make the algorithms have to be more robust, i.e., more interesting.

then again, i might be playing a totally different game.

.

In reply to Re: Perl Game, suggestions. by Vynce
in thread Perl Tanks by SilverB1rd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (1)
As of 2022-05-22 02:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (78 votes). Check out past polls.

    Notices?