Experimenting with a reference-based item database. The idea is to have the player hold a container that only contains player-specific flags and variables (such as amount, trade restrictions, etc.) and have it reference a SQLite database to retrieve all other relevant information such as name, icon, description, stats, etc. I see advantages of being able to apply changes on a live server and putting it into effect without taking a server down.

This is what I currently have so far:
var/database/EquipDatabase

proc
InitializeEquipDatabase()
if(!fexists("Game Data/Equip Database.db"))
EquipDatabase = new/database("Game Data/Equip Database.db")

//Test output
world << "Successfully created Equip Database.db file."
/////////////

var/database/query/q = new

q.Add("CREATE TABLE EquipInfo(RefID UNIQUE, Name, Description, Icon)")
q.Execute(EquipDatabase)

q.Add("CREATE TABLE EquipStats(RefID UNIQUE, Category, EquipType, DamageType, DamageCalc, AttackMultiplier, MagicMultiplier, ATK, MAG, DEF, MDEF, ACC, EVA)")
q.Execute(EquipDatabase)

q.Add("CREATE TABLE EquipEffects(RefID, EffectID, Type, Name, Description, Icon)")
q.Execute(EquipDatabase)
else EquipDatabase = new/database("Game Data/Equip Database.db")

database/proc
AddRow(Table, RefID, list/Data)
var/Columns, Values
for(var/D in Data)
Columns += "[D]"
Values += "NULL"

if(D != Data[Data.len])
Columns += ", "
Values += ", "

var/database/query/q = new

q.Add("INSERT INTO [Table] (RefID, [Columns]) VALUES (?, [Values])", RefID)
q.Execute(src)

EditData(Table, RefID, Data)

EditData(Table, RefID, list/Data)
var/database/query/q = new

for(var/D in Data)
q.Add("UPDATE [Table] SET [D] = ? WHERE RefID = \"[RefID]\" AND [D] IS NULL", Data[D])
q.Execute(src)

QueryRow(Table, RefID, list/Cells)
var/Columns

if(Cells)
for(var/D in Cells)
Columns += "[D]"
if(D != Cells[Cells.len]) Columns += ", "
else Columns = "*"

var/database/query/q = new

q.Add("SELECT [Columns] FROM [Table] WHERE RefID = \"[RefID]\"")
q.Execute(src)

while(q.NextRow())
var/list/RowData = q.GetRowData()

//Just a test output to see if the table cells are actually getting read.
var/Desc = "\[[RefID]] "

for(var/D in RowData)
if(D == "RefID") continue
Desc += "[D]: [RowData[D]]"
if(D != RowData[RowData.len]) Desc += ", "

world << Desc
//////////////////


This also can be used for containers that change due to events to quests within the game. Say I have a container with a Quest flag and two item references:
Equip/Excalibur
RefID = "QUEST001"
Quest = 1

EquipDatabase.AddRow("EquipInfo", "QUEST001", list("Name" = "Excalipur", "Description" = "A fake."))
EquipDatabase.AddRow("EquipInfo", "QUEST002", list("Name" = "Excalibur", "Description" = "A real."))

The container will be a completely different item when its RefID gets changed to "QUEST002".
In response to Lummox JR
Lummox JR wrote:
Yut Put wrote:
http://www.byond.com/games/YutPut/LEGEND

I'm so glad this project could be brought back to life.

CHOO CHOO

Woot looking forward to this
Multiplayer?

goes to 15 minutes
Haven't been on BYOND in a minute. What happened to Severed World?
In response to Oral123
Oral123 wrote:
Haven't been on BYOND in a minute. What happened to Severed World?

https://steamcommunity.com/sharedfiles/ filedetails/?id=444784534

i believe its being made in vylocity now
In response to Bl4ck Adam
Bl4ck Adam wrote:
Oral123 wrote:
Haven't been on BYOND in a minute. What happened to Severed World?

https://steamcommunity.com/sharedfiles/ filedetails/?id=444784534

i believe its being made in vylocity now

https://www.facebook.com/severedworldmmorpg/posts/ 1083394675103378
Messing around with pathfinding and turn-based gameplay for a weekjam.

Refined the Goddess of Fire Concept. Hopefully I can use it as Banner someday. Funny how my previous programmer went AWOL. Does this happen a lot?

Are you paying your programmer? IF not, yes, that will happen a lot since it's a volunteer position. If so, oh well, find someone else.

Cool art though. Well I guess it's hot, but w/e.
In response to A2J2TIWARI
A2J2TIWARI wrote:
Refined the Goddess of Fire Concept. Hopefully I can use it as Banner someday. Funny how my previous programmer went AWOL. Does this happen a lot?


Her boobs are much older than her face and what you would normally expect for a "hot" chick. ;P
looks too lame to be banner material


Can't actually use the guns yet, and there's some weirdness with images in MP, but it's getting there.

EDIT: You can use the guns now.

Man that's pretty, Zuhayr.

For your pathfinding, what method are you using? I found I could make A* relatively performant in softcode by using heaps and associative lists judiciously.
In response to Lummox JR
Lummox JR wrote:
For your pathfinding, what method are you using?

It looks well-suited to Dijkstra, so maybe http://www.byond.com/developer/Theodis/Pathfinder ?

Of course I'd be happy to shamelessly plug http://www.byond.com/developer/Kuraudo/libpathfinder as well. :V
In response to Lummox JR
It's just A* using a bunch of lists currently, it's aggressively underoptimized in general, there's a noticeable delay if you start a turn in a large open space. Someone told me that using lists is in general faster than datums (if you are changing any of the compiled values of the datums). I kinda wanted to try implementing ideas from https://gamedevelopment.tutsplus.com/tutorials/ understanding-goal-based-vector-field-pathfinding--gamedev-9 007 but the memory requirement seems -immense-.
The way it's done in SotS II is that the pather datum works with two sets of lists--one set each for open and closed nodes.

Within the set, one of those lists is a heap. It's an associative list, where each node (turf) has an associated value that is its location in the data list. The data list has two values in a row: the item, which has the item's cost + heuristic as an associated value, and the heuristic alone. I suppose it might be slightly faster simply holding three values instead of two.

When a node is added, it's given a place in the data list and then it's added to the heap list. Then it's bubbled up the heap list. This is a min-heap sorted by cost+heuristic. When a node is removed, it's taken out of the data array (the available spot is noted for reuse later), and swaps with the last item on the heap; that item then trickles down or bubbles up, as appropriate.

Min-heaps are awesome for this sort of algorithm where you always want to access the lowest-cost item in the list.
Other than the sort that's basically how my implementation works. The open and closed set are both assoc with the turf indexing a list containing its cost and the turf stepped from to get there (so I can backtrack to build the final path at the end) as well as a depth value so I can kill the pathfinding early if there's no path short enough to the goal.

Sorting the heap and moving the passable neighbors check from the turf to the pather is next on my todo list, after I get done with implementing the XCOM EU featureset. Basically just cover and ammo use left now.
Page: 1 2 3 ... 316 317 318 319 320 ... 349 350 351