Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6822

Connecting, querying and disconnecting to a SQLite DB in a single method is viable?

$
0
0

@Fer_R wrote:

Hello to all,

It´s my first post, I am in a very early stage of designing some kind of my first video game. Indeed, I´m still not sure if the idea is viable.

The title of this topic is self explanatory.

I would like to develop an AI abble to undertake a wide range of actions acording to the context. In example: if some conditions are verified, then some village will send a merchant to other village with some determined buying-sellying order.

Well, I consider to create a database manager class that abstracts the access and query to DB, to finally have a method called like "check_markets", for example, where some village object, acording to her properties, checks the surplus or deficit of all the products available in the other villages and then determine who products send to sell or buy and where, etc.

Can I make some like this?

method check_data (attributes_to_get, from_what_entity)
- do the connection stuff
- do the requested query
- do the disconnection.
- Return the data to be accesed by some methods like the above mentioned "check_markets".

end of the method.

Some orientation about how to do ¿abstraction? were wellcome. I don´t know if this term, abstraction, is precise enough (I´m not english native speaker). What I mean is making a DB manager class accesible from other class in a friendly way for me. Able to do stuff like "check_nearest_enemies" or "track_down_for_recent_presences (in the coordinates where is performed the action)... including the operation to return the exact data from DB and can aply on it the correspondant logic inside the method.

Many thanks.

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6822

Trending Articles