News:

Function Finder  Find all the functions within source code files

Main Menu

Looking for some guidance...

Started by Tracy, February 24, 2006, 03:30:34 PM

Previous topic - Next topic

Tracy

Hi all.

Being new to the programming realm and anxiously engaged in attempting something probably way beyond my capacty for my first game, I thought I'd post a generalized request for some help on a few topics that I don't even know where to begin with. They are:

1) A map editor. I'd like to program my own, but have no idea where to start. Could someone give me some generalized strategy on what a good map editor needs/how to make one. There's a simple one built-in to the 2D game example that comes with PB, but I'd like some feedback before I grab it and try to turn it into something I could use. Specifically, I'm curious about how to add enemy spawn points to a map. What's a good strategy?

2) A menu. How does one go about programming one of these? Specifically, I'm interested in an 'options' screen where one can change the input for the game. (i.e. change what key does what or what D-pad button does what) Again, I know it's pretty basic, but I'm new to this.

3) Saving games. What's the general strategy for saving game information? I admit freely that I've yet to do the legwork of flipping through help menus for this but, again, some generalized advice before I start would be nice.

Thanks in advance.

kevin

#1
Quote1) A map editor. I'd like to program my own, but have no idea where to start. Could someone give me some generalized strategy on what a good map editor needs/how to make one. There's a simple one built-in to the 2D game example that comes with PB, but I'd like some feedback before I grab it and try to turn it into something I could use.

 The first question, is who are you making the editor for ?    If it's just for you, then you can get away with a lot :).   But if it's for other people to use, then you'll inevitable have to spend some time proofing it for the end user.  

 Is the editor generic or custom ?

  - If it's generic, then what scope does it need cover.  

  - If it's custom, then you can Taylor it to projects design limitations.  If the game has two playfields, then your editor only need to support two playfields   Etc.

Perhaps the most obvious question is Do you really need to write one ?

  it's often better (and a lot faster in terms of development time)  to use a generic tool for mapping, then import that data into a customized game editor where you lay out the game entities against the maps.    So rather than write editor your write a content editor for your game engine.

QuoteSpecifically, I'm curious about how to add enemy spawn points to a map. What's a good strategy?

 If your making an custom editor,  I'd prolly have an entity drop feature.    Where you select the entity type your positioning, then point and click it onto the game world.  

  While it might be tempting to store all the objects vitals with each entity.  From a future proof stand point, it's generally much easier to use simple entities types with bare min of properties.   And have the game engine deal with the actual spawning /initialization of it of them.   That way the level data doesn't require changing when/if an object properties change.


 So the entity data for a level might as be as simple as




[Entity Data ]
 [Player]
    Index = 1; player 1
    pos= 100,200
   Direction = left
 [/Player]

 [Player]
    Index = 2; player 2
    pos= 300,200
   direction = right
 [/Player]
/Entity Data ]


 Spawning  could also be done via a separate block layer.  Where each block index represents the spawn type of a particular entity type.  So the engine translates this block position into the entities pos and that's about it.



Quote2) A menu. How does one go about programming one of these? Specifically, I'm interested in an 'options' screen where one can change the input for the game. (i.e. change what key does what or what D-pad button does what) Again, I know it's pretty basic, but I'm new to this.

 For me i'd roll a generic set of functions that can be used (project to project to project etc etc). These functions would include a couple gadget types. I.e  in your case you might have  Button Type and option.    

The library would handle the display and current settings of the gadget for you.   So when using the library you simply create the buttons, give them a position and then call an update/draw menu function each frame.

 For example you might as 'GetMouseOver'  styled function in your library for returning what menu item the mouse the currently over.  


For you trapping code might look a bit like this


PlayBASIC Code: [Select]
; Create Menu
Button_Start = MakeButton(X,y,Image)
Button_NumberOFPlayers= MakeButton(X,y,Image_SingleLpayer)
Button_Exit= MakeButton(X,y,Image)


; main loop
MenuItem= GetMouseOver(Mousex(),Mousey())
if mousebutton()<>0 ; if the use clicked a button
select MenuItem
case Button_Start
PLAY GAME
Case Button_Numberofplayers
Inc NUmberofPLayers
if NUmberofPLayers > 2 then NUmberofPLayers=1
if Numberofplayers=1 then SetGadgetIMage(menuitem, Image_SinglePlayer)
if Numberofplayers=2 then SetGadgetIMage(menuitem, Image_TwoPlayer)

case Button_exit
END GAME
endselect
endif





Quote3) Saving games. What's the general strategy for saving game information? I admit freely that I've yet to do the legwork of flipping through help menus for this but, again, some generalized advice before I start would be nice.

To save the state of your game, is totally up the user.

Effectively it revolves around recording all the  information about the players progress through the game and the games current state.



Tracy

Thanks, Kevin. I'll be looking over this and seeing what I can glean from it. (As soon as tests are over. :))

(P.S. As a side note, I've decided to register P.B. I just need to get a little cash in my account. I'm having way too much fun to put it all aside in a week when my trial expires.)