Time to reactivate the database code and see if we can get a less static scene…
Talking to the ‘Base
In order to get things up and running without having to deal with it, I had commented out the database calls in the code I was leveraging to load the map. I have a running instance of Dragon’s Spine 184.108.40.206 and the appropriate Microsoft SQL Server database set up, so now I can tackle reading from it.
Once I started re-enabling code, I had to copy over the appropriate Mono version of System.Security.dll. But still nothing works. Time to kludge the ornate logging code into spitting things out to my Unity console:
1 2 3 4 5
1 2 3 4
So then I can see “SQL Server does not exist or access denied”. Time to start troubleshooting my (hardcoded, for now) connection string.
Try a deliberately incorrect password, get the same error. Bad user ID, same.
Bad instance name in “Data Source”, same. Bad server name in “Data Source”, then “No such host is known”. So we’re having trouble with the instance. But the Dragon’s Spine executable I build in Visual Studio is hitting that instance just fine. After a lot of lost time trying to understand SQL Server logging, I tried starting a service that wasn’t running:
…and suddenly all was well. I guess the native .NET magic Visual Studio was giving me didn’t need the Browser service to hit something on localhost, but the Mono stuff in Unity did.
To be on the safe side, we’ll need a read-only user in SQL Server. The internet is useful as always. I added the user but then was denied the ability to EXECUTE the necessary stored procedure, so I had to add access to that specifically.
The obvious thing is to try the map cells first. Near the end of Map.LoadMap:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
and we add some debug to our map loading code to see if we’re getting any of it:
1 2 3 4 5 6 7 8
Nothing, until I realize I need to give the map a name that matches the DB:
Just to tie something visual to the database-driven cell data, let’s show some particle effects where we know there are portals. As we’re iterating through the cells…
1 2 3 4 5 6
Pretty, yes, but still not really “live”. That’ll take a bit of doing.