News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Starfield Simulation...

Started by Phoenix, March 10, 2005, 10:27:32 PM

Previous topic - Next topic

Phoenix

...just another one.

When i started in assembly language on 68000er a long time ago, my teacher told me to test my skill by coding a starfield simulation... well, i started with masm some months ago and i remembered his words.

So i tried and finally got this little starfield simulation working. It works under W2K/Athlon64 or Pentium IV 2.4, unfortunately i have no possibility to test it wit other OS. Please, have a look at it and tell me what you think about. I'm very interested in feedbacks about

- coding style in general
- my style of commenting - does it help?
- optimizing, bug reports a.s.o

It was coded using WinAsm, but QEditor works as well. Dependences: GDIplus.dll. (.lib and .inc included)

Your help is greatly appreciated, thank you!

[attachment deleted by admin]

skywalker

Quote from: Phoenix on March 10, 2005, 10:27:32 PM
...just another one.

When i started in assembly language on 68000er a long time ago, my teacher told me to test my skill by coding a starfield simulation... well, i started with masm some months ago and i remembered his words.

So i tried and finally got this little starfield simulation working. It works under W2K/Athlon64 or Pentium IV 2.4, unfortunately i have no possibility to test it wit other OS. Please, have a look at it and tell me what you think about. I'm very interested in feedbacks about

It works on Win 98 but runs a tad slow on an AMD K-6 475 Hhz. :-)

pbrennick

Hi Phoenix,
Nice App, it runs well on my AMD 1ghz using Win XP HE SP2.  I especially like the controls!
Paul

bitRAKE

Captain, I have good news and bad news: Despite the massive damage the engine is not damaged and navigational thruster are operational. Our star navigational charts have been scrambled.

:green2

Ghirai

Works fine on XP Pro SP2, with 2 Ghz P4.
MASM32 Project/RadASM mirror - http://ghirai.com/hutch/mmi.html

Phoenix

Hi, thank you for your feedback... everything seems to be fine!?  :toothy

skywalker:

Quoteruns a tad slow on an AMD K-6 475 Hhz. :-)

Somehow I expected that..  :'(

pbrennick:

QuoteI especially like the controls!

I guess it is the first one with controls.... adding some rotation would be fine. Any idea?

bitRAKE:

So give me some more power, Scottie!

Ghirai:

So it has passed W98,W2K and XP. Thank you for your feedback!

Farabi

Do you know a rotation function?
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

BytePtr

#7
Speed 25 on my 1,6GHz AMD Duron, with 256RAM, XP Pro.
I don't have the SP2 installed and i never install this.
But Starfield is slow. I coded one starfield in Borland Pascal and it's faster than this because uses direct videomemory.

Phoenix

Farabi, i also think a rotation function could give a nice effect, but i have no idea at the moment how to realize it.... i guess i will have to use trigonometric functions here.

HuMaX, the speed display on the screen is the speed of whatever object "flying" through the stars.. it is not the speed of the routine. You man increase or decrease this speed using mousewheel or (+) and (-) keys on numpad to values from 0 to 300.

QuoteI coded one starfield in Borland Pascal and it's faster than this because uses direct videomemory

This sounds interesting. AFAIK it is not possible to access video memory on NT-Systems directly, for which OS did you code? How many stars are displayed? This one displays 1750, if you did no changes.

BytePtr

#9
now Speed is OK

QBRADQ

Hello there. I've only just begun trolling this board, however this post has provided me with much information. Specifialy, it has brought GDIplus.dll to my attention.

I'll start with a preformance report on your application, by far the best star field simulation I have ever seen (though I have not seem many :P).

---===+++ System Specifications +++===---
Opperating System: Microsoft Windows 2000 Advanced Server, SP 4
Main Board: SoyoDragon Version 1.0 Pro
CPU: AMD AthlonXP 1700+ (cerca 2002)
RAM: 1024 MB DDR (Forgot the BUS speed, sorry)
--- BUS Periphrials ---
3.5 Floppy Interface (forgot spec): None
IDE0 (EIDE): Master - Quantum Firebal HDD, 6GB, Heavy Activity; Slave - [unknown manufacture]

CD-RW (40x12x48)
IDE1 (EIDE): Master - Maxtor HDD, 40GB No Activity (Contains OS intallations used for testing);

Slave - None
PCI0 (33Mhz): None
PCI1 (33Mhz): None
PCI2 (33Mhz): ATA 100 / 133 Periphrial
-> Channel-0: Master - Maxtor HDD, 60GB, Periodic I/O; Slave - None
-> Channel-1: Master - Western Digital HDD, 160GB, Periodic Read Access; Slave - None
PCI3 (33Mhz): None
PCI4 (33Mhz): nVidia GeForce FX 5500
-> Internal GPU: 128-bit core, FLP-OP in hardware
-> Internal RAM: 256 MB RAMDAC @ 400Mhz
-> Fill Rate and other Information: Unknown
AGP0 @ 8X: nVidia GeForce3 500 (Origional run, by PNY Technologies)
-> Internal GPU: 256-bit split-core, FLP-OP in hardware
-> Internal RAM: 64 MB DDR @ 350Mhz
-> Relative Verticies per Second: 31.7 Million
-> Fill Rate and other Information: Unknown
--- On-Board Integrated BUS ---
VIA Chipset (Specifications Unknown)
-> 10/100 Eithernet Adaptor
-> Dolby Digital 5.1 compatible Sound Subsystem (Dedicated hardware, includes WAV

transformation)

!!! This specification was hand-written by the system administrator, based on available

information !!!
!!! Inaccuracies (and mis-spellings) may be present !!!

Applications running at the time of test:
cmd.exe
calc.exe
explorer.exe (multiple child processes)
TextPad (two instances)
Windows Default CHM viewer
Mozilla Firefox version 1.0.6 (four instances, numerous tabs)
Azureus BitTorrent service (massive I/O, network and disk(read only))
WinAmp version 5.something (streaming from disk, invoking XviD codec, 23% CPU usage)
WinRAR version 3.42 explorer process (no active compression / decompression tasks)
JavaVM 2
nVidia nView
Fraps (Frame Rate Calculation)
Some odd-ball alarm clock program, makes a system call every second

Ok, with all this chaos on my system, your program managed to push fresh video data to it's buffer for every refresh cycle (60Hz). On top of this, the video WinAMP was streaming from disk never lost a frame (25.something FPS). I would also like to point out that although your program accessed a full screen device context (from what I can understand of your code, I'ma newbie at 32-bit ASM), it did not interfer with the secondary display what so ever (the GF-FX is the primary, GF-3 secondary). I must say that I am very impressed with both your code and the GDI interface.

The provided executable was used for this test. Recompilation was successful with MASM32 version 8 Service Pack 1 (no pre-existing VC installation), using the headers and library included with the package. Results from recompiled binary was comprable to the provided executable. GDIplus.dll was not resident on the system, however when placed in the root directory of StarField.exe everything ran fine (downloaded from www.DLL-files.com).

Nice work!

I realize that this is a somewhat old post, however I thought you might appreciate a detailed preformance analysis on a heavily loaded system. Hope you find it interesting at least.

Also, does anyone know where I can get some info on accessing the GDIplus library? Yes, I know about MSDN. However, it is often difficult to isolate specifics in there. If there's a tutorial out there, I would love a link (doesn't matter which language).

And that's my first post
QBRADQ

Phoenix

Welcome QBRADQ,

thank you for your feedback!   :lol I'd never test it on a heavily loaded system so it is good to know about your preformance analysis.
If you are interested in GDI+, this topic has a lot of links to related stuff, but however, MSDN is a good place to start:

http://www.masmforum.com/simple/index.php?topic=155.0

There are also a lot of other related posts on this forum, try searching for "gdiplus".

Regards, Phoenix

gabor

Hi!

It worked nicely on my XPs (AMD Athlon XP 2500+ and WinXP).
I accelerated and accelerated and waited to get lines instead of points... (hyperseed maybe warp).
Nice work!

I think this should run faster indeed... How pity I don't understand the GDI :((

About rotation: I don't know whether it is still faster to use a lookup table of sin and cos values instead of using the fpu...
Such table can be calculated with the fpu in no seconds, before the simulation.

Greets, Gábor

QBRADQ

Thank you for the information Phoenix, as well as all of this wounderful source code :P Sure, it's not nearly as easy as video access is in real mode (or on the 6502), but it's Windows API, and that's something I'm familar with.

Hopefuly I'll be posting my own demo within a few weeks.

Also, I noticed that your program would blank the screen every so often. I couldn't really tell from the source (still learning ASM w/ HLA, not too familiar with MASM yet) if that was intentional or not. May have just been all that stuff running on my system.

Till later
QBRADQ