Tilemap in PHP/mySQL?

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
User avatar
Sharlenwar
Posts: 524
Joined: Mon May 28, 2012 7:14 pm

Tilemap in PHP/mySQL?

Post by Sharlenwar »

Yeah, of course this question is going to come up. I have read a bunch of articles with different ways of implementing a solution. I have a working solution but I have no clue how it works. I have a vague idea but I need some clarification. I don't expect any answers other than pointers of how to tackle this.

The idea of the game I have, is the maps will be stored in the database. The reason for this, is I want to create an editor that admins can access to change the existing maps and even add new ones. Most likely will be integrated into the game, as I'm trying to keep it all compact. For the exercise I don't want to load in any files (which could work, but I'm trying to avoid).

If any of you know of a great tutorial for this, then please drop me a link. I have been searching the net and have run into a few snags. Possibly I don't know enough php to understand what I'm doing, or I just need someone to step me through how one would load from a db a map, store it, and display it. My head is pounding and tomorrow I'll give this another shot.

Thanks for all the help!
Deep within the Void of Quasion, a creation.

**My Corner of the Web**
***NEW***GrindFest - My own PHP/MySQL game!
Sharlenwar's Adventures
Torn-City - Massively multiplayer online text based RPG
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Tilemap in PHP/mySQL?

Post by hallsofvallhalla »

one of my first web games FS had a PHP MySQL map system. You can see the tutorials here and see if this is what you need and build from it. I think source link is attacjed

https://www.youtube.com/watch?v=iUsSq2WfDB8
User avatar
Sharlenwar
Posts: 524
Joined: Mon May 28, 2012 7:14 pm

Re: Tilemap in PHP/mySQL?

Post by Sharlenwar »

Awesome Halls, I'll take a look at that series. It might provide that bit of info for it to all just "click" in my head. Once I got this figured out, I hope that this will be the last big hurdle. Everything else seems to be simple enough.
Deep within the Void of Quasion, a creation.

**My Corner of the Web**
***NEW***GrindFest - My own PHP/MySQL game!
Sharlenwar's Adventures
Torn-City - Massively multiplayer online text based RPG
User avatar
Sharlenwar
Posts: 524
Joined: Mon May 28, 2012 7:14 pm

Re: Tilemap in PHP/mySQL?

Post by Sharlenwar »

Question Halls, in the YT description it says that the source for Forsaken Sanctum 1.0 is on the site. Any pointers?
Deep within the Void of Quasion, a creation.

**My Corner of the Web**
***NEW***GrindFest - My own PHP/MySQL game!
Sharlenwar's Adventures
Torn-City - Massively multiplayer online text based RPG
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Tilemap in PHP/mySQL?

Post by hallsofvallhalla »

User avatar
Sharlenwar
Posts: 524
Joined: Mon May 28, 2012 7:14 pm

Re: Tilemap in PHP/mySQL?

Post by Sharlenwar »

Perfect, got it. I started to go through your Forsaken Sanctum videos too. So we will see what I can pick up to fill in any gaps. :D

As always, I'll post up anything new.
Deep within the Void of Quasion, a creation.

**My Corner of the Web**
***NEW***GrindFest - My own PHP/MySQL game!
Sharlenwar's Adventures
Torn-City - Massively multiplayer online text based RPG
User avatar
Sharlenwar
Posts: 524
Joined: Mon May 28, 2012 7:14 pm

Re: Tilemap in PHP/mySQL?

Post by Sharlenwar »

Okay, so you actually helped me get on the right track Halls. I notice that your tilemap that you generate seems to be very... how can I put it. I find it very sloppy and something that could be done in a class, which I am currently going ahead to do. I have successfully been able to pull out information out of my database by loading in the info into an array. Then from this I will use the array to generate the grid I need and it should do the trick.

So I am learning and it seems to all come easier now. Thanks for the source for FS 1.0, I am dipping into it to see how you do what you do in there. Very useful to learn from.

The project I'm working on, tentatively called "Grindfest" is something I'm doing where I will release the source and database to. This way I can make a sort of learning exercise from it for newcomers and what not. It probably pales in comparison to what others have done, but I'm hoping that all of you more advanced people will hop into the code and tell me where I can do everything better and proper.

Again, thanks and I hope I didn't offend you.
Deep within the Void of Quasion, a creation.

**My Corner of the Web**
***NEW***GrindFest - My own PHP/MySQL game!
Sharlenwar's Adventures
Torn-City - Massively multiplayer online text based RPG
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Tilemap in PHP/mySQL?

Post by hallsofvallhalla »

absolutely not. I totally understand. You must remember I wrote that game like 5 years ago. Before CSS3 and some other tech not to mention me learning quite a bit since then. Also what made my videos popular was the fact I took the easy route and made things ultra simple. I make love to classes every night. Love them now. Could not live without them. :P I made those videos as a basis for you to make better and to learn from.

My Udemy videos get bashed constantly by people who are "seasoned vets" but it is funny how I have 300+ sales with it and get emails on people just thanks fro making them simple.
User avatar
Sharlenwar
Posts: 524
Joined: Mon May 28, 2012 7:14 pm

Re: Tilemap in PHP/mySQL?

Post by Sharlenwar »

Exactly Halls! Haha! That is why I mentioned what I did, because I realize you made it a long time ago. I'm glad I have this source, gave me some ideas and it helps me go in the right direction. It helped me to gain a basic understanding of a simple tilemap. Which allowed me to make that jump into arrays and to do it with less code. ;) I'm a lazy bugger.

I can't wait to showcase my game here once I have it up and running. I'm excited. Whether anyone plays it, doesn't matter, hehe.
Deep within the Void of Quasion, a creation.

**My Corner of the Web**
***NEW***GrindFest - My own PHP/MySQL game!
Sharlenwar's Adventures
Torn-City - Massively multiplayer online text based RPG
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Tilemap in PHP/mySQL?

Post by hallsofvallhalla »

The most exciting days of my life have been going live on a game and showing it off! Love those moments.
Post Reply

Return to “Beginner Help and Support”