Author Topic: externalising / unhardcoding bullet sprites (projectiles)  (Read 19435 times)

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
externalising / unhardcoding bullet sprites (projectiles)
« on: July 20, 2012, 09:48:20 pm »
in order to make openxcom again just a little bit better and modder-friendly than the original, it would be nice to have the bullet/projectile sprites in a more... accessible... way.

(for those that - like me - didn't know yet: xcom has a rather clever way of dealing with the projectiles. they consist of a row of 3x3 pixel sprites, which are simply lined up on the flight path like pearls on a string. that way they look fine regardless of the direction of travel. see https://www.strategycore.co.uk/forums/topic/9869-openxcom-mods/ for more info.)

instead of loading them from the hardcoded arrays directly ripped from the xcom executables, it would be nice to have them as image files like the one Bomb Bloke posted in the strategycore thread above - if possible, even separated: one image file per projectile type. that way we could replace them one by one or add new ones in a very simple way.

what do you say? developers? possible? perhaps even easy? I would be willing to provide the necessary image files separated by bullet type with appropriate names. :)

Offline luke83

  • Commander
  • *****
  • Posts: 1559
    • View Profile
    • openxcommods
Re: externalising / unhardcoding bullet sprites (projectiles)
« Reply #1 on: July 22, 2012, 09:28:43 am »
You could leave the originals as is (hard coded ) but allow custom projectiles to be added within the Ruleset and attaching a custom graphic file, Just a thought ::)

Volutar

  • Guest
Re: externalising / unhardcoding bullet sprites (projectiles)
« Reply #2 on: July 22, 2012, 12:04:18 pm »
Moriarty, eh... referring to Bomb Bloke, and forgetting who found all this...
Before thinkin of this openxcom must get easily added new weapon/ammo types. So unhardcodinc bullet sprites is slightly premature idea for the moment. Thanks.

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: externalising / unhardcoding bullet sprites (projectiles)
« Reply #3 on: July 22, 2012, 12:19:20 pm »
Volutar, I am sorry, I did not mean to imply that it was anyone but you who found this. I was merely referring to the picture in the abovementioned thread as being posted by bomb bloke.

as for the idea being premature, I disagree. of course it would also be nice to have an easy way of adding weapons and ammo, as I am sure is planned for the future.

BUT: right now, if somebody were to try and start making new weapons, the only way of testing new weapon and projectile sprites is to modify/replace the existing ones. for that it would be nice to have openxcom load the sprites from something a little bit more accessible than the hardcoded arrays.

at least add an option to load them from external arrays? anything better accessible than having to change something in the source code would be nice. pretty please?  :)

Offline luke83

  • Commander
  • *****
  • Posts: 1559
    • View Profile
    • openxcommods
Re: externalising / unhardcoding bullet sprites (projectiles)
« Reply #4 on: July 22, 2012, 12:50:40 pm »
"So unhardcodinc bullet sprites is slightly premature idea for the moment." I am with Moriarty , If we want to encourage modders to start working with OpenXcom we need too know that options are on the horizons . It is no different to me asking about having the Transport ship land on levels above level 1 for my terror map, it was a interesting concept that Daiky decided to add for me and it makes openxcom different to the UFO EXTENDERS that are still being activity worked on.

Openxcom needs to be the Version of choice for modders and we don't want to re-direct the current schedule, we are more looking to know that something will be supported before we spend Hours making the mods.
« Last Edit: July 22, 2012, 12:57:08 pm by luke83 »

Volutar

  • Guest
Re: externalising / unhardcoding bullet sprites (projectiles)
« Reply #5 on: July 22, 2012, 01:50:37 pm »
before asking these question, you should track all data and links from bullet sprite though weapon->bullet-sprite/ammo->bullet-sprite assignment to weapon data/sprites/battlescape/tech.tree  and think of how this could possible be done and is it even feasible in current stage? This subject is too complex to get it right now or in the nearest future. By externalizing those arrays you will ease modifying current, and won't add any moddability to project. Altering current graphics can't be really called "modding". It's just an artistic excersices for those who can't do anything else. What for? Just for fun, maybe?

See, there is no way to add new weapon. Not graphically, nor in logically. So I suggest to forget it before 1.0.
« Last Edit: July 22, 2012, 01:54:47 pm by Volutar »

Offline luke83

  • Commander
  • *****
  • Posts: 1559
    • View Profile
    • openxcommods
Re: externalising / unhardcoding bullet sprites (projectiles)
« Reply #6 on: July 22, 2012, 02:02:10 pm »
Well Wiki Says "Modding is a slang expression that is derived from the verb "modify". Modding refers to the act of modifying hardware, software, or virtually anything else, to perform a function not originally conceived or intended by the designer. The term modding is often used within the computer game community, particularly in regard to creating new or altered content and sharing that via the web"

 Sorry if i am not as Smart as you Volutar , i make my living as a Tradesman not a IT wizard, So yes maybe i cant do anything else. Moriary did the right thing and asked in the Suggestion forums, and all he asking for is a Guideline as to how to move forward with his plans for Openxcom and IF it will be possible in the near future. I have done work making Armed Civilians with no way to test them, as such i have been forced to hold off on doing the last 3 sets until i know they will make it into my game oneday.
   Yes we are in the early stages of Openxcom and we too want Openxcom to Hit version 1.0 , but there is no reason why we cant start working on our "artistic exercises" because God knows we cant do anything else.
« Last Edit: July 22, 2012, 02:06:50 pm by luke83 »

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: externalising / unhardcoding bullet sprites (projectiles)
« Reply #7 on: July 22, 2012, 02:17:17 pm »
Quote
before asking these question, you should track all data and links from bullet sprite though weapon->bullet-sprite/ammo->bullet-sprite assignment to weapon data/sprites/battlescape/tech.tree  and think of how this could possible be done and is it even feasible in current stage?
I am not a programmer. That's why I asked if it was possible.

Quote
This subject is too complex to get it right now or in the nearest future.
so the answer is no. that's a pity.

Quote
By externalizing those arrays you will ease modifying current, and won't add any moddability to project.
I wholeheartedly disagree. In order to make these resources moddable, they will need to be unhardcoded sooner or later. How else would you add new bullet sprites at all?

Quote
Altering current graphics can't be really called "modding". It's just an artistic excersices for those who can't do anything else. What for? Just for fun, maybe?
Oh well, I'll just go back to my artistic exercises then. You do realise that "modding" is short for "modifying", though? anything you change is a mod. no matter how small and insignificant it may be in your eyes.

Quote
See, there is no way to add new weapon. Not graphically, nor in logically. So I suggest to forget it before 1.0.
please explain to me what you mean by that? right now there's no way to add another weapon, true, but at least we can modify existing ones. but in order to completely replace them by something different, projectile sprites are the remaining bottleneck. so it is only logical that I ask.
are you saying that the way openxcom is done, it will never be possible to add weapons? if that were true, it would be downright stupid.

I hope that in the future we will be able to mod a lot of stuff without the necessity of modifying the source code. If you need mad programming skillz to make changes, it's not modding friendly. I guess it all comes down to what you want it to be.

Volutar

  • Guest
Re: externalising / unhardcoding bullet sprites (projectiles)
« Reply #8 on: July 22, 2012, 04:59:12 pm »
I hope openxcom will get an ability to get absolutely mad weapons and fancy tech tree branches... But for the moment getting bullet sprites modified without any new weapons is unnecessary.

About getting current weapon altered. Okay, that's reasonable to demand externalizing of bullets, BUT, as far as I remember, openxcom claimed to be 99.9% original until 1.0.
The only reason to make such altering possible BEFORE 1.0 is to give people ability to experiment and try different combinations which probably will be added after 1.0. And to get people involved into project, and not to forget about it (which I see is most probably)

Frankly speaking, I think adding new weapons or alien races will be almost impossible even after 1.0, just because yaml config is not a best option to make mods. And most probably without "mad skillz" in programming you won't be able add new weapon even after 1.0. This game cannot be "mod friendly" just because of its "hardcoded" nature. If you want to get xcom-like game which will be really mod-friendly, it should be rewritten from scratch as scripted game. LUA, python, javascript, or whatever. And before writing it, game-paradigm and game-design should be developed. Just not to get into dead end "opps, we wont be able to give people modding this"
« Last Edit: July 22, 2012, 05:55:28 pm by Volutar »

Offline Daiky

  • Battlescape Programmer
  • Administrator
  • Commander
  • *****
  • Posts: 904
    • View Profile
Re: externalising / unhardcoding bullet sprites (projectiles)
« Reply #9 on: July 22, 2012, 06:39:11 pm »
You can already add new tech trees and new weapons. But not *mad* ones, but you can add perfectly fine things like stun grenades, or a rocket launcher with a "3-rockets-clip" and auto-shot mode... as long as it stays within the combinations of existing weapon features.
Bullet sprites are not the only little sprites that are hardcoded, there is this little arrow above the selected soldier, there are these little icons that represent crafts/bases on the geoscape,.... they'll probably get all unhardcoded at some point.

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: externalising / unhardcoding bullet sprites (projectiles)
« Reply #10 on: July 22, 2012, 07:38:14 pm »
Thank you volutar and daiky, you restored my hopes and faith in openxcom. :)

So, with that cleared up, what's going to be your most probable method of externalization? Arrays as text files? .bmp? .pck? One projectile per file or all in one? Or as-of-yet-completely-undecided?

Volutar

  • Guest
Re: externalising / unhardcoding bullet sprites (projectiles)
« Reply #11 on: July 22, 2012, 07:56:17 pm »
The thing is, currently those projectile particles are limited to 3x3, and with "particle list" (which have only 36 variants AFAIR). Size limit will make projectiles too small when resolution grows. So I suppose it should be text config with every projectile listed as string of "bmp" files and spaces between particles (with 640x480 you will have to make 2 times more particle sprites just to get same projectile length in battle). So particle images would be quite reusable for different projectiles. There is another way - single "bmp" for each projectile. For example 96x3. Vertical size also applied as particle size X inside of this image. So 96x3 image will be decoded as 32 particles of size 3x3. But in this case you'll have to fill every single particle in the string with images including "spaces".

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: externalising / unhardcoding bullet sprites (projectiles)
« Reply #12 on: July 22, 2012, 09:55:26 pm »
I like the last way. file is identified by name, height of file defines size of square particle. height needs to be an odd number so that it can be centered. width of the image file could even be arbitrary - it needs to be a multiple of the height, but you could make a single-pixel bullet without trail by supplying a 1x1 image, or a continuous wide laser beam by making it 300x3 solid red.

that said, are all bullets the same speed? globally defined by setting the bullet speed in the battlescape options? it might be interesting to add weapon-specific modifiers to really make laser "beams" that strike almost instantaneously! of course, that challenges the engine by forcing it to draw a lot of frames in quick succession...

Volutar

  • Guest
Re: externalising / unhardcoding bullet sprites (projectiles)
« Reply #13 on: July 23, 2012, 06:50:29 am »
I don't see why these particles cannot have even height. Do you think it's really matter when projectile image is slightly shifted (by half pixel)? You won't see any difference, except for this projectile with even size should have 2x2 core, not 1x1, thus will look slightly unusual, though okay for hires.

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: externalising / unhardcoding bullet sprites (projectiles)
« Reply #14 on: July 23, 2012, 12:11:22 pm »
I think for higher resolutions it should be okay, but in 320x200 if it is off-center by even one pixel, it might look odd.

Then again, I guess if it doesn't matter in terms of programming it, then it doesn't matter. The artists can then choose which looks better.