New Tutorial Online: State-Driven Game Agent Design

Started by
6 comments, last by Nice Coder 19 years, 6 months ago
Enjoy!
Advertisement
Nice! I implemented something very about a week ago, pretty much follows your way of doing things but I like the way you go about explaining it. Good work :)
Looks very good. I'll have a go later on today after work. Theres a few things in there I havent tried in C++.
Good article. you should change the title tho (new page isn't that interesting fo a title.).

Also, the generator and origionator info is in the source, and the html is a bit sloppy.

All in all, it was a good article (liked how you explained how state machines work), which hasn't been htmlized well.

From,
Nice coder
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.
Glad you liked the article and thanks for the feedback. As you have gathered... an HTML wizard I am not!

What do you mean the "generator and originator info is in the source"? What is that info, and why does it matter that it's present?

In what way is the HTML sloppy? I just rely on Frontpage and never look at the generated HTML.

cheers

Quote:Original post by fup
Glad you liked the article and thanks for the feedback. As you have gathered... an HTML wizard I am not!

What do you mean the "generator and originator info is in the source"? What is that info, and why does it matter that it's present?

In what way is the HTML sloppy? I just rely on Frontpage and never look at the generated HTML.

cheers


Don't worry much, few people would notice it, but...

What i was looking at is the way the source looks, and although it is machine-readable, it is like the Obfucated C contest for html. There are redundant tags all over the place.

something like this:
<p class=MsoNormal style='margin-top:3.0pt;margin-right:0in;margin-bottom:3.0pt;margin-left:0in;mso-outline-level:1;text-autospace:none'><spanstyle='font-size:10.0pt;font-family:Arial;color:#FFFFCC'>Note: <istyle='mso-bidi-font-style:normal'>the text for this tutorial comprises part of the second chapter of the book </i><a href="../../books/toc_pgaibe.html">Programming Game AI by Example</a><istyle='mso-bidi-font-style:normal'>. Its appearance online is a cunningly disguised attempt totempt you into purchasing said book. I have no shame. Buy the book, you’llenjoy it</i>. </span><span style='font-size:10.0pt;font-family:Wingdings;mso-ascii-font-family:Arial;mso-hansi-font-family:Arial;mso-bidi-font-family:Arial;color:#FFFFCC;mso-char-type:symbol;mso-symbol-font-family:Wingdings'><spanstyle='mso-char-type:symbol;mso-symbol-font-family:Wingdings'>J</span></span><spanstyle='font-size:10.0pt;font-family:Arial;color:#FFFFCC'> </span></p>


is just mean to look at... its improperly spaced, it hasn't simplified its tagging (the spans could be tuned into font tags, for greater support, and fewer tags!), and the way the engine formatted it is just not nice at all.

This tag
<meta name=ProgId content=FrontPage.Editor.Document>

Is the generator, it is not something good, it does nothing and isn't very useful (other then to advertise that your using frontpage)

I'm not a html wizard, i just know a thing or two (i also like looking at webpages in there sourcecode).

I would remove the <style> tags (what are those? css?) and replace them with font tags. i would also change the paragraph tags, to newline tags (
). this would allow you to only need to use a font tag when your changing fonts. (it makes things much nicer).

Look at this bit:
  <p class=code-white>enum StateType{state_RunAway, state_Patrol, state_Attack};</p>  <p class=code-white> </p>  <p class=code-white>void Agent::UpdateState(StateType CurrentState)</p>  <p class=code-white>{</p>  <p class=code-white>  switch(CurrentState)</p>  <p class=code-white>  {</p>  <p class=code-white>  case state_RunAway:</p>  <p class=code-white> </p>  <p class=code-white>     EvadeEnemy();</p>  <p class=code-white> </p>  <p class=code-white>     if (Safe())</p>  <p class=code-white>     {</p>  <p class=code-white>        ChangeState(state_Patrol);</p>  <p class=code-white>     }</p>  <p class=code-white> </p>  <p class=code-white>     break;</p>  <p class=code-white> </p>  <p class=code-white>  case state_Patrol:</p>  <p class=code-white> </p>  <p class=code-white>    FollowPatrolPath();</p>  <p class=code-white>    </p>  <p class=code-white>    if (Threatened())</p>  <p class=code-white>    {</p>  <p class=code-white>      if (StrongerThanEnemy())</p>  <p class=code-white>      {</p>  <p class=code-white>         ChangeState(state_Attack);</p>  <p class=code-white>      }</p>  <p class=code-white>      else</p>  <p class=code-white>      {</p>  <p class=code-white>         ChangeState(state_RunAway);</p>  <p class=code-white>      }</p>  <p class=code-white>    }</p>  <p class=code-white> </p>  <p class=code-white>    break;</p>  <p class=code-white> </p>  <p class=code-white>  case state_Attack:</p>  <p class=code-white> </p>  <p class=code-white>    if (WeakerThanEnemy())</p>  <p class=code-white>    {</p>  <p class=code-white>        ChangeState(state_RunAway);</p>  <p class=code-white>    }</p>  <p class=code-white>    else</p>  <p class=code-white>    {</p>  <p class=code-white>      BashEnemyOverHead();</p>  <p class=code-white>    }</p>  <p class=code-white> </p>  <p class=code-white>    break;</p>  <p class=code-white> </p>  <p class=code-white>  }//end switch</p>  <p class=code-white>}</p>

(please note that the spaces would be &nb'sp; in the source. (remove the ')

Look at all the effort (and tags that would have been saved if only the generator was smart enough to do something like:
<p class=code-white>Stuff stuff stuff <lbr>
Stuff stuff stuff <'br>
&nb'sp;&nb'sp;&nb'sp;Stuff
<'/br>
<'/p>

(sorry about the ''s, it won't let me do the tags without them.)
Much easier on the eyes, and on the bandwith.

As i said, nice article, but please make the html more readable! (it could save you a bit on bandwith!)

Also, all of your pages's titles are things like "New page 1" and "New page 2", can you please change them? (because you've got a good website otherwise) To do that, right click on the page, and select "Page properties", you then change the text next to the label which says "Title".

From,
Nice coder
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.
thanks for explaining that to me. I don't think I'm going to do anything about it though (apart from the page titles). I have no desire or time to reformat code that the majority of readers will never look at, and which, in the end, will make no difference to their experience.
I know what you mean :)

Its nice that you've learned something anyways (its nice feeling useful)

From,
Nice coder
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.

This topic is closed to new replies.

Advertisement