Page 1 of 1
Tilemap in PHP/mySQL?
Posted: Mon May 26, 2014 8:46 pm
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!
Re: Tilemap in PHP/mySQL?
Posted: Mon May 26, 2014 10:39 pm
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
Re: Tilemap in PHP/mySQL?
Posted: Tue May 27, 2014 10:39 pm
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.
Re: Tilemap in PHP/mySQL?
Posted: Wed May 28, 2014 4:30 am
by Sharlenwar
Question Halls, in the YT description it says that the source for Forsaken Sanctum 1.0 is on the site. Any pointers?
Re: Tilemap in PHP/mySQL?
Posted: Wed May 28, 2014 12:28 pm
by hallsofvallhalla
Re: Tilemap in PHP/mySQL?
Posted: Wed May 28, 2014 1:47 pm
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.
As always, I'll post up anything new.
Re: Tilemap in PHP/mySQL?
Posted: Thu May 29, 2014 9:41 pm
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.
Re: Tilemap in PHP/mySQL?
Posted: Fri May 30, 2014 12:16 am
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.

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.
Re: Tilemap in PHP/mySQL?
Posted: Fri May 30, 2014 2:02 pm
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.
Re: Tilemap in PHP/mySQL?
Posted: Fri May 30, 2014 3:46 pm
by hallsofvallhalla
The most exciting days of my life have been going live on a game and showing it off! Love those moments.