[patch] Improvements of FPS hud and related stuff

[patch] Improvements of FPS hud and related stuff

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Rafal99
Posts: 162
Joined: 14 Jan 2006, 04:09

[patch] Improvements of FPS hud and related stuff

Post by Rafal99 »

Changelog:
* improvements of FPS mode weapon list:
- font size is now adjusted to make all weapon labels fit on screen
- do not leave empty spaces in the list when weapon is a shield
- changed "Reloading" label to "Reloading XX%" showing weapon reload state
- new labels "Stockpiling XX%" and "No ammo" for stockpilable weapons

* when some impulse factor explosion throw FPSed unit outside map area, camera will follow it, instead of staying at map border (fixes Mantis #382)
* CGroundMoveType::SlowUpdate() no longer teleports units flying outside map back to the map border for 1 frame every 16 frames
* some small code cleanups

Everything tested intensively :-)

Screenshots showing weapon list in FPS mode: (sorry for bad quality)
Controling a unit with 2 weapons
Controling a unit with 8 weapons


I am planning to do more work on FPS mode and related stuff, this was just the easiest part. :wink:

On my TODO list:
- fix aiming in FPS mode to prevent weapon state from changing Aiming->Ready->Aiming->Ready->Aiming etc. every frame
- make some of the key shortcuts for commands work when unit is FPSed but not selected (things like K - cloak and X - on/off)
- add new keybindable action to select and deselect unit which is FPSed
- allow spectators to FPS view an unit without actually controlling it
- draw unit model in FPS hud as cloaked unit, when controlled unit is cloaked (i am not sure about this one).

Any comments and suggestions appreciated. :wink:
Attachments
patch.txt
Forum doesn't allow *.diff extension.
(7.3 KiB) Downloaded 26 times
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: [patch] Improvements of FPS hud and related stuff

Post by smoth »

props
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: [patch] Improvements of FPS hud and related stuff

Post by Argh »

Nice, so glad somebody's working on this. I don't suppose that we can pester you for another POV mode at some point? I really, really, really want a Freelancer-style 3rd-person POV...
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: [patch] Improvements of FPS hud and related stuff

Post by FLOZi »

Looks good. I probably should have done some of this stuff when I last tinkered with it (It was me that introduced weapon names being rendered and excluded shields)
Sheekel
Posts: 1391
Joined: 19 Apr 2005, 19:23

Re: [patch] Improvements of FPS hud and related stuff

Post by Sheekel »

can you fix the aiming so its smooth like the fps camera? and maybe give it a crosshair?
User avatar
Rafal99
Posts: 162
Joined: 14 Jan 2006, 04:09

Re: [patch] Improvements of FPS hud and related stuff

Post by Rafal99 »

Argh wrote:Nice, so glad somebody's working on this. I don't suppose that we can pester you for another POV mode at some point? I really, really, really want a Freelancer-style 3rd-person POV...
There is a 3rd-person view of some kind in Spring. You have to FPS an unit, then select it somewhat, then press T. It is quite bugged though. Maybe i will look into it later.
FLOZi wrote:Looks good. I probably should have done some of this stuff when I last tinkered with it (It was me that introduced weapon names being rendered and excluded shields)
I was planning to exclude interceptors too, cause they can't be manually fired, but i finally decided to leave them, so player can see their reloading state. I think that state of the shield should be printed somewhere in FPS hud too. Can one unit have multiple shields or only one?
Sheekel wrote:can you fix the aiming so its smooth like the fps camera? and maybe give it a crosshair?
Yes i will try to do something with it, it is very annoying, hope it can be fixed without too much effort.
Btw it has a crosshair atm. :wink:
User avatar
Rafal99
Posts: 162
Joined: 14 Jan 2006, 04:09

Re: [patch] Improvements of FPS hud and related stuff

Post by Rafal99 »

Thanks Kloot for committing it. :-)
I am glad you additionally made a proper code formatting in Game.cpp and GroudMoveType.cpp, it is much more readable now and easier to work with. :-)
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: [patch] Improvements of FPS hud and related stuff

Post by Pxtl »

There were a lot of good ideas for FPS mode stuff in this thread:

http://spring.clan-sy.com/phpbb/viewtop ... sk=t&sd=a&
User avatar
Rafal99
Posts: 162
Joined: 14 Jan 2006, 04:09

Re: [patch] Improvements of FPS hud and related stuff

Post by Rafal99 »

Interesting thread, thx for link. :-)
I like the idea of First Person Perspective mode where you see through the unit but don't actually control it. I am thinking of separating camera mode, and unit control, so you can use First Person view and Third Person view without controlling the unit (for example give bomber an order to bomb something, then use First Person view to see how it flies and bombs).
I am also thinking of adding possibility of controling the unit in normal camera mode, so you use can arrow keys for moving and turning and mouse for aiming and shooting, instead of giving orders (imagine a commander avoiding rocko's rockets using this 8)).
Ok these are only ideas, it is not that easy when it comes to implementing. :wink:

PS. Someone close Mantis #382 please, i fixed it in my patch.
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Re: [patch] Improvements of FPS hud and related stuff

Post by Warlord Zsinj »

Yeah, 3rd person controlling would be made of win
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: [patch] Improvements of FPS hud and related stuff

Post by lurker »

Shields go in weapon slots, so a unit can have up to 16, and even use them as multiple hitspheres.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: [patch] Improvements of FPS hud and related stuff

Post by jK »

lurker wrote:Shields go in weapon slots, so a unit can have up to 16, and even use them as multiple hitspheres.
but it handles the strongest shield in a special manner (there is only one unit.h::CUnit::shieldWeapon)
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: [patch] Improvements of FPS hud and related stuff

Post by lurker »

Strongest? Not.. first or anything? That makes very little sense.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: [patch] Improvements of FPS hud and related stuff

Post by jK »

Weapon.cpp::CWeapon::Init():

Code: Select all

	if (weaponDef->isShield) {
		if ((owner->shieldWeapon == NULL) ||
		    (owner->shieldWeapon->weaponDef->shieldRadius < weaponDef->shieldRadius)) {
			owner->shieldWeapon = this;
		}
	}
so it is the one with the largest radius
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: [patch] Improvements of FPS hud and related stuff

Post by Pxtl »

jK wrote:Weapon.cpp::CWeapon::Init():

Code: Select all

	if (weaponDef->isShield) {
		if ((owner->shieldWeapon == NULL) ||
		    (owner->shieldWeapon->weaponDef->shieldRadius < weaponDef->shieldRadius)) {
			owner->shieldWeapon = this;
		}
	}
so it is the one with the largest radius
*headslap*

Who was the clever genius who wrote that one? At least "first" would be consistent with the weapons.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: [patch] Improvements of FPS hud and related stuff

Post by lurker »

At least largest makes more sense than strongest.
User avatar
Rafal99
Posts: 162
Joined: 14 Jan 2006, 04:09

Re: [patch] Improvements of FPS hud and related stuff

Post by Rafal99 »

Talking about shields, i have added a small portion of code that prints shield state in FPS hud.
Screenshot

It uses unit->shieldWeapon, the same way as done in GetUnitShieldState() LUA function, used in Healthbars widget for example.

Warlord Zsinj wrote:Yeah, 3rd person controlling would be made of win
It already exists, look at my earlier post:
Rafal99 wrote:There is a 3rd-person view of some kind in Spring. You have to FPS an unit, then select it somewhat, then press T.
It needs some fixes, but works.
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: [patch] Improvements of FPS hud and related stuff

Post by REVENGE »

Well shit, that's news to me.

Good job man, keep up the good work!
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Re: [patch] Improvements of FPS hud and related stuff

Post by Warlord Zsinj »

You also mentioned that it was buggy.

I'll rephrase:

3rd person controlling that is not hacky, is intentionally coded, and works smoothly would be made of win
User avatar
Tribulexrenamed
Posts: 775
Joined: 22 Apr 2008, 19:06

Re: [patch] Improvements of FPS hud and related stuff

Post by Tribulexrenamed »

Excellent.

If possible, positioning the fps text with the control panel config would be helpful when commanding units while in fps mode, so the text does not interfere with the control panel. Its not really applicable to current mods, but that is about to change. :twisted:
Post Reply

Return to “Engine”