XNA Creators Club Online
Page 1 of 1 (19 items)
Sort Posts: Previous Next

New Tutorial: Role-Playing Game Tutorial #2 - Re-using the Tile Engine

Last post 11-05-2008 1:22 PM by ITECCGDD. 18 replies.
  • 06-18-2008 8:42 AM

    New Tutorial: Role-Playing Game Tutorial #2 - Re-using the Tile Engine

    The second tutorial for the new Role-Playing Game starter kit is now available. This tutorial provides step-by-step instructions on how to re-use the tile-based engine featured in the starter kit in your own game. For more information, check out the Role-Playing Game starter kit page, and also check out the first tutorial on adding a quest to the game.

    Matthew Picioccio
    XNA Developer Connection
  • 06-21-2008 4:13 PM In reply to

    Re: New Tutorial: Role-Playing Game Tutorial #2 - Re-using the Tile Engine

    Pretty good rundown of the guts of the Map portion of the RPG sample. I am going to attempt to gut pieces of it as well however I am working on a turn based game which doesn't have the 'One Position of Importance' part of the RPG engine.

    - The game state engine needs to support 2 players, each taking 'turns'

    - Fixed board size (my map is height 24 squares, width 29 squares)
    - Entire map should fit on a 1200 x 800 display
    - Figures need to be placeable by either player and need to be able to remove themselves
    - Figures needs to move from Point to Point based on mouse input (similar to chess, highlight the figure, then choose move, then choose the target square)
    - MapSquares need characteristics beyond blocking, some can be harder to move through etc.
    - Eventually the Map and all the initial figures will be loaded from a server after 2 players begin a game

    The RPG starter cleared up some issues I had concerning rendering which is great.

  • 06-22-2008 11:45 AM In reply to

    Re: New Tutorial: Role-Playing Game Tutorial #2 - Re-using the Tile Engine

    I'd just like to say thanks for your efforts in making this available - I got everything going with a minimum of fuss (some namespace problems with the ContentWriter and that was about it). Having something like this means making that action-RPG for my 5 year old is a little closer to reality :)
  • 06-24-2008 12:19 PM In reply to

    Re: New Tutorial: Role-Playing Game Tutorial #2 - Re-using the Tile Engine

    Tonight I did a bit of playing around trying to understand why the PartyLeader would sometimes get stuck on edges and not be able to move up or down.

     I first added a spriteFont so I could dump some debug to the game screen. Next I modified ForestTiles.png and included some red and green tile borders. Then I modified TileEngine DrawLayers() method to render the borders around blocked tiles. That way, I could at least see what tiles were blocked, and what the current and desired TilePosition and TileOffsets were.

    Anyway, to cut a long story short, there is a documented relationship between the partyLeaderMovementSpeed and movementCollisionTolerance constants. That's fine, but what isn't explained is that these values should also evenly divide into the tile size. What can happen is that the initial test in CanPartyLeaderMoveUp(), CanPartyLeaderMoveDown() etc return true, even though subsequently applying the desiredOffset would take the position into a blocked tile. If you check the first map where sign with the down arrow is, and the trees narrow, you can reproduce this behaviour.

    I'm having trouble explaining this well, so I can either take some screenshots to help explain, or you can just set your constants so they divide evenly into the map tile size to fix it.

    Question: In TileEngine::Update(), what's the purpose behind the Vector2.Multiply(userMovement, 15f). I took it out and it appeared to make no difference.

  • 07-01-2008 8:11 PM In reply to

    Re: New Tutorial: Role-Playing Game Tutorial #2 - Re-using the Tile Engine

    sorry but I have follow tutorial until "Hooking it Up" topic , after edit game1.cs accroding to tutorial when i'm hit F5 im got run time error at command TileEngine.SetMap(Content.Load<Map>(@"Maps\\Map001"), null);

     

    say "Error loading "Maps\\Map001". Cannot find ContentTypeReader RolePlayingGameData.Map+MapReader, RolePlayingGameDataWindows."

    everythings are work fine before enter this point. I have tried to follow0 the tutorial from the begineing for 2 times and got same problem if someone know how to fix this problem plz help me.

  • 07-02-2008 7:48 PM In reply to

    Re: New Tutorial: Role-Playing Game Tutorial #2 - Re-using the Tile Engine

    Same error here.
  • 07-07-2008 8:10 PM In reply to

    Re: New Tutorial: Role-Playing Game Tutorial #2 - Re-using the Tile Engine

    I ran into this problem myself. Do you have two Content nodes in your main game project? If so, it's very likely that you included the map and texture files in the main project, instead of the Content node as specified in the tutorial. At the end of the "Copying the Test Data" section:
    "Select the Content node in the game project, go to the Project menu, and click Show All Files."

    If you do have two Content nodes, you can move the asset files you just added from one to the other, then delete the now-empty one. The correct Content node is the one with References.

    You may encounter another error after this:
    There was an error while deserializing intermediate XML. Cannot find type "RolePlayingGameData.Map".

    Similar fix. You did not properly reference the pipeline project. More than likely, you are referencing the pipeline project in the main project, when the reference should be in the Content node. See this section at the end of the "Creating the Projects" section:
    "The game’s content project needs to know about the processor library so it can build the content. In Solution Explorer, right-click the Content node under game project node, and then click Add Reference. In the Add Reference window that pops up, click the Projects tab, select your pipeline project, and then click OK."

    Should work now. :)

    To the tutorial author:  I recommend you emphasize these points in the tutorial. Easy to overlook.
  • 07-16-2008 9:25 AM In reply to

    Re: New Tutorial: Role-Playing Game Tutorial #2 - Re-using the Tile Engine

    I included them in the content node, not the main project but I have the same error. Can't understand. Could you upload your result here?

    PS: I wrote for windows, not xbox.

  • 07-16-2008 11:05 AM In reply to

    Re: New Tutorial: Role-Playing Game Tutorial #2 - Re-using the Tile Engine

    rygringo:
    I included them in the content node, not the main project but I have the same error. Can't understand. Could you upload your result here?

    PS: I wrote for windows, not xbox.

    Make sure that you have replaced the project names in the Pipeline project. 

    In RolePlayingGameWriter.cs change RolePlayingGameDataWindows

     (Around line 43) readerText += ", RolePlayingGameDataWindows";  to the name of your project name.

     (Around line 64) string typeText = type.FullName + ", RolePlayingGameDataWindows"; also.

  • 07-18-2008 4:46 PM In reply to

    Re: New Tutorial: Role-Playing Game Tutorial #2 - Re-using the Tile Engine

    Thank you for your reply DLuke. I tried that. But not a chance. Still got the old error: "Error loading "Maps\\Map001". Cannot find ContentTypeReader RolePlayingGameData.Map+MapReader, BomberMan."
  • 07-20-2008 11:08 AM In reply to

    Re: New Tutorial: Role-Playing Game Tutorial #2 - Re-using the Tile Engine

    I'm also getting the same error. Does anyone have a solution? Not sure what we're missing.
  • 07-21-2008 3:07 PM In reply to

    Re: New Tutorial: Role-Playing Game Tutorial #2 - Re-using the Tile Engine

    I can run my project now. have to be sure  It's a naming problem. We have to be sure that we changed in RolePlayingGameWriter the name of the DATA project, not the main project. Thank everyone. :D
  • 08-08-2008 2:12 PM In reply to

    Re: New Tutorial: Role-Playing Game Tutorial #2 - Re-using the Tile Engine