Skip to main content
gamedev.net
🔒 Locked

Jason Lam's code structure

Started by amish1234 Dec 24, 2004 at 11:24 PM 2 replies 550+ views
Original Post
amish1234
amish1234
Someone on gamedev referred me to Jason Lam's site for his e-book on J2ME games. I'm wondering about the way he structures his menu system. Basically each menu and submenu is a List. But since it's a game, you'd probably want to make each one a Canvas so you could use colored fonts and images. (He also has a couple examples of menus with Canvases). What do you guys think of this design? It seems ok at first, but that's gotta be taking up so much memory on a teeny tiny cell phone. It seems like it would be better to just have one canvas and have if statements to see which menu you're in, or if you're in the game. Of course this would make the code sloppier and there would be way more code per file. Plus the game would be running if statements every loop. Which approach do you think is better? Or is there another design that you use?
___________________________________________________________Where to find the intensity (Updated Dec 28, 2004)Member of UBAAG (Unban aftermath Association of Gamedev)
kooktroop
kooktroop
Avoid using List's in games. It takes away from your interface, and doesnt integrate well. Making the game very 'unsmooth' in terms of GUI.

Another thing is dont create more then one canvas. Have one canvas for your entire game, but use flags (end up with some big bloody switch statements) to indicate the state of the canvas and what it should be displaying.

Merry Xmas!
Do not remove a fly from your friend's forehead with a hatchet.Chinese Proverb
Zahlman
Zahlman
List menus are ok for prototyping, but you want to switch over as soon as you can - there can be weird issues both ways, and they're different issues ;)

Oh, and once you're doing a bunch of switching logic in one Canvas - try to simplify the way you represent the game state. Any time something seems not right, try to fix it by simplification first rather than working around it.
shmoove
shmoove
I believe those list menus are there mostly because it's a book for novices and you have to start somewhere. I still see a few games that come out with list menus nowadays, but the norm are graphical menus.

shmoove

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.