Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Pages: 1 2 3 [4] 5 6 ... 93

Author Topic: [0.96a] Console Commands v2023.05.05  (Read 1536793 times)

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: Unofficial Developer's Console (beta 0.3 released!)
« Reply #45 on: September 19, 2012, 06:26:03 PM »

Looking forward to testing this and then maybe writing some custom commands this evening to get the ball rolling on the stuff I need to finish before my next release :)

In the current version you'll need to hard-code them into the console. It's not complicated, but hardly intuitive. I'll put together a quick tutorial in a bit.

I can't wait until the next Starfarer release. The version with reflection is much simpler, it's just Console.registerCommand(YourCustomCommand.class) and you're done. :)

Alex is allowing reflection in scripts?!

Sorry, let me rephrase that. The version with class literals is much simpler. He unblocked java.lang.reflect, I don't know if reflection itself will be allowed. :)
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Unofficial Developer's Console (beta 0.3 released!)
« Reply #46 on: September 19, 2012, 06:40:46 PM »

For all of us who are still new to Java, what does that mean, exactly?
Logged
Please check out my SS projects :)
Xeno's Mod Pack

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: Unofficial Developer's Console (beta 0.3 released!)
« Reply #47 on: September 19, 2012, 06:51:52 PM »

Class literals point to the actual class object associated with an object. You can do some crazy stuff with it and reflection.

Reflection allows you to analyze and change the program during runtime (hence the name 'reflection', the program is looking at itself) - see here for more.

I know there's a security risk with reflection since you can grab and change even private variables/methods (which shouldn't be a big deal since this is a single player game, plus the dangerous object types are still blocked). Is there something I'm missing?
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Unofficial Developer's Console (beta 0.3 released!)
« Reply #48 on: September 19, 2012, 07:15:46 PM »

I'm still befuddled; the docs make it sound like you can grab classes without knowing their names, and thereby can dig out and modify pretty much whatever you want (which would be great, I'd love to be able to customize how some of the really low-level code works, change some basic rules), but how can you do that if you don't know the names, and how do you get it back in a format you can analyze and write new code to modify?

Sorry, this is probably RTFM stuff, but I'm not used to this kind of approach; it sounds like it'd let us mod practically anything, which is a neat idea, but I can't see how that wouldn't let us do dangerous stuff like get open access to the file system, or attack people via bloating their savegames to thousands of gigabytes with junk data, etc.

If that stuff wasn't possible, it's not a big deal; it's a SP game, if a mod doesn't do something awesome and entertaining with that ability, then it's not an issue, same with the reverse, because either way they need to buy the game to play it, which seems like a win-win for Alex.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

medikohl

  • Admiral
  • *****
  • Posts: 854
    • View Profile
Re: Unofficial Developer's Console (beta 0.3 released!)
« Reply #49 on: September 21, 2012, 02:59:55 PM »

will it be possible to reload assets midgame?

right now it's make something, open game, test, close game, change a stat, re-open game, test, close game, change something else, open game again
Logged
"Captain! You can't call our greatest dreadnought 'The Parrot'"
"Watch me"
Spiral Arms: Ship Sprites for Everyone

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: Unofficial Developer's Console (beta 0.3 released!)
« Reply #50 on: September 21, 2012, 03:08:36 PM »

will it be possible to reload assets midgame?

right now it's make something, open game, test, close game, change a stat, re-open game, test, close game, change something else, open game again

Unfortunately not, but you might want to take a look at this thread. Just keep in mind Alex's warning there.
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: Unofficial Developer's Console (beta 0.3 released!)
« Reply #51 on: September 23, 2012, 01:07:54 PM »

Progress update:

Thanks to Thaago's excellent advice, I've started work on a combat-compatible console. This was as good a time as any to switch to a multi-threaded mod, so the console should now work anywhere in-game - paused, in menus, etc.

It will be a while before the next update is released. I'll need to test everything to see what commands will work in combat, hammer out the massive bug-list this update has created, and polish a few other changes that snuck into the development version.

It's probable that this won't be released until after the next Starfarer update, which is good, because the underlying changes to how the console functions will mean this update wouldn't be save-compatible anyway.

I'll still support the currently released version while I'm working on this. If you find any bugs or have feature requests for the current version, let me know. :)
Logged

CrashToDesktop

  • Admiral
  • *****
  • Posts: 3876
  • Quartermaster
    • View Profile
Re: Unofficial Developer's Console (beta 0.3 released!)
« Reply #52 on: September 23, 2012, 01:17:18 PM »

We eagerly await the new patch to use your console.  Plenty of fun with the last one, even more fun with it in combat. >:D
Logged
Quote from: Trylobot
I am officially an epoch.
Quote from: Thaago
Note: please sacrifice your goats responsibly, look up the proper pronunciation of Alex's name. We wouldn't want some other project receiving mystic power.

Upgradecap

  • Admiral
  • *****
  • Posts: 5422
  • CEO of the TimCORP
    • View Profile
Re: Unofficial Developer's Console (beta 0.3 released!)
« Reply #53 on: September 23, 2012, 01:39:55 PM »

This is going to be of greatest help to me. How can we thank you, LW? :D
Logged

Sproginator

  • Admiral
  • *****
  • Posts: 3592
  • Forum Ancient
    • View Profile
Re: Unofficial Developer's Console (beta 0.3 released!)
« Reply #54 on: September 23, 2012, 01:41:46 PM »

This is going to be of greatest help to me. How can we thank you, LW? :D
I'm surprised he isn't working for them I must say
Logged
A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: Unofficial Developer's Console (beta 0.3 released!)
« Reply #55 on: September 23, 2012, 01:55:53 PM »

We eagerly await the new patch to use your console.  Plenty of fun with the last one, even more fun with it in combat. >:D

I'm looking forward to seeing what horrors we can unleash with the combat version. I haven't explored the combat API thoroughly to see what's possible yet, but I'm fairly certain you'll at least be able to modify available command points. >:D

This is going to be of greatest help to me. How can we thank you, LW? :D

Ten million dollars. *evil laugh*

But seriously, it's actually a very simple mod (only about 2,000 lines of code last I checked). Anyone could have done it; I'm just the only one boring enough to like making this kind of thing. :)

I'm surprised he isn't working for them I must say

Thank you for the compliment, but I'm only a hobbyist programmer. Most of my knowledge - especially in Java - is self-taught, and the language I have the most experience in (LPC) doesn't translate skill-wise to Java. I'm sure if a professional ever looked at my code, they'd scream in horror. ;)
« Last Edit: September 23, 2012, 02:00:03 PM by LazyWizard »
Logged

Sproginator

  • Admiral
  • *****
  • Posts: 3592
  • Forum Ancient
    • View Profile
Re: Unofficial Developer's Console (beta 0.3 released!)
« Reply #56 on: September 23, 2012, 02:00:06 PM »

We eagerly await the new patch to use your console.  Plenty of fun with the last one, even more fun with it in combat. >:D

I'm looking forward to seeing what horrors we can unleash with the combat version. I haven't explored the combat API thoroughly to see what's possible yet, but I'm fairly certain you'll at least be able to modify available command points. >:D

This is going to be of greatest help to me. How can we thank you, LW? :D

Ten million dollars. *evil laugh*

But seriously, it's actually a very simple mod (only about 2,000 lines of code last I checked). Anyone could have done it; I'm just the only one boring enough to like making this kind of thing. :)

I'm surprised he isn't working for them I must say

In all actuality, I'm only a hobbyist programmer. Most of my knowledge - especially in Java - is self-taught, and the language I have the most experience in (LPC) doesn't translate skill-wise to Java. I'm sure if a professional ever looked at my code, they'd scream in horror. ;)

1st response: woohoo! That would be epic!
2nd response: simple to you, maybe, but wow
3rd response: where does one learn all of this
Logged
A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23989
    • View Profile
Re: Unofficial Developer's Console (beta 0.3 released!)
« Reply #57 on: September 23, 2012, 02:20:53 PM »

Hmm. I'd be careful about using a multi-threaded approach - almost none of the core game classes are thread-safe.
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: Unofficial Developer's Console (beta 0.3 released!)
« Reply #58 on: September 23, 2012, 02:21:27 PM »

where does one learn all of this

If you have the funds to spare or the academic achievements for a scholarship, university is a good route. If not, no worries. A university degree isn't as big a deal in game development as it is in other IT industries. Sign up for some cheap college courses. Buy multiple textbooks and read them in your free time. Study the documentation that comes with the language. Whatever you want. It depends on how you learn best.

Most importantly, once you've learned the basic syntax of a language and are comfortable coding on your own, experiment. If something even slightly interests you, make a simple project to learn how it works. If you stumble on another topic that interests you while working on that, start another project. Don't feel bad about abandoning projects that no longer interest you; the goal here is to learn, not create a polished product (my personal code directory contains hundreds of projects, of which about a dozen are complete). This is, in my opinion, the best way to learn a language's libraries quickly and accurately. And a strong portfolio impresses potential employers just as much as a piece of paper that says you can follow instructions for a few years.

Don't hesitate to go online if you get lost. Every problem you face, many others have faced before you and at least one of them asked for help. Hang out on sites like StackOverflow. Read every question you comprehend, even - especially - if you think you know the answer already. The experts often have tricks and better ways of doing things than you were taught.

Join community projects. Most larger, established teams have experienced modders who will be willing to give you a hand, and can point out your mistakes before they become ingrained. A mod team is probably the best option for learning game development, and mods looks great on a résumé.

And above all, remember: it's never too late to learn something new.
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: Unofficial Developer's Console (beta 0.3 released!)
« Reply #59 on: September 23, 2012, 02:29:28 PM »

Hmm. I'd be careful about using a multi-threaded approach - almost none of the core game classes are thread-safe.

The plan is to have the keyboard handler alone in its own thread, and everything else including running commands will be done in the main thread. The current spawn point method I'm using will be changed to just tell the console if it's currently on the campaign map, and a custom combat plugin will tell it when it's on the battle map. I'm having minor issues with refit battles, but it seems to work fine other than that (aside from the bugs caused by shifting the entire structure of the mod around, of course). :)
Logged
Pages: 1 2 3 [4] 5 6 ... 93