Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Unity - Rendering Sprites in a script?

Author
Message
Dark Dragon
19
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 31st Oct 2010 22:49 Edited at: 31st Oct 2010 23:14
....Is it possible to render a DB sprite in a Unity script? You can display/manipulate 3d in it......So how would i Paste Sprites and such? .......Dont tell me i wasted 20 bucks.....


I need to do this as I'm Scripting attacks for my RPG(I never gave up on it!), and i'll need to update my graphics in the script. Any method to do this, anyone?

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 31st Oct 2010 23:15
You're asking how to use darkbasic in unity? or have i misunderstood?

Dark Dragon
19
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 31st Oct 2010 23:35
Yes, I'm wondering how to use Darkbasic Sprites in lua(Unity)...

BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 1st Nov 2010 00:36
Ah - Unity Lua Scripts, not Unity the 3D Programming environment

You need to think of Unity as a way to parameterise DBP functions. You can pass data (parameters) back and forth and use Lua to manipulate those parameters, create triggers and so on.

For example, you might write a Lua script that passes in trigger zone parameters. In DBP, you'd have a "listener" function that reads in parameters, and acts upon them. e.g

"TRIG~1~120,30,250,90"

In DBP I need a function that knows that a TRIG request requires a trigger box in my scene - named "1", that has x/z coordinates as supplied.

Then I have a second function that sends a request back to Lus when the trigger is hit

"TRIGHIT~1~PLAYER"

This tells me the player (rather than an NPC, vehicle or weapon) has hit the trigger. In response the Lua Script runs a function and reports that a player hitting the trigger is rewarded with more health:

"PLAYER~HEALTH~100"

Finally, DBP processes the increase in health.

Using a messaging system with common keywords and actions allows you / your modder to place objects, zones, actions etc. However it's constrained by the functions you implement in DBP.

Back with your example, you can pass a message that tells the DBP function you have written to create a Sprite using the image you pass and the positions you specify.

Dark Dragon
19
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 1st Nov 2010 02:49 Edited at: 1st Nov 2010 02:52
Hmm, thats a start...... Actually i'd had a simular thought. the only thing is,i'm not quite sure how to do this exactly like that. When i wrote the game out in 'lua player'(I'm porting to DB.....), I was able to have my main game engine handle the menu, then The attacks that could be performed were called(The script was run), and each attack had a seperate script. inside each attack script were several loops that manipulated/updated the game's graphics and such directly.......however, passing the data of each entity back and forth to and from Db wont work for this. If i had to tell Db what i want my sprites to do.......Whats the point of scripting them? in lua player,I have the engine setup to accept a filename leading to the attack's script,and then the script runs(animation is played,etc.), and once done the engine goes on to the next attack. once all the players/enemys are done, the game engine takes over and handles attack selection......etc. See what i mean? if i'm constantly passing the data back to DB to render those attacks, there's no point in scripting it, because i can handle the variables fine in DB. I needed the ability to have.......well, seperate scripts that can handle everything, including the graphics, so that i can keep this method. I got the impression Unity could handle this, and since it supported basic 3-D stuff I'd figured it definatly had 2-d stuff,even if it was limited or something. But yeah, any way to do this?


Oh and if you dont mind could you explain what you meant a little further....?

BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 1st Nov 2010 10:35
I think you may have to change your approach to make it work in DBP unfortunately

Unity is more about giving your users the opportunity to change the way a game runs via scripting. This means you have control over the overall gameplay in your DBP game. The user has the opportunity to create some external logic to satisfy their needs, but within the confines of your game logic and what you allow them to access. For example you let them create a routine for randomly placing additional weapons but your game logic ensures it can't be in their base or in the middle of a lake. They can provide additional cash windfalls, but your game logic insists it can only happen once every 10 minutes to a maximum of 100 gold pieces.

If you extract all of the logic to Lua then the player can destroy or almost rewrite the game entirely.

Login to post a reply

Server time is: 2026-07-22 04:37:06
Your offset time is: 2026-07-22 04:37:06