Tutorial MMORPG Code Revamps

Location of the Videos
Post Reply
User avatar
Nyaar
Posts: 15
Joined: Tue Nov 16, 2010 6:16 am

Tutorial MMORPG Code Revamps

Post by Nyaar »

I'm a rogue PHP programmer that just started work on a game. I plan on revamping the tutorial code and sharing those scripts here for anyone to use. So... feel free to use them as you wish and to ask me any questions you may have. I don't know how quickly I can throw out code or answers at you so please be patient.

Anyway, without further delay...

System Revamp v.1
I just got finished watching all the videos yesterday and over the night I had designed a new register/login system that I will be using on my project. I was going to release that at first, but since I used different variables/tables and this should be as newbie friendly as possible... I took extra time to convert the forms for the original release (the one for videos 19-20) to my system.

This is almost 100% tested to work and I even fixed a couple of bugs that were present.

Installation: Either unzip this folder in the location of the old scripts or create a new folder for it. <<The Folder>>
If you do the former, overwrite everything.
Also, make a table called 'tutorial' in your database and import the tutorial.sql file. I recommend deleting the old 'tutorial' table if it exists.
Finally, make sure that connect.php has the correct information to connect to your database.

Features:
  • New register system: Complete error handler (shows all errors the user made and places the register form back under the error box so they can fix them), more easily CSS customizable, easy to change character limits on passwords and usernames, remembers what the user typed if an error pops up, and now all on one page. (You can delete reguser.php) [New CSS: #reg_page, #reg_form, and #reg_error]
  • *new Email verification: Got a script to validate email addresses. It's possible for wrong/less used domains to take awhile to load but worked perfectly for me.
  • New login system: Now when you go to index.php, it will check if you're logged in and if you aren't, it will bring up the login form on that page. Let's face it. When people first come to your site you'll want them to be able to login or register somewhere on the first page and now that the login box is in a div on the first page, you can put it anywhere with CSS easily. (Once again on one page. You can delete authenticate.php) [New CSS: #login and deleted #login2]
  • New page - game.php: This is where the actual game happens. You really don't want it to be on the homepage anyway. Everything from the old index.php was moved here and all links to index.php were changed to go here for you.
  • Auto-redirect: When you go to index.php while logged in, it immediately takes you to game.php. Likewise, if you're not logged in and go to game.php, it immediately sends you to index.php so you can log in. No prompts or warnings. It just takes care of it.
  • All changes fully commented: index.php, login.php, register.php, and game.php are now fully commented everywhere that I made changes. That way you can see what the code is doing and what you can easily change.
Bug Fixes:
  • Registration didn't set the player's location so I fixed that. It's set to Crocania currently. You can change it.
  • Fixed tutorial.sql to have the location column for creatures.
  • Fixed battle.php isssue where creatures wouldn't show up. It was a case of not getting the location of the player AND the creatures having no locations. (Make new creatures. The current 2 are technically taken I think.)
  • Fixed a line in newitem.php. I have no idea what the script does... just that my IDE told me it was missing a semi-colon.
  • Um... forgot any others.
Screenshots:
[Screenshot 1] [Screenshot 2] [Screenshot 3] [Screenshot 4]
* This update wasn't very visual so mostly showing off the error handler on the registration page and the changed URLs.
User avatar
Nyaar
Posts: 15
Joined: Tue Nov 16, 2010 6:16 am

Re: Tutorial MMORPG Code Revamps

Post by Nyaar »

* Placeholder for more scripts, updates, etc. *

Note: Later additions will just be single pages or even just code snippets to copy/paste in. The reason for the full release is the change to index.php and the bug fixes. The code SHOULD be completely stable now but let me know if you have an error.
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Tutorial MMORPG Code Revamps

Post by hallsofvallhalla »

this is awesome! I have been wanting for someone to revamp this for when people want something more advanced. The tutorials are good for learing basics but at some point everyone wants to advance beyond them.
User avatar
Nyaar
Posts: 15
Joined: Tue Nov 16, 2010 6:16 am

Re: Tutorial MMORPG Code Revamps

Post by Nyaar »

Thanks, Halls! Glad to help out~

On that note, if anyone has any features they want included in any part of the system (not just registration/login, but anything), just let me know here.
I'll do my best to get it coded and fully commented so you can learn from it. I don't want everyone just copying and pasting code. You should be able to take it, understand it, and even improve/alter it. We are here to learn after all, aren't we?

Note: I'm not messing with the codes from either of Hall's games, just the code provided at the end of the tutorials so far.

As for my own progress, I haven't done much else yet. Got a hacked together code for a character generator that no one could really use but that's it.
Life has kinda got me busy this week so far and that's slowed things down considerably. Still, request away and I'll put it on my to-do list.
spawnfestis
Posts: 79
Joined: Fri Dec 04, 2009 3:19 am

Re: Tutorial MMORPG Code Revamps

Post by spawnfestis »

I found when checking out the tutorials that the code was just poorly written.
Then I decided to actually write it all on my own just basing it on the PBBG concept I learned from the very first video tutorials. I think this needs more than a revamp, more like a whole new re-coding of it.

I am sure Hallsofvalhalla made the tutorials quickly and had no chance to improve it, but still, it teaches a lot of bad practices.
User avatar
Callan S.
Posts: 2043
Joined: Sun Jan 24, 2010 5:43 am

Re: Tutorial MMORPG Code Revamps

Post by Callan S. »

:shock: Spawn, the key element here is teaching/sharing anything at all, to begin with. Someone who knows a better practice but doesn't actually teach it is teaching even worse practice. As in a student of them would obviously come out knowing nothing new at all.
Fight Cycle : My latest Browser game WIP
Driftwurld : My Browser Game WIP
Philosopher Gamer : My Blog
spawnfestis
Posts: 79
Joined: Fri Dec 04, 2009 3:19 am

Re: Tutorial MMORPG Code Revamps

Post by spawnfestis »

Callan S. wrote::shock: Spawn, the key element here is teaching/sharing anything at all, to begin with. Someone who knows a better practice but doesn't actually teach it is teaching even worse practice. As in a student of them would obviously come out knowing nothing new at all.
I understand, but it should still at the very least _try_ teaching out good practice.
However, I understand halls making them quickly, not thinking it through properly as I stated in the above post.

:]
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Tutorial MMORPG Code Revamps

Post by hallsofvallhalla »

This is your final and ONLY warning! You have had a bad attitude since you got here and i WILL NOT put up with it any longer. Become part of the helpful community or leave.

I have helped more people with these videos than you could ever imagine. Not by making them like every other complicated over done video out there but by making them so everyone can understand. Start off easy and then work your way up.

Do you learn to drive in a Nascar race?
No you learn driving around on a parking lot or down a old dirt road and you break every law there is trying to figure it out. The good practices come later.

Do you learn to speak by doing a debate?
No, babies learn to speak by saying mooma, nanna, and other words considered wrong

Do you learn to play guitar by grabbing one for the first time and jamming out to metallica?
No you grab tab instead of learning the notes, which is bad practice and play what you want.

You learn what you can at a elementary level and go from there.

If you do not like the videos then make your own that show your "good practices". Once again don't bitch about free stuff that someone worked hard on.
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: Tutorial MMORPG Code Revamps

Post by Jackolantern »

I absolutely agree. People who have a handle on things like object oriented design and patterns don't need these videos. If someone is pointing out the flaws in the coding, then why are they watching it? I will back Halls up in that I have seen literally hundreds of people come through here and learn from this site. Their games work, and that is the important part. They will likely never need to scale their games up to house 50 million page views a day on one Apache box, so why spend the year+ learning how to write code that can? These tutorials present a way that someone with basically no coding experience can get something up on the page in 30 minutes, which interests them and pushes them forward. Learning best practices and advanced coding mechanics will scare off all but the CS-grads.
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Tutorial MMORPG Code Revamps

Post by hallsofvallhalla »

I also want to state that I value everyone here and their opinion. I am not asking you to leave or wanting anyone to leave. Just simply stating we are a easy going community that is one of the few places on the net that you won't be called a noob for not knowing something or asking a question. I am myself a noob. :)
Post Reply

Return to “Older Browser MMO Videos”